Skip to content

Commit

Permalink
Merge branch 'develop' into add/9826-payment-methods-logos-component
Browse files Browse the repository at this point in the history
  • Loading branch information
mdmoore authored Jan 27, 2025
2 parents 2d30b89 + 0454bb5 commit 64bb4e2
Show file tree
Hide file tree
Showing 41 changed files with 1,611 additions and 638 deletions.
4 changes: 4 additions & 0 deletions changelog/add-7348-multi-currency-widget-setup-e2e-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Add e2e tests for the multi-currency widget setup.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Convert shopper checkout with UPE methods E2E test to Playwright, split saving card tests to separate file
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Convert shopper checkout save card and purchase test to Playwright
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Convert the shopper-myaccount-payment-methods-add-fail spec from Puppeteer to Playwright.
4 changes: 4 additions & 0 deletions changelog/dev-10210-fix-saving-woopayments-settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Refactoring of snackbar checks in Playwright e2e tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Added timestamp to the order note when terminal payment fails.
4 changes: 4 additions & 0 deletions changelog/fix-10249-remove-subscriptions-jest-spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Remove the subscriptions spec for Puppeteer
4 changes: 4 additions & 0 deletions changelog/fix-playwright-saved-card-flakiness
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Fix flakiness in saved card tests caused by selling the same cart multiple times, triggering duplicate order protection
4 changes: 4 additions & 0 deletions changelog/fix-tokenized-ece-with-no-address-on-initialization
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

fix: avoid ECE error when no address is provided on initialization
4 changes: 4 additions & 0 deletions changelog/update-9811-design-improvements-overview-page
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: update

Design improvements related to the overview page
5 changes: 5 additions & 0 deletions changelog/update-bump-wc-tested-up-to-9-6
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: update
Comment: Bump wc tested up to 9.6.0


60 changes: 39 additions & 21 deletions client/components/deposits-status/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
* External dependencies
*/
import GridiconCheckmarkCircle from 'gridicons/dist/checkmark-circle';
import HelpOutlineIcon from 'gridicons/dist/help-outline';
import GridiconNotice from 'gridicons/dist/notice';
import { __ } from '@wordpress/i18n';
import { createInterpolateElement } from '@wordpress/element';
import { __, sprintf } from '@wordpress/i18n';
import interpolateComponents from '@automattic/interpolate-components';
import React from 'react';

/**
* Internal dependencies
*/
import 'components/account-status/shared.scss';
import { ClickTooltip } from 'wcpay/components/tooltip';
import type { AccountStatus } from 'wcpay/types/account/account-status';

type DepositsStatus = 'enabled' | 'disabled' | 'blocked';
Expand Down Expand Up @@ -62,31 +64,47 @@ const DepositsStatusDisabled: React.FC< DepositsStatusProps > = ( props ) => {
const DepositsStatusSuspended: React.FC< DepositsStatusProps > = ( props ) => {
const { iconSize } = props;

const learnMoreHref =
'https://woocommerce.com/document/woopayments/payouts/why-payouts-suspended/';

const description = createInterpolateElement(
const description =
/* translators: <a> - suspended accounts FAQ URL */
__(
'Temporarily suspended (<a>learn more</a>)',
'woocommerce-payments'
),
{
a: (
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a
href={ learnMoreHref }
target="_blank"
rel="noopener noreferrer"
/>
),
}
);
__( 'Temporarily suspended', 'woocommerce-payments' );

return (
<span className={ 'account-status__info__yellow' }>
<GridiconNotice size={ iconSize } />
{ description }
<ClickTooltip
maxWidth={ '300px' }
buttonIcon={ <HelpOutlineIcon /> }
buttonLabel={ __(
'Learn more about payouts suspended',
'woocommerce-payments'
) }
content={ interpolateComponents( {
mixedString: sprintf(
/* translators: 1: WooPayments */
__(
// eslint-disable-next-line max-len
'After the information review, your account was temporarily suspended. {{learnMoreLink}}Learn more{{/learnMoreLink}}',
'woocommerce-payments'
),
'WooPayments'
),
components: {
learnMoreLink: (
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a
href={
// eslint-disable-next-line max-len
'https://woocommerce.com/document/woopayments/payouts/why-payouts-suspended/'
}
target="_blank"
rel="noreferrer"
type="external"
/>
),
},
} ) }
/>
</span>
);
};
Expand Down
108 changes: 84 additions & 24 deletions client/components/deposits-status/test/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,35 @@ exports[`DepositsStatus renders blocked status 1`] = `
/>
</g>
</svg>
Temporarily suspended (
<a
href="https://woocommerce.com/document/woopayments/payouts/why-payouts-suspended/"
rel="noopener noreferrer"
target="_blank"
Temporarily suspended
<button
class="wcpay-tooltip__content-wrapper wcpay-tooltip--click__content-wrapper"
type="button"
>
learn more
</a>
)
<div
class="wcpay-tooltip__content-wrapper"
>
<div
aria-label="Learn more about payouts suspended"
role="button"
tabindex="0"
>
<svg
class="gridicon gridicons-help-outline"
height="16"
viewBox="0 0 24 24"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<g>
<path
d="M12 4c4.411 0 8 3.589 8 8s-3.589 8-8 8-8-3.589-8-8 3.589-8 8-8m0-2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm4 8a4 4 0 00-8 0h2c0-1.103.897-2 2-2s2 .897 2 2-.897 2-2 2a1 1 0 00-1 1v2h2v-1.141A3.991 3.991 0 0016 10zm-3 6h-2v2h2v-2z"
/>
</g>
</svg>
</div>
</div>
</button>
</span>
</div>
`;
Expand All @@ -49,15 +69,35 @@ exports[`DepositsStatus renders blocked status 2`] = `
/>
</g>
</svg>
Temporarily suspended (
<a
href="https://woocommerce.com/document/woopayments/payouts/why-payouts-suspended/"
rel="noopener noreferrer"
target="_blank"
Temporarily suspended
<button
class="wcpay-tooltip__content-wrapper wcpay-tooltip--click__content-wrapper"
type="button"
>
learn more
</a>
)
<div
class="wcpay-tooltip__content-wrapper"
>
<div
aria-label="Learn more about payouts suspended"
role="button"
tabindex="0"
>
<svg
class="gridicon gridicons-help-outline"
height="16"
viewBox="0 0 24 24"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<g>
<path
d="M12 4c4.411 0 8 3.589 8 8s-3.589 8-8 8-8-3.589-8-8 3.589-8 8-8m0-2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm4 8a4 4 0 00-8 0h2c0-1.103.897-2 2-2s2 .897 2 2-.897 2-2 2a1 1 0 00-1 1v2h2v-1.141A3.991 3.991 0 0016 10zm-3 6h-2v2h2v-2z"
/>
</g>
</svg>
</div>
</div>
</button>
</span>
</div>
`;
Expand Down Expand Up @@ -172,15 +212,35 @@ exports[`DepositsStatus renders pending verification status 1`] = `
/>
</g>
</svg>
Temporarily suspended (
<a
href="https://woocommerce.com/document/woopayments/payouts/why-payouts-suspended/"
rel="noopener noreferrer"
target="_blank"
Temporarily suspended
<button
class="wcpay-tooltip__content-wrapper wcpay-tooltip--click__content-wrapper"
type="button"
>
learn more
</a>
)
<div
class="wcpay-tooltip__content-wrapper"
>
<div
aria-label="Learn more about payouts suspended"
role="button"
tabindex="0"
>
<svg
class="gridicon gridicons-help-outline"
height="16"
viewBox="0 0 24 24"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<g>
<path
d="M12 4c4.411 0 8 3.589 8 8s-3.589 8-8 8-8-3.589-8-8 3.589-8 8-8m0-2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm4 8a4 4 0 00-8 0h2c0-1.103.897-2 2-2s2 .897 2 2-.897 2-2 2a1 1 0 00-1 1v2h2v-1.141A3.991 3.991 0 0016 10zm-3 6h-2v2h2v-2z"
/>
</g>
</svg>
</div>
</div>
</button>
</span>
</div>
`;
Expand Down
45 changes: 35 additions & 10 deletions client/express-checkout/blocks/hooks/use-express-checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import { useCallback } from '@wordpress/element';
import { useStripe, useElements } from '@stripe/react-stripe-js';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
Expand Down Expand Up @@ -58,22 +59,46 @@ export const useExpressCheckout = ( {
return;
}

const shippingAddressRequired = shippingData?.needsShipping;

let shippingRates;
if ( shippingAddressRequired ) {
const hasValidRates =
shippingData?.shippingRates[ 0 ]?.shipping_rates?.length >
0;

if ( hasValidRates ) {
shippingRates = shippingData.shippingRates[ 0 ].shipping_rates.map(
( rate ) => {
return {
id: rate.rate_id,
amount: parseInt( rate.price, 10 ),
displayName: rate.name,
};
}
);
} else {
shippingRates = [
{
id: 'pending',
displayName: __(
'Pending',
'woocommerce-payments'
),
amount: 0,
},
];
}
}

const options = {
lineItems: normalizeLineItems( billing?.cartTotalItems ),
emailRequired: true,
shippingAddressRequired: shippingData?.needsShipping,
shippingAddressRequired,
phoneNumberRequired:
getExpressCheckoutData( 'checkout' )?.needs_payer_phone ??
false,
shippingRates: shippingData?.shippingRates[ 0 ]?.shipping_rates?.map(
( r ) => {
return {
id: r.rate_id,
amount: parseInt( r.price, 10 ),
displayName: r.name,
};
}
),
shippingRates,
allowedShippingCountries: getExpressCheckoutData( 'checkout' )
.allowed_shipping_countries,
};
Expand Down
4 changes: 2 additions & 2 deletions client/express-checkout/event-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import {
let lastSelectedAddress = null;

export const shippingAddressChangeHandler = async ( api, event, elements ) => {
lastSelectedAddress = event.address;

try {
const response = await api.expressCheckoutECECalculateShippingOptions(
normalizeShippingAddress( event.address )
Expand All @@ -33,8 +35,6 @@ export const shippingAddressChangeHandler = async ( api, event, elements ) => {
amount: response.total.amount,
} );

lastSelectedAddress = event.address;

event.resolve( {
shippingRates: response.shipping_options,
lineItems: normalizeLineItems( response.displayItems ),
Expand Down
4 changes: 4 additions & 0 deletions client/overview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ const OverviewPage = () => {
const accountRejected =
accountStatus.status && accountStatus.status.startsWith( 'rejected' );
const accountUnderReview = accountStatus.status === 'under_review';
const paymentsEnabled = accountStatus.paymentsEnabled;
const depositsEnabled = accountStatus.deposits?.status === 'enabled';

const showConnectionSuccess =
queryParams[ 'wcpay-connection-success' ] === '1';
Expand All @@ -119,6 +121,8 @@ const OverviewPage = () => {
const showConnectionSuccessModal =
showConnectionSuccess &&
! isTestModeOnboarding &&
paymentsEnabled &&
depositsEnabled &&
isPoDisabledOrCompleted;

const activeAccountFees = Object.entries( wcpaySettings.accountFees )
Expand Down
Loading

0 comments on commit 64bb4e2

Please sign in to comment.