feat(dashboard,core-flows,js-sdk,types,link-modules,payment): ability to copy payment link (#8630)
what: - enables a button to create a payment link when a payment delta is present - api to delete order payment collection - adds a pending amount to payment collections Note: Not the happiest with the decision on when to create a payment collection and when not to. The code should programatically create or delete payment collections currently to generate the right collection for the payment delta. Adding a more specific flow to create and manage a payment collection will help reduce this burden from the code path and onto CX/merchant. Another issue I found is that the payment collection status doesn't get updated when payment is complete as it still gets stuck to "authorized" state https://github.com/user-attachments/assets/037a10f9-3621-43c2-94ba-1ada4b0a041b
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { deleteOrderPaymentCollections } from "@medusajs/core-flows"
|
||||
import { DeleteResponse } from "@medusajs/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../types/routing"
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
res: MedusaResponse<DeleteResponse<"payment-collection">>
|
||||
) => {
|
||||
const { id } = req.params
|
||||
|
||||
await deleteOrderPaymentCollections(req.scope).run({
|
||||
input: { id },
|
||||
})
|
||||
|
||||
res.status(200).json({
|
||||
id,
|
||||
object: "payment-collection",
|
||||
deleted: true,
|
||||
})
|
||||
}
|
||||
@@ -19,4 +19,9 @@ export const adminPaymentCollectionsMiddlewares: MiddlewareRoute[] = [
|
||||
),
|
||||
],
|
||||
},
|
||||
{
|
||||
method: ["DELETE"],
|
||||
matcher: "/admin/payment-collections/:id",
|
||||
middlewares: [],
|
||||
},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user