-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix pay for order with blocks API on ECE (#3760)
* Enabling Blocks API for ECE by default * Changelog and readme entries * Deprecating method instead of removing it * Deprecating the order creation method * Deprecated the pay for order endpoint * Fix pay for order with blocks API on ECE * Changelog and readme entries * Removing unused function * Fix tests
- Loading branch information
Showing
6 changed files
with
5 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
import { | ||
normalizeLineItems, | ||
normalizeOrderData, | ||
normalizePayForOrderData, | ||
normalizeShippingAddress, | ||
} from '../normalize'; | ||
|
||
|
@@ -343,92 +342,6 @@ describe( 'Express checkout normalization', () => { | |
} ); | ||
} ); | ||
|
||
describe( 'normalizePayForOrderData', () => { | ||
test( 'should normalize pay for order data with complete event and paymentMethodId', () => { | ||
const event = { | ||
billingDetails: { | ||
name: 'John Doe', | ||
email: '[email protected]', | ||
address: { | ||
organization: 'Some Company', | ||
country: 'US', | ||
line1: '123 Main St', | ||
line2: 'Apt 4B', | ||
city: 'New York', | ||
state: 'NY', | ||
postal_code: '10001', | ||
}, | ||
phone: '(123) 456-7890', | ||
}, | ||
shippingAddress: { | ||
name: 'John Doe', | ||
organization: 'Some Company', | ||
address: { | ||
country: 'US', | ||
line1: '123 Main St', | ||
line2: 'Apt 4B', | ||
city: 'New York', | ||
state: 'NY', | ||
postal_code: '10001', | ||
}, | ||
}, | ||
shippingRate: { id: 'rate_1' }, | ||
expressPaymentType: 'express', | ||
}; | ||
|
||
expect( normalizePayForOrderData( event, 'pm_123456' ) ).toEqual( { | ||
payment_data: [ | ||
{ | ||
key: 'payment_method', | ||
value: 'stripe', | ||
}, | ||
{ | ||
key: 'wc-stripe-payment-method', | ||
value: 'pm_123456', | ||
}, | ||
{ | ||
key: 'express_payment_type', | ||
value: 'express', | ||
}, | ||
{ | ||
key: 'wc-stripe-is-deferred-intent', | ||
value: true, | ||
}, | ||
], | ||
payment_method: 'stripe', | ||
} ); | ||
} ); | ||
|
||
test( 'should normalize pay for order data with empty event and empty payment method', () => { | ||
const event = {}; | ||
const paymentMethodId = ''; | ||
|
||
expect( | ||
normalizePayForOrderData( event, paymentMethodId ) | ||
).toEqual( { | ||
payment_data: [ | ||
{ | ||
key: 'payment_method', | ||
value: 'stripe', | ||
}, | ||
{ | ||
key: 'wc-stripe-payment-method', | ||
value: '', | ||
}, | ||
{ | ||
key: 'express_payment_type', | ||
value: undefined, | ||
}, | ||
{ | ||
key: 'wc-stripe-is-deferred-intent', | ||
value: true, | ||
}, | ||
], | ||
payment_method: 'stripe', | ||
} ); | ||
} ); | ||
} ); | ||
|
||
describe( 'normalizeShippingAddress', () => { | ||
test( 'should normalize shipping address with all fields present', () => { | ||
const shippingAddress = { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters