pursuant to our conversation today, i think the following code changes will eliminate the bug associated with gift certificates.
we can change this line here:
|
$order_total_modules->pre_confirmation_check(); |
to
$calculatedTotal = $order_total_modules->pre_confirmation_check('string');
$total = $calculatedTotal;
if (is_array($calculatedTotal)) {
$total = $calculatedTotal['total'];
}
we can then delete line 185:
|
$order_totals = $order_total_modules->process(); |
finally we need to change this section of code:
|
if (($_SESSION['opc_saved_order_total'] ?? '') !== $currencies->value($order->info['total'])) { |
|
$error = true; |
|
$checkout_one->debug_message( |
|
"Order-total mismatch, before and after:\n" . |
|
json_encode($_SESSION['opc_saved_order_total'] ?? '', JSON_PRETTY_PRINT) . "\n" . |
|
json_encode($currencies->value($order->info['total']), JSON_PRETTY_PRINT) |
|
); |
|
$messageStack->add_session('checkout_payment', ERROR_NOJS_ORDER_CHANGED, 'error'); |
|
} |
to:
if (($_SESSION['opc_saved_order_total'] ?? '') !== $currencies->value($total)) {
$error = true;
$checkout_one->debug_message(
"Order-total mismatch, before and after:\n" .
json_encode($_SESSION['opc_saved_order_total'] ?? '', JSON_PRETTY_PRINT) . "\n" .
json_encode($currencies->value($total), JSON_PRETTY_PRINT)
);
$messageStack->add_session('checkout_payment', ERROR_NOJS_ORDER_CHANGED, 'error');
}
the only reason i see calling the process method is to update the $order->info['total'] amount and use it for comparison to the opc saved value.
frankly i am surprised that this bug was not exposed earlier; but then again, maybe my payment module is the only one that needs the correct amount on the confirmation page?
as we saw, this is a definite bug as the amount going to the payment module using 3 page checkout was different from the amount going from OPC. and i have tracked that bug down to line 185.
pursuant to our conversation today, i think the following code changes will eliminate the bug associated with gift certificates.
we can change this line here:
one_page_checkout/includes/modules/pages/checkout_one_confirmation/header_php.php
Line 139 in 2839539
to
we can then delete line 185:
one_page_checkout/includes/modules/pages/checkout_one_confirmation/header_php.php
Line 185 in 2839539
finally we need to change this section of code:
one_page_checkout/includes/modules/pages/checkout_one_confirmation/header_php.php
Lines 206 to 214 in 2839539
to:
the only reason i see calling the
processmethod is to update the$order->info['total']amount and use it for comparison to the opc saved value.frankly i am surprised that this bug was not exposed earlier; but then again, maybe my payment module is the only one that needs the correct amount on the confirmation page?
as we saw, this is a definite bug as the amount going to the payment module using 3 page checkout was different from the amount going from OPC. and i have tracked that bug down to line 185.