Changeset View
Changeset View
Standalone View
Standalone View
src/app/Providers/PaymentProvider.php
Show First 20 Lines • Show All 179 Lines • ▼ Show 20 Lines | protected function storeRefund(Wallet $wallet, array $refund): void | ||||
} else { | } else { | ||||
$transaction_type = Transaction::WALLET_REFUND; | $transaction_type = Transaction::WALLET_REFUND; | ||||
} | } | ||||
Transaction::create([ | Transaction::create([ | ||||
'object_id' => $wallet->id, | 'object_id' => $wallet->id, | ||||
'object_type' => Wallet::class, | 'object_type' => Wallet::class, | ||||
'type' => $transaction_type, | 'type' => $transaction_type, | ||||
'amount' => $refund['amount'], | 'amount' => $refund['amount'] * -1, | ||||
'description' => $refund['description'] ?? '', | 'description' => $refund['description'] ?? '', | ||||
]); | ]); | ||||
$refund['status'] = self::STATUS_PAID; | $refund['status'] = self::STATUS_PAID; | ||||
$refund['amount'] *= -1; | $refund['amount'] *= -1; | ||||
$this->storePayment($refund, $wallet->id); | $this->storePayment($refund, $wallet->id); | ||||
} | } | ||||
} | } |