Skip to content

Commit 2c22e38

Browse files
committed
Merge release/5.3.0 into trunk
2 parents bb15782 + ba52b7c commit 2c22e38

File tree

80 files changed

+2626
-718
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2626
-718
lines changed

.github/workflows/compatibility.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
pull_request
55

66
env:
7-
WC_L2_VERSION: '7.0.1'
7+
WC_L2_VERSION: '7.1.1'
88
WP_L2_VERSION: '5.9'
99

1010
jobs:
@@ -20,7 +20,7 @@ jobs:
2020
WC_VERSIONS=$( echo "[\"$WC_L2_VERSION\", \"latest\", \"beta\"]" )
2121
MATRIX_INCLUDE=$( echo "[{\"woocommerce\":\"$WC_L2_VERSION\",\"wordpress\":\"$WP_L2_VERSION\",\"gutenberg\":\"13.6.0\",\"php\":\"7.2\"}]" )
2222
echo "matrix={\"woocommerce\":$WC_VERSIONS,\"wordpress\":[\"latest\"],\"gutenberg\":[\"latest\"],\"php\":[\"7.4\"], \"include\":$MATRIX_INCLUDE}" >> $GITHUB_OUTPUT
23-
23+
2424
woocommerce-compatibility:
2525
name: "WC compatibility"
2626
needs: generate-matrix

.github/workflows/e2e-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ env:
2323
E2E_SLACK_TOKEN: ${{ secrets.E2E_SLACK_TOKEN }}
2424
E2E_USE_LOCAL_SERVER: false
2525
E2E_RESULT_FILEPATH: 'tests/e2e/results.json'
26-
WC_L2_VERSION: '7.0.1'
26+
WC_L2_VERSION: '7.1.1'
2727

2828

2929
jobs:
@@ -46,7 +46,7 @@ jobs:
4646
strategy:
4747
fail-fast: false
4848
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
49-
49+
5050
name: WC - ${{ matrix.woocommerce }} | ${{ matrix.test_groups }} - ${{ matrix.test_branches }}
5151

5252
env:

.github/workflows/php-lint-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55

66
env:
77
WP_VERSION: latest
8-
WC_L2_VERSION: '7.0.1' # the min supported version as per L-2 policy
8+
WC_L2_VERSION: '7.1.1' # the min supported version as per L-2 policy
99
GUTENBERG_VERSION: latest
1010

1111
jobs:

.github/workflows/release-code-freeze.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88
inputs:
99
skipSlackPing:
10-
description: "If true, the Slack ping will be skipped"
10+
description: "Skip the Slack ping"
1111
type: boolean
1212
required: false
1313
default: false
@@ -75,6 +75,7 @@ jobs:
7575
uses: ./.github/workflows/release-pr.yml
7676
with:
7777
releaseVersion: ${{ needs.check-code-freeze.outputs.nextReleaseVersion }}
78+
secrets: inherit
7879

7980
slack-notification:
8081
name: "Send notification to Slack"

.github/workflows/release-pr.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
required: false
1414
default: "next wednesday"
1515
type: string
16+
1617
workflow_dispatch:
1718
inputs:
1819
releaseVersion:

changelog.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
*** WooCommerce Payments Changelog ***
22

3+
= 5.3.0 - 2023-01-11 =
4+
* Add - Added support for WooPay express checkout on product page. This feature is currently behind a feature flag and is not yet publicly available.
5+
* Add - Add the processing order_id to WC Session and its handling to prevent duplicate orders
6+
* Fix - Ensure script dependencies are loaded properly even when trying to register them again in the same request.
7+
* Fix - Fix an issue which caused synced wcpay subscription to not sync the first payment date when the customer is charged upfront.
8+
* Fix - Fix subscriptions remaining on-hold after processing a WCPay Subscription renewal on HPOS environments.
9+
* Fix - Make the webhook processing respect the test/live mode setting for the gateway
10+
* Fix - Prevent 'No such customer' errors after store is migrated to a new WCPay account.
11+
* Fix - Prevent occasional fatal errors when creating customers via ActionScheduler jobs
12+
* Fix - Updates subscriptions' payment token when a new default payment method is set.
13+
* Update - Bail out before payment processing for WooPay's order validation request
14+
* Update - Check the status of previously initiated payments and mark orders as processing instead of initiating a new payment.
15+
* Update - Enhance save my info section on classic and Blocks checkout
16+
* Dev - Bump minimum required version of WooCommerce to 7.1.1.
17+
* Dev - Remove redundant compatibility utility class for admin notes.
18+
* Dev - Replace typed payment intent strings with constants saved in an Enum clas
19+
* Dev - Retry API requests on network failure if Idempotency-Key header is present.
20+
* Dev - The PR replaces hard-coded order status constants, with a dedicated Enum class to make it reusable across the codebase.
21+
322
= 5.2.1 - 2022-12-30 =
423
* Fix - UPE not loading on checkout page due to undefined i18n.
524

client/checkout/api/index.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,10 +662,21 @@ export default class WCPayAPI {
662662
_wpnonce: nonce,
663663
email: userEmail,
664664
user_session: platformCheckoutUserSession,
665+
return_url: window?.location?.href ?? '',
665666
}
666667
);
667668
}
668669

670+
expressCheckoutAddToCart( productData ) {
671+
const wcAjaxUrl = getConfig( 'wcAjaxUrl' );
672+
const addToCartNonce = getConfig( 'addToCartNonce' );
673+
674+
return this.request( buildAjaxURL( wcAjaxUrl, 'add_to_cart' ), {
675+
security: addToCartNonce,
676+
...productData,
677+
} );
678+
}
679+
669680
paymentRequestPayForOrder( order, paymentData ) {
670681
return this.request( getPaymentRequestAjaxURL( 'pay_for_order' ), {
671682
_wpnonce: getPaymentRequestData( 'nonce' )?.pay_for_order,
@@ -692,4 +703,30 @@ export default class WCPayAPI {
692703
return true;
693704
} );
694705
}
706+
707+
/**
708+
* Redirect to the order-received page for duplicate payments.
709+
*
710+
* @param {Object} response Response data to check if doing the redirect.
711+
* @return {boolean} Returns true if doing the redirection.
712+
*/
713+
handleDuplicatePayments( {
714+
wcpay_upe_paid_for_previous_order: previouslyPaid,
715+
wcpay_upe_previous_successful_intent: previousSuccessfulIntent,
716+
redirect,
717+
} ) {
718+
if ( redirect ) {
719+
// Another order has the same cart content and was paid.
720+
if ( previouslyPaid ) {
721+
return ( window.location = redirect );
722+
}
723+
724+
// Another intent has the equivalent successful status for the order.
725+
if ( previousSuccessfulIntent ) {
726+
return ( window.location = redirect );
727+
}
728+
}
729+
730+
return false;
731+
}
695732
}

client/checkout/api/test/index.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ describe( 'WCPayAPI', () => {
2525
expect( request ).toHaveBeenLastCalledWith( 'https://example.org/', {
2626
_wpnonce: 'foo',
2727
28+
return_url: 'http://localhost/',
2829
user_session: 'qwerty123',
2930
} );
3031
} );

client/checkout/blocks/upe-fields.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,10 @@ const WCPayUPEFields = ( {
272272
onCheckoutAfterProcessingWithSuccess(
273273
( { orderId, processingResponse: { paymentDetails } } ) => {
274274
async function updateIntent() {
275+
if ( api.handleDuplicatePayments( paymentDetails ) ) {
276+
return;
277+
}
278+
275279
await api.updateIntent(
276280
paymentIntentId,
277281
orderId,

client/checkout/classic/upe.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,14 +453,20 @@ jQuery( function ( $ ) {
453453

454454
try {
455455
// Update payment intent with level3 data, customer and maybe setup for future use.
456-
await api.updateIntent(
456+
const updateResponse = await api.updateIntent(
457457
paymentIntentId,
458458
orderId,
459459
savePaymentMethod,
460460
$( '#wcpay_selected_upe_payment_type' ).val(),
461461
$( '#wcpay_payment_country' ).val()
462462
);
463463

464+
if ( updateResponse.data ) {
465+
if ( api.handleDuplicatePayments( updateResponse.data ) ) {
466+
return;
467+
}
468+
}
469+
464470
const { error } = await api.handlePaymentConfirmation(
465471
elements,
466472
{
@@ -535,6 +541,11 @@ jQuery( function ( $ ) {
535541
formFields,
536542
fingerprint ? fingerprint : ''
537543
);
544+
545+
if ( api.handleDuplicatePayments( response ) ) {
546+
return;
547+
}
548+
538549
const redirectUrl = response.redirect_url;
539550
const upeConfig = {
540551
elements,

0 commit comments

Comments
 (0)