From d74cb80a11e47a44792589e06a8a3688c1d72276 Mon Sep 17 00:00:00 2001 From: Chris Brown Date: Fri, 23 Jun 2017 14:45:30 -0400 Subject: [PATCH] Small adjustment to minimize risk of payment form jQuery attachment errors --- README.md | 2 +- .../pages/checkout_payment/jscript_payeezy.php | 4 ++-- includes/modules/payment/payeezyjszc.php | 12 +++++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index dff3cb7..7193a45 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Simply upload these files into the corresponding folders on your own store: `/includes/modules/pages/checkout_payment/jscript_payeezy.php` -**Note: You should not copy the README.md, LICENSE or changelog.txt files to your live server.** +**Note: You should not copy the README.md, LICENSE files to your live server.** ### Admin module configuration This module requires that you enter 5 configuration settings from your Payeezy and GGe4 account: diff --git a/includes/modules/pages/checkout_payment/jscript_payeezy.php b/includes/modules/pages/checkout_payment/jscript_payeezy.php index 717cf9f..2160b18 100644 --- a/includes/modules/pages/checkout_payment/jscript_payeezy.php +++ b/includes/modules/pages/checkout_payment/jscript_payeezy.php @@ -3,7 +3,7 @@ * Javascript to prep functionality for Payeezy payment module * * @package payeezy - * @copyright Copyright 2003-2016 Zen Cart Development Team + * @copyright Copyright 2003-2017 Zen Cart Development Team * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version GIT: $Id: Author: Ian Wilson New in v1.5.5 $ */ @@ -185,7 +185,7 @@ function t() { jQuery(function($) { $('form[name="checkout_payment"]').submit(function(e) { - if($('#pmt-payeezyjszc').is(':checked') || this['payment'].value == 'payeezyjszc') { + if($('#pmt-payeezyjszc').is(':checked') || this['payment'].value == 'payeezyjszc' || document.getElementById('pmt-payeezyjszc').checked == true) { var $form = $(this); $form.find('button').prop('disabled', true); e.preventDefault(); diff --git a/includes/modules/payment/payeezyjszc.php b/includes/modules/payment/payeezyjszc.php index bbd7330..0206fb4 100644 --- a/includes/modules/payment/payeezyjszc.php +++ b/includes/modules/payment/payeezyjszc.php @@ -31,7 +31,7 @@ class payeezyjszc extends base /** * $moduleVersion is the plugin version number */ - var $moduleVersion = '0.941'; + var $moduleVersion = '0.942'; /** * $title is the displayed name for this payment method * @@ -704,11 +704,13 @@ private function format_amount_for_payeezy($amount) if (isset($order) && isset($order->info['currency'])) { $decimal_places = $currencies->get_decimal_places($order->info['currency']); } - if ($decimal_places > 0) { - $amount = $amount * pow(10, $decimal_places); // Future: Exponentiation Operator ** requires PHP 5.6 - } + if ((int)$decimal_places === 0) return (int)$amount; + + // older way + return (int)(string)(round($amount, $decimal_places) * pow(10, $decimal_places)); - return $amount; + // Requires PHP 5.6 or newer: + return (int)(string)(round($amount, $decimal_places) * 10 ** $decimal_places); } private function hmacAuthorizationToken($payload)