This commit is contained in:
2025-11-02 18:40:52 +05:00
parent 386e74374b
commit 13ad714b22

View File

@@ -153,12 +153,12 @@ class OnlinePaymentRepository
/**
* Check payment
*/
public function checkPayment(string $orderId)
public function checkPayment(string $orderId): array
{
/** @var \App\Modules\OnlinePayment\Models\OnlinePayment Find payment order from history */
$paymentHistory = OnlinePayment::where('orderId', $orderId)->first();
/** @var \App\Modules\CardOrder\Models\CardOrder Find related resource */
/** @var \Illuminate\Database\Eloquent\Model Find related resource */
$relatedResource = (new $paymentHistory->online_paymantable_type)->find(id: $paymentHistory->online_paymantable_id);
// Check if resource could not be found or does not exist
@@ -183,17 +183,9 @@ class OnlinePaymentRepository
return $this->paymentFailed('(REQUEST FAILURE)');
}
$payment_status = $response['ErrorCode'] == '0';
if ($payment_status) {
return $this->paymentSuccessful($relatedResource, $paymentHistory, $bankBranch);
}
return $this->paymentFailed(
title: __('Payment has failed'),
paymentHistory: $paymentHistory,
bankBranch: $bankBranch,
);
return $response['ErrorCode'] == '0'
? $this->paymentSuccessful($relatedResource, $paymentHistory, $bankBranch)
: $this->paymentFailed(__('Payment has failed'), $paymentHistory, $bankBranch);
}
/**