diff --git a/.gitignore b/.gitignore
index 6b05a4982..9ffcb360b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ node_modules
yarn-error.log
modules/*/vendor/*
modules/*/assets/*
+!modules/ppcp-wc-gateway/assets/images
*.zip
.env
.env.e2e
diff --git a/changelog.txt b/changelog.txt
index bcba15236..2332be339 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,5 +1,12 @@
*** Changelog ***
+= 2.7.1 - xxxx-xx-xx =
+* Fix - Ensure package tracking data is sent to original PayPal transaction #2180
+* Fix - Set the 'Woo_PPCP' as a default value for data-partner-attribution-id #2188
+* Fix - Allow PUI Gateway for refund processor #2192
+* Fix - Notice on newly created block cart checkout #2211
+* Fix - Apple Pay button in the editor #2177
+
= 2.7.0 - 2024-04-30 =
* Fix - Zero sum subscriptions cause CANNOT_BE_ZERO_OR_NEGATIVE when using Vault v3 #2152
* Fix - Incorrect Pricing Issue with Variable Subscriptions in PayPal Subscriptions Mode #2156
diff --git a/modules/ppcp-api-client/src/Exception/PayPalApiException.php b/modules/ppcp-api-client/src/Exception/PayPalApiException.php
index 9db633729..11405b22b 100644
--- a/modules/ppcp-api-client/src/Exception/PayPalApiException.php
+++ b/modules/ppcp-api-client/src/Exception/PayPalApiException.php
@@ -155,11 +155,11 @@ class PayPalApiException extends RuntimeException {
return $json->message;
}
$improved_keys_messages = array(
- 'PAYMENT_DENIED' => __( 'PayPal rejected the payment. Please reach out to the PayPal support for more information.', 'woocommerce-paypal-payments' ),
- 'TRANSACTION_REFUSED' => __( 'The transaction has been refused by the payment processor. Please reach out to the PayPal support for more information.', 'woocommerce-paypal-payments' ),
- 'DUPLICATE_INVOICE_ID' => __( 'The transaction has been refused because the Invoice ID already exists. Please create a new order or reach out to the store owner.', 'woocommerce-paypal-payments' ),
- 'PAYER_CANNOT_PAY' => __( 'There was a problem processing this transaction. Please reach out to the store owner.', 'woocommerce-paypal-payments' ),
- 'PAYEE_ACCOUNT_RESTRICTED' => __( 'There was a problem processing this transaction. Please reach out to the store owner.', 'woocommerce-paypal-payments' ),
+ 'PAYMENT_DENIED' => __( 'PayPal rejected the payment. Please reach out to the PayPal support for more information.', 'woocommerce-paypal-payments' ),
+ 'TRANSACTION_REFUSED' => __( 'The transaction has been refused by the payment processor. Please reach out to the PayPal support for more information.', 'woocommerce-paypal-payments' ),
+ 'DUPLICATE_INVOICE_ID' => __( 'The transaction has been refused because the Invoice ID already exists. Please create a new order or reach out to the store owner.', 'woocommerce-paypal-payments' ),
+ 'PAYER_CANNOT_PAY' => __( 'There was a problem processing this transaction. Please reach out to the store owner.', 'woocommerce-paypal-payments' ),
+ 'PAYEE_ACCOUNT_RESTRICTED' => __( 'There was a problem processing this transaction. Please reach out to the store owner.', 'woocommerce-paypal-payments' ),
'AGREEMENT_ALREADY_CANCELLED' => __( 'The requested agreement is already canceled. Please reach out to the PayPal support for more information.', 'woocommerce-paypal-payments' ),
);
$improved_errors = array_filter(
diff --git a/modules/ppcp-applepay/resources/css/styles.scss b/modules/ppcp-applepay/resources/css/styles.scss
index 858094433..da8fe0c22 100644
--- a/modules/ppcp-applepay/resources/css/styles.scss
+++ b/modules/ppcp-applepay/resources/css/styles.scss
@@ -46,4 +46,10 @@
}
}
}
+
+ .ppcp-button-applepay {
+ apple-pay-button {
+ display: block;
+ }
+ }
}
diff --git a/modules/ppcp-applepay/resources/js/ApplepayManagerBlockEditor.js b/modules/ppcp-applepay/resources/js/ApplepayManagerBlockEditor.js
new file mode 100644
index 000000000..75ff956b5
--- /dev/null
+++ b/modules/ppcp-applepay/resources/js/ApplepayManagerBlockEditor.js
@@ -0,0 +1,36 @@
+import ApplepayButton from "./ApplepayButton";
+
+class ApplepayManagerBlockEditor {
+
+ constructor(buttonConfig, ppcpConfig) {
+ this.buttonConfig = buttonConfig;
+ this.ppcpConfig = ppcpConfig;
+ this.applePayConfig = null;
+ }
+
+ init() {
+ (async () => {
+ await this.config();
+ })();
+ }
+
+ async config() {
+ try {
+ this.applePayConfig = await paypal.Applepay().config();
+
+ const button = new ApplepayButton(
+ this.ppcpConfig.context,
+ null,
+ this.buttonConfig,
+ this.ppcpConfig,
+ );
+
+ button.init(this.applePayConfig);
+
+ } catch (error) {
+ console.error('Failed to initialize Apple Pay:', error);
+ }
+ }
+}
+
+export default ApplepayManagerBlockEditor;
diff --git a/modules/ppcp-applepay/resources/js/boot-block.js b/modules/ppcp-applepay/resources/js/boot-block.js
index b1d29c9c9..d8e92ef24 100644
--- a/modules/ppcp-applepay/resources/js/boot-block.js
+++ b/modules/ppcp-applepay/resources/js/boot-block.js
@@ -2,9 +2,10 @@ import {useEffect, useState} from '@wordpress/element';
import {registerExpressPaymentMethod} from '@woocommerce/blocks-registry';
import {loadPaypalScript} from '../../../ppcp-button/resources/js/modules/Helper/ScriptLoading'
import {cartHasSubscriptionProducts} from '../../../ppcp-blocks/resources/js/Helper/Subscription'
-import ApplepayManager from "./ApplepayManager";
import {loadCustomScript} from "@paypal/paypal-js";
import CheckoutHandler from "./Context/CheckoutHandler";
+import ApplepayManager from "./ApplepayManager";
+import ApplepayManagerBlockEditor from "./ApplepayManagerBlockEditor";
const ppcpData = wc.wcSettings.getSetting('ppcp-gateway_data');
const ppcpConfig = ppcpData.scriptData;
@@ -16,13 +17,14 @@ if (typeof window.PayPalCommerceGateway === 'undefined') {
window.PayPalCommerceGateway = ppcpConfig;
}
-const ApplePayComponent = () => {
+const ApplePayComponent = ( props ) => {
const [bootstrapped, setBootstrapped] = useState(false);
const [paypalLoaded, setPaypalLoaded] = useState(false);
const [applePayLoaded, setApplePayLoaded] = useState(false);
const bootstrap = function () {
- const manager = new ApplepayManager(buttonConfig, ppcpConfig);
+ const ManagerClass = props.isEditing ? ApplepayManagerBlockEditor : ApplepayManager;
+ const manager = new ManagerClass(buttonConfig, ppcpConfig);
manager.init();
};
@@ -32,6 +34,8 @@ const ApplePayComponent = () => {
setApplePayLoaded(true);
});
+ ppcpConfig.url_params.components += ',applepay';
+
// Load PayPal
loadPaypalScript(ppcpConfig, () => {
setPaypalLoaded(true);
@@ -46,7 +50,10 @@ const ApplePayComponent = () => {
}, [paypalLoaded, applePayLoaded]);
return (
-
'
- . __( 'Help accelerate checkout for guests with PayPal\'s autofill solution.', 'woocommerce-paypal-payments' )
+ . __( 'Help accelerate the checkout process for guests with PayPal\'s autofill solution. When enabled, Fastlane is presented as the default payment method for guests.', 'woocommerce-paypal-payments' )
. '
',
'default' => 'yes',
'screens' => array( State::STATE_ONBOARDED ),
@@ -82,7 +83,9 @@ return array(
->rule()
->condition_element( 'axo_enabled', '1' )
->action_visible( 'axo_gateway_title' )
+ ->action_visible( 'axo_checkout_config_notice' )
->action_visible( 'axo_privacy' )
+ ->action_visible( 'axo_name_on_card' )
->action_visible( 'axo_style_heading' )
->action_class( 'axo_enabled', 'active' )
->to_array(),
@@ -94,6 +97,7 @@ return array(
->action_visible( 'axo_style_root_bg_color' )
->action_visible( 'axo_style_root_error_color' )
->action_visible( 'axo_style_root_font_family' )
+ ->action_visible( 'axo_style_root_text_color_base' )
->action_visible( 'axo_style_root_font_size_base' )
->action_visible( 'axo_style_root_padding' )
->action_visible( 'axo_style_root_primary_color' )
@@ -110,6 +114,18 @@ return array(
),
'classes' => array( 'ppcp-valign-label-middle', 'ppcp-align-label-center' ),
),
+ 'axo_checkout_config_notice' => array(
+ 'heading' => '',
+ 'html' => $container->get( 'axo.checkout-config-notice' ),
+ 'type' => 'ppcp-html',
+ 'classes' => array( 'ppcp-field-indent' ),
+ 'class' => array(),
+ 'screens' => array(
+ State::STATE_ONBOARDED,
+ ),
+ 'requirements' => array( 'dcc', 'axo' ),
+ 'gateway' => array( 'dcc', 'axo' ),
+ ),
'axo_gateway_title' => array(
'title' => __( 'Gateway Title', 'woocommerce-paypal-payments' ),
'type' => 'text',
@@ -133,7 +149,7 @@ return array(
'title' => __( 'Privacy', 'woocommerce-paypal-payments' ),
'type' => 'select',
'label' => __(
- 'Require customers to confirm express payments from the Cart and Express Checkout on the checkout page.
+ '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'
),
@@ -151,6 +167,17 @@ return array(
'gateway' => array( 'dcc', 'axo' ),
'requirements' => array( 'axo' ),
),
+ 'axo_name_on_card' => array(
+ 'title' => __( 'Display Name on Card', 'woocommerce-paypal-payments' ),
+ 'type' => 'checkbox',
+ 'default' => 'yes',
+ 'classes' => array( 'ppcp-field-indent' ),
+ 'class' => array(),
+ 'label' => __( 'Enable this to display the "Name on Card" field for new Fastlane buyers.', 'woocommerce-paypal-payments' ),
+ 'screens' => array( State::STATE_ONBOARDED ),
+ 'gateway' => array( 'dcc', 'axo' ),
+ 'requirements' => array( 'axo' ),
+ ),
'axo_style_heading' => array(
'heading' => __( 'Advanced Style Settings (optional)', 'woocommerce-paypal-payments' ),
'heading_html' => sprintf(
@@ -200,52 +227,9 @@ return array(
'axo_style_root_bg_color' => array(
'title' => __( 'Background Color', 'woocommerce-paypal-payments' ),
'type' => 'text',
+ 'placeholder' => '#ffffff',
'classes' => array( 'ppcp-field-indent' ),
- 'default' => '#ffffff',
- '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',
- 'classes' => array( 'ppcp-field-indent' ),
- 'default' => '#d9360b',
- 'screens' => array(
- State::STATE_ONBOARDED,
- ),
- 'requirements' => array( 'axo' ),
- 'gateway' => array( 'dcc', 'axo' ),
- ),
- 'axo_style_root_font_family' => array(
- 'title' => __( 'Font Family', 'woocommerce-paypal-payments' ),
- 'type' => 'text',
- 'classes' => array( 'ppcp-field-indent' ),
- 'default' => 'PayPal Open',
- 'screens' => array(
- State::STATE_ONBOARDED,
- ),
- 'requirements' => array( 'axo' ),
- 'gateway' => array( 'dcc', 'axo' ),
- ),
- 'axo_style_root_font_size_base' => array(
- 'title' => __( 'Font Size Base', 'woocommerce-paypal-payments' ),
- 'type' => 'text',
- 'classes' => array( 'ppcp-field-indent' ),
- 'default' => '16px',
- 'screens' => array(
- State::STATE_ONBOARDED,
- ),
- 'requirements' => array( 'axo' ),
- 'gateway' => array( 'dcc', 'axo' ),
- ),
- 'axo_style_root_padding' => array(
- 'title' => __( 'Padding', 'woocommerce-paypal-payments' ),
- 'type' => 'text',
- 'classes' => array( 'ppcp-field-indent' ),
- 'default' => '4px',
+ 'default' => '',
'screens' => array(
State::STATE_ONBOARDED,
),
@@ -255,8 +239,69 @@ return array(
'axo_style_root_primary_color' => array(
'title' => __( 'Primary Color', 'woocommerce-paypal-payments' ),
'type' => 'text',
+ 'placeholder' => '#0057F',
'classes' => array( 'ppcp-field-indent' ),
- 'default' => '#0057ff',
+ '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',
+ 'placeholder' => '#D9360B',
+ 'classes' => array( 'ppcp-field-indent' ),
+ 'default' => '',
+ 'screens' => array(
+ State::STATE_ONBOARDED,
+ ),
+ 'requirements' => array( 'axo' ),
+ 'gateway' => array( 'dcc', 'axo' ),
+ ),
+ 'axo_style_root_font_family' => array(
+ 'title' => __( 'Font Family', 'woocommerce-paypal-payments' ),
+ 'type' => 'text',
+ 'placeholder' => 'PayPal-Open',
+ 'classes' => array( 'ppcp-field-indent' ),
+ 'default' => '',
+ 'screens' => array(
+ State::STATE_ONBOARDED,
+ ),
+ 'requirements' => array( 'axo' ),
+ 'gateway' => array( 'dcc', 'axo' ),
+ ),
+ 'axo_style_root_text_color_base' => array(
+ 'title' => __( 'Text Color Base', 'woocommerce-paypal-payments' ),
+ 'type' => 'text',
+ 'placeholder' => '#010B0D',
+ 'classes' => array( 'ppcp-field-indent' ),
+ 'default' => '',
+ 'screens' => array(
+ State::STATE_ONBOARDED,
+ ),
+ 'requirements' => array( 'axo' ),
+ 'gateway' => array( 'dcc', 'axo' ),
+ ),
+ 'axo_style_root_font_size_base' => array(
+ 'title' => __( 'Font Size Base', 'woocommerce-paypal-payments' ),
+ 'type' => 'text',
+ 'placeholder' => '16px',
+ 'classes' => array( 'ppcp-field-indent' ),
+ 'default' => '',
+ 'screens' => array(
+ State::STATE_ONBOARDED,
+ ),
+ 'requirements' => array( 'axo' ),
+ 'gateway' => array( 'dcc', 'axo' ),
+ ),
+ 'axo_style_root_padding' => array(
+ 'title' => __( 'Padding', 'woocommerce-paypal-payments' ),
+ 'type' => 'text',
+ 'placeholder' => '4px',
+ 'classes' => array( 'ppcp-field-indent' ),
+ 'default' => '',
'screens' => array(
State::STATE_ONBOARDED,
),
@@ -278,8 +323,9 @@ return array(
'axo_style_input_bg_color' => array(
'title' => __( 'Background Color', 'woocommerce-paypal-payments' ),
'type' => 'text',
+ 'placeholder' => '#ffffff',
'classes' => array( 'ppcp-field-indent' ),
- 'default' => '#ffffff',
+ 'default' => '',
'screens' => array(
State::STATE_ONBOARDED,
),
@@ -289,8 +335,9 @@ return array(
'axo_style_input_border_radius' => array(
'title' => __( 'Border Radius', 'woocommerce-paypal-payments' ),
'type' => 'text',
+ 'placeholder' => '0.25em',
'classes' => array( 'ppcp-field-indent' ),
- 'default' => '0.25em',
+ 'default' => '',
'screens' => array(
State::STATE_ONBOARDED,
),
@@ -300,8 +347,9 @@ return array(
'axo_style_input_border_color' => array(
'title' => __( 'Border Color', 'woocommerce-paypal-payments' ),
'type' => 'text',
+ 'placeholder' => '#DADDDD',
'classes' => array( 'ppcp-field-indent' ),
- 'default' => '#dadddd',
+ 'default' => '',
'screens' => array(
State::STATE_ONBOARDED,
),
@@ -311,8 +359,9 @@ return array(
'axo_style_input_border_width' => array(
'title' => __( 'Border Width', 'woocommerce-paypal-payments' ),
'type' => 'text',
+ 'placeholder' => '1px',
'classes' => array( 'ppcp-field-indent' ),
- 'default' => '1px',
+ 'default' => '',
'screens' => array(
State::STATE_ONBOARDED,
),
@@ -322,8 +371,9 @@ return array(
'axo_style_input_text_color_base' => array(
'title' => __( 'Text Color Base', 'woocommerce-paypal-payments' ),
'type' => 'text',
+ 'placeholder' => '#010B0D',
'classes' => array( 'ppcp-field-indent' ),
- 'default' => '#010b0d',
+ 'default' => '',
'screens' => array(
State::STATE_ONBOARDED,
),
@@ -333,8 +383,9 @@ return array(
'axo_style_input_focus_border_color' => array(
'title' => __( 'Focus Border Color', 'woocommerce-paypal-payments' ),
'type' => 'text',
+ 'placeholder' => '#0057FF',
'classes' => array( 'ppcp-field-indent' ),
- 'default' => '#0057ff',
+ 'default' => '',
'screens' => array(
State::STATE_ONBOARDED,
),
diff --git a/modules/ppcp-axo/resources/css/styles.scss b/modules/ppcp-axo/resources/css/styles.scss
index 0fcfb2cd6..605ac18b2 100644
--- a/modules/ppcp-axo/resources/css/styles.scss
+++ b/modules/ppcp-axo/resources/css/styles.scss
@@ -1,13 +1,3 @@
-
-.ppcp-axo-card-icons {
- padding: 4px 0 16px 25px;
-
- .ppcp-card-icon {
- float: left !important;
- max-height: 25px;
- }
-}
-
.ppcp-axo-watermark-container {
max-width: 200px;
margin-top: 10px;
@@ -17,7 +7,7 @@
padding: 1rem 0;
background-color: #ffffff;
- &.hidden {
+ &.axo-hidden {
display: none;
}
}
@@ -53,3 +43,14 @@
margin: var(--global-md-spacing) 0 1em;
padding: 0.6em 1em;
}
+
+#payment .payment_methods li label[for="payment_method_ppcp-axo-gateway"] {
+ img {
+ float: none;
+ vertical-align: middle;
+ }
+
+ .ppcp-card-icon {
+ max-height: 25px;
+ }
+}
diff --git a/modules/ppcp-axo/resources/js/AxoManager.js b/modules/ppcp-axo/resources/js/AxoManager.js
index 6fbdb8d73..a250c09b7 100644
--- a/modules/ppcp-axo/resources/js/AxoManager.js
+++ b/modules/ppcp-axo/resources/js/AxoManager.js
@@ -34,8 +34,12 @@ class AxoManager {
card: null,
};
+ this.states = this.axoConfig.woocommerce.states;
+
this.el = new DomElementCollection();
+ this.emailInput = document.querySelector(this.el.fieldBillingEmail.selector + ' input');
+
this.styles = {
root: {
backgroundColorPrimary: '#ffffff'
@@ -46,7 +50,7 @@ class AxoManager {
this.registerEventHandlers();
- this.shippingView = new ShippingView(this.el.shippingAddressContainer.selector, this.el);
+ this.shippingView = new ShippingView(this.el.shippingAddressContainer.selector, this.el, this.states );
this.billingView = new BillingView(this.el.billingAddressContainer.selector, this.el);
this.cardView = new CardView(this.el.paymentContainer.selector + '-details', this.el, this);
@@ -160,6 +164,29 @@ class AxoManager {
this.$('form.woocommerce-checkout input').on('keydown', async (ev) => {
if(ev.key === 'Enter' && getCurrentPaymentMethod() === 'ppcp-axo-gateway' ) {
ev.preventDefault();
+ log('Enter key attempt');
+ log('emailInput', this.emailInput.value);
+ log('this.lastEmailCheckedIdentity', this.lastEmailCheckedIdentity);
+ if (this.emailInput && this.lastEmailCheckedIdentity !== this.emailInput.value) {
+ await this.onChangeEmail();
+ }
+ }
+ });
+
+ // Clear last email checked identity when email field is focused.
+ this.$('#billing_email_field input').on('focus', (ev) => {
+ log('Clear the last email checked:', this.lastEmailCheckedIdentity);
+ this.lastEmailCheckedIdentity = '';
+ });
+
+ // Listening to status update event
+ document.addEventListener('axo_status_updated', (ev) => {
+ const termsField = document.querySelector("[name='terms-field']");
+ if(termsField) {
+ const status = ev.detail;
+ const shouldHide = status.active && status.validEmail === false && status.hasProfile === false;
+
+ termsField.parentElement.style.display = shouldHide ? 'none' : 'block';
}
});
}
@@ -347,6 +374,8 @@ class AxoManager {
log('Status updated', JSON.parse(JSON.stringify(this.status)));
+ document.dispatchEvent(new CustomEvent("axo_status_updated", {detail: this.status}));
+
this.rerender();
}
@@ -355,8 +384,10 @@ class AxoManager {
this.initFastlane();
this.setStatus('active', true);
- const emailInput = document.querySelector(this.el.fieldBillingEmail.selector + ' input');
- if (emailInput && this.lastEmailCheckedIdentity !== emailInput.value) {
+ log('Attempt on activation');
+ log('emailInput', this.emailInput.value);
+ log('this.lastEmailCheckedIdentity', this.lastEmailCheckedIdentity);
+ if (this.emailInput && this.lastEmailCheckedIdentity !== this.emailInput.value) {
this.onChangeEmail();
}
}
@@ -396,7 +427,6 @@ class AxoManager {
// Watermark container
const wc = this.el.watermarkContainer;
if (!document.querySelector(wc.selector)) {
- this.emailInput = document.querySelector(this.el.fieldBillingEmail.selector + ' input');
this.emailInput.insertAdjacentHTML('afterend', `
`;
@@ -115,6 +132,15 @@ class ShippingView {
});
}
+ hasEmptyValues(data, stateName) {
+ return !data.value('email')
+ || !data.value('firstName')
+ || !data.value('lastName')
+ || !data.value('street1')
+ || !data.value('city')
+ || !stateName;
+ }
+
isActive() {
return this.group.active;
}
diff --git a/modules/ppcp-axo/services.php b/modules/ppcp-axo/services.php
index 8b65508ae..44253f22d 100644
--- a/modules/ppcp-axo/services.php
+++ b/modules/ppcp-axo/services.php
@@ -13,6 +13,7 @@ use WooCommerce\PayPalCommerce\Axo\Assets\AxoManager;
use WooCommerce\PayPalCommerce\Axo\Gateway\AxoGateway;
use WooCommerce\PayPalCommerce\Axo\Helper\ApmApplies;
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
+use WooCommerce\PayPalCommerce\WcGateway\Helper\CartCheckoutDetector;
return array(
@@ -68,6 +69,7 @@ return array(
$container->get( 'wcgateway.url' ),
$container->get( 'wcgateway.order-processor' ),
$container->get( 'axo.card_icons' ),
+ $container->get( 'axo.card_icons.axo' ),
$container->get( 'api.endpoint.order' ),
$container->get( 'api.factory.purchase-unit' ),
$container->get( 'api.factory.shipping-preference' ),
@@ -98,6 +100,39 @@ return array(
);
},
+ 'axo.card_icons.axo' => static function ( ContainerInterface $container ): array {
+ return array(
+ array(
+ 'title' => 'Visa',
+ 'file' => 'visa-light.svg',
+ ),
+ array(
+ 'title' => 'MasterCard',
+ 'file' => 'mastercard-light.svg',
+ ),
+ array(
+ 'title' => 'Amex',
+ 'file' => 'amex-light.svg',
+ ),
+ array(
+ 'title' => 'Discover',
+ 'file' => 'discover-light.svg',
+ ),
+ array(
+ 'title' => 'Diners Club',
+ 'file' => 'dinersclub-light.svg',
+ ),
+ array(
+ 'title' => 'JCB',
+ 'file' => 'jcb-light.svg',
+ ),
+ array(
+ 'title' => 'UnionPay',
+ 'file' => 'unionpay-light.svg',
+ ),
+ );
+ },
+
/**
* The matrix which countries and currency combinations can be used for AXO.
*/
@@ -115,4 +150,47 @@ return array(
);
},
+ 'axo.checkout-config-notice' => static function ( ContainerInterface $container ) : string {
+ $checkout_page_link = esc_url( get_edit_post_link( wc_get_page_id( 'checkout' ) ) ?? '' );
+ $block_checkout_docs_link = __(
+ 'https://woocommerce.com/document/cart-checkout-blocks-status/#reverting-to-the-cart-and-checkout-shortcodes',
+ 'woocommerce-paypal-payments'
+ );
+
+ if ( CartCheckoutDetector::has_elementor_checkout() ) {
+ $notice_content = sprintf(
+ /* translators: %1$s: URL to the Checkout edit page. %2$s: URL to the block checkout docs. */
+ __(
+ '
Warning: The
Checkout page of your store currently uses the
Elementor Checkout widget
. To enable Fastlane and accelerate payments, the page must include either the
Classic Checkout
or the
[woocommerce_checkout]
shortcode. See
this page for instructions on how to switch to the classic layout.',
+ 'woocommerce-paypal-payments'
+ ),
+ esc_url( $checkout_page_link ),
+ esc_url( $block_checkout_docs_link )
+ );
+ } elseif ( CartCheckoutDetector::has_block_checkout() ) {
+ $notice_content = sprintf(
+ /* translators: %1$s: URL to the Checkout edit page. %2$s: URL to the block checkout docs. */
+ __(
+ '
Warning: The
Checkout page of your store currently uses the WooCommerce
Checkout
block. To enable Fastlane and accelerate payments, the page must include either the
Classic Checkout
or the
[woocommerce_checkout]
shortcode. See
this page for instructions on how to switch to the classic layout.',
+ 'woocommerce-paypal-payments'
+ ),
+ esc_url( $checkout_page_link ),
+ esc_url( $block_checkout_docs_link )
+ );
+ } elseif ( ! CartCheckoutDetector::has_classic_checkout() ) {
+ $notice_content = sprintf(
+ /* translators: %1$s: URL to the Checkout edit page. %2$s: URL to the block checkout docs. */
+ __(
+ '
Warning: The
Checkout page of your store does not seem to be properly configured or uses an incompatible
third-party Checkout
solution. To enable Fastlane and accelerate payments, the page must include either the
Classic Checkout
or the
[woocommerce_checkout]
shortcode. See
this page for instructions on how to switch to the classic layout.',
+ 'woocommerce-paypal-payments'
+ ),
+ esc_url( $checkout_page_link ),
+ esc_url( $block_checkout_docs_link )
+ );
+ } else {
+ return '';
+ }
+
+ return '
';
+ },
);
diff --git a/modules/ppcp-axo/src/Assets/AxoManager.php b/modules/ppcp-axo/src/Assets/AxoManager.php
index adb5543c2..2ed5fc04c 100644
--- a/modules/ppcp-axo/src/Assets/AxoManager.php
+++ b/modules/ppcp-axo/src/Assets/AxoManager.php
@@ -151,13 +151,13 @@ class AxoManager {
*/
private function script_data() {
return array(
- 'environment' => array(
+ 'environment' => array(
'is_sandbox' => $this->environment->current_environment() === 'sandbox',
),
- 'widgets' => array(
+ 'widgets' => array(
'email' => 'render',
),
- 'insights' => array(
+ 'insights' => array(
'enabled' => true,
'client_id' => ( $this->settings->has( 'client_id' ) ? $this->settings->get( 'client_id' ) : null ),
'session_id' =>
@@ -171,6 +171,33 @@ class AxoManager {
'value' => WC()->cart->get_total( 'numeric' ),
),
),
+ 'style_options' => array(
+ 'root' => array(
+ 'backgroundColor' => $this->settings->has( 'axo_style_root_bg_color' ) ? $this->settings->get( 'axo_style_root_bg_color' ) : '',
+ 'errorColor' => $this->settings->has( 'axo_style_root_error_color' ) ? $this->settings->get( 'axo_style_root_error_color' ) : '',
+ 'fontFamily' => $this->settings->has( 'axo_style_root_font_family' ) ? $this->settings->get( 'axo_style_root_font_family' ) : '',
+ 'textColorBase' => $this->settings->has( 'axo_style_root_text_color_base' ) ? $this->settings->get( 'axo_style_root_text_color_base' ) : '',
+ 'fontSizeBase' => $this->settings->has( 'axo_style_root_font_size_base' ) ? $this->settings->get( 'axo_style_root_font_size_base' ) : '',
+ 'padding' => $this->settings->has( 'axo_style_root_padding' ) ? $this->settings->get( 'axo_style_root_padding' ) : '',
+ 'primaryColor' => $this->settings->has( 'axo_style_root_primary_color' ) ? $this->settings->get( 'axo_style_root_primary_color' ) : '',
+ ),
+ 'input' => array(
+ 'backgroundColor' => $this->settings->has( 'axo_style_input_bg_color' ) ? $this->settings->get( 'axo_style_input_bg_color' ) : '',
+ 'borderRadius' => $this->settings->has( 'axo_style_input_border_radius' ) ? $this->settings->get( 'axo_style_input_border_radius' ) : '',
+ 'borderColor' => $this->settings->has( 'axo_style_input_border_color' ) ? $this->settings->get( 'axo_style_input_border_color' ) : '',
+ 'borderWidth' => $this->settings->has( 'axo_style_input_border_width' ) ? $this->settings->get( 'axo_style_input_border_width' ) : '',
+ 'textColorBase' => $this->settings->has( 'axo_style_input_text_color_base' ) ? $this->settings->get( 'axo_style_input_text_color_base' ) : '',
+ 'focusBorderColor' => $this->settings->has( 'axo_style_input_focus_border_color' ) ? $this->settings->get( 'axo_style_input_focus_border_color' ) : '',
+ ),
+ ),
+ 'name_on_card' => $this->settings->has( 'axo_name_on_card' ) ? $this->settings->get( 'axo_name_on_card' ) : '',
+ 'woocommerce' => array(
+ 'states' => array(
+ 'US' => WC()->countries->get_states( 'US' ),
+ 'CA' => WC()->countries->get_states( 'CA' ),
+ ),
+ ),
+ 'module_url' => untrailingslashit( $this->module_url ),
);
}
diff --git a/modules/ppcp-axo/src/AxoModule.php b/modules/ppcp-axo/src/AxoModule.php
index 6680c9fd7..dfb76ef60 100644
--- a/modules/ppcp-axo/src/AxoModule.php
+++ b/modules/ppcp-axo/src/AxoModule.php
@@ -14,12 +14,16 @@ use WooCommerce\PayPalCommerce\ApiClient\Authentication\SdkClientToken;
use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\Axo\Assets\AxoManager;
+use WooCommerce\PayPalCommerce\Axo\Gateway\AxoGateway;
use WooCommerce\PayPalCommerce\Button\Assets\SmartButtonInterface;
use WooCommerce\PayPalCommerce\Onboarding\Render\OnboardingOptionsRenderer;
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
+use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
+use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
+use WooCommerce\PayPalCommerce\WcGateway\Helper\CartCheckoutDetector;
/**
* Class AxoModule
@@ -77,9 +81,36 @@ class AxoModule implements ModuleInterface {
9
);
+ // Hides credit card gateway on checkout when using Fastlane.
+ add_filter(
+ 'woocommerce_available_payment_gateways',
+ /**
+ * Param types removed to avoid third-party issues.
+ *
+ * @psalm-suppress MissingClosureParamType
+ */
+ function ( $methods ) use ( $c ): array {
+ if ( ! is_array( $methods ) || ! $c->get( 'axo.eligible' ) ) {
+ return $methods;
+ }
+
+ $settings = $c->get( 'wcgateway.settings' );
+ assert( $settings instanceof Settings );
+
+ if ( apply_filters(
+ 'woocommerce_paypal_payments_axo_hide_credit_card_gateway',
+ $this->hide_credit_card_when_using_fastlane( $methods, $settings )
+ ) ) {
+ unset( $methods[ CreditCardGateway::ID ] );
+ }
+
+ return $methods;
+ }
+ );
+
add_action(
'init',
- static function () use ( $c, $module ) {
+ function () use ( $c, $module ) {
// Check if the module is applicable, correct country, currency, ... etc.
if ( ! $c->get( 'axo.eligible' ) ) {
@@ -169,6 +200,19 @@ class AxoModule implements ModuleInterface {
2
);
+ // Set Axo as the default payment method on checkout for guest customers.
+ add_action(
+ 'template_redirect',
+ function () use ( $c ) {
+ $settings = $c->get( 'wcgateway.settings' );
+ assert( $settings instanceof Settings );
+
+ if ( $this->should_render_fastlane( $settings ) ) {
+ WC()->session->set( 'chosen_payment_method', AxoGateway::ID );
+ }
+ }
+ );
+
},
1
);
@@ -221,4 +265,31 @@ class AxoModule implements ModuleInterface {
*/
public function getKey() {
}
+
+ /**
+ * Condition to evaluate if Credit Card gateway should be hidden.
+ *
+ * @param array $methods WC payment methods.
+ * @param Settings $settings The settings.
+ * @return bool
+ */
+ private function hide_credit_card_when_using_fastlane( array $methods, Settings $settings ): bool {
+ return $this->should_render_fastlane( $settings ) && isset( $methods[ CreditCardGateway::ID ] );
+ }
+
+ /**
+ * Condition to evaluate if Fastlane should be rendered.
+ *
+ * Fastlane should only render on the classic checkout, when Fastlane is enabled in the settings and also only for guest customers.
+ *
+ * @param Settings $settings The settings.
+ * @return bool
+ */
+ private function should_render_fastlane( Settings $settings ): bool {
+ $is_axo_enabled = $settings->has( 'axo_enabled' ) && $settings->get( 'axo_enabled' ) ?? false;
+
+ return ! is_user_logged_in()
+ && CartCheckoutDetector::has_classic_checkout()
+ && $is_axo_enabled;
+ }
}
diff --git a/modules/ppcp-axo/src/Gateway/AxoGateway.php b/modules/ppcp-axo/src/Gateway/AxoGateway.php
index 9e94e4dc7..13e81b74c 100644
--- a/modules/ppcp-axo/src/Gateway/AxoGateway.php
+++ b/modules/ppcp-axo/src/Gateway/AxoGateway.php
@@ -70,6 +70,13 @@ class AxoGateway extends WC_Payment_Gateway {
*/
protected $card_icons;
+ /**
+ * The AXO card icons.
+ *
+ * @var array
+ */
+ protected $card_icons_axo;
+
/**
* The order endpoint.
*
@@ -120,6 +127,7 @@ class AxoGateway extends WC_Payment_Gateway {
* @param string $wcgateway_module_url The WcGateway module URL.
* @param OrderProcessor $order_processor The Order processor.
* @param array $card_icons The card icons.
+ * @param array $card_icons_axo The card icons.
* @param OrderEndpoint $order_endpoint The order endpoint.
* @param PurchaseUnitFactory $purchase_unit_factory The purchase unit factory.
* @param ShippingPreferenceFactory $shipping_preference_factory The shipping preference factory.
@@ -133,6 +141,7 @@ class AxoGateway extends WC_Payment_Gateway {
string $wcgateway_module_url,
OrderProcessor $order_processor,
array $card_icons,
+ array $card_icons_axo,
OrderEndpoint $order_endpoint,
PurchaseUnitFactory $purchase_unit_factory,
ShippingPreferenceFactory $shipping_preference_factory,
@@ -147,9 +156,10 @@ class AxoGateway extends WC_Payment_Gateway {
$this->wcgateway_module_url = $wcgateway_module_url;
$this->order_processor = $order_processor;
$this->card_icons = $card_icons;
+ $this->card_icons_axo = $card_icons_axo;
$this->method_title = __( 'Fastlane Debit & Credit Cards', 'woocommerce-paypal-payments' );
- $this->method_description = __( 'PayPal Fastlane offers an accelerated checkout experience that recognizes guest shoppers and autofills their details so they can pay in seconds.', 'woocommerce-paypal-payments' );
+ $this->method_description = __( 'Fastlane accelerates the checkout experience for guest shoppers and autofills their details so they can pay in seconds. When enabled, Fastlane is presented as the default payment method for guests.', 'woocommerce-paypal-payments' );
$is_axo_enabled = $this->ppcp_settings->has( 'axo_enabled' ) && $this->ppcp_settings->get( 'axo_enabled' );
$this->update_option( 'enabled', $is_axo_enabled ? 'yes' : 'no' );
@@ -208,10 +218,13 @@ class AxoGateway extends WC_Payment_Gateway {
public function process_payment( $order_id ) {
$wc_order = wc_get_order( $order_id );
- $payment_method_title = __( 'Credit Card (via Fastlane by PayPal)', 'woocommerce-paypal-payments' );
-
- $wc_order->set_payment_method_title( $payment_method_title );
- $wc_order->save();
+ // phpcs:ignore WordPress.Security.NonceVerification.Missing
+ $fastlane_member = wc_clean( wp_unslash( $_POST['fastlane_member'] ?? '' ) );
+ if ( $fastlane_member ) {
+ $payment_method_title = __( 'Debit & Credit Cards (via Fastlane by PayPal)', 'woocommerce-paypal-payments' );
+ $wc_order->set_payment_method_title( $payment_method_title );
+ $wc_order->save();
+ }
$purchase_unit = $this->purchase_unit_factory->from_wc_order( $wc_order );
@@ -282,22 +295,30 @@ class AxoGateway extends WC_Payment_Gateway {
* @return string
*/
public function get_icon() {
- $icon = parent::get_icon();
+ $icon = parent::get_icon();
+ $icons = $this->card_icons;
+ $icons_src = esc_url( $this->wcgateway_module_url ) . 'assets/images/';
+
+ if ( $this->card_icons_axo ) {
+ $icons = $this->card_icons_axo;
+ $icons_src = esc_url( $this->wcgateway_module_url ) . 'assets/images/axo/';
+ }
if ( empty( $this->card_icons ) ) {
return $icon;
}
$images = array();
- foreach ( $this->card_icons as $card ) {
+
+ foreach ( $icons as $card ) {
$images[] = '
';
}
- return '
' . implode( '', $images ) . '
';
+ return implode( '', $images );
}
/**
diff --git a/modules/ppcp-button/src/Assets/SmartButton.php b/modules/ppcp-button/src/Assets/SmartButton.php
index 1bca8238c..fe0ca2905 100644
--- a/modules/ppcp-button/src/Assets/SmartButton.php
+++ b/modules/ppcp-button/src/Assets/SmartButton.php
@@ -1533,7 +1533,7 @@ document.querySelector("#payment").before(document.querySelector(".ppcp-messages
private function bn_code_for_context( string $context ): string {
$codes = $this->bn_codes();
- return ( isset( $codes[ $context ] ) ) ? $codes[ $context ] : '';
+ return ( isset( $codes[ $context ] ) ) ? $codes[ $context ] : 'Woo_PPCP';
}
/**
diff --git a/modules/ppcp-order-tracking/resources/js/order-edit-page.js b/modules/ppcp-order-tracking/resources/js/order-edit-page.js
index baa6c16b3..bf1056102 100644
--- a/modules/ppcp-order-tracking/resources/js/order-edit-page.js
+++ b/modules/ppcp-order-tracking/resources/js/order-edit-page.js
@@ -9,7 +9,7 @@ document.addEventListener(
const includeAllItemsCheckbox = document.getElementById('include-all-items');
const shipmentsWrapper = '#ppcp_order-tracking .ppcp-tracking-column.shipments';
- const transactionId = document.querySelector('.ppcp-tracking-transaction_id');
+ const captureId = document.querySelector('.ppcp-tracking-capture_id');
const orderId = document.querySelector('.ppcp-tracking-order_id');
const carrier = document.querySelector('.ppcp-tracking-carrier');
const carrierNameOther = document.querySelector('.ppcp-tracking-carrier_name_other');
@@ -86,7 +86,7 @@ document.addEventListener(
credentials: 'same-origin',
body: JSON.stringify({
nonce: config.ajax.tracking_info.nonce,
- transaction_id: transactionId ? transactionId.value : null,
+ capture_id: captureId ? captureId.value : null,
tracking_number: trackingNumber ? trackingNumber.value : null,
status: status ? status.value : null,
carrier: carrier ? carrier.value : null,
@@ -113,6 +113,7 @@ document.addEventListener(
if (noShipemntsContainer) {
noShipemntsContainer.parentNode.removeChild(noShipemntsContainer);
}
+ trackingNumber.value = ''
});
})
}
@@ -135,7 +136,7 @@ document.addEventListener(
credentials: 'same-origin',
body: JSON.stringify({
nonce: config.ajax.tracking_info.nonce,
- transaction_id: transactionId ? transactionId.value : null,
+ capture_id: captureId ? captureId.value : null,
tracking_number: shipmentTrackingNumber ? shipmentTrackingNumber.value : null,
status: shipmentStatus ? shipmentStatus.value : null,
carrier: shipmentCarrier ? shipmentCarrier.value : null,
diff --git a/modules/ppcp-order-tracking/src/Endpoint/OrderTrackingEndpoint.php b/modules/ppcp-order-tracking/src/Endpoint/OrderTrackingEndpoint.php
index ae2ca54f0..9e454a4fe 100644
--- a/modules/ppcp-order-tracking/src/Endpoint/OrderTrackingEndpoint.php
+++ b/modules/ppcp-order-tracking/src/Endpoint/OrderTrackingEndpoint.php
@@ -23,13 +23,14 @@ use WooCommerce\PayPalCommerce\OrderTracking\Shipment\ShipmentFactoryInterface;
use WooCommerce\PayPalCommerce\OrderTracking\Shipment\ShipmentInterface;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\WcGateway\Processor\TransactionIdHandlingTrait;
+use function WooCommerce\PayPalCommerce\Api\ppcp_get_paypal_order;
/**
* The OrderTrackingEndpoint.
*
* @psalm-type SupportedStatuses = 'SHIPPED'|'ON_HOLD'|'DELIVERED'|'CANCELLED'
* @psalm-type TrackingInfo = array{
- * transaction_id: string,
+ * capture_id: string,
* status: SupportedStatuses,
* tracking_number: string,
* carrier: string,
@@ -222,7 +223,7 @@ class OrderTrackingEndpoint {
*/
public function update_tracking_information( ShipmentInterface $shipment, int $order_id ) : void {
$host = trailingslashit( $this->host );
- $tracker_id = $this->find_tracker_id( $shipment->transaction_id(), $shipment->tracking_number() );
+ $tracker_id = $this->find_tracker_id( $shipment->capture_id(), $shipment->tracking_number() );
$url = "{$host}v1/shipping/trackers/{$tracker_id}";
$shipment_data = $shipment->to_array();
@@ -272,9 +273,11 @@ class OrderTrackingEndpoint {
return null;
}
- $host = trailingslashit( $this->host );
- $tracker_id = $this->find_tracker_id( $wc_order->get_transaction_id(), $tracking_number );
- $url = "{$host}v1/shipping/trackers/{$tracker_id}";
+ $host = trailingslashit( $this->host );
+ $paypal_order = ppcp_get_paypal_order( $wc_order );
+ $capture_id = $this->get_paypal_order_transaction_id( $paypal_order ) ?? '';
+ $tracker_id = $this->find_tracker_id( $capture_id, $tracking_number );
+ $url = "{$host}v1/shipping/trackers/{$tracker_id}";
$args = array(
'method' => 'GET',
@@ -319,9 +322,10 @@ class OrderTrackingEndpoint {
return array();
}
- $host = trailingslashit( $this->host );
- $transaction_id = $wc_order->get_transaction_id();
- $url = "{$host}v1/shipping/trackers?transaction_id={$transaction_id}";
+ $host = trailingslashit( $this->host );
+ $paypal_order = ppcp_get_paypal_order( $wc_order );
+ $capture_id = $this->get_paypal_order_transaction_id( $paypal_order );
+ $url = "{$host}v1/shipping/trackers?transaction_id={$capture_id}";
$args = array(
'method' => 'GET',
@@ -382,7 +386,7 @@ class OrderTrackingEndpoint {
$carrier = $data['carrier'] ?? '';
$tracking_info = array(
- 'transaction_id' => $data['transaction_id'] ?? '',
+ 'capture_id' => $data['capture_id'] ?? '',
'status' => $data['status'] ?? '',
'tracking_number' => $data['tracking_number'] ?? '',
'carrier' => $carrier,
@@ -395,7 +399,7 @@ class OrderTrackingEndpoint {
return $this->shipment_factory->create_shipment(
$wc_order_id,
- $tracking_info['transaction_id'],
+ $tracking_info['capture_id'],
$tracking_info['tracking_number'],
$tracking_info['status'],
$tracking_info['carrier'],
@@ -418,7 +422,7 @@ class OrderTrackingEndpoint {
$carrier = $request_values['carrier'] ?? '';
$data_to_check = array(
- 'transaction_id' => $request_values['transaction_id'] ?? '',
+ 'capture_id' => $request_values['capture_id'] ?? '',
'status' => $request_values['status'] ?? '',
'tracking_number' => $request_values['tracking_number'] ?? '',
'carrier' => $carrier,
@@ -458,14 +462,14 @@ class OrderTrackingEndpoint {
}
/**
- * Finds the tracker ID from given transaction ID and tracking number.
+ * Finds the tracker ID from given capture ID and tracking number.
*
- * @param string $transaction_id The transaction ID.
+ * @param string $capture_id The capture ID.
* @param string $tracking_number The tracking number.
* @return string The tracker ID.
*/
- protected function find_tracker_id( string $transaction_id, string $tracking_number ): string {
- return ! empty( $tracking_number ) ? "{$transaction_id}-{$tracking_number}" : "{$transaction_id}-NOTRACKER";
+ protected function find_tracker_id( string $capture_id, string $tracking_number ): string {
+ return ! empty( $tracking_number ) ? "{$capture_id}-{$tracking_number}" : "{$capture_id}-NOTRACKER";
}
/**
@@ -503,21 +507,18 @@ class OrderTrackingEndpoint {
$host = trailingslashit( $this->host );
$shipment_data = $shipment->to_array();
- $old_api_data = $shipment_data;
- unset( $old_api_data['items'] );
- $request_shipment_data = array( 'trackers' => array( $old_api_data ) );
-
- if ( $this->should_use_new_api ) {
- unset( $shipment_data['transaction_id'] );
- $shipment_data['capture_id'] = $shipment->transaction_id();
- $request_shipment_data = $shipment_data;
+ if ( ! $this->should_use_new_api ) {
+ unset( $shipment_data['capture_id'] );
+ unset( $shipment_data['items'] );
+ $shipment_data['transaction_id'] = $shipment->capture_id();
+ $shipment_data = array( 'trackers' => array( $shipment_data ) );
}
$url = $this->should_use_new_api ? "{$host}v2/checkout/orders/{$paypal_order_id}/track" : "{$host}v1/shipping/trackers";
$args = array(
'method' => 'POST',
'headers' => $this->request_headers(),
- 'body' => wp_json_encode( (array) apply_filters( 'woocommerce_paypal_payments_tracking_data_before_sending', $request_shipment_data, $wc_order->get_id() ) ),
+ 'body' => wp_json_encode( (array) apply_filters( 'woocommerce_paypal_payments_tracking_data_before_sending', $shipment_data, $wc_order->get_id() ) ),
);
return array(
diff --git a/modules/ppcp-order-tracking/src/Integration/GermanizedShipmentIntegration.php b/modules/ppcp-order-tracking/src/Integration/GermanizedShipmentIntegration.php
index 7e44fd765..3dfe5bf73 100644
--- a/modules/ppcp-order-tracking/src/Integration/GermanizedShipmentIntegration.php
+++ b/modules/ppcp-order-tracking/src/Integration/GermanizedShipmentIntegration.php
@@ -17,12 +17,16 @@ use Vendidero\Germanized\Shipments\Shipment;
use Vendidero\Germanized\Shipments\ShipmentItem;
use WooCommerce\PayPalCommerce\OrderTracking\Endpoint\OrderTrackingEndpoint;
use WooCommerce\PayPalCommerce\OrderTracking\Shipment\ShipmentFactoryInterface;
+use WooCommerce\PayPalCommerce\WcGateway\Processor\TransactionIdHandlingTrait;
+use function WooCommerce\PayPalCommerce\Api\ppcp_get_paypal_order;
/**
* Class GermanizedShipmentIntegration.
*/
class GermanizedShipmentIntegration implements Integration {
+ use TransactionIdHandlingTrait;
+
/**
* The shipment factory.
*
@@ -79,8 +83,9 @@ class GermanizedShipmentIntegration implements Integration {
return;
}
+ $paypal_order = ppcp_get_paypal_order( $wc_order );
+ $capture_id = $this->get_paypal_order_transaction_id( $paypal_order );
$wc_order_id = $wc_order->get_id();
- $transaction_id = $wc_order->get_transaction_id();
$tracking_number = $shipment->get_tracking_id();
$carrier = $shipment->get_shipping_provider();
@@ -91,14 +96,14 @@ class GermanizedShipmentIntegration implements Integration {
$shipment->get_items()
);
- if ( ! $tracking_number || ! $carrier || ! $transaction_id ) {
+ if ( ! $tracking_number || ! $carrier || ! $capture_id ) {
return;
}
try {
$ppcp_shipment = $this->shipment_factory->create_shipment(
$wc_order_id,
- $transaction_id,
+ $capture_id,
$tracking_number,
'SHIPPED',
'OTHER',
diff --git a/modules/ppcp-order-tracking/src/Integration/ShipStationIntegration.php b/modules/ppcp-order-tracking/src/Integration/ShipStationIntegration.php
index 08a476e4b..dbb95aabc 100644
--- a/modules/ppcp-order-tracking/src/Integration/ShipStationIntegration.php
+++ b/modules/ppcp-order-tracking/src/Integration/ShipStationIntegration.php
@@ -15,12 +15,16 @@ use WC_Order;
use WooCommerce\PayPalCommerce\Compat\Integration;
use WooCommerce\PayPalCommerce\OrderTracking\Endpoint\OrderTrackingEndpoint;
use WooCommerce\PayPalCommerce\OrderTracking\Shipment\ShipmentFactoryInterface;
+use WooCommerce\PayPalCommerce\WcGateway\Processor\TransactionIdHandlingTrait;
+use function WooCommerce\PayPalCommerce\Api\ppcp_get_paypal_order;
/**
* Class ShipStationIntegration.
*/
class ShipStationIntegration implements Integration {
+ use TransactionIdHandlingTrait;
+
/**
* The shipment factory.
*
@@ -80,19 +84,20 @@ class ShipStationIntegration implements Integration {
return;
}
+ $paypal_order = ppcp_get_paypal_order( $wc_order );
+ $capture_id = $this->get_paypal_order_transaction_id( $paypal_order );
$order_id = $wc_order->get_id();
- $transaction_id = $wc_order->get_transaction_id();
$tracking_number = $data['tracking_number'] ?? '';
$carrier = $data['carrier'] ?? '';
- if ( ! $tracking_number || ! is_string( $tracking_number ) || ! $carrier || ! is_string( $carrier ) || ! $transaction_id ) {
+ if ( ! $tracking_number || ! is_string( $tracking_number ) || ! $carrier || ! is_string( $carrier ) || ! $capture_id ) {
return;
}
try {
$ppcp_shipment = $this->shipment_factory->create_shipment(
$order_id,
- $transaction_id,
+ $capture_id,
$tracking_number,
'SHIPPED',
'OTHER',
diff --git a/modules/ppcp-order-tracking/src/Integration/ShipmentTrackingIntegration.php b/modules/ppcp-order-tracking/src/Integration/ShipmentTrackingIntegration.php
index 6c506a5e8..9417da693 100644
--- a/modules/ppcp-order-tracking/src/Integration/ShipmentTrackingIntegration.php
+++ b/modules/ppcp-order-tracking/src/Integration/ShipmentTrackingIntegration.php
@@ -15,14 +15,18 @@ use WC_Order;
use WooCommerce\PayPalCommerce\Compat\Integration;
use WooCommerce\PayPalCommerce\OrderTracking\Endpoint\OrderTrackingEndpoint;
use WooCommerce\PayPalCommerce\OrderTracking\Shipment\ShipmentFactoryInterface;
+use WooCommerce\PayPalCommerce\WcGateway\Processor\TransactionIdHandlingTrait;
use WP_REST_Request;
use WP_REST_Response;
+use function WooCommerce\PayPalCommerce\Api\ppcp_get_paypal_order;
/**
* Class ShipmentTrackingIntegration.
*/
class ShipmentTrackingIntegration implements Integration {
+ use TransactionIdHandlingTrait;
+
/**
* The shipment factory.
*
@@ -81,17 +85,18 @@ class ShipmentTrackingIntegration implements Integration {
return;
}
- $transaction_id = $wc_order->get_transaction_id();
+ $paypal_order = ppcp_get_paypal_order( $wc_order );
+ $capture_id = $this->get_paypal_order_transaction_id( $paypal_order );
$tracking_number = wc_clean( wp_unslash( $_POST['tracking_number'] ?? '' ) );
$carrier = wc_clean( wp_unslash( $_POST['tracking_provider'] ?? '' ) );
$carrier_other = wc_clean( wp_unslash( $_POST['custom_tracking_provider'] ?? '' ) );
$carrier = $carrier ?: $carrier_other ?: '';
- if ( ! $tracking_number || ! is_string( $tracking_number ) || ! $carrier || ! is_string( $carrier ) || ! $transaction_id ) {
+ if ( ! $tracking_number || ! is_string( $tracking_number ) || ! $carrier || ! is_string( $carrier ) || ! $capture_id ) {
return;
}
- $this->sync_tracking( $order_id, $transaction_id, $tracking_number, $carrier );
+ $this->sync_tracking( $order_id, $capture_id, $tracking_number, $carrier );
}
);
@@ -116,17 +121,18 @@ class ShipmentTrackingIntegration implements Integration {
return $response;
}
- $transaction_id = $wc_order->get_transaction_id();
+ $paypal_order = ppcp_get_paypal_order( $wc_order );
+ $capture_id = $this->get_paypal_order_transaction_id( $paypal_order );
$tracking_number = $tracking_item['tracking_number'] ?? '';
$carrier = $tracking_item['tracking_provider'] ?? '';
$carrier_other = $tracking_item['custom_tracking_provider'] ?? '';
$carrier = $carrier ?: $carrier_other ?: '';
- if ( ! $tracking_number || ! $carrier || ! $transaction_id ) {
+ if ( ! $tracking_number || ! $carrier || ! $capture_id ) {
return $response;
}
- $this->sync_tracking( $order_id, $transaction_id, $tracking_number, $carrier );
+ $this->sync_tracking( $order_id, $capture_id, $tracking_number, $carrier );
return $response;
},
@@ -139,21 +145,21 @@ class ShipmentTrackingIntegration implements Integration {
* Syncs (add | update) the PayPal tracking with given info.
*
* @param int $wc_order_id The WC order ID.
- * @param string $transaction_id The transaction ID.
+ * @param string $capture_id The capture ID.
* @param string $tracking_number The tracking number.
* @param string $carrier The shipment carrier.
* @return void
*/
protected function sync_tracking(
int $wc_order_id,
- string $transaction_id,
+ string $capture_id,
string $tracking_number,
string $carrier
) {
try {
$ppcp_shipment = $this->shipment_factory->create_shipment(
$wc_order_id,
- $transaction_id,
+ $capture_id,
$tracking_number,
'SHIPPED',
'OTHER',
diff --git a/modules/ppcp-order-tracking/src/Integration/WcShippingTaxIntegration.php b/modules/ppcp-order-tracking/src/Integration/WcShippingTaxIntegration.php
index a808c6ade..87cca24de 100644
--- a/modules/ppcp-order-tracking/src/Integration/WcShippingTaxIntegration.php
+++ b/modules/ppcp-order-tracking/src/Integration/WcShippingTaxIntegration.php
@@ -16,16 +16,18 @@ use WooCommerce\PayPalCommerce\Compat\Integration;
use WooCommerce\PayPalCommerce\OrderTracking\Endpoint\OrderTrackingEndpoint;
use WooCommerce\PayPalCommerce\OrderTracking\Shipment\ShipmentFactoryInterface;
use WooCommerce\PayPalCommerce\OrderTracking\TrackingAvailabilityTrait;
+use WooCommerce\PayPalCommerce\WcGateway\Processor\TransactionIdHandlingTrait;
use WP_HTTP_Response;
use WP_REST_Request;
use WP_REST_Server;
+use function WooCommerce\PayPalCommerce\Api\ppcp_get_paypal_order;
/**
* Class WcShippingTaxIntegration.
*/
class WcShippingTaxIntegration implements Integration {
- use TrackingAvailabilityTrait;
+ use TrackingAvailabilityTrait, TransactionIdHandlingTrait;
/**
* The shipment factory.
@@ -99,15 +101,16 @@ class WcShippingTaxIntegration implements Integration {
continue;
}
- $transaction_id = $wc_order->get_transaction_id();
- $carrier = $label['carrier_id'] ?? $label['service_name'] ?? '';
- $items = array_map( 'intval', $label['product_ids'] ?? array() );
+ $paypal_order = ppcp_get_paypal_order( $wc_order );
+ $capture_id = $this->get_paypal_order_transaction_id( $paypal_order );
+ $carrier = $label['carrier_id'] ?? $label['service_name'] ?? '';
+ $items = array_map( 'intval', $label['product_ids'] ?? array() );
- if ( ! $carrier || ! $transaction_id ) {
+ if ( ! $carrier || ! $capture_id ) {
continue;
}
- $this->sync_tracking( $order_id, $transaction_id, $tracking_number, $carrier, $items );
+ $this->sync_tracking( $order_id, $capture_id, $tracking_number, $carrier, $items );
}
return $response;
@@ -122,7 +125,7 @@ class WcShippingTaxIntegration implements Integration {
* Syncs (add | update) the PayPal tracking with given info.
*
* @param int $wc_order_id The WC order ID.
- * @param string $transaction_id The transaction ID.
+ * @param string $capture_id The capture ID.
* @param string $tracking_number The tracking number.
* @param string $carrier The shipment carrier.
* @param int[] $items The list of line items IDs.
@@ -130,7 +133,7 @@ class WcShippingTaxIntegration implements Integration {
*/
protected function sync_tracking(
int $wc_order_id,
- string $transaction_id,
+ string $capture_id,
string $tracking_number,
string $carrier,
array $items
@@ -138,7 +141,7 @@ class WcShippingTaxIntegration implements Integration {
try {
$ppcp_shipment = $this->shipment_factory->create_shipment(
$wc_order_id,
- $transaction_id,
+ $capture_id,
$tracking_number,
'SHIPPED',
'OTHER',
diff --git a/modules/ppcp-order-tracking/src/Integration/YithShipmentIntegration.php b/modules/ppcp-order-tracking/src/Integration/YithShipmentIntegration.php
index 57a36babf..9b2be196c 100644
--- a/modules/ppcp-order-tracking/src/Integration/YithShipmentIntegration.php
+++ b/modules/ppcp-order-tracking/src/Integration/YithShipmentIntegration.php
@@ -15,12 +15,16 @@ use WC_Order;
use WooCommerce\PayPalCommerce\Compat\Integration;
use WooCommerce\PayPalCommerce\OrderTracking\Endpoint\OrderTrackingEndpoint;
use WooCommerce\PayPalCommerce\OrderTracking\Shipment\ShipmentFactoryInterface;
+use WooCommerce\PayPalCommerce\WcGateway\Processor\TransactionIdHandlingTrait;
+use function WooCommerce\PayPalCommerce\Api\ppcp_get_paypal_order;
/**
* Class YithShipmentIntegration.
*/
class YithShipmentIntegration implements Integration {
+ use TransactionIdHandlingTrait;
+
/**
* The shipment factory.
*
@@ -76,20 +80,21 @@ class YithShipmentIntegration implements Integration {
return;
}
- $transaction_id = $wc_order->get_transaction_id();
+ $paypal_order = ppcp_get_paypal_order( $wc_order );
+ $capture_id = $this->get_paypal_order_transaction_id( $paypal_order );
// phpcs:ignore WordPress.Security.NonceVerification.Missing
$tracking_number = wc_clean( wp_unslash( $_POST['ywot_tracking_code'] ?? '' ) );
// phpcs:ignore WordPress.Security.NonceVerification.Missing
$carrier = wc_clean( wp_unslash( $_POST['ywot_carrier_name'] ?? '' ) );
- if ( ! $tracking_number || ! is_string( $tracking_number ) || ! $carrier || ! is_string( $carrier ) || ! $transaction_id ) {
+ if ( ! $tracking_number || ! is_string( $tracking_number ) || ! $carrier || ! is_string( $carrier ) || ! $capture_id ) {
return;
}
try {
$ppcp_shipment = $this->shipment_factory->create_shipment(
$order_id,
- $transaction_id,
+ $capture_id,
$tracking_number,
'SHIPPED',
'OTHER',
diff --git a/modules/ppcp-order-tracking/src/MetaBoxRenderer.php b/modules/ppcp-order-tracking/src/MetaBoxRenderer.php
index 916b9fbda..c7a043d7c 100644
--- a/modules/ppcp-order-tracking/src/MetaBoxRenderer.php
+++ b/modules/ppcp-order-tracking/src/MetaBoxRenderer.php
@@ -9,11 +9,15 @@ declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\OrderTracking;
+use Exception;
use WC_Order;
use WooCommerce\PayPalCommerce\OrderTracking\Endpoint\OrderTrackingEndpoint;
use WooCommerce\PayPalCommerce\OrderTracking\Shipment\ShipmentInterface;
+use WooCommerce\PayPalCommerce\WcGateway\Processor\TransactionIdHandlingTrait;
use WP_Post;
+use function WooCommerce\PayPalCommerce\Api\ppcp_get_paypal_order;
+
/**
* Class MetaBoxRenderer
*
@@ -25,6 +29,8 @@ use WP_Post;
*/
class MetaBoxRenderer {
+ use TransactionIdHandlingTrait;
+
/**
* Allowed shipping statuses.
*
@@ -87,7 +93,13 @@ class MetaBoxRenderer {
return;
}
- $transaction_id = $wc_order->get_transaction_id() ?: '';
+ $paypal_order = ppcp_get_paypal_order( $wc_order );
+ $capture_id = $this->get_paypal_order_transaction_id( $paypal_order ) ?? '';
+
+ if ( ! $capture_id ) {
+ return;
+ }
+
$order_items = $wc_order->get_items();
$order_item_count = ! empty( $order_items ) ? count( $order_items ) : 0;
@@ -102,8 +114,8 @@ class MetaBoxRenderer {
-
-
+
+
1 && $this->should_use_new_api ) : ?>
diff --git a/modules/ppcp-order-tracking/src/Shipment/Shipment.php b/modules/ppcp-order-tracking/src/Shipment/Shipment.php
index 9661d574c..c59a77387 100644
--- a/modules/ppcp-order-tracking/src/Shipment/Shipment.php
+++ b/modules/ppcp-order-tracking/src/Shipment/Shipment.php
@@ -32,11 +32,11 @@ class Shipment implements ShipmentInterface {
private $wc_order_id;
/**
- * The transaction ID.
+ * The capture ID.
*
* @var string
*/
- protected $transaction_id;
+ protected $capture_id;
/**
* The tracking number.
@@ -76,7 +76,7 @@ class Shipment implements ShipmentInterface {
* Shipment constructor.
*
* @param int $wc_order_id The WC order ID.
- * @param string $transaction_id The transaction ID.
+ * @param string $capture_id The capture ID.
* @param string $tracking_number The tracking number.
* @param string $status The shipment status.
* @param string $carrier The shipment carrier.
@@ -85,7 +85,7 @@ class Shipment implements ShipmentInterface {
*/
public function __construct(
int $wc_order_id,
- string $transaction_id,
+ string $capture_id,
string $tracking_number,
string $status,
string $carrier,
@@ -97,15 +97,15 @@ class Shipment implements ShipmentInterface {
$this->carrier = $carrier;
$this->carrier_name_other = $carrier_name_other;
$this->line_items = $line_items;
- $this->transaction_id = $transaction_id;
+ $this->capture_id = $capture_id;
$this->wc_order_id = $wc_order_id;
}
/**
* {@inheritDoc}
*/
- public function transaction_id(): string {
- return $this->transaction_id;
+ public function capture_id(): string {
+ return $this->capture_id;
}
/**
@@ -228,7 +228,7 @@ class Shipment implements ShipmentInterface {
*/
public function to_array(): array {
$shipment = array(
- 'transaction_id' => $this->transaction_id(),
+ 'capture_id' => $this->capture_id(),
'tracking_number' => $this->tracking_number(),
'status' => $this->status(),
'carrier' => $this->carrier(),
diff --git a/modules/ppcp-order-tracking/src/Shipment/ShipmentFactory.php b/modules/ppcp-order-tracking/src/Shipment/ShipmentFactory.php
index cddae0b2b..b77e71759 100644
--- a/modules/ppcp-order-tracking/src/Shipment/ShipmentFactory.php
+++ b/modules/ppcp-order-tracking/src/Shipment/ShipmentFactory.php
@@ -19,13 +19,13 @@ class ShipmentFactory implements ShipmentFactoryInterface {
*/
public function create_shipment(
int $wc_order_id,
- string $transaction_id,
+ string $capture_id,
string $tracking_number,
string $status,
string $carrier,
string $carrier_name_other,
array $line_items
): ShipmentInterface {
- return new Shipment( $wc_order_id, $transaction_id, $tracking_number, $status, $carrier, $carrier_name_other, $line_items );
+ return new Shipment( $wc_order_id, $capture_id, $tracking_number, $status, $carrier, $carrier_name_other, $line_items );
}
}
diff --git a/modules/ppcp-order-tracking/src/Shipment/ShipmentFactoryInterface.php b/modules/ppcp-order-tracking/src/Shipment/ShipmentFactoryInterface.php
index c1c471e48..25f8627a3 100644
--- a/modules/ppcp-order-tracking/src/Shipment/ShipmentFactoryInterface.php
+++ b/modules/ppcp-order-tracking/src/Shipment/ShipmentFactoryInterface.php
@@ -20,7 +20,7 @@ interface ShipmentFactoryInterface {
* Returns the new shipment instance.
*
* @param int $wc_order_id The WC order ID.
- * @param string $transaction_id The transaction ID.
+ * @param string $capture_id The capture ID.
* @param string $tracking_number The tracking number.
* @param string $status The shipment status.
* @param string $carrier The shipment carrier.
@@ -32,7 +32,7 @@ interface ShipmentFactoryInterface {
*/
public function create_shipment(
int $wc_order_id,
- string $transaction_id,
+ string $capture_id,
string $tracking_number,
string $status,
string $carrier,
diff --git a/modules/ppcp-order-tracking/src/Shipment/ShipmentInterface.php b/modules/ppcp-order-tracking/src/Shipment/ShipmentInterface.php
index 29d7eecff..80657868b 100644
--- a/modules/ppcp-order-tracking/src/Shipment/ShipmentInterface.php
+++ b/modules/ppcp-order-tracking/src/Shipment/ShipmentInterface.php
@@ -24,7 +24,7 @@ namespace WooCommerce\PayPalCommerce\OrderTracking\Shipment;
* tax_rate?: string
* }
* @psalm-type shipmentMap = array{
- * transaction_id: string,
+ * capture_id: string,
* tracking_number: string,
* status: string,
* carrier: string,
@@ -35,11 +35,11 @@ namespace WooCommerce\PayPalCommerce\OrderTracking\Shipment;
interface ShipmentInterface {
/**
- * The transaction ID.
+ * The capture ID.
*
* @return string
*/
- public function transaction_id(): string;
+ public function capture_id(): string;
/**
* The tracking number.
diff --git a/modules/ppcp-paylater-wc-blocks/src/PayLaterWCBlocksRenderer.php b/modules/ppcp-paylater-wc-blocks/src/PayLaterWCBlocksRenderer.php
index e1a01393d..6709b9a5b 100644
--- a/modules/ppcp-paylater-wc-blocks/src/PayLaterWCBlocksRenderer.php
+++ b/modules/ppcp-paylater-wc-blocks/src/PayLaterWCBlocksRenderer.php
@@ -119,13 +119,7 @@ class PayLaterWCBlocksRenderer {
$processor->set_attribute( 'data-pp-placement', esc_attr( $this->placement ) );
}
- $updated_html = $processor->get_updated_html();
-
- return sprintf(
- '
%2$s
',
- wp_kses_data( get_block_wrapper_attributes() ),
- $updated_html
- );
+ return $processor->get_updated_html();
}
}
}
diff --git a/modules/ppcp-wc-gateway/assets/images/axo/amex-light.svg b/modules/ppcp-wc-gateway/assets/images/axo/amex-light.svg
new file mode 100644
index 000000000..495d3409f
--- /dev/null
+++ b/modules/ppcp-wc-gateway/assets/images/axo/amex-light.svg
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/modules/ppcp-wc-gateway/assets/images/axo/dinersclub-light.svg b/modules/ppcp-wc-gateway/assets/images/axo/dinersclub-light.svg
new file mode 100644
index 000000000..5f226276f
--- /dev/null
+++ b/modules/ppcp-wc-gateway/assets/images/axo/dinersclub-light.svg
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/modules/ppcp-wc-gateway/assets/images/axo/discover-light.svg b/modules/ppcp-wc-gateway/assets/images/axo/discover-light.svg
new file mode 100644
index 000000000..41995f760
--- /dev/null
+++ b/modules/ppcp-wc-gateway/assets/images/axo/discover-light.svg
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/modules/ppcp-wc-gateway/assets/images/axo/jcb-light.svg b/modules/ppcp-wc-gateway/assets/images/axo/jcb-light.svg
new file mode 100644
index 000000000..c0bc1719a
--- /dev/null
+++ b/modules/ppcp-wc-gateway/assets/images/axo/jcb-light.svg
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/ppcp-wc-gateway/assets/images/axo/mastercard-light.svg b/modules/ppcp-wc-gateway/assets/images/axo/mastercard-light.svg
new file mode 100644
index 000000000..0f3cb2bd4
--- /dev/null
+++ b/modules/ppcp-wc-gateway/assets/images/axo/mastercard-light.svg
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/ppcp-wc-gateway/assets/images/axo/unionpay-light.svg b/modules/ppcp-wc-gateway/assets/images/axo/unionpay-light.svg
new file mode 100644
index 000000000..e13bd06fc
--- /dev/null
+++ b/modules/ppcp-wc-gateway/assets/images/axo/unionpay-light.svg
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/ppcp-wc-gateway/assets/images/axo/visa-light.svg b/modules/ppcp-wc-gateway/assets/images/axo/visa-light.svg
new file mode 100644
index 000000000..21afc5ef4
--- /dev/null
+++ b/modules/ppcp-wc-gateway/assets/images/axo/visa-light.svg
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/ppcp-wc-gateway/resources/css/common.scss b/modules/ppcp-wc-gateway/resources/css/common.scss
index b97b1a038..1345cb810 100644
--- a/modules/ppcp-wc-gateway/resources/css/common.scss
+++ b/modules/ppcp-wc-gateway/resources/css/common.scss
@@ -56,13 +56,22 @@ $background-ident-color: #fbfbfb;
}
}
-.ppcp-important {
- background: white;
- padding: 5px 5px 5px 15px;
- border-left: 2px solid #dba617;
+.ppcp-notice {
+ background: #fff;
+ border: 1px solid #c3c4c7;
+ border-left-width: 4px;
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
+ margin: 5px 15px 2px;
+ padding: 1px 12px;
+}
- span {
+.ppcp-notice-warning {
+ border-left-color: #dba617;
+
+ .highlight {
+ background: transparent;
color: #dba617;
+ font-weight: 600;
}
}
@@ -87,6 +96,18 @@ $background-ident-color: #fbfbfb;
th, &.ppcp-settings-field-heading td {
padding-left: 40px;
+ padding-right: 40px;
+ }
+
+ .ppcp-notice {
+ margin-left: 40px;
+ margin-right: 10px;
+ padding: 1px 12px;
+
+ p {
+ margin: .5em 0;
+ padding: 2px;
+ }
}
th, td {
diff --git a/modules/ppcp-wc-gateway/services.php b/modules/ppcp-wc-gateway/services.php
index 65101e8b8..dcbc43333 100644
--- a/modules/ppcp-wc-gateway/services.php
+++ b/modules/ppcp-wc-gateway/services.php
@@ -803,6 +803,15 @@ return array(
'elo' => _x( 'Elo', 'Name of credit card', 'woocommerce-paypal-payments' ),
'hiper' => _x( 'Hiper', 'Name of credit card', 'woocommerce-paypal-payments' ),
),
+ 'options_axo' => array(
+ 'visa-light' => _x( 'Visa (light)', 'Name of credit card', 'woocommerce-paypal-payments' ),
+ 'mastercard-light' => _x( 'Mastercard (light)', 'Name of credit card', 'woocommerce-paypal-payments' ),
+ 'amex-light' => _x( 'Amex (light)', 'Name of credit card', 'woocommerce-paypal-payments' ),
+ 'discover-light' => _x( 'Discover (light)', 'Name of credit card', 'woocommerce-paypal-payments' ),
+ 'dinersclub-light' => _x( 'Diners Club (light)', 'Name of credit card', 'woocommerce-paypal-payments' ),
+ 'jcb-light' => _x( 'JCB (light)', 'Name of credit card', 'woocommerce-paypal-payments' ),
+ 'unionpay-light' => _x( 'UnionPay (light)', 'Name of credit card', 'woocommerce-paypal-payments' ),
+ ),
'screens' => array(
State::STATE_ONBOARDED,
),
diff --git a/modules/ppcp-wc-gateway/src/Helper/CartCheckoutDetector.php b/modules/ppcp-wc-gateway/src/Helper/CartCheckoutDetector.php
new file mode 100644
index 000000000..faac7f257
--- /dev/null
+++ b/modules/ppcp-wc-gateway/src/Helper/CartCheckoutDetector.php
@@ -0,0 +1,129 @@
+get_payment_method(), array( PayPalGateway::ID, CreditCardGateway::ID, CardButtonGateway::ID ), true ) ) {
+ if ( ! in_array( $wc_order->get_payment_method(), array( PayPalGateway::ID, CreditCardGateway::ID, CardButtonGateway::ID, PayUponInvoiceGateway::ID ), true ) ) {
return true;
}
diff --git a/modules/ppcp-wc-gateway/src/Settings/SettingsRenderer.php b/modules/ppcp-wc-gateway/src/Settings/SettingsRenderer.php
index 03ef59ca6..46216b548 100644
--- a/modules/ppcp-wc-gateway/src/Settings/SettingsRenderer.php
+++ b/modules/ppcp-wc-gateway/src/Settings/SettingsRenderer.php
@@ -268,6 +268,31 @@ class SettingsRenderer {
return $html;
}
+ /**
+ * Renders the html field.
+ *
+ * @param string $field The current field HTML.
+ * @param string $key The current key.
+ * @param array $config The configuration array.
+ * @param string $value The current value.
+ *
+ * @return string
+ */
+ public function render_html( $field, $key, $config, $value ): string {
+
+ if ( 'ppcp-html' !== $config['type'] ) {
+ return $field;
+ }
+
+ $html = sprintf(
+ '
%s
',
+ esc_attr( implode( ' ', $config['classes'] ) ),
+ $config['html']
+ );
+
+ return $html;
+ }
+
/**
* Renders the table row.
*
diff --git a/modules/ppcp-wc-gateway/src/WCGatewayModule.php b/modules/ppcp-wc-gateway/src/WCGatewayModule.php
index 8e765a8e9..19f67ef53 100644
--- a/modules/ppcp-wc-gateway/src/WCGatewayModule.php
+++ b/modules/ppcp-wc-gateway/src/WCGatewayModule.php
@@ -627,6 +627,7 @@ class WCGatewayModule implements ModuleInterface {
$field = $renderer->render_password( $field, $key, $args, $value );
$field = $renderer->render_heading( $field, $key, $args, $value );
$field = $renderer->render_table( $field, $key, $args, $value );
+ $field = $renderer->render_html( $field, $key, $args, $value );
return $field;
},
10,
diff --git a/package.json b/package.json
index 6476f3d1b..bf52a8677 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "woocommerce-paypal-payments",
- "version": "2.7.0",
+ "version": "2.7.1",
"description": "WooCommerce PayPal Payments",
"repository": "https://github.com/woocommerce/woocommerce-paypal-payments",
"license": "GPL-2.0",
diff --git a/readme.txt b/readme.txt
index a234e9d34..42840c062 100644
--- a/readme.txt
+++ b/readme.txt
@@ -4,7 +4,7 @@ Tags: woocommerce, paypal, payments, ecommerce, checkout, cart, pay later, apple
Requires at least: 5.3
Tested up to: 6.5
Requires PHP: 7.2
-Stable tag: 2.7.0
+Stable tag: 2.7.1
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -179,6 +179,13 @@ If you encounter issues with the PayPal buttons not appearing after an update, p
== Changelog ==
+= 2.7.1 - xxxx-xx-xx =
+* Fix - Ensure package tracking data is sent to original PayPal transaction #2180
+* Fix - Set the 'Woo_PPCP' as a default value for data-partner-attribution-id #2188
+* Fix - Allow PUI Gateway for refund processor #2192
+* Fix - Notice on newly created block cart checkout #2211
+* Fix - Apple Pay button in the editor #2177
+
= 2.7.0 - 2024-04-30 =
* Fix - Zero sum subscriptions cause CANNOT_BE_ZERO_OR_NEGATIVE when using Vault v3 #2152
* Fix - Incorrect Pricing Issue with Variable Subscriptions in PayPal Subscriptions Mode #2156
diff --git a/woocommerce-paypal-payments.php b/woocommerce-paypal-payments.php
index e193c42f0..ce5883709 100644
--- a/woocommerce-paypal-payments.php
+++ b/woocommerce-paypal-payments.php
@@ -3,7 +3,7 @@
* Plugin Name: WooCommerce PayPal Payments
* Plugin URI: https://woocommerce.com/products/woocommerce-paypal-payments/
* Description: PayPal's latest complete payments processing solution. Accept PayPal, Pay Later, credit/debit cards, alternative digital wallets local payment types and bank accounts. Turn on only PayPal options or process a full suite of payment methods. Enable global transaction with extensive currency and country coverage.
- * Version: 2.7.0
+ * Version: 2.7.1
* Author: WooCommerce
* Author URI: https://woocommerce.com/
* License: GPL-2.0
@@ -26,7 +26,7 @@ define( 'PAYPAL_API_URL', 'https://api-m.paypal.com' );
define( 'PAYPAL_URL', 'https://www.paypal.com' );
define( 'PAYPAL_SANDBOX_API_URL', 'https://api-m.sandbox.paypal.com' );
define( 'PAYPAL_SANDBOX_URL', 'https://www.sandbox.paypal.com' );
-define( 'PAYPAL_INTEGRATION_DATE', '2024-04-22' );
+define( 'PAYPAL_INTEGRATION_DATE', '2024-05-13' );
! defined( 'CONNECT_WOO_CLIENT_ID' ) && define( 'CONNECT_WOO_CLIENT_ID', 'AcCAsWta_JTL__OfpjspNyH7c1GGHH332fLwonA5CwX4Y10mhybRZmHLA0GdRbwKwjQIhpDQy0pluX_P' );
! defined( 'CONNECT_WOO_SANDBOX_CLIENT_ID' ) && define( 'CONNECT_WOO_SANDBOX_CLIENT_ID', 'AYmOHbt1VHg-OZ_oihPdzKEVbU3qg0qXonBcAztuzniQRaKE0w1Hr762cSFwd4n8wxOl-TCWohEa0XM_' );