feat(medusa,medusa-react): PaymentCollection support (#2659)
* chore: medusa react, order edit complete fix and single payment session
This commit is contained in:
committed by
GitHub
parent
42d9c7222b
commit
15c667fbd3
@@ -27,7 +27,7 @@ describe("[MEDUSA_FF_ORDER_EDITING] /admin/payment-collections", () => {
|
||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||
const [process, connection] = await startServerWithEnvironment({
|
||||
cwd,
|
||||
env: { MEDUSA_FF_ORDER_EDITING: true },
|
||||
env: { MEDUSA_FF_ORDER_EDITING: true }
|
||||
})
|
||||
dbConnection = connection
|
||||
medusaProcess = process
|
||||
|
||||
@@ -66,14 +66,20 @@ describe("[MEDUSA_FF_ORDER_EDITING] /admin/payment", () => {
|
||||
const api = useApi()
|
||||
|
||||
// create payment session
|
||||
await api.post(`/store/payment-collections/${payCol.id}/sessions`, {
|
||||
sessions: {
|
||||
const payColRes = await api.post(
|
||||
`/store/payment-collections/${payCol.id}/sessions`,
|
||||
{
|
||||
provider_id: "test-pay",
|
||||
customer_id: "customer",
|
||||
amount: 10000,
|
||||
},
|
||||
})
|
||||
await api.post(`/store/payment-collections/${payCol.id}/authorize`)
|
||||
}
|
||||
)
|
||||
await api.post(
|
||||
`/store/payment-collections/${payCol.id}/sessions/batch/authorize`,
|
||||
{
|
||||
session_ids: payColRes.data.payment_collection.payment_sessions.map(
|
||||
({ id }) => id
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
const paymentCollections = await api.get(
|
||||
`/admin/payment-collections/${payCol.id}`,
|
||||
@@ -85,6 +91,7 @@ describe("[MEDUSA_FF_ORDER_EDITING] /admin/payment", () => {
|
||||
)
|
||||
|
||||
const payment = paymentCollections.data.payment_collection.payments[0]
|
||||
|
||||
expect(payment.captured_at).toBe(null)
|
||||
|
||||
const response = await api.post(
|
||||
@@ -107,14 +114,20 @@ describe("[MEDUSA_FF_ORDER_EDITING] /admin/payment", () => {
|
||||
const api = useApi()
|
||||
|
||||
// create payment session
|
||||
await api.post(`/store/payment-collections/${payCol.id}/sessions`, {
|
||||
sessions: {
|
||||
const payColRes = await api.post(
|
||||
`/store/payment-collections/${payCol.id}/sessions`,
|
||||
{
|
||||
provider_id: "test-pay",
|
||||
customer_id: "customer",
|
||||
amount: 10000,
|
||||
},
|
||||
})
|
||||
await api.post(`/store/payment-collections/${payCol.id}/authorize`)
|
||||
}
|
||||
)
|
||||
await api.post(
|
||||
`/store/payment-collections/${payCol.id}/sessions/batch/authorize`,
|
||||
{
|
||||
session_ids: payColRes.data.payment_collection.payment_sessions.map(
|
||||
({ id }) => id
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
const paymentCollections = await api.get(
|
||||
`/admin/payment-collections/${payCol.id}`,
|
||||
|
||||
Reference in New Issue
Block a user