mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
update command logic
This commit is contained in:
@@ -103,23 +103,8 @@ class UpdateBillGroupAndGroupToIncludeTransferFee extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
// get the groups
|
||||
$payments = $billGroup->groups;
|
||||
|
||||
$totalOriginalTransferFee = 0;
|
||||
$totalTransferFee = 0;
|
||||
// for each group
|
||||
foreach ($payments as $group) {
|
||||
$group_transfer_fee = $group->morphTransactions()->where('type', TransactionType::TRANSFER_FEE)->first();
|
||||
|
||||
if ($group_transfer_fee) {
|
||||
$totalOriginalTransferFee += $group_transfer_fee->original_amount;
|
||||
$totalTransferFee = $totalTransferFee + ($group_transfer_fee->original_amount / $group->currency_rate);
|
||||
}
|
||||
}
|
||||
|
||||
$totalOriginal = $billGroup->original_amount + $totalOriginalTransferFee;
|
||||
$total = $billGroup->amount + $totalTransferFee;
|
||||
$totalOriginal = $billGroup->groups()->sum('original_amount');
|
||||
$total = $billGroup->groups()->sum('amount');
|
||||
|
||||
// update bill group payment transaction amount if there is only 1 payment transaction
|
||||
$payment_transactions = $billGroup->transactions()->whereIn('status', [ApprovalStatus::PENDING_SUBMISSION, ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->get();
|
||||
|
||||
Reference in New Issue
Block a user