Hello @gozzandes
Many thanks for your explanation. I've been confusing myself trying to understand the logic of multiple payment modules and how order_total is use in various places, so I will need some time to reset my brain, read and digest your explanation, and thereby understand the code.
In the meantime, since $order->info['total'] at the time the stripe.php module was loaded was the plain product total only, I found that I could include the required order_total additions by requesting them in the pre_confirmation_check() function before the $amount_total is calculated.
PHP Code:
function pre_confirmation_check() {
// add $order_totals, $order_total_modules globals
global $order, $db, $stripeCustomerID, $user_id, $stripe_select, $order_totals, $order_total_modules;
/../
// debug - add any order_total additions for Stripe to get the correct amount
if (MODULE_ORDER_TOTAL_INSTALLED) {
$order_totals = $order_total_modules->process();
}
// end debug
if ( isset($_SESSION['opc_saved_order_total'])) {
$order_value = $_SESSION['opc_saved_order_total'];
}else{
if (MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE == 'true' && MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER >= $order->info['total']) {
$order_value = $order->info['total'] + MODULE_ORDER_TOTAL_LOWORDERFEE_FEE ;
} else{
$order_value = $order->info['total'];
}
}
$amount_total=round($order_value * $order->info['currency_value'],$decimal_places)*$multiplied_by;
/../
I understand this is hack and I need to also change the code below with lowerorder fee.
Bookmarks