account-statement-pagination

This commit is contained in:
JiaSheng
2023-11-04 00:00:58 +08:00
parent 4bf32ac285
commit d6754014aa
7 changed files with 436 additions and 10 deletions
@@ -20,6 +20,22 @@ class PaymentTransactionResource extends JsonResource
{
$booking = in_array((int)$this->type, [TransactionType::BILL, TransactionType::REFUND])? $this->owner->owner : $this->owner;
$current_running_balance = $request['running_balance'];
switch((int) $this->type){
case 1:
$request['running_balance'] = bcadd($request['running_balance'], $this->amount, 7);
break;
case 2:
$request['running_balance'] = bcsub($request['running_balance'], $this->amount / $this->currency_rate + $this->service_charge, 7);
break;
case 5:
$request['running_balance'] = bcsub($request['running_balance'], $this->amount, 7);
break;
case 9:
$request['running_balance'] = bcsub($request['running_balance'], $this->amount, 7);
break;
}
$booking_marking = '';
switch ($this->owner_type) {
@@ -43,6 +59,7 @@ class PaymentTransactionResource extends JsonResource
'issuer_id' => $this->issuerCompany->id,
'amount' => (double) $this->amount,
'original_amount' => (double) $this->original_amount,
'running_balance' => (double) $current_running_balance,
'currency' => new CurrencyResource($this->currency),
'original_currency' => new CurrencyResource($this->original_currency),
'service_charge' => (double) $this->service_charge,