Skip to content

Commit

Permalink
bonus added
Browse files Browse the repository at this point in the history
  • Loading branch information
krutyosila committed Dec 11, 2020
1 parent a24c3f9 commit c8adb19
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/Services/WalletService.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class WalletService
const TYPE_WITHDRAW = 'withdraw';
const TYPE_BET = 'bet';
const TYPE_WIN = 'win';
const CYCLE_TYPES = ['deposit', 'bet'];
const TYPE_BONUS = 'bonus';
const CYCLE_TYPES = ['deposit', 'bet', 'bonus'];
public function create(WalletTransactionType $types)
{
$wallet = $types->getWallet();
Expand All @@ -24,7 +25,7 @@ public function create(WalletTransactionType $types)
$wallet->balance = $wallet->balance + $types->getAmount();
$wallet->save();
}
if (($types->getType() == self::TYPE_DEPOSIT OR $types->getType() == self::TYPE_WIN) && $types->getConfirmed()) {
if (($types->getType() == self::TYPE_DEPOSIT OR $types->getType() == self::TYPE_WIN OR self::TYPE_BONUS) && $types->getConfirmed()) {
$wallet->balance = $wallet->balance + $types->getAmount();
$wallet->save();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/WalletTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function withdraw($intermediary, $amount, $meta = [], $confirmed = 1)

public function transaction($type, $intermediary, $amount, $meta = [])
{
if(!in_array($type, [WalletService::TYPE_BET, WalletService::TYPE_WIN])) {
if(!in_array($type, [WalletService::TYPE_BET, WalletService::TYPE_WIN, WalletService::TYPE_BONUS])) {
return false;
}
$types = new WalletTransactionType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function up()
$table->id();
$table->unsignedBigInteger('wallet_id');
$table->string('txn')->unique();
$table->enum('type', ['deposit', 'withdraw', 'bet', 'win'])->nullable();
$table->enum('type', ['deposit', 'withdraw', 'bet', 'win', 'bonus'])->nullable();
$table->string('intermediary')->nullable();
$table->decimal('amount', 8,2)->default(0);
$table->boolean('confirmed')->default(1);
Expand Down

0 comments on commit c8adb19

Please sign in to comment.