Skip to content

Commit

Permalink
Merge branch 'develop' into update/5002-authorizations-improve-messag…
Browse files Browse the repository at this point in the history
…e-shown-to-merchants-when-there-is-an-error-capturing-authorizations
  • Loading branch information
mgascam authored Dec 16, 2024
2 parents 33b38d1 + db8947f commit d3698a9
Show file tree
Hide file tree
Showing 65 changed files with 805 additions and 3,675 deletions.
4 changes: 0 additions & 4 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,3 @@ vendor/*
release/*
tests/e2e/docker*
tests/e2e/deps*

# We'll delete the directory and its contents as part of https://github.com/Automattic/woocommerce-payments/issues/9722 .
# ignoring it because we're temporariily cleaning it up.
client/tokenized-payment-request
4 changes: 2 additions & 2 deletions bin/docker-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ cli()
set +e
# Wait for containers to be started up before the setup.
# The db being accessible means that the db container started and the WP has been downloaded and the plugin linked
cli wp db check --path=/var/www/html --quiet > /dev/null
cli wp db check --skip_ssl --path=/var/www/html --quiet > /dev/null
while [[ $? -ne 0 ]]; do
echo "Waiting until the service is ready..."
sleep 5
cli wp db check --path=/var/www/html --quiet > /dev/null
cli wp db check --skip_ssl --path=/var/www/html --quiet > /dev/null
done

# If the plugin is already active then return early
Expand Down
4 changes: 4 additions & 0 deletions changelog/add-6924-migrate-test-drive-capabilities
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: add

Migrate active capabilities from test-drive account when switching to live account.
4 changes: 4 additions & 0 deletions changelog/add-jetpack-config-callback
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

Added conditional use of Jetpack Config callback to avoid i18n notices.
4 changes: 4 additions & 0 deletions changelog/as-fix-ece-variable-subs-free-trial
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

Enable ECE for Virtual Variable Subscriptions with Free Trials.
5 changes: 5 additions & 0 deletions changelog/chore-remove-tokenized-payment-request-references
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: chore: remove tokeinzed payment request code


4 changes: 4 additions & 0 deletions changelog/compat-9727-avoid-early-translations
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Remove translations during initialization, preventing unnecessary warnings.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fixed an issue where order metadata was not updated when capturing an order in the processing state.
4 changes: 4 additions & 0 deletions changelog/fix-9421-auto-enable-woopay-in-sandbox-mode
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Ensure WooPay 'enabled by default' value is correctly set in sandbox mode.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fix inconsistent alignment of the download button across transactions, payouts, and disputes reporting views for a more cohesive user interface.
4 changes: 4 additions & 0 deletions changelog/fix-9806-ECE-subscription-checkout-signed-out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Ensure ECE login confirmation dialog is shown on Blocks.
4 changes: 4 additions & 0 deletions changelog/fix-skip-ssl-requirement-env-setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

Skip mysqlcheck SSL Requirement during E2E environment setup
5 changes: 5 additions & 0 deletions changelog/fix-tokenized-cart-error-notice-json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: fix: tokenized cart error notice json


4 changes: 4 additions & 0 deletions changelog/replace-from-url-query
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

Fix Jetpack onboarding URL query from "woocommerce-payments" to "woocommerce-core-profiler"
5 changes: 5 additions & 0 deletions changelog/update-9910-transaction-id-label
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: Change ID to uppercase in the 'Transaction ID' column label for consistency with similar unique IDs in the UI.


Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Add support for utilizing NOX capabilities as URL parameters during account creation.
19 changes: 13 additions & 6 deletions client/connect-account-page/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ const ConnectAccountPage: React.FC = () => {
}
};

const checkAccountStatus = () => {
const checkAccountStatus = ( extraQueryArgs = {} ) => {
// Fetch account status from the cache.
apiFetch( {
path: `/wc/v3/payments/accounts`,
Expand All @@ -188,18 +188,22 @@ const ConnectAccountPage: React.FC = () => {
loaderProgressRef.current > 95
) {
setTestDriveLoaderProgress( 100 );

// Redirect to the Connect URL and let it figure it out where to point the merchant.
window.location.href = addQueryArgs( connectUrl, {
const queryArgs = {
test_drive: 'true',
'wcpay-sandbox-success': 'true',
source: determineTrackingSource(),
from: 'WCPAY_CONNECT',
redirect_to_settings_page:
urlParams.get( 'redirect_to_settings_page' ) || '',
};

// Redirect to the Connect URL and let it figure it out where to point the merchant.
window.location.href = addQueryArgs( connectUrl, {
...queryArgs,
...extraQueryArgs,
} );
} else {
setTimeout( checkAccountStatus, 2000 );
setTimeout( () => checkAccountStatus( extraQueryArgs ), 2000 );
}
} );
};
Expand All @@ -211,6 +215,7 @@ const ConnectAccountPage: React.FC = () => {

const customizedConnectUrl = addQueryArgs( connectUrl, {
test_drive: 'true',
capabilities: urlParams.get( 'capabilities' ) || '',
} );

const updateProgress = setInterval( updateLoaderProgress, 2500, 40, 5 );
Expand Down Expand Up @@ -264,7 +269,9 @@ const ConnectAccountPage: React.FC = () => {
// The account has been successfully onboarded.
if ( !! connectionSuccess ) {
// Start checking the account status in a loop.
checkAccountStatus();
checkAccountStatus( {
'wcpay-connection-success': '1',
} );
} else {
// Redirect to the response URL, but attach our test drive flags.
// This URL is generally a Connect page URL.
Expand Down
7 changes: 7 additions & 0 deletions client/express-checkout/blocks/hooks/use-express-checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useStripe, useElements } from '@stripe/react-stripe-js';
* Internal dependencies
*/
import {
displayLoginConfirmation,
getExpressCheckoutButtonStyleSettings,
getExpressCheckoutData,
normalizeLineItems,
Expand Down Expand Up @@ -52,6 +53,12 @@ export const useExpressCheckout = ( {

const onButtonClick = useCallback(
( event ) => {
// If login is required for checkout, display redirect confirmation dialog.
if ( getExpressCheckoutData( 'login_confirmation' ) ) {
displayLoginConfirmation( event.expressPaymentType );
return;
}

const options = {
lineItems: normalizeLineItems( billing?.cartTotalItems ),
emailRequired: true,
Expand Down
23 changes: 19 additions & 4 deletions client/express-checkout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ jQuery( ( $ ) => {
} );

if ( getExpressCheckoutData( 'button_context' ) === 'product' ) {
wcpayECE.attachProductPageEventListeners( elements );
wcpayECE.attachProductPageEventListeners( elements, eceButton );
}
},

Expand Down Expand Up @@ -414,7 +414,7 @@ jQuery( ( $ ) => {
return api.expressCheckoutECEGetSelectedProductData( data );
},

attachProductPageEventListeners: ( elements ) => {
attachProductPageEventListeners: ( elements, eceButton ) => {
// WooCommerce Deposits support.
// Trigger the "woocommerce_variation_has_changed" event when the deposit option is changed.
// Needs to be defined before the `woocommerce_variation_has_changed` event handler is set.
Expand All @@ -437,6 +437,18 @@ jQuery( ( $ ) => {

$.when( wcpayECE.getSelectedProductData() )
.then( ( response ) => {
// We do not support variable subscriptions with variations
// that require shipping and include a free trial.
if (
getExpressCheckoutData( 'product' )
.product_type === 'variable-subscription' &&
response.needs_shipping &&
response.has_free_trial
) {
eceButton.destroy();
return;
}

const isDeposits = wcpayECE.productHasDepositOption();
/**
* If the customer aborted the express checkout,
Expand All @@ -449,8 +461,11 @@ jQuery( ( $ ) => {
! wcpayECE.paymentAborted &&
getExpressCheckoutData( 'product' )
.needs_shipping === response.needs_shipping;

if ( ! isDeposits && needsShipping ) {
if (
! isDeposits &&
needsShipping &&
! ( eceButton._destroyed ?? false )
) {
elements.update( {
amount: response.total.amount,
} );
Expand Down
1 change: 1 addition & 0 deletions client/express-checkout/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export interface WCPayExpressCheckoutParams {
product: {
needs_shipping: boolean;
currency: string;
product_type: string;
shippingOptions: {
id: string;
label: string;
Expand Down
2 changes: 2 additions & 0 deletions client/onboarding/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ export const createAccountSession = async (
data: OnboardingFields,
isPoEligible: boolean
): Promise< AccountKycSession > => {
const urlParams = new URLSearchParams( window.location.search );
return await apiFetch< AccountKycSession >( {
path: addQueryArgs( `${ NAMESPACE }/onboarding/kyc/session`, {
self_assessment: fromDotNotation( data ),
capabilities: urlParams.get( 'capabilities' ) || '',
progressive: isPoEligible,
} ),
method: 'GET',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useStripe, useElements } from '@stripe/react-stripe-js';
* Internal dependencies
*/
import {
displayLoginConfirmation,
getExpressCheckoutButtonStyleSettings,
getExpressCheckoutData,
normalizeLineItems,
Expand Down Expand Up @@ -52,6 +53,12 @@ export const useExpressCheckout = ( {

const onButtonClick = useCallback(
( event ) => {
// If login is required for checkout, display redirect confirmation dialog.
if ( getExpressCheckoutData( 'login_confirmation' ) ) {
displayLoginConfirmation( event.expressPaymentType );
return;
}

const options = {
lineItems: normalizeLineItems( billing?.cartTotalItems ),
emailRequired: true,
Expand Down
23 changes: 15 additions & 8 deletions client/tokenized-express-checkout/event-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,23 @@ export const onConfirmHandler = async (
completePayment( redirectUrl );
}
} catch ( e ) {
// API errors are not parsed, so we need to do it ourselves.
if ( e.json ) {
e = e.json();
}

return abortPayment(
event,
getErrorMessageFromNotice( e.message ) ||
e.payment_result?.payment_details.find(
( detail ) => detail.key === 'errorMessage'
)?.value ||
__(
'There was a problem processing the order.',
'woocommerce-payments'
)
getErrorMessageFromNotice(
e.message ||
e.payment_result?.payment_details.find(
( detail ) => detail.key === 'errorMessage'
)?.value ||
__(
'There was a problem processing the order.',
'woocommerce-payments'
)
)
);
}
};
Expand Down
4 changes: 3 additions & 1 deletion client/tokenized-express-checkout/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export const getExpressCheckoutData = <
* @param notice Error notice.
* @return Error messages.
*/
export const getErrorMessageFromNotice = ( notice: string ) => {
export const getErrorMessageFromNotice = ( notice: string | undefined ) => {
if ( ! notice ) return '';

const div = document.createElement( 'div' );
div.innerHTML = notice.trim();
return div.firstChild ? div.firstChild.textContent : '';
Expand Down
4 changes: 0 additions & 4 deletions client/tokenized-payment-request/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions client/tokenized-payment-request/blocks/apple-pay-preview.js

This file was deleted.

62 changes: 0 additions & 62 deletions client/tokenized-payment-request/blocks/index.js

This file was deleted.

Loading

0 comments on commit d3698a9

Please sign in to comment.