wip
This commit is contained in:
@@ -194,15 +194,15 @@ class OnlinePaymentRepository
|
||||
$paymentHistory = OnlinePayment::where('orderId', $orderId)->first();
|
||||
|
||||
// Resolve related resource model dynamically
|
||||
/** @var \Illuminate\Database\Eloquent\Model Find related resource */
|
||||
$modelClass = $paymentHistory->online_paymantable_type;
|
||||
$modelId = $paymentHistory->online_paymantable_id;
|
||||
|
||||
if (! class_exists($modelClass)) {
|
||||
return $this->paymentFailed('(INVALID RESOURCE TYPE)');
|
||||
return $this->paymentFailed('(RELATED RESOURCE CLASS NOT FOUND)');
|
||||
}
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Model Find related resource */
|
||||
$relatedResource = $modelClass::find($modelId);
|
||||
$relatedResource = (new $modelClass)->find(id: $modelId);
|
||||
|
||||
// Check if resource could not be found or does not exist
|
||||
if (! $relatedResource) {
|
||||
@@ -222,11 +222,11 @@ class OnlinePaymentRepository
|
||||
$this->provider->setPassword($bankBranch->billing_password);
|
||||
$response = $this->provider->checkPayment($orderId);
|
||||
|
||||
if ($response['ErrorCode'] == '99') {
|
||||
if ($response['errorCode'] == '99') {
|
||||
return $this->paymentFailed('(REQUEST FAILURE)');
|
||||
}
|
||||
|
||||
return $response['ErrorCode'] == '0'
|
||||
return $response['paymentAmountInfo']['depositedAmount'] > 0
|
||||
? $this->paymentSuccessful($relatedResource, $paymentHistory, $bankBranch)
|
||||
: $this->paymentFailed(__('Payment has failed'), $paymentHistory, $bankBranch);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user