From 119436fab71477e48fd3ca39c9d886dda3efcd6d Mon Sep 17 00:00:00 2001 From: aait Date: Fri, 28 Feb 2020 17:11:20 +0600 Subject: [PATCH] Add CheckoutWC support --- assets/js/checkout.js | 3 ++- assets/js/checkout.min.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/assets/js/checkout.js b/assets/js/checkout.js index 6c78dc34..8fd0be63 100644 --- a/assets/js/checkout.js +++ b/assets/js/checkout.js @@ -1,4 +1,5 @@ /* global wc_checkout_params */ +/* global Reepay */ // Preload ModalCheckout window.rp = new Reepay.ModalCheckout(); @@ -12,7 +13,7 @@ jQuery( function( $ ) { } $( document ).ajaxComplete( function ( event, xhr, settings ) { - if ( settings.url === wc_checkout_params.checkout_url ) { + if ( ( settings.url === wc_checkout_params.checkout_url ) || ( settings.url.indexOf( 'wc-ajax=complete_order' ) > -1 ) ) { const data = xhr.responseText; // Parse diff --git a/assets/js/checkout.min.js b/assets/js/checkout.min.js index fccb8f27..66cee2e1 100644 --- a/assets/js/checkout.min.js +++ b/assets/js/checkout.min.js @@ -1,2 +1,2 @@ -window.rp=new Reepay.ModalCheckout,jQuery(function(e){"use strict";if("undefined"==typeof wc_checkout_params)return!1;e(document).ajaxComplete(function(n,o,t){if(t.url===wc_checkout_params.checkout_url){const n=o.responseText;try{const o=e.parseJSON(n);if(!o.hasOwnProperty("is_reepay_checkout"))return!1;wc_reepay.buildModalCheckout(o.reepay.id,o.accept_url,o.cancel_url)}catch(e){return!1}}}),e(document).ready(function(){if(window.location.hash.indexOf("#!reepay-pay")>-1){const e=document.location.hash.replace("#!reepay-pay",""),n=new URLSearchParams(e);let o=n.get("rid"),t=n.get("accept_url"),a=n.get("cancel_url");window.setTimeout(function(){wc_reepay.buildModalCheckout(o,t,a),history.pushState("",document.title,window.location.pathname)},1e3)}})}),wc_reepay={buildModalCheckout:function(e,n,o){"OVERLAY"===WC_Gateway_Reepay_Checkout.payment_type?window.rp.show(e):window.rp=new Reepay.WindowCheckout(e),window.rp.addEventHandler(Reepay.Event.Accept,function(e){console.log("Accept",e);let o=n;for(let n in e)o=wc_reepay.setUrlParameter(o,n,e[n]);window.location.href=o}),window.rp.addEventHandler(Reepay.Event.Cancel,function(e){console.log("Cancel",e),window.location.href=o}),window.rp.addEventHandler(Reepay.Event.Close,function(e){console.log("Close",e)}),window.rp.addEventHandler(Reepay.Event.Error,function(e){console.log("Error",e),window.location.href=o})},setUrlParameter:function(e,n,o){var t=e.split("?")[0],a="?"+e.split("?")[1],c=n+"="+o,r="?"+c;if(a){var l=new RegExp("([?&])"+n+"[^&]*"),i=new RegExp("([?&])"+n+"=[^&;]+[&;]?");r=null==o||""===o?(r=a.replace(i,"$1")).replace(/[&;]$/,""):null!==a.match(l)?a.replace(l,"$1"+c):a+"&"+c}return t+(r="?"===r?"":r)}}; -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNoZWNrb3V0LmpzIl0sIm5hbWVzIjpbIndpbmRvdyIsInJwIiwiUmVlcGF5IiwiTW9kYWxDaGVja291dCIsImpRdWVyeSIsIiQiLCJ3Y19jaGVja291dF9wYXJhbXMiLCJkb2N1bWVudCIsImFqYXhDb21wbGV0ZSIsImV2ZW50IiwieGhyIiwic2V0dGluZ3MiLCJ1cmwiLCJjaGVja291dF91cmwiLCJkYXRhIiwicmVzcG9uc2VUZXh0IiwicmVzdWx0IiwicGFyc2VKU09OIiwiaGFzT3duUHJvcGVydHkiLCJ3Y19yZWVwYXkiLCJidWlsZE1vZGFsQ2hlY2tvdXQiLCJyZWVwYXkiLCJpZCIsImFjY2VwdF91cmwiLCJjYW5jZWxfdXJsIiwiZSIsInJlYWR5IiwibG9jYXRpb24iLCJoYXNoIiwiaW5kZXhPZiIsInJlcGxhY2UiLCJwYXJhbXMiLCJVUkxTZWFyY2hQYXJhbXMiLCJyaWQiLCJnZXQiLCJzZXRUaW1lb3V0IiwiaGlzdG9yeSIsInB1c2hTdGF0ZS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aXN0c1xuICAgIGlmICggdHlwZW9mIHdjX2NoZWNrb3V0X3BhcmFtcyA9PT0gJ3VuZGVmaW5lZCcgKSB7XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9XG5cbiAgICAkKCBkb2N1bWVudCApLmFqYXhDb21wbGV0ZSggZnVuY3Rpb24gKCBldmVudCwgeGhyLCBzZXR0aW5ncyApIHtcbiAgICAgICAgaWYgKCBzZXR0aW5ncy51cmwgPT09IHdjX2NoZWNrb3V0X3BhcmFtcy5jaGVja291dF91cmwgKSB7XG4gICAgICAgICAgICBjb25zdCBkYXRhID0geGhyLnJlc3BvbnNlVGV4dDtcblxuICAgICAgICAgICAgLy8gUGFyc2VcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgY29uc3QgcmVzdWx0ID0gJC5wYXJzZUpTT04oIGRhdGEgKTtcblxuICAgICAgICAgICAgICAgIC8vIENoZWNrIGlzIHJlc3BvbnNlIGZyb20gcGF5bWVudCBnYXRld2F5XG4gICAgICAgICAgICAgICAgaWYgKCAhIHJlc3VsdC5oYXNPd25Qcm9wZXJ0eSggJ2lzX3JlZXBheV9jaGVja291dCcgKSApIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHdjX3JlZXBheS5idWlsZE1vZGFsQ2hlY2tvdXQoIHJlc3VsdC5yZWVwYXkuaWQsIHJlc3VsdC5hY2NlcHRfdXJsLCByZXN1bHQuY2FuY2VsX3VybCApO1xuICAgICAgICAgICAgfSBjYXRjaCAoIGUgKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfSApO1xuXG4gICAgJCggZG9jdW1lbnQgKS5yZWFkeShmdW5jdGlvbiAoKSB7XG4gICAgICAgIGlmICggd2luZG93LmxvY2F0aW9uLmhhc2guaW5kZXhPZiggJyMhcmVlcGF5LXBheScgKSA+IC0xICkge1xuICAgICAgICAgICAgY29uc3QgdXJsID0gZG9jdW1lbnQubG9jYXRpb24uaGFzaC5yZXBsYWNlKCAnIyFyZWVwYXktcGF5JywnJyApLFxuICAgICAgICAgICAgICAgIHBhcmFtcyA9IG5ldyBVUkxTZWFyY2hQYXJhbXMoIHVybCApO1xuXG4gICAgICAgICAgICBsZXQgcmlkID0gcGFyYW1zLmdldCggJ3JpZCcgKSxcbiAgICAgICAgICAgICAgICBhY2NlcHRfdXJsID0gcGFyYW1zLmdldCggJ2FjY2VwdF91cmwnICksXG4gICAgICAgICAgICAgICAgY2FuY2VsX3VybCA9IHBhcmFtcy5nZXQoICdjYW5jZWxfdXJsJyApO1xuXG4gICAgICAgICAgICB3aW5kb3cuc2V0VGltZW91dCggZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgIHdjX3JlZXBheS5idWlsZE1vZGFsQ2hlY2tvdXQoIHJpZCwgYWNjZXB0X3VybCwgY2FuY2VsX3VybCApO1xuICAgICAgICAgICAgICAgIGhpc3RvcnkucHVzaFN0YXRlKCAnJywgZG9jdW1lbnQudGl0bGUsIHdpbmRvdy5sb2NhdGlvbi5wYXRobmFtZSApO1xuICAgICAgICAgICAgfSwgMTAwMCApO1xuICAgICAgICB9XG4gICAgfSk7XG59KTtcblxud2NfcmVlcGF5ID0ge1xuICAgIC8qKlxuICAgICAqIEJ1aWxkIE1vZGFsIENoZWNrb3V0XG4gICAgICpcbiAgICAgKiBAcGFyYW0gcmVlcGF5X2lkXG4gICAgICogQHBhcmFtIGFjY2VwdF91cmxcbiAgICAgKiBAcGFyYW0gY2FuY2VsX3VybFxuICAgICAqL1xuICAgIGJ1aWxkTW9kYWxDaGVja291dDogZnVuY3Rpb24gKCByZWVwYXlfaWQsIGFjY2VwdF91cmwsIGNhbmNlbF91cmwgKSB7XG4gICAgICAgIGlmICggV0NfR2F0ZXdheV9SZWVwYXlfQ2hlY2tvdXQucGF5bWVudF90eXBlID09PSAnT1ZFUkxBWScgKSB7XG4gICAgICAgICAgICAvLyBTaG93IG1vZGFsXG4gICAgICAgICAgICB3aW5kb3cucnAuc2hvdyggcmVlcGF5X2lkICk7XG4gICAgICAgICAgICAvL3JwID0gbmV3IFJlZXBheS5Nb2RhbENoZWNrb3V0KCByZWVwYXlfaWQgKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHdpbmRvdy5ycCA9IG5ldyBSZWVwYXkuV2luZG93Q2hlY2tvdXQoIHJlZXBheV9pZCApO1xuICAgICAgICB9XG5cbiAgICAgICAgd2luZG93LnJwLmFkZEV2ZW50SGFuZGxlciggUmVlcGF5LkV2ZW50LkFjY2VwdCwgZnVuY3Rpb24oIGRhdGEgKSB7XG4gICAgICAgICAgICBjb25zb2xlLmxvZyggJ0FjY2VwdCcsIGRhdGEgKTtcblxuICAgICAgICAgICAgbGV0IHJlZGlyZWN0X3VybCA9IGFjY2VwdF91cmw7XG4gICAgICAgICAgICBmb3IgKCBsZXQgcHJvcCBpbiBkYXRhICkge1xuICAgICAgICAgICAgICAgIHJlZGlyZWN0X3VybCA9IHdjX3JlZXBheS5zZXRVcmxQYXJhbWV0ZXIoIHJlZGlyZWN0X3VybCwgcHJvcCwgZGF0YVtwcm9wXSApO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB3aW5kb3cubG9jYXRpb24uaHJlZiA9IHJlZGlyZWN0X3VybDtcbiAgICAgICAgfSApO1xuXG4gICAgICAgIHdpbmRvdy5ycC5hZGRFdmVudEhhbmRsZXIoIFJlZXBheS5FdmVudC5DYW5jZWwsIGZ1bmN0aW9uKCBkYXRhICkge1xuICAgICAgICAgICAgY29uc29sZS5sb2coICdDYW5jZWwnLCBkYXRhICk7XG4gICAgICAgICAgICB3aW5kb3cubG9jYXRpb24uaHJlZiA9IGNhbmNlbF91cmw7XG4gICAgICAgIH0gKTtcblxuICAgICAgICB3aW5kb3cucnAuYWRkRXZlbnRIYW5kbGVyKCBSZWVwYXku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xuIl19 +window.rp=new Reepay.ModalCheckout,jQuery(function(e){"use strict";if("undefined"==typeof wc_checkout_params)return!1;e(document).ajaxComplete(function(n,o,t){if(t.url===wc_checkout_params.checkout_url||t.url.indexOf("wc-ajax=complete_order")>-1){const n=o.responseText;try{const o=e.parseJSON(n);if(!o.hasOwnProperty("is_reepay_checkout"))return!1;wc_reepay.buildModalCheckout(o.reepay.id,o.accept_url,o.cancel_url)}catch(e){return!1}}}),e(document).ready(function(){if(window.location.hash.indexOf("#!reepay-pay")>-1){const e=document.location.hash.replace("#!reepay-pay",""),n=new URLSearchParams(e);let o=n.get("rid"),t=n.get("accept_url"),a=n.get("cancel_url");window.setTimeout(function(){wc_reepay.buildModalCheckout(o,t,a),history.pushState("",document.title,window.location.pathname)},1e3)}})}),wc_reepay={buildModalCheckout:function(e,n,o){"OVERLAY"===WC_Gateway_Reepay_Checkout.payment_type?window.rp.show(e):window.rp=new Reepay.WindowCheckout(e),window.rp.addEventHandler(Reepay.Event.Accept,function(e){console.log("Accept",e);let o=n;for(let n in e)o=wc_reepay.setUrlParameter(o,n,e[n]);window.location.href=o}),window.rp.addEventHandler(Reepay.Event.Cancel,function(e){console.log("Cancel",e),window.location.href=o}),window.rp.addEventHandler(Reepay.Event.Close,function(e){console.log("Close",e)}),window.rp.addEventHandler(Reepay.Event.Error,function(e){console.log("Error",e),window.location.href=o})},setUrlParameter:function(e,n,o){var t=e.split("?")[0],a="?"+e.split("?")[1],c=n+"="+o,r="?"+c;if(a){var l=new RegExp("([?&])"+n+"[^&]*"),i=new RegExp("([?&])"+n+"=[^&;]+[&;]?");r=null==o||""===o?(r=a.replace(i,"$1")).replace(/[&;]$/,""):null!==a.match(l)?a.replace(l,"$1"+c):a+"&"+c}return t+(r="?"===r?"":r)}}; +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNoZWNrb3V0LmpzIl0sIm5hbWVzIjpbIndpbmRvdyIsInJwIiwiUm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9ICQucGFyc2VKU09OKCBkYXRhICk7XG5cbiAgICAgICAgICAgICAgICAvLyBDaGVjayBpcyByZXNwb25zZSBmcm9tIHBheW1lbnQgZ2F0ZXdheVxuICAgICAgICAgICAgICAgIGlmICggISByZXN1bHQuaGFzT3duUHJvcGVydHkoICdpc19yZWVwYXlfY2hlY2tvdXQnICkgKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB3Y19yZWVwYXkuYnVpbGRNb2RhbENoZWNrb3V0KCByZXN1bHQucmVlcGF5LmlkLCByZXN1bHQuYWNjZXB0X3VybCwgcmVzdWx0LmNhbmNlbF91cmwgKTtcbiAgICAgICAgICAgIH0gY2F0Y2ggKCBlICkge1xuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH0gKTtcblxuICAgICQoIGRvY3VtZW50ICkucmVhZHkoZnVuY3Rpb24gKCkge1xuICAgICAgICBpZiAoIHdpbmRvdy5sb2NhdGlvbi5oYXNoLmluZGV4T2YoICcjIXJlZXBheS1wYXknICkgPiAtMSApIHtcbiAgICAgICAgICAgIGNvbnN0IHVybCA9IGRvY3VtZW50LmxvY2F0aW9uLmhhc2gucmVwbGFjZSggJyMhcmVlcGF5LXBheScsJycgKSxcbiAgICAgICAgICAgICAgICBwYXJhbXMgPSBuZXcgVVJMU2VhcmNoUGFyYW1zKCB1cmwgKTtcblxuICAgICAgICAgICAgbGV0IHJpZCA9IHBhcmFtcy5nZXQoICdyaWQnICksXG4gICAgICAgICAgICAgICAgYWNjZXB0X3VybCA9IHBhcmFtcy5nZXQoICdhY2NlcHRfdXJsJyApLFxuICAgICAgICAgICAgICAgIGNhbmNlbF91cmwgPSBwYXJhbXMuZ2V0KCAnY2FuY2VsX3VybCcgKTtcblxuICAgICAgICAgICAgd2luZG93LnNldFRpbWVvdXQoIGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICB3Y19yZWVwYXkuYnVpbGRNb2RhbENoZWNrb3V0KCByaWQsIGFjY2VwdF91cmwsIGNhbmNlbF91cmwgKTtcbiAgICAgICAgICAgICAgICBoaXN0b3J5LnB1c2hTdGF0ZSggJycsIGRvY3VtZW50LnRpdGxlLCB3aW5kb3cubG9jYXRpb24ucGF0aG5hbWUgKTtcbiAgICAgICAgICAgIH0sIDEwMDAgKTtcbiAgICAgICAgfVxuICAgIH0pO1xufSk7XG5cbndjX3JlZXBheSA9IHtcbiAgICAvKipcbiAgICAgKiBCdWlsZCBNb2RhbCBDaGVja291dFxuICAgICAqXG4gICAgICogQHBhcmFtIHJlZXBheV9pZFxuICAgICAqIEBwYXJhbSBhY2NlcHRfdXJsXG4gICAgICogQHBhcmFtIGNhbmNlbF91cmxcbiAgICAgKi9cbiAgICBidWlsZE1vZGFsQ2hlY2tvdXQ6IGZ1bmN0aW9uICggcmVlcGF5X2lkLCBhY2NlcHRfdXJsLCBjYW5jZWxfdXJsICkge1xuICAgICAgICBpZiAoIFdDX0dhdGV3YXlfUmVlcGF5X0NoZWNrb3V0LnBheW1lbnRfdHlwZSA9PT0gJ09WRVJMQVknICkge1xuICAgICAgICAgICAgLy8gU2hvdyBtb2RhbFxuICAgICAgICAgICAgd2luZG93LnJwLnNob3coIHJlZXBheV9pZCApO1xuICAgICAgICAgICAgLy9ycCA9IG5ldyBSZWVwYXkuTW9kYWxDaGVja291dCggcmVlcGF5X2lkICk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB3aW5kb3cucnAgPSBuZXcgUmVlcGF5LldpbmRvd0NoZWNrb3V0KCByZWVwYXlfaWQgKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHdpbmRvdy5ycC5hZGRFdmVudEhhbmRsZXIoIFJlZXBheS5FdmVudC5BY2NlcHQsIGZ1bmN0aW9uKCBkYXRhICkge1xuICAgICAgICAgICAgY29uc29sZS5sb2coICdBY2NlcHQnLCBkYXRhICk7XG5cbiAgICAgICAgICAgIGxldCByZWRpcmVjdF91cmwgPSBhY2NlcHRfdXJsO1xuICAgICAgICAgICAgZm9yICggbGV0IHByb3AgaW4gZGF0YSApIHtcbiAgICAgICAgICAgICAgICByZWRpcmVjdF91cmwgPSB3Y19yZWVwYXkuc2V0VXJsUGFyYW1ldGVyKCByZWRpcmVjdF91cmwsIHByb3AsIGRhdGFbcHJvcF0gKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgd2luZG93LmxvY2F0aW9uLmhyZWYgPSByZWRpcmVjdF91cmw7XG4gICAgICAgIH0gKTtcblxuICAgICAgICB3aW5kb3cucnAuYWRkRXZlbnRIYW5kbGVyKCBSZWVwYXkuRXZlbnQuQ2FuY2VsLCBmdW5jdGlvbiggZGF0YSApIHtcbiAgICAgICAgICAgIGNvbnNvbGUubG9nKCAnQ2FuY2VsJywgZGF0YSApO1xuICAgICAgICAgICAgd2luZG93LmxvY2F0aW9uLmhyZWYgPSBjYW5jZWxfdXJsO1xuICAgICAgICB9ICk7XG5cbiAgICAgICAgd2luZG93LnJwLmFkZEV2ZW50SGFuZGxlciggUmVlcGF5LkV2ZW50LkNsb3NlLCBmdW5jdGlvbiggZGF0YSApIHtcbiAgICAgICAgICAgIGNvbnNvbGUubG9nKCAnQ2xvc2UnLCBkYXRhICk7XG4gICAgICAgIH0gKTtcblxuICAgICAgICB3aW5kb3cucnAuYWRkRXZlbnRIYW5kbGVyKCBSZWVwYXkuRXZlbnQuRXJyb3IsIGZ1bmN0aW9uKCBkYXRhICkge1xuICAgICAgICAgICAgY29uc29sZS5sb2coICdFcnJvcicsIGRhdGEgKTtcbiAgICAgICAgICAgIHdpbmRvdy5sb2NhdGlvbi5ocmVmID0gY2FuY2VsX3VybDtcbiAgICAgICAgfSApO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBBZGQgcGFyYW1ldGVyIGZvciBVcmxcbiAgICAgKlxuICAgICAqIEBwYXJhbSB1cmxcb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