chore(medusa,core-flows): cart payment collection link (#8457)
This commit is contained in:
1 parent
decd830474
commit
5125d1328d
16 files changed
+249
-211
No files matched your search
@@ -6,7 +6,6 @@ import {
|
||||
deleteLineItemsStepId,
|
||||
deleteLineItemsWorkflow,
|
||||
findOrCreateCustomerStepId,
|
||||
linkCartAndPaymentCollectionsStepId,
|
||||
listShippingOptionsForCartWorkflow,
|
||||
refreshPaymentCollectionForCartWorkflow,
|
||||
updateLineItemInCartWorkflow,
|
||||
@@ -1143,9 +1142,6 @@ medusaIntegrationTestRunner({
|
||||
await createPaymentCollectionForCartWorkflow(appContainer).run({
|
||||
input: {
|
||||
cart_id: cart.id,
|
||||
region_id: defaultRegion.id,
|
||||
currency_code: "dkk",
|
||||
amount: 5000,
|
||||
},
|
||||
throwOnError: false,
|
||||
})
|
||||
@@ -1182,17 +1178,13 @@ medusaIntegrationTestRunner({
|
||||
const workflow =
|
||||
createPaymentCollectionForCartWorkflow(appContainer)
|
||||
|
||||
workflow.appendAction(
|
||||
"throw",
|
||||
linkCartAndPaymentCollectionsStepId,
|
||||
{
|
||||
invoke: async function failStep() {
|
||||
throw new Error(
|
||||
`Failed to do something after linking cart and payment collection`
|
||||
)
|
||||
},
|
||||
}
|
||||
)
|
||||
workflow.addAction("throw", {
|
||||
invoke: async function failStep() {
|
||||
throw new Error(
|
||||
`Failed to do something after linking cart and payment collection`
|
||||
)
|
||||
},
|
||||
})
|
||||
|
||||
const region = await regionModuleService.createRegions({
|
||||
name: "US",
|
||||
@@ -1214,9 +1206,6 @@ medusaIntegrationTestRunner({
|
||||
const { errors } = await workflow.run({
|
||||
input: {
|
||||
cart_id: cart.id,
|
||||
region_id: region.id,
|
||||
currency_code: "usd",
|
||||
amount: 5000,
|
||||
},
|
||||
throwOnError: false,
|
||||
})
|
||||
@@ -1280,7 +1269,7 @@ medusaIntegrationTestRunner({
|
||||
|
||||
const paymentCollection =
|
||||
await paymentModule.createPaymentCollections({
|
||||
amount: 5000,
|
||||
amount: 5001,
|
||||
currency_code: "dkk",
|
||||
region_id: defaultRegion.id,
|
||||
})
|
||||
@@ -1288,7 +1277,7 @@ medusaIntegrationTestRunner({
|
||||
const paymentSession = await paymentModule.createPaymentSession(
|
||||
paymentCollection.id,
|
||||
{
|
||||
amount: 5000,
|
||||
amount: 5001,
|
||||
currency_code: "dkk",
|
||||
data: {},
|
||||
provider_id: "pp_system_default",
|
||||
|
||||
@@ -1400,7 +1400,7 @@ medusaIntegrationTestRunner({
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
code: "PROMOTION_APPLIED",
|
||||
amount: 180,
|
||||
amount: 177.86561264822134,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
@@ -1414,7 +1414,7 @@ medusaIntegrationTestRunner({
|
||||
expect.objectContaining({
|
||||
id: expect.not.stringContaining(lineItemAdjustment.id),
|
||||
code: "PROMOTION_APPLIED",
|
||||
amount: 120,
|
||||
amount: 122.13438735177866,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
@@ -1542,10 +1542,7 @@ medusaIntegrationTestRunner({
|
||||
})
|
||||
|
||||
const response = await api.post(`/store/payment-collections`, {
|
||||
region_id: region.id,
|
||||
cart_id: cart.id,
|
||||
amount: 0,
|
||||
currency_code: cart.currency_code,
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
@@ -1570,18 +1567,12 @@ medusaIntegrationTestRunner({
|
||||
|
||||
const firstCollection = (
|
||||
await api.post(`/store/payment-collections`, {
|
||||
region_id: region.id,
|
||||
cart_id: cart.id,
|
||||
amount: 0,
|
||||
currency_code: cart.currency_code,
|
||||
})
|
||||
).data.payment_collection
|
||||
|
||||
const response = await api.post(`/store/payment-collections`, {
|
||||
region_id: region.id,
|
||||
cart_id: cart.id,
|
||||
amount: 0,
|
||||
currency_code: cart.currency_code,
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
@@ -1608,19 +1599,13 @@ medusaIntegrationTestRunner({
|
||||
|
||||
const firstCollection = (
|
||||
await api.post(`/store/payment-collections`, {
|
||||
region_id: region.id,
|
||||
cart_id: firstCart.id,
|
||||
amount: 0,
|
||||
currency_code: firstCart.currency_code,
|
||||
})
|
||||
).data.payment_collection
|
||||
|
||||
const secondCollection = (
|
||||
await api.post(`/store/payment-collections`, {
|
||||
region_id: region.id,
|
||||
cart_id: secondCart.id,
|
||||
amount: 0,
|
||||
currency_code: secondCart.currency_code,
|
||||
})
|
||||
).data.payment_collection
|
||||
|
||||
@@ -2008,9 +1993,6 @@ medusaIntegrationTestRunner({
|
||||
const paymentCollection = (
|
||||
await api.post(`/store/payment-collections`, {
|
||||
cart_id: cart.id,
|
||||
region_id: region.id,
|
||||
currency_code: region.currency_code,
|
||||
amount: cart.total,
|
||||
})
|
||||
).data.payment_collection
|
||||
|
||||
@@ -2140,9 +2122,6 @@ medusaIntegrationTestRunner({
|
||||
|
||||
await api.post(`/store/payment-collections`, {
|
||||
cart_id: cart.id,
|
||||
region_id: region.id,
|
||||
currency_code: region.currency_code,
|
||||
amount: cart.total,
|
||||
})
|
||||
|
||||
const error = await api
|
||||
@@ -2192,9 +2171,6 @@ medusaIntegrationTestRunner({
|
||||
const paymentCollection = (
|
||||
await api.post(`/store/payment-collections`, {
|
||||
cart_id: cart.id,
|
||||
region_id: region.id,
|
||||
currency_code: region.currency_code,
|
||||
amount: cart.total,
|
||||
})
|
||||
).data.payment_collection
|
||||
|
||||
|
||||
Reference in new issue
Block a user