Skip to content

Commit

Permalink
formatting+fix id
Browse files Browse the repository at this point in the history
  • Loading branch information
Kedrihan committed Jul 13, 2024
1 parent b7c9608 commit 7a7c445
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
10 changes: 4 additions & 6 deletions resources/[soz]/soz-bank/server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ QBCore.Functions.CreateCallback("banking:server:TransferMoney", function(source,
local CurrentMoney = Player.Functions.GetMoney("money")
amount = tonumber(amount)


if accountSource == "player" then --Dépot
if accountSource == "player" then -- Dépot
if amount <= CurrentMoney then
if Player.Functions.RemoveMoney("money", amount) then
Account.AddMoney(accountTarget, amount)
Expand All @@ -96,7 +95,7 @@ QBCore.Functions.CreateCallback("banking:server:TransferMoney", function(source,
return
end
end
elseif accountTarget == "player" then --Retrait
elseif accountTarget == "player" then -- Retrait
local AccountMoney = Account(accountSource).money
if amount <= AccountMoney then
if Player.Functions.AddMoney("money", amount) then
Expand All @@ -113,7 +112,7 @@ QBCore.Functions.CreateCallback("banking:server:TransferMoney", function(source,
return
end
end
else --Transfert entre 2 comptes
else -- Transfert entre 2 comptes
Account.TransfertMoney(accountSource, accountTarget, amount, function(success, reason)
if success then
exports["soz-core"]:AddBankTransaction(accountSource, accountTarget, amount)
Expand All @@ -126,8 +125,7 @@ QBCore.Functions.CreateCallback("banking:server:TransferMoney", function(source,

if Target then
TriggerClientEvent("soz-core:client:notification:draw-advanced", Target.PlayerData.source, "Maze Banque", "Mouvement bancaire",
"Un versement vient d'être réalisé sur votre compte",
"CHAR_BANK_MAZE")
"Un versement vient d'être réalisé sur votre compte", "CHAR_BANK_MAZE")
end
end
end
Expand Down
1 change: 1 addition & 0 deletions resources/[soz]/soz-core/src/server/bank/bank.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export class BankService {
private sendTransactionToPhone(transaction: any, player: PlayerData | null) {
if (player) {
TriggerClientEvent(ClientEvent.PHONE_APP_BANK_TRANSACTION_CREATED, player.source, {
id: Number(transaction.id),
emitterAccount: transaction.emitterAccount,
emitterName: transaction.emitterName,
targetAccount: transaction.targetAccount,
Expand Down
2 changes: 1 addition & 1 deletion resources/[soz]/soz-phone/src/server/bank/bank.db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BankTransaction } from '../../../typings/app/bank';
export class _BankTransactionDB {
async getTransactions(account: string): Promise<BankTransaction[]> {
return await exports.oxmysql.query_async(
`SELECT emitterAccount, emitterName, targetAccount, targetName, amount, unix_timestamp(date)*1000 as date
`SELECT id, emitterAccount, emitterName, targetAccount, targetName, amount, unix_timestamp(date)*1000 as date
FROM bank_transactions
WHERE date > date_sub(now(), interval 7 day)
AND (targetAccount = ? OR emitterAccount = ?)
Expand Down
1 change: 1 addition & 0 deletions resources/[soz]/soz-phone/typings/app/bank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export interface IBankCredentials {
balance: number;
}
export interface BankTransaction {
id: number,
amount: bigint;
emitterAccount: string;
targetAccount: string;
Expand Down

0 comments on commit 7a7c445

Please sign in to comment.