mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Merge branch 'fastlane' into PCP-3172-fastlane-send-js-logs-to-woo-commerce-logger
This commit is contained in:
commit
4c9ccebd10
7 changed files with 49 additions and 46 deletions
|
@ -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.
|
||||
<p class="description">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.</p>',
|
||||
'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'
|
||||
),
|
||||
'<a href="https://www.paypal.com/us/fastlane" target="_blank">',
|
||||
|
@ -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',
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -34,22 +34,7 @@ class BillingView {
|
|||
</div>
|
||||
`;
|
||||
}
|
||||
return `
|
||||
<div style="margin-bottom: 20px;">
|
||||
<div class="axo-checkout-header-section">
|
||||
<h3>Billing</h3>
|
||||
<a href="javascript:void(0)" ${this.el.changeBillingAddressLink.attributes}>Edit</a>
|
||||
</div>
|
||||
<div>${data.value('email')}</div>
|
||||
<div>${data.value('company')}</div>
|
||||
<div>${data.value('firstName')} ${data.value('lastName')}</div>
|
||||
<div>${data.value('street1')}</div>
|
||||
<div>${data.value('street2')}</div>
|
||||
<div>${data.value('postCode')} ${data.value('city')}</div>
|
||||
<div>${valueOfSelect('#billing_state', data.value('stateCode'))}</div>
|
||||
<div>${valueOfSelect('#billing_country', data.value('countryCode'))}</div>
|
||||
</div>
|
||||
`;
|
||||
return '';
|
||||
},
|
||||
fields: {
|
||||
email: {
|
||||
|
|
|
@ -20,10 +20,6 @@ class CardView {
|
|||
if (data.isEmpty()) {
|
||||
return `
|
||||
<div style="margin-bottom: 20px; text-align: center;">
|
||||
<div style="border:2px solid #cccccc; border-radius: 10px; padding: 26px 20px; margin-bottom: 20px; background-color:#f6f6f6">
|
||||
<div>Please fill in your card details.</div>
|
||||
</div>
|
||||
<h4><a href="javascript:void(0)" ${this.el.changeCardLink.attributes}>Add card details</a></h4>
|
||||
${selectOtherPaymentMethod()}
|
||||
</div>
|
||||
`;
|
||||
|
|
|
@ -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' ),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue