Plugin Directory

Changeset 2309547


Ignore:
Timestamp:
05/21/2020 02:41:43 PM (6 years ago)
Author:
eftsecure
Message:

tagging version 1.0.5

Location:
woo-eftsecure-gateway
Files:
6 edited
6 copied

Legend:

Unmodified
Added
Removed
  • woo-eftsecure-gateway/tags/1.0.5/assets/js/eftsecure_checkout.js

    r1691756 r2309547  
    11jQuery( function( $ ) {
    22    'use strict';
     3
     4    window.eftPaymentKey = null;
    35
    46    window.wc_checkout_form = {
     
    112114                e.preventDefault();
    113115
    114                 jQuery.ajax({
    115                     type: 'POST',
    116                     url: wc_checkout_params.checkout_url,
    117                     data: jQuery('form.checkout').serialize(),
    118                     dataType: 'json',
    119                     success: function(result) {
    120                         try {
    121                             if ('success' === result.result) {
    122                                 var $paymentKey = result.paymentKey;
    123                                 console.log($paymentKey);
    124                                 console.log('Initiating transaction');
    125                                 eftSec.checkout.init({
    126                                     paymentKey: $paymentKey,
    127                                     onLoad: function() {
    128                                         wc_eftsecure_form.unblock();
    129                                     },
    130                                     onComplete: function(data) {
    131                                         eftSec.checkout.hideFrame();
    132                                         wc_eftsecure_form.eftsecure_submit = true;
    133                                         var $form = wc_eftsecure_form.form;
    134                                         if ($form.find( 'input.eftsecure_transaction_id' ).length > 0) {
    135                                             $form.find('input.eftsecure_transaction_id').remove();
    136                                         }
    137                                         $form.append( '<input type="hidden" class="eftsecure_transaction_id" name="eftsecure_transaction_id" value="' + data.transaction_id + '"/>' );
    138                                         $form.submit();
    139                                     }
    140                                 });
    141 
    142                             } else if ('failure' === result.result) {
    143                                 throw 'Result failure';
    144                             } else {
    145                                 throw 'Invalid response';
    146                             }
    147                         } catch (err) {
    148                             // Reload page
    149                             if (true === result.reload) {
    150                                 window.location.reload();
    151                                 return;
    152                             }
    153 
    154                             // Trigger update in case we need a fresh nonce
    155                             if (true === result.refresh) {
    156                                 jQuery(document.body).trigger('update_checkout');
    157                             }
    158 
    159                             // Add new errors
    160                             if (result.messages) {
    161                                 window.wc_checkout_form.submit_error(result.messages);
    162                             } else {
    163                                 window.wc_checkout_form.submit_error('<div class="woocommerce-error">' + wc_checkout_params.i18n_checkout_error + '</div>');
    164                             }
     116                if (window.eftPaymentKey != null) {
     117                    console.log('Initiating transaction existing transaction');
     118                    eftSec.checkout.init({
     119                        paymentKey: window.eftPaymentKey,
     120                        onLoad: function () {
     121                            wc_eftsecure_form.unblock();
     122                        },
     123                        onComplete: function (data) {
     124                            console.log('onComplete', data);
     125                            console.log('form', wc_eftsecure_form);
     126                            try {
     127                                eftSec.checkout.hideFrame();
     128                            }
     129                            catch (e) {
     130                                console.log(e);
     131                            }
     132                            wc_eftsecure_form.eftsecure_submit = true;
     133                            var $form = wc_eftsecure_form.form;
     134                            if ($form.find('input.eftsecure_transaction_id').length > 0) {
     135                                $form.find('input.eftsecure_transaction_id').remove();
     136                            }
     137                            $form.append('<input type="hidden" class="eftsecure_transaction_id" name="eftsecure_transaction_id" value="' + data.transaction_id + '"/>');
     138                            $form.submit();
    165139                        }
    166                     },
    167                     error: function(jqXHR, textStatus, errorThrown) {
    168                         wc_checkout_form.submit_error('<div class="woocommerce-error">' + errorThrown + '</div>');
    169                     }
    170                 });
     140                    });
     141                }
     142                else {
     143                    jQuery.ajax({
     144                        type: 'POST',
     145                        url: wc_checkout_params.checkout_url,
     146                        data: jQuery('form.checkout').serialize(),
     147                        dataType: 'json',
     148                        success: function (result) {
     149                            try {
     150                                if ('success' === result.result) {
     151                                    window.eftPaymentKey = result.paymentKey;
     152                                    console.log(window.eftPaymentKey);
     153                                    console.log('Initiating transaction first time');
     154                                    eftSec.checkout.init({
     155                                        paymentKey: window.eftPaymentKey,
     156                                        onLoad: function () {
     157                                            wc_eftsecure_form.unblock();
     158                                        },
     159                                        onComplete: function (data) {
     160                                            eftSec.checkout.hideFrame();
     161                                            wc_eftsecure_form.eftsecure_submit = true;
     162                                            var $form = wc_eftsecure_form.form;
     163                                            if ($form.find('input.eftsecure_transaction_id').length > 0) {
     164                                                $form.find('input.eftsecure_transaction_id').remove();
     165                                            }
     166                                            $form.append('<input type="hidden" class="eftsecure_transaction_id" name="eftsecure_transaction_id" value="' + data.transaction_id + '"/>');
     167                                            $form.submit();
     168                                        }
     169                                    });
     170
     171                                } else if ('failure' === result.result) {
     172                                    throw 'Result failure';
     173                                } else {
     174                                    throw 'Invalid response';
     175                                }
     176                            } catch (err) {
     177                                // Reload page
     178                                if (true === result.reload) {
     179                                    window.location.reload();
     180                                    return;
     181                                }
     182
     183                                // Trigger update in case we need a fresh nonce
     184                                if (true === result.refresh) {
     185                                    jQuery(document.body).trigger('update_checkout');
     186                                }
     187
     188                                // Add new errors
     189                                if (result.messages) {
     190                                    window.wc_checkout_form.submit_error(result.messages);
     191                                } else {
     192                                    window.wc_checkout_form.submit_error('<div class="woocommerce-error">' + wc_checkout_params.i18n_checkout_error + '</div>');
     193                                }
     194                            }
     195                        },
     196                        error: function (jqXHR, textStatus, errorThrown) {
     197                            wc_checkout_form.submit_error('<div class="woocommerce-error">' + errorThrown + '</div>');
     198                        }
     199                    });
     200                }
    171201
    172202                wc_eftsecure_form.block();
  • woo-eftsecure-gateway/tags/1.0.5/changelog.txt

    r2307714 r2309547  
    1818= 1.0.4 - 2020.05.16 =
    1919* Woocommerce 3.X support
     20
     21= 1.0.5 - 2020.05.21 =
     22* Checkout bug fixes
  • woo-eftsecure-gateway/tags/1.0.5/includes/class-wc-gateway-eftsecure.php

    r2307714 r2309547  
    332332        add_post_meta( $this->get_order_id($order), '_transaction_id', $response->id, true );
    333333
    334         $order->add_order_note(sprintf( __( 'EFTsecure charge complete (Transaction ID: %s)', 'woocommerce-gateway-stripe' ), $response->id ));
     334        $order->add_order_note(sprintf( __( 'EFTsecure charge complete (Transaction ID: %s)', 'woocommerce-gateway-eftsecure' ), $response->id ));
    335335
    336336        if ( $order->has_status( array( 'pending', 'failed' ) ) ) {
     
    383383
    384384            WC_Eftsecure::log("Info: Begin processing IPN for payment for order $order_id for the amount of {$order->get_total()}");
    385             $order->add_order_note(sprintf(__('EFTsecure IPN received : %s', 'woocommerce-gateway-stripe'), (($response->successful) ? 'SUCCESS' : 'FAILED')));
     385            $order->add_order_note(sprintf(__('EFTsecure IPN received : %s', 'woocommerce-gateway-eftsecure'), (($response->successful) ? 'SUCCESS' : 'FAILED')));
    386386
    387387            WC_Eftsecure::log("Processing response: " . print_r($response, true));
     
    408408
    409409                $order->payment_complete();
    410                 $order->add_order_note(sprintf(__('EFTsecure charge complete (Transaction ID: %s)', 'woocommerce-gateway-stripe'), $response->id));
     410                $order->add_order_note(sprintf(__('EFTsecure charge complete (Transaction ID: %s)', 'woocommerce-gateway-eftsecure'), $response->id));
    411411
    412412                WC_Eftsecure::log("Successful payment: $response->id");
     
    416416                $order->add_order_note(sprintf(__('EFTsecure Transaction Failed: (%s)', 'woocommerce-gateway-eftsecure'), $response->reason));
    417417            }
     418        } else {
     419            $order->add_order_note(sprintf(__('Transaction updated .. ignoring IPN.', 'woocommerce-gateway-eftsecure')));
    418420        }
    419421
  • woo-eftsecure-gateway/tags/1.0.5/readme.txt

    r2307742 r2309547  
    11=== Woocommerce EFTsecure gateway ===
    22Tags: eft,eftsecure,woocommerce
    3 Tested up to: 5.4.1
     3Tested up to: 4.7.5
    44License: MIT
    55License URI: https://github.com/EFTsecure/woocommerce-gateway-eftsecure/blob/master/LICENSE
     
    2121
    2222== Changelog ==
     23= 1.0.5 - 2020.05.21 =
     24* Checkout bug fixes
     25
    2326= 1.0.4 - 2020.05.16 =
    2427* Woocommerce 3.X support
  • woo-eftsecure-gateway/tags/1.0.5/woocommerce-gateway-eftsecure.php

    r2307714 r2309547  
    55 * Author: CallPay
    66 * Author URI: http://www.eftsecure.co.za/
    7  * Version: 1.0.4
     7 * Version: 1.0.5
    88 * Text Domain: woocommerce-gateway-eftsecure
    99 * Domain Path: /languages
     
    1919 * Required minimums and constants
    2020 */
    21 define( 'WC_EFTSECURE_VERSION', '1.0.4' );
     21define( 'WC_EFTSECURE_VERSION', '1.0.5' );
    2222define( 'WC_EFTSECURE_MIN_WC_VER', '2.2.0' );
    2323define( 'WC_EFTSECURE_MAIN_FILE', __FILE__ );
  • woo-eftsecure-gateway/trunk/assets/js/eftsecure_checkout.js

    r1691756 r2309547  
    11jQuery( function( $ ) {
    22    'use strict';
     3
     4    window.eftPaymentKey = null;
    35
    46    window.wc_checkout_form = {
     
    112114                e.preventDefault();
    113115
    114                 jQuery.ajax({
    115                     type: 'POST',
    116                     url: wc_checkout_params.checkout_url,
    117                     data: jQuery('form.checkout').serialize(),
    118                     dataType: 'json',
    119                     success: function(result) {
    120                         try {
    121                             if ('success' === result.result) {
    122                                 var $paymentKey = result.paymentKey;
    123                                 console.log($paymentKey);
    124                                 console.log('Initiating transaction');
    125                                 eftSec.checkout.init({
    126                                     paymentKey: $paymentKey,
    127                                     onLoad: function() {
    128                                         wc_eftsecure_form.unblock();
    129                                     },
    130                                     onComplete: function(data) {
    131                                         eftSec.checkout.hideFrame();
    132                                         wc_eftsecure_form.eftsecure_submit = true;
    133                                         var $form = wc_eftsecure_form.form;
    134                                         if ($form.find( 'input.eftsecure_transaction_id' ).length > 0) {
    135                                             $form.find('input.eftsecure_transaction_id').remove();
    136                                         }
    137                                         $form.append( '<input type="hidden" class="eftsecure_transaction_id" name="eftsecure_transaction_id" value="' + data.transaction_id + '"/>' );
    138                                         $form.submit();
    139                                     }
    140                                 });
    141 
    142                             } else if ('failure' === result.result) {
    143                                 throw 'Result failure';
    144                             } else {
    145                                 throw 'Invalid response';
    146                             }
    147                         } catch (err) {
    148                             // Reload page
    149                             if (true === result.reload) {
    150                                 window.location.reload();
    151                                 return;
    152                             }
    153 
    154                             // Trigger update in case we need a fresh nonce
    155                             if (true === result.refresh) {
    156                                 jQuery(document.body).trigger('update_checkout');
    157                             }
    158 
    159                             // Add new errors
    160                             if (result.messages) {
    161                                 window.wc_checkout_form.submit_error(result.messages);
    162                             } else {
    163                                 window.wc_checkout_form.submit_error('<div class="woocommerce-error">' + wc_checkout_params.i18n_checkout_error + '</div>');
    164                             }
     116                if (window.eftPaymentKey != null) {
     117                    console.log('Initiating transaction existing transaction');
     118                    eftSec.checkout.init({
     119                        paymentKey: window.eftPaymentKey,
     120                        onLoad: function () {
     121                            wc_eftsecure_form.unblock();
     122                        },
     123                        onComplete: function (data) {
     124                            console.log('onComplete', data);
     125                            console.log('form', wc_eftsecure_form);
     126                            try {
     127                                eftSec.checkout.hideFrame();
     128                            }
     129                            catch (e) {
     130                                console.log(e);
     131                            }
     132                            wc_eftsecure_form.eftsecure_submit = true;
     133                            var $form = wc_eftsecure_form.form;
     134                            if ($form.find('input.eftsecure_transaction_id').length > 0) {
     135                                $form.find('input.eftsecure_transaction_id').remove();
     136                            }
     137                            $form.append('<input type="hidden" class="eftsecure_transaction_id" name="eftsecure_transaction_id" value="' + data.transaction_id + '"/>');
     138                            $form.submit();
    165139                        }
    166                     },
    167                     error: function(jqXHR, textStatus, errorThrown) {
    168                         wc_checkout_form.submit_error('<div class="woocommerce-error">' + errorThrown + '</div>');
    169                     }
    170                 });
     140                    });
     141                }
     142                else {
     143                    jQuery.ajax({
     144                        type: 'POST',
     145                        url: wc_checkout_params.checkout_url,
     146                        data: jQuery('form.checkout').serialize(),
     147                        dataType: 'json',
     148                        success: function (result) {
     149                            try {
     150                                if ('success' === result.result) {
     151                                    window.eftPaymentKey = result.paymentKey;
     152                                    console.log(window.eftPaymentKey);
     153                                    console.log('Initiating transaction first time');
     154                                    eftSec.checkout.init({
     155                                        paymentKey: window.eftPaymentKey,
     156                                        onLoad: function () {
     157                                            wc_eftsecure_form.unblock();
     158                                        },
     159                                        onComplete: function (data) {
     160                                            eftSec.checkout.hideFrame();
     161                                            wc_eftsecure_form.eftsecure_submit = true;
     162                                            var $form = wc_eftsecure_form.form;
     163                                            if ($form.find('input.eftsecure_transaction_id').length > 0) {
     164                                                $form.find('input.eftsecure_transaction_id').remove();
     165                                            }
     166                                            $form.append('<input type="hidden" class="eftsecure_transaction_id" name="eftsecure_transaction_id" value="' + data.transaction_id + '"/>');
     167                                            $form.submit();
     168                                        }
     169                                    });
     170
     171                                } else if ('failure' === result.result) {
     172                                    throw 'Result failure';
     173                                } else {
     174                                    throw 'Invalid response';
     175                                }
     176                            } catch (err) {
     177                                // Reload page
     178                                if (true === result.reload) {
     179                                    window.location.reload();
     180                                    return;
     181                                }
     182
     183                                // Trigger update in case we need a fresh nonce
     184                                if (true === result.refresh) {
     185                                    jQuery(document.body).trigger('update_checkout');
     186                                }
     187
     188                                // Add new errors
     189                                if (result.messages) {
     190                                    window.wc_checkout_form.submit_error(result.messages);
     191                                } else {
     192                                    window.wc_checkout_form.submit_error('<div class="woocommerce-error">' + wc_checkout_params.i18n_checkout_error + '</div>');
     193                                }
     194                            }
     195                        },
     196                        error: function (jqXHR, textStatus, errorThrown) {
     197                            wc_checkout_form.submit_error('<div class="woocommerce-error">' + errorThrown + '</div>');
     198                        }
     199                    });
     200                }
    171201
    172202                wc_eftsecure_form.block();
  • woo-eftsecure-gateway/trunk/changelog.txt

    r2307714 r2309547  
    1818= 1.0.4 - 2020.05.16 =
    1919* Woocommerce 3.X support
     20
     21= 1.0.5 - 2020.05.21 =
     22* Checkout bug fixes
  • woo-eftsecure-gateway/trunk/includes/class-wc-gateway-eftsecure.php

    r2307714 r2309547  
    332332        add_post_meta( $this->get_order_id($order), '_transaction_id', $response->id, true );
    333333
    334         $order->add_order_note(sprintf( __( 'EFTsecure charge complete (Transaction ID: %s)', 'woocommerce-gateway-stripe' ), $response->id ));
     334        $order->add_order_note(sprintf( __( 'EFTsecure charge complete (Transaction ID: %s)', 'woocommerce-gateway-eftsecure' ), $response->id ));
    335335
    336336        if ( $order->has_status( array( 'pending', 'failed' ) ) ) {
     
    383383
    384384            WC_Eftsecure::log("Info: Begin processing IPN for payment for order $order_id for the amount of {$order->get_total()}");
    385             $order->add_order_note(sprintf(__('EFTsecure IPN received : %s', 'woocommerce-gateway-stripe'), (($response->successful) ? 'SUCCESS' : 'FAILED')));
     385            $order->add_order_note(sprintf(__('EFTsecure IPN received : %s', 'woocommerce-gateway-eftsecure'), (($response->successful) ? 'SUCCESS' : 'FAILED')));
    386386
    387387            WC_Eftsecure::log("Processing response: " . print_r($response, true));
     
    408408
    409409                $order->payment_complete();
    410                 $order->add_order_note(sprintf(__('EFTsecure charge complete (Transaction ID: %s)', 'woocommerce-gateway-stripe'), $response->id));
     410                $order->add_order_note(sprintf(__('EFTsecure charge complete (Transaction ID: %s)', 'woocommerce-gateway-eftsecure'), $response->id));
    411411
    412412                WC_Eftsecure::log("Successful payment: $response->id");
     
    416416                $order->add_order_note(sprintf(__('EFTsecure Transaction Failed: (%s)', 'woocommerce-gateway-eftsecure'), $response->reason));
    417417            }
     418        } else {
     419            $order->add_order_note(sprintf(__('Transaction updated .. ignoring IPN.', 'woocommerce-gateway-eftsecure')));
    418420        }
    419421
  • woo-eftsecure-gateway/trunk/readme.txt

    r2307742 r2309547  
    11=== Woocommerce EFTsecure gateway ===
    22Tags: eft,eftsecure,woocommerce
    3 Tested up to: 5.4.1
     3Tested up to: 4.7.5
    44License: MIT
    55License URI: https://github.com/EFTsecure/woocommerce-gateway-eftsecure/blob/master/LICENSE
     
    2121
    2222== Changelog ==
     23= 1.0.5 - 2020.05.21 =
     24* Checkout bug fixes
     25
    2326= 1.0.4 - 2020.05.16 =
    2427* Woocommerce 3.X support
  • woo-eftsecure-gateway/trunk/woocommerce-gateway-eftsecure.php

    r2307714 r2309547  
    55 * Author: CallPay
    66 * Author URI: http://www.eftsecure.co.za/
    7  * Version: 1.0.4
     7 * Version: 1.0.5
    88 * Text Domain: woocommerce-gateway-eftsecure
    99 * Domain Path: /languages
     
    1919 * Required minimums and constants
    2020 */
    21 define( 'WC_EFTSECURE_VERSION', '1.0.4' );
     21define( 'WC_EFTSECURE_VERSION', '1.0.5' );
    2222define( 'WC_EFTSECURE_MIN_WC_VER', '2.2.0' );
    2323define( 'WC_EFTSECURE_MAIN_FILE', __FILE__ );
Note: See TracChangeset for help on using the changeset viewer.