fixed issue

This commit is contained in:
varun kewlani
2026-08-17 17:28:02 +05:30
parent c15870b531
commit cea201da1d

View File

@@ -129,13 +129,11 @@ class QloPaypalCommercePaymentModuleFrontController extends ModuleFrontControlle
// Order status/amount must reflect what PayPal actually captured,
// not the cart's is_advance_payment flag (still editable by the
// customer after payment, so it cannot be trusted here).
$capturedAmount = (float) (
$returnData['data']['purchase_units'][0]['payments']['captures'][0]['amount']['value'] ?? 0
);
$capturedAmount = isset(
$returnData['data']['purchase_units'][0]['payments']['captures'][0]['amount']['value']
) ? (float) $returnData['data']['purchase_units'][0]['payments']['captures'][0]['amount']['value'] : 0;
$fullTotal = (float) $cart->getOrderTotal(true, Cart::BOTH);
$isFullyPaid = Tools::ps_round($capturedAmount, _PS_PRICE_COMPUTE_PRECISION_)
>= Tools::ps_round($fullTotal, _PS_PRICE_COMPUTE_PRECISION_);
$total = $isFullyPaid ? $fullTotal : $capturedAmount;
$isFullyPaid = $capturedAmount >= $fullTotal;
// set order status
if ($returnData['data']['status'] == 'COMPLETED') {
@@ -151,7 +149,7 @@ class QloPaypalCommercePaymentModuleFrontController extends ModuleFrontControlle
$this->module->validateOrder(
$cart->id,
$orderStatus,
$total,
$capturedAmount,
$this->module->l('PayPal Checkout', 'payment'),
null,
$extraVars,