Emergency fix problem with group payment (reported by Eileen)

This commit is contained in:
Dillon Ngo
2023-12-20 20:52:24 +08:00
parent 19bd548127
commit 5c9fd6e2a6
2 changed files with 16 additions and 12 deletions
@@ -85,7 +85,7 @@ class CreatePaymentTransactionProcessor
/**
* @throws MalformedRequestException
*/
public function execute(Transaction $invoice, $payment_method, $bank_code)
public function execute(Transaction $invoice, $payment_method, $bank_code, $run = true)
{
$amount = $invoice->amount;
Log::info($invoice->owner);
@@ -127,22 +127,26 @@ class CreatePaymentTransactionProcessor
$this->updatesWalletBalance->execute($wallet, ($amount * -1));
// $packingList = $invoice->owner;
// $order = $packingList->owner;
// $packingList->status = ApprovalStatus::APPROVED;
// $packingList->save();
if($run)
{
$packingList = $invoice->owner;
$order = $packingList->owner;
$packingList->status = ApprovalStatus::APPROVED;
$packingList->save();
// if(app()->environment('production')){
// $this->updateDoFromVTPortalProcessor->execute($packingList);
// $this->updateDoFromYDPortalProcessor->execute($packingList);
// }
if(app()->environment('production')){
$this->updateDoFromVTPortalProcessor->execute($packingList);
$this->updateDoFromYDPortalProcessor->execute($packingList);
}
}
// later use this variabke to create a approved payment transaction
$approvalStatus = ApprovalStatus::APPROVED;
// update invoice to completed
// $this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED);
if($run){
$this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED);
}
}
else {
$payment_method = PaymentMethodType::CASH;