Skip to content

Commit

Permalink
Merge branch 'develop' into update/9971-simplify-localization-csv-export
Browse files Browse the repository at this point in the history
  • Loading branch information
Nagesh Pai committed Dec 24, 2024
2 parents 7f4d666 + 21d5cf8 commit 8a33f21
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 9 deletions.
5 changes: 5 additions & 0 deletions changelog/dev-10029-export-deposit-type-assert
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Add type assertion for payouts CSV export response to ensure type safety and fix TypeScript linting error


5 changes: 5 additions & 0 deletions changelog/dev-10034-linter-warning-useeffect-unused-import
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Not user-facing: removed an unused `useEffect` import causing linter warnings


4 changes: 4 additions & 0 deletions changelog/fix-9942-no-cost-subscription
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Zero dollar subscriptions with zero dollar renewals checkout error
3 changes: 2 additions & 1 deletion client/checkout/blocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ Object.entries( enabledPaymentMethodsConfig )
savedTokenComponent: <SavedTokenHandler api={ api } />,
canMakePayment: ( cartData ) => {
const billingCountry = cartData.billingAddress.country;
const needsPayment = cartData.cart.cartNeedsPayment;
const isRestrictedInAnyCountry = !! upeConfig.countries.length;
const isAvailableInTheCountry =
! isRestrictedInAnyCountry ||
upeConfig.countries.includes( billingCountry );
// We used to check if stripe was loaded with `getStripeForUPE`, but we can't guarantee it will be loaded synchronously.
return isAvailableInTheCountry;
return needsPayment && isAvailableInTheCountry;
},
paymentMethodId: upeMethods[ upeName ],
// see .wc-block-checkout__payment-method styles in blocks/style.scss
Expand Down
20 changes: 13 additions & 7 deletions client/components/woopay/save-user/checkout-page-save-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ const CheckoutPageSaveUser = ( { isBlocksCheckout } ) => {
const { isWCPayChosen, isNewPaymentTokenChosen } = useSelectedPaymentMethod(
isBlocksCheckout
);

// In classic checkout the saved tokens are under WCPay, so we need to check if new token is selected or not,
// under WCPay. For blocks checkout considering isWCPayChosen is enough.
const isWCPayWithNewTokenChosen = isBlocksCheckout
? isWCPayChosen
: isWCPayChosen && isNewPaymentTokenChosen;

const viewportWidth = window.document.documentElement.clientWidth;
const viewportHeight = window.document.documentElement.clientHeight;

Expand Down Expand Up @@ -193,7 +200,11 @@ const CheckoutPageSaveUser = ( { isBlocksCheckout } ) => {
return;
}

if ( isSaveDetailsChecked && ! isPhoneValid ) {
if (
isSaveDetailsChecked &&
! isPhoneValid &&
isWCPayWithNewTokenChosen
) {
setValidationErrors( {
[ errorId ]: {
message: __(
Expand All @@ -212,14 +223,9 @@ const CheckoutPageSaveUser = ( { isBlocksCheckout } ) => {
isSaveDetailsChecked,
sendExtensionData,
setValidationErrors,
isWCPayWithNewTokenChosen,
] );

// In classic checkout the saved tokens are under WCPay, so we need to check if new token is selected or not,
// under WCPay. For blocks checkout considering isWCPayChosen is enough.
const isWCPayWithNewTokenChosen = isBlocksCheckout
? isWCPayChosen
: isWCPayChosen && isNewPaymentTokenChosen;

const updatePhoneNumber = useCallback( () => {
if ( isPhoneNumberTouched.current ) {
return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import React, { useEffect, useState } from 'react';
import React, { useState } from 'react';
import { __, sprintf } from '@wordpress/i18n';
import { addQueryArgs } from '@wordpress/url';
import { Button, Modal } from '@wordpress/components';
Expand Down

0 comments on commit 8a33f21

Please sign in to comment.