-complete supplier bill group when oustanding is 0

-create refund and supplier refund if the request refund order is in white form
This commit is contained in:
JiaSheng
2024-02-28 01:34:39 +08:00
parent 8d84c970e2
commit 5fd2f6ef7f
9 changed files with 58 additions and 25 deletions
@@ -85,6 +85,8 @@ class UpdateRefundTransactionStatusLogic extends AbstractControllerLogic
$paymentTransaction = $refundTransaction->owner;
$supplierRefundTransaction = $paymentTransaction->transactions()->supplierRefunds()->where('status', [ApprovalStatus::PENDING_VERIFICATION])->first();
$booking = $paymentTransaction->owner;
$reference = $refundTransaction->amount == $paymentTransaction->amount ? 'Fully Refund for Ref. ' . $booking->marking : 'Partially Refund for Ref. ' . $booking->marking;
@@ -93,6 +95,10 @@ class UpdateRefundTransactionStatusLogic extends AbstractControllerLogic
$this->creditWalletProcessor->execute($booking->company, $refundTransaction->type, $refundTransaction->amount, $reference);
}
if ($supplierRefundTransaction) {
$this->updatesTransactionStatus->execute($supplierRefundTransaction, $request->route('status'));
}
$paidAmount = $paymentTransaction->original_amount - $this->calculatesBookingRefundAmount->calculateRefundAmount($paymentTransaction, $booking->fix_currency_id);
if (!$paidAmount > 0) {
$this->updatesTransactionStatus->execute($paymentTransaction, ApprovalStatus::REFUNDED);