Skip to content

Commit

Permalink
wallet fix
Browse files Browse the repository at this point in the history
  • Loading branch information
krutyosila committed Nov 24, 2020
1 parent e29e7f6 commit f7e4877
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 33 deletions.
1 change: 1 addition & 0 deletions src/Services/WalletService.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function create(WalletTransactionType $types)
$wallet->balance = $wallet->balance + $types->getAmount();
$wallet->save();
}
$types->setTxn($wallet->id);
return $wallet->transactions()->create($types->getAll());
}

Expand Down
6 changes: 3 additions & 3 deletions src/Types/WalletTransactionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ public function getTxn()
}

/**
* @param mixed $txn
* @param mixed $walletId
*/
public function setTxn($txn)
public function setTxn($walletId)
{
$this->txn = Str::random(32);
$this->txn = Hash::make($walletId.microtime());
}
/**
* @return array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public function up()
Schema::create('wallet_transactions', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('wallet_id');
$table->string('txn')->unique();
$table->enum('type', ['deposit', 'withdraw'])->nullable();
$table->string('intermediary')->nullable();
$table->decimal('amount', 8,2)->default(0);
Expand Down

This file was deleted.

0 comments on commit f7e4877

Please sign in to comment.