From da3fb6d8d64420f16a98407b3b06b82694971e6b Mon Sep 17 00:00:00 2001 From: Daniel Dudzic Date: Fri, 24 May 2024 09:38:40 +0200 Subject: [PATCH 1/7] Fix the two AXO bugs: Billing details missing and select another payment gateway missing --- modules/ppcp-axo/resources/js/AxoManager.js | 3 ++- modules/ppcp-axo/resources/js/Views/CardView.js | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/ppcp-axo/resources/js/AxoManager.js b/modules/ppcp-axo/resources/js/AxoManager.js index d3dd2fee7..79c2ac5a2 100644 --- a/modules/ppcp-axo/resources/js/AxoManager.js +++ b/modules/ppcp-axo/resources/js/AxoManager.js @@ -261,9 +261,10 @@ class AxoManager { if (scenario.axoProfileViews) { this.shippingView.activate(); + this.cardView.activate(); if (this.status.hasCard) { - this.cardView.activate(); + this.billingView.activate(); } // Move watermark to after shipping. diff --git a/modules/ppcp-axo/resources/js/Views/CardView.js b/modules/ppcp-axo/resources/js/Views/CardView.js index a72a38ff3..82c15079c 100644 --- a/modules/ppcp-axo/resources/js/Views/CardView.js +++ b/modules/ppcp-axo/resources/js/Views/CardView.js @@ -20,10 +20,6 @@ class CardView { if (data.isEmpty()) { return `
-
-
Please fill in your card details.
-
-

Add card details

${selectOtherPaymentMethod()}
`; From ff3091b3a6b6106c4559594b557e53faaafc15b8 Mon Sep 17 00:00:00 2001 From: Emili Castells Guasch Date: Fri, 24 May 2024 17:20:44 +0200 Subject: [PATCH 2/7] Use uuid for `data-client-metadata-id` --- .../ppcp-button/resources/js/modules/Helper/ScriptLoading.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/ppcp-button/resources/js/modules/Helper/ScriptLoading.js b/modules/ppcp-button/resources/js/modules/Helper/ScriptLoading.js index dce3136c8..6fbd419cb 100644 --- a/modules/ppcp-button/resources/js/modules/Helper/ScriptLoading.js +++ b/modules/ppcp-button/resources/js/modules/Helper/ScriptLoading.js @@ -63,9 +63,10 @@ export const loadPaypalScript = (config, onLoaded, onError = null) => { // Axo SDK options const sdkClientToken = config?.axo?.sdk_client_token; + const uuid = self.crypto.randomUUID(); if(sdkClientToken) { scriptOptions['data-sdk-client-token'] = sdkClientToken; - scriptOptions['data-client-metadata-id'] = 'ppcp-cm-id'; + scriptOptions['data-client-metadata-id'] = uuid; } // Load PayPal script for special case with data-client-token From a3c610bc1c56899da3888511bd8ff048674eacf7 Mon Sep 17 00:00:00 2001 From: Daniel Dudzic Date: Mon, 27 May 2024 11:33:34 +0200 Subject: [PATCH 3/7] Replace crypto.randomUUID with a dependency (3165) --- .../ppcp-button/resources/js/modules/Helper/ScriptLoading.js | 3 ++- package.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/ppcp-button/resources/js/modules/Helper/ScriptLoading.js b/modules/ppcp-button/resources/js/modules/Helper/ScriptLoading.js index 6fbd419cb..55866fe9d 100644 --- a/modules/ppcp-button/resources/js/modules/Helper/ScriptLoading.js +++ b/modules/ppcp-button/resources/js/modules/Helper/ScriptLoading.js @@ -4,6 +4,7 @@ import widgetBuilder from "../Renderer/WidgetBuilder"; import merge from "deepmerge"; import {keysToCamelCase} from "./Utils"; import {getCurrentPaymentMethod} from "./CheckoutMethodState"; +import { v4 as uuidv4 } from 'uuid'; // This component may be used by multiple modules. This assures that options are shared between all instances. let options = window.ppcpWidgetBuilder = window.ppcpWidgetBuilder || { @@ -63,7 +64,7 @@ export const loadPaypalScript = (config, onLoaded, onError = null) => { // Axo SDK options const sdkClientToken = config?.axo?.sdk_client_token; - const uuid = self.crypto.randomUUID(); + const uuid = uuidv4().replace(/-/g, ''); if(sdkClientToken) { scriptOptions['data-sdk-client-token'] = sdkClientToken; scriptOptions['data-client-metadata-id'] = uuid; diff --git a/package.json b/package.json index bf52a8677..1e060a0ce 100644 --- a/package.json +++ b/package.json @@ -94,6 +94,7 @@ "dotenv": "^16.0.3", "npm-run-all": "^4.1.5", "playwright": "^1.43.0", - "run-s": "^0.0.0" + "run-s": "^0.0.0", + "uuid": "^9.0.1" } } From 5b8d9b352081cf642bf4172d50742a82ac0465fc Mon Sep 17 00:00:00 2001 From: Daniel Dudzic Date: Mon, 27 May 2024 12:27:59 +0200 Subject: [PATCH 4/7] AXO: Remove Billing Details from the Ryan flow (3173) --- .../ppcp-axo/resources/js/Views/BillingView.js | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/modules/ppcp-axo/resources/js/Views/BillingView.js b/modules/ppcp-axo/resources/js/Views/BillingView.js index aba44afcf..24f8a3682 100644 --- a/modules/ppcp-axo/resources/js/Views/BillingView.js +++ b/modules/ppcp-axo/resources/js/Views/BillingView.js @@ -34,22 +34,7 @@ class BillingView { `; } - return ` -
-
-

Billing

- Edit -
-
${data.value('email')}
-
${data.value('company')}
-
${data.value('firstName')} ${data.value('lastName')}
-
${data.value('street1')}
-
${data.value('street2')}
-
${data.value('postCode')} ${data.value('city')}
-
${valueOfSelect('#billing_state', data.value('stateCode'))}
-
${valueOfSelect('#billing_country', data.value('countryCode'))}
-
- `; + return ``; }, fields: { email: { From 65a74d12a5a7c5157976ce9298bf942870bc08ae Mon Sep 17 00:00:00 2001 From: Daniel Dudzic Date: Mon, 27 May 2024 12:40:17 +0200 Subject: [PATCH 5/7] Replace backticks with single quotes --- modules/ppcp-axo/resources/js/Views/BillingView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ppcp-axo/resources/js/Views/BillingView.js b/modules/ppcp-axo/resources/js/Views/BillingView.js index 24f8a3682..f2903d4ef 100644 --- a/modules/ppcp-axo/resources/js/Views/BillingView.js +++ b/modules/ppcp-axo/resources/js/Views/BillingView.js @@ -34,7 +34,7 @@ class BillingView { `; } - return ``; + return ''; }, fields: { email: { From 64dee95a76b31c26943d3cfee84c21d3286f3197 Mon Sep 17 00:00:00 2001 From: Daniel Dudzic Date: Mon, 27 May 2024 15:59:46 +0200 Subject: [PATCH 6/7] AXO: Disable payment method selection during OTP interaction (3174) --- modules/ppcp-axo/resources/js/AxoManager.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/ppcp-axo/resources/js/AxoManager.js b/modules/ppcp-axo/resources/js/AxoManager.js index 7c2a21964..5229573ae 100644 --- a/modules/ppcp-axo/resources/js/AxoManager.js +++ b/modules/ppcp-axo/resources/js/AxoManager.js @@ -571,7 +571,9 @@ class AxoManager { page_type: 'checkout' }); + this.disableGatewaySelection(); await this.lookupCustomerByEmail(); + this.enableGatewaySelection(); } async lookupCustomerByEmail() { @@ -659,6 +661,14 @@ class AxoManager { } } + disableGatewaySelection() { + this.$('.wc_payment_methods input').prop('disabled', true); + } + + enableGatewaySelection() { + this.$('.wc_payment_methods input').prop('disabled', false); + } + clearData() { this.data = { email: null, From 8e573918ef21a0c71f5bc166a2c575b4dccac51f Mon Sep 17 00:00:00 2001 From: Daniel Dudzic Date: Tue, 28 May 2024 18:32:49 +0200 Subject: [PATCH 7/7] AXO: Update Fastlane settings (3166) --- modules/ppcp-axo/extensions.php | 42 +++++++++---------- .../src/Helper/PropertiesDictionary.php | 12 ++++++ 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/modules/ppcp-axo/extensions.php b/modules/ppcp-axo/extensions.php index e6d0f4836..8d8bf4378 100644 --- a/modules/ppcp-axo/extensions.php +++ b/modules/ppcp-axo/extensions.php @@ -148,14 +148,8 @@ return array( 'axo_privacy' => array( 'title' => __( 'Privacy', 'woocommerce-paypal-payments' ), 'type' => 'select', - 'label' => __( - 'This setting will control whether Fastlane branding is shown by email field. -

PayPal powers this accelerated checkout solution from Fastlane. Since you\'ll share consumers\' email addresses with PayPal, please consult your legal advisors on the apropriate privacy setting for your business.

', - 'woocommerce-paypal-payments' - ), - 'desc_tip' => true, 'description' => __( - 'This setting will control whether Fastlane branding is shown by email field.', + 'PayPal powers this accelerated checkout solution from Fastlane. Since you\'ll share consumers\' email address with PayPal, please consult your legal advisors on the appropriate privacy setting for your business.', 'woocommerce-paypal-payments' ), 'classes' => array( 'ppcp-field-indent' ), @@ -168,12 +162,14 @@ return array( 'requirements' => array( 'axo' ), ), 'axo_name_on_card' => array( - 'title' => __( 'Display Name on Card', 'woocommerce-paypal-payments' ), - 'type' => 'checkbox', + 'title' => __( 'Cardholder Name', 'woocommerce-paypal-payments' ), + 'type' => 'select', 'default' => 'yes', + 'options' => PropertiesDictionary::cardholder_name_options(), 'classes' => array( 'ppcp-field-indent' ), 'class' => array(), - 'label' => __( 'Enable this to display the "Name on Card" field for new Fastlane buyers.', 'woocommerce-paypal-payments' ), + 'input_class' => array( 'wc-enhanced-select' ), + 'description' => __( 'This setting will control whether or not the cardholder name is displayed in the card field\'s UI.', 'woocommerce-paypal-payments' ), 'screens' => array( State::STATE_ONBOARDED ), 'gateway' => array( 'dcc', 'axo' ), 'requirements' => array( 'axo' ), @@ -196,7 +192,7 @@ return array( sprintf( // translators: %1$s and %2$s is a link tag. __( - 'Leave the default styling, or customize how Fastlane looks on your website. %1$sSee PayPal\'s developer docs%2$s for info', + 'Leave the default styling, or customize how Fastlane looks on your website. Styles that don\'t meet accessibility guidelines will revert to the defaults. See %1$sPayPal\'s developer docs%2$s for info.', 'woocommerce-paypal-payments' ), '', @@ -236,18 +232,6 @@ return array( 'requirements' => array( 'axo' ), 'gateway' => array( 'dcc', 'axo' ), ), - 'axo_style_root_primary_color' => array( - 'title' => __( 'Primary Color', 'woocommerce-paypal-payments' ), - 'type' => 'text', - 'placeholder' => '#0057F', - 'classes' => array( 'ppcp-field-indent' ), - 'default' => '', - 'screens' => array( - State::STATE_ONBOARDED, - ), - 'requirements' => array( 'axo' ), - 'gateway' => array( 'dcc', 'axo' ), - ), 'axo_style_root_error_color' => array( 'title' => __( 'Error Color', 'woocommerce-paypal-payments' ), 'type' => 'text', @@ -308,6 +292,18 @@ return array( 'requirements' => array( 'axo' ), 'gateway' => array( 'dcc', 'axo' ), ), + 'axo_style_root_primary_color' => array( + 'title' => __( 'Primary Color', 'woocommerce-paypal-payments' ), + 'type' => 'text', + 'placeholder' => '#0057FF', + 'classes' => array( 'ppcp-field-indent' ), + 'default' => '', + 'screens' => array( + State::STATE_ONBOARDED, + ), + 'requirements' => array( 'axo' ), + 'gateway' => array( 'dcc', 'axo' ), + ), 'axo_style_input_heading' => array( 'heading' => __( 'Input Settings', 'woocommerce-paypal-payments' ), 'type' => 'ppcp-heading', diff --git a/modules/ppcp-axo/src/Helper/PropertiesDictionary.php b/modules/ppcp-axo/src/Helper/PropertiesDictionary.php index 024c3649c..a07c4ace3 100644 --- a/modules/ppcp-axo/src/Helper/PropertiesDictionary.php +++ b/modules/ppcp-axo/src/Helper/PropertiesDictionary.php @@ -26,4 +26,16 @@ class PropertiesDictionary { ); } + /** + * Returns the list of possible cardholder name options. + * + * @return array + */ + public static function cardholder_name_options(): array { + return array( + 'yes' => __( 'Yes', 'woocommerce-paypal-payments' ), + 'no' => __( 'No', 'woocommerce-paypal-payments' ), + ); + } + }