From 4c2c59e979b24948ee48b0bce23591ca98d72580 Mon Sep 17 00:00:00 2001 From: Mateusz Twardowski Date: Thu, 15 Feb 2024 15:31:58 +0100 Subject: [PATCH 1/4] add fingerprint to evry card Payment --- .../class-wc-gateway-pay-by-paynow-pl-card-payment.php | 2 +- src/includes/templates/card_payment.php | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-card-payment.php b/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-card-payment.php index 25d6f99..5aa3cd3 100644 --- a/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-card-payment.php +++ b/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-card-payment.php @@ -20,7 +20,7 @@ public function __construct() { public function payment_fields() { $card_payment_methods = $this->get_only_payment_methods_for_type( Type::CARD ); $card_payment_method = $card_payment_methods[0] ?? null; - if ( $card_payment_method && ! empty( $card_payment_method->getSavedInstruments() ) ) { + if ( $card_payment_method ) { $method_block = 'card'; $idempotency_key = WC_Pay_By_Paynow_PL_Keys_Generator::generate_idempotency_key( WC_Pay_By_Paynow_PL_Keys_Generator::generate_external_id_from_cart() diff --git a/src/includes/templates/card_payment.php b/src/includes/templates/card_payment.php index 86af6cf..eeaf5b5 100644 --- a/src/includes/templates/card_payment.php +++ b/src/includes/templates/card_payment.php @@ -1,6 +1,6 @@ +

-
@@ -50,4 +50,9 @@ class="paynow-payment-card-remove --hidden" type="button"
+ +

+
+

+
From baeac5b479d756211a610478e18c239d68573b1d Mon Sep 17 00:00:00 2001 From: Mateusz Twardowski Date: Thu, 15 Feb 2024 16:43:22 +0100 Subject: [PATCH 2/4] fix adding fingerprint to block payments --- src/Blocks/Payment/build/paynow-apple-pay-block.asset.php | 5 +---- src/Blocks/Payment/build/paynow-blik-block.asset.php | 5 +---- src/Blocks/Payment/build/paynow-card-block.asset.php | 5 +---- src/Blocks/Payment/build/paynow-card-block.js | 2 +- .../Payment/build/paynow-digital-wallets-block.asset.php | 5 +---- src/Blocks/Payment/build/paynow-google-pay-block.asset.php | 5 +---- src/Blocks/Payment/build/paynow-paywall-block.asset.php | 5 +---- src/Blocks/Payment/build/paynow-pbl-block.asset.php | 5 +---- src/Blocks/Payment/src/js/paynow-card-payment-block.js | 3 ++- 9 files changed, 10 insertions(+), 30 deletions(-) diff --git a/src/Blocks/Payment/build/paynow-apple-pay-block.asset.php b/src/Blocks/Payment/build/paynow-apple-pay-block.asset.php index d304b09..cf870dc 100644 --- a/src/Blocks/Payment/build/paynow-apple-pay-block.asset.php +++ b/src/Blocks/Payment/build/paynow-apple-pay-block.asset.php @@ -1,4 +1 @@ - array( 'react' ), - 'version' => 'a729dcdfc951ba0e5b17', -); + array('react'), 'version' => 'a729dcdfc951ba0e5b17'); diff --git a/src/Blocks/Payment/build/paynow-blik-block.asset.php b/src/Blocks/Payment/build/paynow-blik-block.asset.php index c1c056f..c3ca253 100644 --- a/src/Blocks/Payment/build/paynow-blik-block.asset.php +++ b/src/Blocks/Payment/build/paynow-blik-block.asset.php @@ -1,4 +1 @@ - array( 'react' ), - 'version' => 'b84faacbc42ca524da05', -); + array('react'), 'version' => 'b84faacbc42ca524da05'); diff --git a/src/Blocks/Payment/build/paynow-card-block.asset.php b/src/Blocks/Payment/build/paynow-card-block.asset.php index ff4b0c7..7cc8608 100644 --- a/src/Blocks/Payment/build/paynow-card-block.asset.php +++ b/src/Blocks/Payment/build/paynow-card-block.asset.php @@ -1,4 +1 @@ - array( 'react' ), - 'version' => 'cd445b690ee486bceaab', -); + array('react'), 'version' => '6710366c52f1516041d3'); diff --git a/src/Blocks/Payment/build/paynow-card-block.js b/src/Blocks/Payment/build/paynow-card-block.js index 3026e30..f031e94 100644 --- a/src/Blocks/Payment/build/paynow-card-block.js +++ b/src/Blocks/Payment/build/paynow-card-block.js @@ -1 +1 @@ -(()=>{"use strict";var e={211:e=>{e.exports=import("https://static.paynow.pl/scripts/PyG5QjFDUI.min.js")}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}(()=>{const e=window.React,{decodeEntities:t}=wp.htmlEntities,{getSetting:r}=wc.wcSettings,{registerPaymentMethod:a}=wc.wcBlocksRegistry,{useEffect:o}=wp.element,s=r("pay_by_paynow_pl_card_data",{}),l=t(s.title||"Card"),c=s.iconurl,i=t(s.available||!1),p=t(s.fields||"");let m=null;try{Promise.resolve().then(n.bind(n,211)).then((e=>e.load())).then((e=>e.get())).then((e=>{m=e.visitorId}))}catch(e){console.error("Cannot get fingerprint")}const y=t=>{const{eventRegistration:n,emitResponse:r}=t,{onPaymentProcessing:a}=n;return o((()=>{const e=a((async()=>{const e=document.querySelector('input[name="paymentMethodToken"]:checked'),t=e?e.value:null,n={};return t&&(n.paymentMethodToken=t,n.paymentMethodFingerprint=m),{type:r.responseTypes.SUCCESS,meta:{paymentMethodData:n}}}));return()=>{e()}}),[r.responseTypes.ERROR,r.responseTypes.SUCCESS,a]),(0,e.createElement)("div",{dangerouslySetInnerHTML:{__html:p}})};a({name:"pay_by_paynow_pl_card",label:(0,e.createElement)((t=>{const{PaymentMethodLabel:n}=t.components,r=(0,e.createElement)("img",{src:c,alt:l,name:l});return(0,e.createElement)(n,{className:"paynow-block-label",text:l,icon:r})}),null),content:(0,e.createElement)(y,null),edit:(0,e.createElement)(y,null),canMakePayment:()=>i,ariaLabel:l})})()})(); \ No newline at end of file +(()=>{"use strict";var e={211:e=>{e.exports=import("https://static.paynow.pl/scripts/PyG5QjFDUI.min.js")}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}(()=>{const e=window.React,{decodeEntities:t}=wp.htmlEntities,{getSetting:r}=wc.wcSettings,{registerPaymentMethod:a}=wc.wcBlocksRegistry,{useEffect:o}=wp.element,s=r("pay_by_paynow_pl_card_data",{}),l=t(s.title||"Card"),c=s.iconurl,i=t(s.available||!1),p=t(s.fields||"");let m=null;try{Promise.resolve().then(n.bind(n,211)).then((e=>e.load())).then((e=>e.get())).then((e=>{m=e.visitorId}))}catch(e){console.error("Cannot get fingerprint")}const y=t=>{const{eventRegistration:n,emitResponse:r}=t,{onPaymentProcessing:a}=n;return o((()=>{const e=a((async()=>{const e=document.querySelector('input[name="paymentMethodToken"]:checked'),t=e?e.value:null,n={};return t&&(n.paymentMethodToken=t),n.paymentMethodFingerprint=m,{type:r.responseTypes.SUCCESS,meta:{paymentMethodData:n}}}));return()=>{e()}}),[r.responseTypes.ERROR,r.responseTypes.SUCCESS,a]),(0,e.createElement)("div",{dangerouslySetInnerHTML:{__html:p}})};a({name:"pay_by_paynow_pl_card",label:(0,e.createElement)((t=>{const{PaymentMethodLabel:n}=t.components,r=(0,e.createElement)("img",{src:c,alt:l,name:l});return(0,e.createElement)(n,{className:"paynow-block-label",text:l,icon:r})}),null),content:(0,e.createElement)(y,null),edit:(0,e.createElement)(y,null),canMakePayment:()=>i,ariaLabel:l})})()})(); \ No newline at end of file diff --git a/src/Blocks/Payment/build/paynow-digital-wallets-block.asset.php b/src/Blocks/Payment/build/paynow-digital-wallets-block.asset.php index 46bbad1..a4ecf8a 100644 --- a/src/Blocks/Payment/build/paynow-digital-wallets-block.asset.php +++ b/src/Blocks/Payment/build/paynow-digital-wallets-block.asset.php @@ -1,4 +1 @@ - array( 'react' ), - 'version' => '9cdc28fc4e882254f8e8', -); + array('react'), 'version' => '9cdc28fc4e882254f8e8'); diff --git a/src/Blocks/Payment/build/paynow-google-pay-block.asset.php b/src/Blocks/Payment/build/paynow-google-pay-block.asset.php index df415bc..1979ef6 100644 --- a/src/Blocks/Payment/build/paynow-google-pay-block.asset.php +++ b/src/Blocks/Payment/build/paynow-google-pay-block.asset.php @@ -1,4 +1 @@ - array( 'react' ), - 'version' => '76a843566dc95ce582ca', -); + array('react'), 'version' => '76a843566dc95ce582ca'); diff --git a/src/Blocks/Payment/build/paynow-paywall-block.asset.php b/src/Blocks/Payment/build/paynow-paywall-block.asset.php index fbe10a3..a28d522 100644 --- a/src/Blocks/Payment/build/paynow-paywall-block.asset.php +++ b/src/Blocks/Payment/build/paynow-paywall-block.asset.php @@ -1,4 +1 @@ - array( 'react' ), - 'version' => 'ecf63bf6cabbb822c71a', -); + array('react'), 'version' => 'ecf63bf6cabbb822c71a'); diff --git a/src/Blocks/Payment/build/paynow-pbl-block.asset.php b/src/Blocks/Payment/build/paynow-pbl-block.asset.php index 9d17d35..703528e 100644 --- a/src/Blocks/Payment/build/paynow-pbl-block.asset.php +++ b/src/Blocks/Payment/build/paynow-pbl-block.asset.php @@ -1,4 +1 @@ - array( 'react' ), - 'version' => '73f50c24018bac626ab5', -); + array('react'), 'version' => '73f50c24018bac626ab5'); diff --git a/src/Blocks/Payment/src/js/paynow-card-payment-block.js b/src/Blocks/Payment/src/js/paynow-card-payment-block.js index a89f9aa..407cd72 100755 --- a/src/Blocks/Payment/src/js/paynow-card-payment-block.js +++ b/src/Blocks/Payment/src/js/paynow-card-payment-block.js @@ -39,9 +39,10 @@ const Content = props => { if (paymentMethodTokenInputValue) { data.paymentMethodToken = paymentMethodTokenInputValue; - data.paymentMethodFingerprint = paymentMethodFingerprint } + data.paymentMethodFingerprint = paymentMethodFingerprint + return { type: emitResponse.responseTypes.SUCCESS, meta: { From 18953bcd9eff6136e4f4ef69eee828d4e369d440 Mon Sep 17 00:00:00 2001 From: Mateusz Twardowski Date: Tue, 20 Feb 2024 11:30:26 +0100 Subject: [PATCH 3/4] up versions + changelog note + up wordpress tested up version --- changelog.txt | 4 ++++ composer.json | 2 +- readme.txt | 4 ++-- src/pay-by-paynow-pl.php | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/changelog.txt b/changelog.txt index b57b3df..84dc435 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ == Changelog == += 2.5.3 (2024-02-20) = + +- We have fixed payment security feature + = 2.5.2 (2024-02-02) = - We have added support for woocommerce blocks diff --git a/composer.json b/composer.json index 1c16d75..491a2f4 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "pay-now/paynow-woocommerce", "description": "paynow.pl plugin for WooCommerce", "license": "GPLv3", - "version": "2.5.2", + "version": "2.5.3", "authors": [ { "name": "mElements S.A.", diff --git a/readme.txt b/readme.txt index 69164f7..06d70a6 100644 --- a/readme.txt +++ b/readme.txt @@ -1,8 +1,8 @@ === Pay by paynow.pl === Tags: payment, payment gateway, paynow, woocommerce, płatności, payments, bramka płatności -Tested up to: 6.2 +Tested up to: 6.4 Requires PHP: 7.1 -Stable tag: 2.5.2 +Stable tag: 2.5.3 License: GPLv3 **pay**now is a secure online payment by bank transfers, BLIK and card. diff --git a/src/pay-by-paynow-pl.php b/src/pay-by-paynow-pl.php index 6ad26f8..6b15dd9 100644 --- a/src/pay-by-paynow-pl.php +++ b/src/pay-by-paynow-pl.php @@ -3,14 +3,14 @@ * Plugin Name: Pay by paynow.pl * Plugin URI: https://github.com/pay-now/paynow-woocommerce * Description: Accepts secure BLIK, credit cards payments and fast online transfers by paynow.pl - * Version: 2.5.2 + * Version: 2.5.3 * Requires PHP: 7.1 * Author: mElements S.A. * Author URI: https://www.paynow.pl * License: GPLv3 * Text Domain: pay-by-paynow-pl * Domain Path: /languages - * Tested up to: 6.2 + * Tested up to: 6.4 * WC tested up to: 7.7.0 * * @package Paynow From cd4c048b43b1890d42ba80f701461332e631987b Mon Sep 17 00:00:00 2001 From: Mateusz Twardowski Date: Tue, 20 Feb 2024 11:47:23 +0100 Subject: [PATCH 4/4] fix blocks code style --- src/Blocks/Payment/build/paynow-apple-pay-block.asset.php | 5 ++++- src/Blocks/Payment/build/paynow-blik-block.asset.php | 5 ++++- src/Blocks/Payment/build/paynow-card-block.asset.php | 5 ++++- .../Payment/build/paynow-digital-wallets-block.asset.php | 5 ++++- src/Blocks/Payment/build/paynow-google-pay-block.asset.php | 5 ++++- src/Blocks/Payment/build/paynow-paywall-block.asset.php | 5 ++++- src/Blocks/Payment/build/paynow-pbl-block.asset.php | 5 ++++- 7 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/Blocks/Payment/build/paynow-apple-pay-block.asset.php b/src/Blocks/Payment/build/paynow-apple-pay-block.asset.php index cf870dc..d304b09 100644 --- a/src/Blocks/Payment/build/paynow-apple-pay-block.asset.php +++ b/src/Blocks/Payment/build/paynow-apple-pay-block.asset.php @@ -1 +1,4 @@ - array('react'), 'version' => 'a729dcdfc951ba0e5b17'); + array( 'react' ), + 'version' => 'a729dcdfc951ba0e5b17', +); diff --git a/src/Blocks/Payment/build/paynow-blik-block.asset.php b/src/Blocks/Payment/build/paynow-blik-block.asset.php index c3ca253..c1c056f 100644 --- a/src/Blocks/Payment/build/paynow-blik-block.asset.php +++ b/src/Blocks/Payment/build/paynow-blik-block.asset.php @@ -1 +1,4 @@ - array('react'), 'version' => 'b84faacbc42ca524da05'); + array( 'react' ), + 'version' => 'b84faacbc42ca524da05', +); diff --git a/src/Blocks/Payment/build/paynow-card-block.asset.php b/src/Blocks/Payment/build/paynow-card-block.asset.php index 7cc8608..3b80d54 100644 --- a/src/Blocks/Payment/build/paynow-card-block.asset.php +++ b/src/Blocks/Payment/build/paynow-card-block.asset.php @@ -1 +1,4 @@ - array('react'), 'version' => '6710366c52f1516041d3'); + array( 'react' ), + 'version' => '6710366c52f1516041d3', +); diff --git a/src/Blocks/Payment/build/paynow-digital-wallets-block.asset.php b/src/Blocks/Payment/build/paynow-digital-wallets-block.asset.php index a4ecf8a..46bbad1 100644 --- a/src/Blocks/Payment/build/paynow-digital-wallets-block.asset.php +++ b/src/Blocks/Payment/build/paynow-digital-wallets-block.asset.php @@ -1 +1,4 @@ - array('react'), 'version' => '9cdc28fc4e882254f8e8'); + array( 'react' ), + 'version' => '9cdc28fc4e882254f8e8', +); diff --git a/src/Blocks/Payment/build/paynow-google-pay-block.asset.php b/src/Blocks/Payment/build/paynow-google-pay-block.asset.php index 1979ef6..df415bc 100644 --- a/src/Blocks/Payment/build/paynow-google-pay-block.asset.php +++ b/src/Blocks/Payment/build/paynow-google-pay-block.asset.php @@ -1 +1,4 @@ - array('react'), 'version' => '76a843566dc95ce582ca'); + array( 'react' ), + 'version' => '76a843566dc95ce582ca', +); diff --git a/src/Blocks/Payment/build/paynow-paywall-block.asset.php b/src/Blocks/Payment/build/paynow-paywall-block.asset.php index a28d522..fbe10a3 100644 --- a/src/Blocks/Payment/build/paynow-paywall-block.asset.php +++ b/src/Blocks/Payment/build/paynow-paywall-block.asset.php @@ -1 +1,4 @@ - array('react'), 'version' => 'ecf63bf6cabbb822c71a'); + array( 'react' ), + 'version' => 'ecf63bf6cabbb822c71a', +); diff --git a/src/Blocks/Payment/build/paynow-pbl-block.asset.php b/src/Blocks/Payment/build/paynow-pbl-block.asset.php index 703528e..9d17d35 100644 --- a/src/Blocks/Payment/build/paynow-pbl-block.asset.php +++ b/src/Blocks/Payment/build/paynow-pbl-block.asset.php @@ -1 +1,4 @@ - array('react'), 'version' => '73f50c24018bac626ab5'); + array( 'react' ), + 'version' => '73f50c24018bac626ab5', +);