From df13eb5b613abe40e70468a610e2ede7009458e4 Mon Sep 17 00:00:00 2001 From: regdos Date: Sat, 21 Sep 2024 16:35:33 +0200 Subject: [PATCH] PayU - secureform via WooCommerce Blocks, version update --- Payu/Blocks/PayuSecureFormBlock.php | 11 + .../Gateways}/WC_Gateway_PayuSecureForm.php | 35 +- Payu/Gateways/WC_Payu_Gateways.php | 110 +- assets/css/payu-gateway.css | 2 +- assets/css/payu-gateway.scss | 37 + blocks_translates_map.json | 5 +- changelog.txt | 3 + composer.json | 39 +- composer.lock | 56 +- includes/lib/Cache/.htaccess | 2 - includes/lib/Cache/index.php | 0 includes/lib/OpenPayU/AuthType/AuthType.php | 12 - includes/lib/OpenPayU/AuthType/Basic.php | 33 - includes/lib/OpenPayU/AuthType/Oauth.php | 35 - .../lib/OpenPayU/AuthType/TokenRequest.php | 14 - includes/lib/OpenPayU/Configuration.php | 423 --- includes/lib/OpenPayU/Http.php | 166 - includes/lib/OpenPayU/HttpCurl.php | 111 - includes/lib/OpenPayU/Model/PayuShop.php | 100 - .../Model/PayuShop/PayuShopBalance.php | 78 - .../OpenPayU/Oauth/Cache/OauthCacheFile.php | 40 - .../Oauth/Cache/OauthCacheInterface.php | 26 - .../Oauth/Cache/OauthCacheMemcached.php | 43 - includes/lib/OpenPayU/Oauth/Oauth.php | 123 - .../lib/OpenPayU/Oauth/OauthGrantType.php | 7 - .../Oauth/OauthResultClientCredentials.php | 121 - includes/lib/OpenPayU/OpenPayU.php | 65 - includes/lib/OpenPayU/OpenPayUException.php | 57 - includes/lib/OpenPayU/OpenPayuOrderStatus.php | 23 - .../lib/OpenPayU/OpenPayuRefundStatus.php | 19 - includes/lib/OpenPayU/Result.php | 224 -- includes/lib/OpenPayU/ResultError.php | 58 - includes/lib/OpenPayU/Util.php | 300 -- includes/lib/OpenPayU/v2/Order.php | 293 -- includes/lib/OpenPayU/v2/Refund.php | 96 - includes/lib/OpenPayU/v2/Retrieve.php | 74 - includes/lib/OpenPayU/v2/Shop.php | 78 - includes/lib/OpenPayU/v2/Token.php | 74 - includes/lib/openpayu.php | 44 - lang/woo-payu-payment-gateway-pl_PL.l10n.php | 4 +- lang/woo-payu-payment-gateway-pl_PL.mo | Bin 13681 -> 13789 bytes lang/woo-payu-payment-gateway-pl_PL.po | 185 +- lang/woo-payu-payment-gateway.pot | 185 +- package-lock.json | 3372 ++++++++++++----- package.json | 2 + readme.txt | 7 +- src/js/SecureForm/cardcvv.js | 18 + src/js/SecureForm/cardexpire.js | 18 + src/js/SecureForm/cardnumber.js | 18 + src/js/SecureForm/error.js | 10 + src/js/SecureForm/options.js | 15 + src/js/payublik.js | 192 +- src/js/payucreditcard.js | 44 +- src/js/payuinstallments.js | 103 +- src/js/payuklarna.js | 44 +- src/js/payulistbanks.js | 371 +- src/js/payupaypo.js | 44 +- src/js/payusecureform.js | 363 ++ src/js/payustandard.js | 44 +- src/js/payutwistopl.js | 44 +- src/js/util.js | 53 + webpack.config.js | 81 +- woocommerce-gateway-payu.php | 12 +- 63 files changed, 3852 insertions(+), 4414 deletions(-) create mode 100644 Payu/Blocks/PayuSecureFormBlock.php rename {includes => Payu/Gateways}/WC_Gateway_PayuSecureForm.php (88%) delete mode 100644 includes/lib/Cache/.htaccess delete mode 100644 includes/lib/Cache/index.php delete mode 100644 includes/lib/OpenPayU/AuthType/AuthType.php delete mode 100644 includes/lib/OpenPayU/AuthType/Basic.php delete mode 100644 includes/lib/OpenPayU/AuthType/Oauth.php delete mode 100644 includes/lib/OpenPayU/AuthType/TokenRequest.php delete mode 100644 includes/lib/OpenPayU/Configuration.php delete mode 100644 includes/lib/OpenPayU/Http.php delete mode 100644 includes/lib/OpenPayU/HttpCurl.php delete mode 100644 includes/lib/OpenPayU/Model/PayuShop.php delete mode 100644 includes/lib/OpenPayU/Model/PayuShop/PayuShopBalance.php delete mode 100644 includes/lib/OpenPayU/Oauth/Cache/OauthCacheFile.php delete mode 100644 includes/lib/OpenPayU/Oauth/Cache/OauthCacheInterface.php delete mode 100644 includes/lib/OpenPayU/Oauth/Cache/OauthCacheMemcached.php delete mode 100644 includes/lib/OpenPayU/Oauth/Oauth.php delete mode 100644 includes/lib/OpenPayU/Oauth/OauthGrantType.php delete mode 100644 includes/lib/OpenPayU/Oauth/OauthResultClientCredentials.php delete mode 100644 includes/lib/OpenPayU/OpenPayU.php delete mode 100644 includes/lib/OpenPayU/OpenPayUException.php delete mode 100644 includes/lib/OpenPayU/OpenPayuOrderStatus.php delete mode 100644 includes/lib/OpenPayU/OpenPayuRefundStatus.php delete mode 100644 includes/lib/OpenPayU/Result.php delete mode 100644 includes/lib/OpenPayU/ResultError.php delete mode 100644 includes/lib/OpenPayU/Util.php delete mode 100644 includes/lib/OpenPayU/v2/Order.php delete mode 100644 includes/lib/OpenPayU/v2/Refund.php delete mode 100644 includes/lib/OpenPayU/v2/Retrieve.php delete mode 100644 includes/lib/OpenPayU/v2/Shop.php delete mode 100644 includes/lib/OpenPayU/v2/Token.php delete mode 100644 includes/lib/openpayu.php create mode 100644 src/js/SecureForm/cardcvv.js create mode 100644 src/js/SecureForm/cardexpire.js create mode 100644 src/js/SecureForm/cardnumber.js create mode 100644 src/js/SecureForm/error.js create mode 100644 src/js/SecureForm/options.js create mode 100644 src/js/payusecureform.js create mode 100644 src/js/util.js diff --git a/Payu/Blocks/PayuSecureFormBlock.php b/Payu/Blocks/PayuSecureFormBlock.php new file mode 100644 index 0000000..f483dc9 --- /dev/null +++ b/Payu/Blocks/PayuSecureFormBlock.php @@ -0,0 +1,11 @@ +payu_sdk_url = $this->sandbox ? 'https://secure.snd.payu.com/javascript/sdk' : 'https://secure.payu.com/javascript/sdk'; + if ( $this->is_enabled() ) { $this->icon = apply_filters( 'woocommerce_payu_icon', plugins_url( '/assets/images/card-visa-mc.svg', PAYU_PLUGIN_FILE ) ); @@ -28,10 +33,16 @@ public function is_available(): bool { return parent::is_available(); } - /** - * @return null - */ - function minicart_checkout_refresh_script() { + // Additional data for Blocks + public function get_additional_data(): array { + return [ + 'posId' => $this->pos_id, + 'sdkUrl' => $this->payu_sdk_url, + 'lang' => explode( '_', get_locale() )[0] + ]; + } + + function minicart_checkout_refresh_script(): void { if ( is_checkout() || is_wc_endpoint_url() ) : ?>