Skip to content
This repository has been archived by the owner on Mar 18, 2020. It is now read-only.

Commit

Permalink
Small adjustment to minimize risk of payment form jQuery attachment e…
Browse files Browse the repository at this point in the history
…rrors
  • Loading branch information
drbyte committed Jun 23, 2017
1 parent 9f1181d commit d74cb80
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions includes/modules/pages/checkout_payment/jscript_payeezy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 $
*/
Expand Down Expand Up @@ -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();
Expand Down
12 changes: 7 additions & 5 deletions includes/modules/payment/payeezyjszc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d74cb80

Please sign in to comment.