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/resources/js/AxoManager.js b/modules/ppcp-axo/resources/js/AxoManager.js index 6659fbb2c..e868eb207 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. @@ -570,7 +571,9 @@ class AxoManager { page_type: 'checkout' }); + this.disableGatewaySelection(); await this.lookupCustomerByEmail(); + this.enableGatewaySelection(); } async lookupCustomerByEmail() { @@ -661,6 +664,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, diff --git a/modules/ppcp-axo/resources/js/Views/BillingView.js b/modules/ppcp-axo/resources/js/Views/BillingView.js index aba44afcf..f2903d4ef 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: { 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()}
`; 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' ), + ); + } + } diff --git a/modules/ppcp-button/resources/js/modules/Helper/ScriptLoading.js b/modules/ppcp-button/resources/js/modules/Helper/ScriptLoading.js index dce3136c8..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,9 +64,10 @@ export const loadPaypalScript = (config, onLoaded, onError = null) => { // Axo SDK options const sdkClientToken = config?.axo?.sdk_client_token; + const uuid = uuidv4().replace(/-/g, ''); 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 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" } }