Skip to content

Commit

Permalink
Merge branch 'develop' into fix/fatal-error-editing-shortcode-checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
wjrosa authored Jan 24, 2025
2 parents 59ed708 + 88b5007 commit 3fc9496
Show file tree
Hide file tree
Showing 16 changed files with 61 additions and 1,056 deletions.
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

= 9.2.0 - xxxx-xx-xx =
* Fix - Fixes a fatal error when editing the shortcode checkout page with an empty cart on PHP 8.4.
* Fix - Fixes processing of orders through the Pay for Order page when using ECE with Blocks (Store) API.
* Add - Enables the use of Blocks API for Express Checkout Element orders by default.
* Add - Adds a new filter to allow changing the user attributed to an order when paying for it through the Order Pay page.
* Fix - Fixes an error with the fingerprint property setting when using the legacy checkout.
* Fix - Fixes order attribution data for the Express Checkout Element when using the Blocks API to process.
Expand All @@ -12,6 +14,7 @@
* Add - Support zero-amount refunds.
* Fix - A potential fix to prevent duplicate charges.
* Fix - Improve product page caching when Express Payment buttons are not enabled.
* Fix - Allow editing uncaptured orders but show a warning about the possible failure scenario.
* Fix - Error when changing subscription payment method to a 3D Secure card while using a custom checkout endpoint.

= 9.1.1 - 2025-01-10 =
Expand Down
30 changes: 1 addition & 29 deletions client/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,34 +504,6 @@ export default class WCStripeAPI {
* @return {Promise} Promise for the request to the server.
*/
expressCheckoutECECreateOrder( paymentData ) {
return this.request( getExpressCheckoutAjaxURL( 'create_order' ), {
_wpnonce: getExpressCheckoutData( 'nonce' )?.checkout,
...getRequiredFieldDataFromCheckoutForm( paymentData ),
} );
}

/**
* Pays for an order based on the Express Checkout payment method.
*
* @param {number} order The order ID.
* @param {Object} paymentData Order data.
* @return {Promise} Promise for the request to the server.
*/
expressCheckoutECEPayForOrder( order, paymentData ) {
return this.request( getExpressCheckoutAjaxURL( 'pay_for_order' ), {
_wpnonce: getExpressCheckoutData( 'nonce' )?.pay_for_order,
order,
...paymentData,
} );
}

/**
* Creates order based on Express Checkout ECE payment method.
*
* @param {Object} paymentData Order data.
* @return {Promise} Promise for the request to the server.
*/
expressCheckoutECECreateOrderForBlocksAPI( paymentData ) {
return this.postToBlocksAPI( '/wc/store/v1/checkout', {
...getRequiredFieldDataFromCheckoutForm( paymentData ),
} );
Expand All @@ -544,7 +516,7 @@ export default class WCStripeAPI {
* @param {Object} paymentData Order data.
* @return {Promise} Promise for the request to the server.
*/
expressCheckoutECEPayForOrderForBlocksAPI( order, paymentData ) {
expressCheckoutECEPayForOrder( order, paymentData ) {
return this.postToBlocksAPI( `/wc/store/v1/checkout/${ order }`, {
...paymentData,
} );
Expand Down
11 changes: 0 additions & 11 deletions client/blocks/express-checkout/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
onClickHandler,
onCompletePaymentHandler,
onConfirmHandler,
onConfirmHandlerForBlocksAPI,
} from 'wcstripe/express-checkout/event-handler';
import {
displayExpressCheckoutNotice,
Expand Down Expand Up @@ -118,16 +117,6 @@ export const useExpressCheckout = ( {
);

const onConfirm = async ( event ) => {
if ( getExpressCheckoutData( 'use_blocks_api' ) ) {
return await onConfirmHandlerForBlocksAPI(
api,
stripe,
elements,
completePayment,
abortPayment,
event
);
}
return await onConfirmHandler(
api,
stripe,
Expand Down
12 changes: 0 additions & 12 deletions client/entrypoints/express-checkout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
onClickHandler,
onCompletePaymentHandler,
onConfirmHandler,
onConfirmHandlerForBlocksAPI,
onReadyHandler,
shippingAddressChangeHandler,
shippingRateChangeHandler,
Expand Down Expand Up @@ -235,17 +234,6 @@ jQuery( function ( $ ) {

eceButton.on( 'confirm', async ( event ) => {
const order = options.order ? options.order : 0;
if ( getExpressCheckoutData( 'use_blocks_api' ) ) {
return await onConfirmHandlerForBlocksAPI(
api,
api.getStripe(),
elements,
wcStripeECE.completePayment,
wcStripeECE.abortPayment,
event,
order
);
}
return await onConfirmHandler(
api,
api.getStripe(),
Expand Down
Loading

0 comments on commit 3fc9496

Please sign in to comment.