Skip to content

Commit

Permalink
Merge branch 'develop' into add/prb-load-tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
malithsen authored Jan 2, 2024
2 parents 2c56a25 + 8af9441 commit 301048f
Show file tree
Hide file tree
Showing 135 changed files with 5,235 additions and 6,903 deletions.
4 changes: 4 additions & 0 deletions changelog/7588-express-checkout-utilities
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Introduce WC_Payments_Express_Checkout_Button_Utils class.
4 changes: 4 additions & 0 deletions changelog/add-334-test-mode-notice-order-details
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: add

Add test mode notice in page order detail.
4 changes: 4 additions & 0 deletions changelog/add-7248-refund-transaction-from-details-page
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: add

Add refund controls to transaction details view
4 changes: 4 additions & 0 deletions changelog/add-7846-test-mode-confirm-modal
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: add

Display a Confirmaton Modal on enabling Test Mode
4 changes: 4 additions & 0 deletions changelog/cleanup-upe-checkout-class
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Cleanup the deprecated payment gateway processing - part IV
4 changes: 4 additions & 0 deletions changelog/cleanup-upe-gateways-II
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Cleanup the deprecated payment gateway processing - part VI
4 changes: 4 additions & 0 deletions changelog/cleanup-upe-gateways-part-1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Cleanup the deprecated payment gateway processing - part V
4 changes: 4 additions & 0 deletions changelog/dev-3468-allow-reset-account-management
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: add

Add Account Management tools with reset account functionality for partially onboarded accounts.
4 changes: 4 additions & 0 deletions changelog/dev-bump-wc-version-8-4-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Bump WC tested up to version to 8.4.0.
4 changes: 4 additions & 0 deletions changelog/fix-6700-remove-currency-sign-modification-code
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fix currency negative sign position on JS rendered amounts
4 changes: 4 additions & 0 deletions changelog/fix-7913-woopay-automatewoo-referrals-integration
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fix WooPay integration with AutomateWoo - Refer a Friend extension.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: Not user-facing: fixes styling bug introduced in develop branch


4 changes: 4 additions & 0 deletions changelog/fix-jsx-account-status-error-messages
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fix account status error messages with links.
5 changes: 5 additions & 0 deletions changelog/fix-test-support-phone
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: Modified the test phone numbers supported by Stripe.


4 changes: 4 additions & 0 deletions changelog/fix-trim-woopay-source-url
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Checkout error when page URL is too long
5 changes: 5 additions & 0 deletions changelog/revert-file-needed-for-plugin-update
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: This is the file revert to avoid failures on plugin update. This is a temporary solution. Both removal & revert happen on develop meaning there is no change to the outside world.


4 changes: 4 additions & 0 deletions changelog/subscriptions-6.6.0-1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Deprecate the WC_Subscriptions_Synchroniser::add_to_recurring_cart_key(). Use WC_Subscriptions_Synchroniser::add_to_recurring_product_grouping_key() instead.
4 changes: 4 additions & 0 deletions changelog/subscriptions-6.6.0-2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Introduce a new wcs_get_subscription_grouping_key() function to generate a unique key for a subscription based on its billing schedule. This function uses the existing recurring cart key concept.
4 changes: 4 additions & 0 deletions changelog/subscriptions-core-6.6.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Updated subscriptions-core to version 6.6.0
4 changes: 4 additions & 0 deletions changelog/subscriptions-core-6.6.0-3
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

Fetch and update the `_cancelled_email_sent` meta in a HPOS compatibile way.
4 changes: 4 additions & 0 deletions changelog/subscriptions-core-6.6.0-4
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

Ensure proper backfilling of subscription metadata (i.e. dates and cache) to the postmeta table when HPOS is enabled and compatibility mode (data syncing) is turned on.
4 changes: 4 additions & 0 deletions changelog/subscriptions-core-6.6.0-5
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

Resolved an issue that would cause undefined $current_page, $max_num_pages, and $paginate variable errors when viewing a page with the subscriptions-shortcode.
4 changes: 4 additions & 0 deletions changelog/subscriptions-core-6.6.0-6
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

When HPOS is enabled and data compatibility mode is turned on, make sure subscription date changes made to postmeta are synced to orders_meta table.
4 changes: 4 additions & 0 deletions changelog/subscriptions-core-6.6.0-7
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

Prevents a PHP fatal error that occurs when the cart contains a renewal order item that no longer exists.
4 changes: 4 additions & 0 deletions changelog/subscriptions-core-6.6.0-8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

When using the checkout block to pay for renewal orders, ensure the order's cart hash is updated to make sure the existing order can be used.
137 changes: 0 additions & 137 deletions client/checkout/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,24 +335,6 @@ export default class WCPayAPI {
};
}

/**
* Creates a setup intent without confirming it.
*
* @return {Promise} The final promise for the request to the server.
*/
initSetupIntent() {
const path = 'init_setup_intent';

return this.request( buildAjaxURL( getConfig( 'wcAjaxUrl' ), path ), {
_ajax_nonce: getConfig( 'createSetupIntentNonce' ),
} ).then( ( response ) => {
if ( ! response.success ) {
throw response.data.error;
}
return response.data;
} );
}

/**
* Sets up an intent based on a payment method.
*
Expand Down Expand Up @@ -389,92 +371,6 @@ export default class WCPayAPI {
} );
}

/**
* Creates an intent based on a payment method.
*
* @param {Object} options Object containing intent optional parameters (fingerprint, paymentMethodType, orderId)
*
* @return {Promise} The final promise for the request to the server.
*/
createIntent( options ) {
const { fingerprint, orderId } = options;
const path = 'create_payment_intent';
const params = {
_ajax_nonce: getConfig( 'createPaymentIntentNonce' ),
'wcpay-fingerprint': fingerprint,
};

if ( orderId ) {
params.wcpay_order_id = orderId;
}

return this.request(
buildAjaxURL( getConfig( 'wcAjaxUrl' ), path ),
params
)
.then( ( response ) => {
if ( ! response.success ) {
throw response.data.error;
}
return response.data;
} )
.catch( ( error ) => {
if ( error.message ) {
throw error;
} else {
// Covers the case of error on the Ajax request.
throw new Error( error.statusText );
}
} );
}

/**
* Updates a payment intent with data from order: customer, level3 data and maybe sets the payment for future use.
*
* @param {string} paymentIntentId The id of the payment intent.
* @param {int} orderId The id of the order.
* @param {string} savePaymentMethod 'yes' if saving.
* @param {string} selectedUPEPaymentType The name of the selected UPE payment type or empty string.
* @param {string?} paymentCountry The payment two-letter iso country code or null.
* @param {string?} fingerprint User fingerprint.
*
* @return {Promise} The final promise for the request to the server.
*/
updateIntent(
paymentIntentId,
orderId,
savePaymentMethod,
selectedUPEPaymentType,
paymentCountry,
fingerprint
) {
const path = 'update_payment_intent';

return this.request( buildAjaxURL( getConfig( 'wcAjaxUrl' ), path ), {
wcpay_order_id: orderId,
wc_payment_intent_id: paymentIntentId,
save_payment_method: savePaymentMethod,
wcpay_selected_upe_payment_type: selectedUPEPaymentType,
wcpay_payment_country: paymentCountry,
_ajax_nonce: getConfig( 'updatePaymentIntentNonce' ),
'wcpay-fingerprint': fingerprint,
} )
.then( ( response ) => {
if ( response.result === 'failure' ) {
throw new Error( response.messages );
}
return response;
} )
.catch( ( error ) => {
if ( error.message ) {
throw error;
} else {
// Covers the case of error on the Ajaxrequest.
throw new Error( error.statusText );
}
} );
}

/**
* Confirm Stripe payment with fallback for rate limit error.
*
Expand Down Expand Up @@ -544,39 +440,6 @@ export default class WCPayAPI {
} );
}

/**
* Process checkout and update payment intent via AJAX.
*
* @param {string} paymentIntentId ID of payment intent to be updated.
* @param {Object} fields Checkout fields.
* @param {string} fingerprint User fingerprint.
* @return {Promise} Promise containing redirect URL for UPE element.
*/
processCheckout( paymentIntentId, fields, fingerprint ) {
return this.request(
buildAjaxURL( getConfig( 'wcAjaxUrl' ), 'checkout', '' ),
{
...fields,
wc_payment_intent_id: paymentIntentId,
'wcpay-fingerprint': fingerprint,
}
)
.then( ( response ) => {
if ( response.result === 'failure' ) {
throw new Error( response.messages );
}
return response;
} )
.catch( ( error ) => {
if ( error.message ) {
throw error;
} else {
// Covers the case of error on the Ajaxrequest.
throw new Error( error.statusText );
}
} );
}

/**
* Submits shipping address to get available shipping options
* from Payment Request button.
Expand Down
66 changes: 0 additions & 66 deletions client/checkout/utils/test/upe.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
getTerms,
getCookieValue,
isWCPayChosen,
getPaymentIntentFromSession,
generateCheckoutEventNames,
getUpeSettings,
getStripeElementOptions,
Expand Down Expand Up @@ -168,71 +167,6 @@ describe( 'UPE checkout utils', () => {
} );
} );

describe( 'getPaymentIntentFromSession', () => {
const paymentMethodsConfig = {
card: {
upePaymentIntentData:
'abcd1234-pi_abc123-pi_abc123_secret_5678xyz',
},
eps: {
upePaymentIntentData: null,
},
};

const cardData = {
clientSecret: 'pi_abc123_secret_5678xyz',
intentId: 'pi_abc123',
};

it( 'should return the correct client secret and intent ID', () => {
Object.defineProperty( document, 'cookie', {
get: () => {
return 'woocommerce_cart_hash=abcd1234;';
},
configurable: true,
} );
expect(
getPaymentIntentFromSession( paymentMethodsConfig, 'card' )
).toEqual( cardData );
} );

it( 'should return an empty object if no payment intent exists', () => {
Object.defineProperty( document, 'cookie', {
get: () => {
return 'woocommerce_cart_hash=abcd1234;';
},
configurable: true,
} );
expect(
getPaymentIntentFromSession( paymentMethodsConfig, 'eps' )
).toEqual( {} );
} );

it( 'should return an empty object if no cart hash exists', () => {
Object.defineProperty( document, 'cookie', {
get: () => {
return 'woocommerce_cart_items=1;';
},
configurable: true,
} );
expect(
getPaymentIntentFromSession( paymentMethodsConfig, 'card' )
).toEqual( {} );
} );

it( 'should return an empty object if the payment intent data does not start with the cart hash', () => {
Object.defineProperty( document, 'cookie', {
get: () => {
return 'woocommerce_cart_hash=xyz9876;';
},
configurable: true,
} );
expect(
getPaymentIntentFromSession( paymentMethodsConfig, 'card' )
).toEqual( {} );
} );
} );

describe( 'getUPESettings', () => {
afterEach( () => {
const checkboxElement = document.getElementById(
Expand Down
Loading

0 comments on commit 301048f

Please sign in to comment.