diff --git a/changelog.txt b/changelog.txt index 3ca38e0e2..c424884cd 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,19 @@ *** Changelog *** += 2.8.0 - 2024-06-11 = +* Fix - Calculate totals after adding shipping to include taxes #2296 +* Fix - Package tracking integration throws error in 2.7.1 #2289 +* Fix - Make PayPal Subscription products unique in cart #2265 +* Fix - PayPal declares subscription support when merchant not enabled for Reference Transactions #2282 +* Fix - Google Pay and Apple Pay Settings button from Connection tab have wrong links #2273 +* Fix - Smart Buttons in Block Checkout not respecting the location setting (2830) #2278 +* Fix - Disable Pay Upon Invoice if billing/shipping country not set #2281 +* Fix - Critical error on pay for order page when we try to pay with ACDC gateway #2321 +* Enhancement - Enable shipping callback for WC subscriptions #2259 +* Enhancement - Disable the shipping callback for "venmo" when vaulting is active #2269 +* Enhancement - Improve "Could not retrieve order" error message #2271 +* Enhancement - Add block Checkout compatibility to Advanced Card Processing #2246 + = 2.7.1 - 2024-05-28 = * 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 diff --git a/modules/ppcp-api-client/src/Authentication/SdkClientToken.php b/modules/ppcp-api-client/src/Authentication/SdkClientToken.php index 200ba2322..ba0f3a373 100644 --- a/modules/ppcp-api-client/src/Authentication/SdkClientToken.php +++ b/modules/ppcp-api-client/src/Authentication/SdkClientToken.php @@ -73,6 +73,7 @@ class SdkClientToken { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized $domain = wp_unslash( $_SERVER['HTTP_HOST'] ?? '' ); + $domain = preg_replace( '/^www\./', '', $domain ); $url = trailingslashit( $this->host ) . 'v1/oauth2/token?grant_type=client_credentials&response_type=client_token&intent=sdk_init&domains[]=' . $domain; diff --git a/modules/ppcp-api-client/src/Factory/ShippingOptionFactory.php b/modules/ppcp-api-client/src/Factory/ShippingOptionFactory.php index 08af8c79e..3c21d4161 100644 --- a/modules/ppcp-api-client/src/Factory/ShippingOptionFactory.php +++ b/modules/ppcp-api-client/src/Factory/ShippingOptionFactory.php @@ -50,9 +50,7 @@ class ShippingOptionFactory { $cart->calculate_shipping(); $chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods', array() ); - if ( ! is_array( $chosen_shipping_methods ) ) { - $chosen_shipping_methods = array(); - } + $chosen_shipping_method = $chosen_shipping_methods[0] ?? false; $packages = WC()->shipping()->get_packages(); $options = array(); @@ -62,11 +60,10 @@ class ShippingOptionFactory { if ( ! $rate instanceof \WC_Shipping_Rate ) { continue; } - $options[] = new ShippingOption( $rate->get_id(), $rate->get_label(), - in_array( $rate->get_id(), $chosen_shipping_methods, true ), + $rate->get_id() === $chosen_shipping_method, new Money( (float) $rate->get_cost(), get_woocommerce_currency() diff --git a/modules/ppcp-applepay/services.php b/modules/ppcp-applepay/services.php index 003c8226c..6079fcb40 100644 --- a/modules/ppcp-applepay/services.php +++ b/modules/ppcp-applepay/services.php @@ -964,7 +964,7 @@ return array( : $container->get( 'applepay.enable-url-sandbox' ); $button_url = $enabled - ? admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway#field-alternative_payment_methods' ) + ? admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway&ppcp-tab=ppcp-credit-card-gateway#ppcp-applepay_button_enabled' ) : $enable_url; return sprintf( 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/css/styles.scss b/modules/ppcp-axo/resources/css/styles.scss index 605ac18b2..3513d0642 100644 --- a/modules/ppcp-axo/resources/css/styles.scss +++ b/modules/ppcp-axo/resources/css/styles.scss @@ -1,6 +1,15 @@ .ppcp-axo-watermark-container { max-width: 200px; margin-top: 10px; + position: relative; + + &.loader:before { + height: 12px; + width: 12px; + margin-left: -6px; + margin-top: -6px; + left: 12px; + } } .ppcp-axo-payment-container { @@ -28,6 +37,7 @@ .ppcp-axo-customer-details { margin-bottom: 40px; + position: relative; } .axo-checkout-header-section { @@ -44,6 +54,31 @@ padding: 0.6em 1em; } +.ppcp-axo-watermark-loading { + min-height: 12px; +} + +.ppcp-axo-overlay, +.ppcp-axo-watermark-loading:after { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(255, 255, 255, 0.5); + display: flex; + justify-content: center; + align-items: center; + z-index: 999; + content: ''; +} + +.ppcp-axo-loading .col-1 { + position: relative; + opacity: 0.9; + transition: opacity 0.5s ease; +} + #payment .payment_methods li label[for="payment_method_ppcp-axo-gateway"] { img { float: none; diff --git a/modules/ppcp-axo/resources/js/AxoManager.js b/modules/ppcp-axo/resources/js/AxoManager.js index a250c09b7..960da7f26 100644 --- a/modules/ppcp-axo/resources/js/AxoManager.js +++ b/modules/ppcp-axo/resources/js/AxoManager.js @@ -24,7 +24,8 @@ class AxoManager { active: false, validEmail: false, hasProfile: false, - useEmailWidget: this.useEmailWidget() + useEmailWidget: this.useEmailWidget(), + hasCard: false, }; this.data = { @@ -59,7 +60,6 @@ class AxoManager { } document.axoDebugObject = () => { - console.log(this); return this; } @@ -156,6 +156,7 @@ class AxoManager { this.el.showGatewaySelectionLink.on('click', async () => { this.hideGatewaySelection = false; this.$('.wc_payment_methods label').show(); + this.$('.wc_payment_methods input').show(); this.cardView.refresh(); }); @@ -164,9 +165,8 @@ 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); + log(`Enter key attempt - emailInput: ${this.emailInput.value}`); + log(`this.lastEmailCheckedIdentity: ${this.lastEmailCheckedIdentity}`); if (this.emailInput && this.lastEmailCheckedIdentity !== this.emailInput.value) { await this.onChangeEmail(); } @@ -175,7 +175,7 @@ class AxoManager { // 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); + log(`Clear the last email checked: ${this.lastEmailCheckedIdentity}`); this.lastEmailCheckedIdentity = ''; }); @@ -212,7 +212,7 @@ class AxoManager { this.status.hasProfile ); - log('Scenario', scenario); + log(`Scenario: ${JSON.stringify(scenario)}`); // Reset some elements to a default status. this.el.watermarkContainer.hide(); @@ -231,6 +231,7 @@ class AxoManager { if (scenario.defaultFormFields) { this.el.customerDetails.show(); + this.toggleLoaderAndOverlay(this.el.customerDetails, 'loader', 'ppcp-axo-overlay'); } else { this.el.customerDetails.hide(); } @@ -248,7 +249,6 @@ class AxoManager { this.$(this.el.fieldBillingEmail.selector).append( this.$(this.el.watermarkContainer.selector) ); - } else { this.el.emailWidgetContainer.hide(); if (!scenario.defaultEmailField) { @@ -257,12 +257,14 @@ class AxoManager { } if (scenario.axoProfileViews) { - this.el.billingAddressContainer.hide(); this.shippingView.activate(); - this.billingView.activate(); this.cardView.activate(); + if (this.status.hasCard) { + this.billingView.activate(); + } + // Move watermark to after shipping. this.$(this.el.shippingAddressContainer.selector).after( this.$(this.el.watermarkContainer.selector) @@ -372,7 +374,7 @@ class AxoManager { setStatus(key, value) { this.status[key] = value; - log('Status updated', JSON.parse(JSON.stringify(this.status))); + log(`Status updated: ${JSON.stringify(this.status)}`); document.dispatchEvent(new CustomEvent("axo_status_updated", {detail: this.status})); @@ -384,9 +386,8 @@ class AxoManager { this.initFastlane(); this.setStatus('active', true); - log('Attempt on activation'); - log('emailInput', this.emailInput.value); - log('this.lastEmailCheckedIdentity', this.lastEmailCheckedIdentity); + log(`Attempt on activation - emailInput: ${this.emailInput.value}`); + log(`this.lastEmailCheckedIdentity: ${this.lastEmailCheckedIdentity}`); if (this.emailInput && this.lastEmailCheckedIdentity !== this.emailInput.value) { this.onChangeEmail(); } @@ -496,6 +497,8 @@ class AxoManager { (await this.fastlane.FastlaneWatermarkComponent({ includeAdditionalInfo })).render(this.el.watermarkContainer.selector); + + this.toggleWatermarkLoading(this.el.watermarkContainer, 'ppcp-axo-watermark-loading', 'loader'); } watchEmail() { @@ -506,17 +509,15 @@ class AxoManager { } else { this.emailInput.addEventListener('change', async ()=> { - log('Change event attempt'); - log('emailInput', this.emailInput.value); - log('this.lastEmailCheckedIdentity', this.lastEmailCheckedIdentity); + log(`Change event attempt - emailInput: ${this.emailInput.value}`); + log(`this.lastEmailCheckedIdentity: ${this.lastEmailCheckedIdentity}`); if (this.emailInput && this.lastEmailCheckedIdentity !== this.emailInput.value) { this.onChangeEmail(); } }); - log('Last, this.emailInput.value attempt'); - log('emailInput', this.emailInput.value); - log('this.lastEmailCheckedIdentity', this.lastEmailCheckedIdentity); + log(`Last, this.emailInput.value attempt - emailInput: ${this.emailInput.value}`); + log(`this.lastEmailCheckedIdentity: ${this.lastEmailCheckedIdentity}`); if (this.emailInput.value) { this.onChangeEmail(); } @@ -536,7 +537,7 @@ class AxoManager { return; } - log('Email changed: ' + (this.emailInput ? this.emailInput.value : '' . $notice_content . '
Cart
& Classic Cart
Smart Button Locations cannot be disabled while Fastlane is active.',
+ 'woocommerce-paypal-payments'
+ ),
+ esc_url( $fastlane_settings_url )
+ );
+ } else {
+ return '';
+ }
+
return '' . $notice_content . '
Important: Cannot be deactivated while the WooCommerce Subscriptions plugin is active.