Skip to content

Commit

Permalink
rename of anonymous method name
Browse files Browse the repository at this point in the history
  • Loading branch information
frosso committed Jul 16, 2024
1 parent 6b124c2 commit a2f47bc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions client/tokenized-payment-request/cart-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ export default class PaymentRequestCartApi {
*
* @return {Promise} Cart response object.
*/
async createAnonymousCart() {
async createSeparateCart() {
const response = await this._request( {
method: 'GET',
path: '/wc/store/v1/cart',
// parse: false to ensure we can get the response headers
parse: false,
headers: {
// sending an empty value, so that the custom session handler is leveraged.
// sending an empty value, so that the custom session handler is leveraged to create a separate cart.
'X-WooPayments-Tokenized-Cart-Session': '',
},
} );
Expand Down
4 changes: 2 additions & 2 deletions client/tokenized-payment-request/payment-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default class WooPaymentsPaymentRequest {
// so that we don't affect the products in the main cart.
// On cart, checkout, place order pages we instead use the cart itself.
if ( getPaymentRequestData( 'button_context' ) === 'product' ) {
await this.paymentRequestCartApi.createAnonymousCart();
await this.paymentRequestCartApi.createSeparateCart();
}

const paymentRequestButton = this.wcpayApi
Expand Down Expand Up @@ -432,7 +432,7 @@ export default class WooPaymentsPaymentRequest {
// to avoid scenarios where the stock for a product with limited (or low) availability is added to the cart,
// preventing other customers from purchasing.
const temporaryCart = new PaymentRequestCartApi();
await temporaryCart.createAnonymousCart();
await temporaryCart.createSeparateCart();

const cartData = await temporaryCart.addProductToCart();

Expand Down
2 changes: 1 addition & 1 deletion client/tokenized-payment-request/test/cart-api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe( 'PaymentRequestCartApi', () => {
const api = new PaymentRequestCartApi();
const anotherApi = new PaymentRequestCartApi();

await api.createAnonymousCart();
await api.createSeparateCart();

expect( apiFetch ).toHaveBeenCalledWith(
expect.objectContaining( {
Expand Down

0 comments on commit a2f47bc

Please sign in to comment.