feat: Add support for managing account holder in payment module (#11015)

This commit is contained in:
Stevche Radevski
2025-01-28 08:55:15 +01:00
committed by GitHub
parent a37a9c8023
commit 59cbc0ec77
29 changed files with 1328 additions and 803 deletions
@@ -11,19 +11,13 @@ export const POST = async (
res: MedusaResponse<HttpTypes.StorePaymentCollectionResponse>
) => {
const collectionId = req.params.id
const { context = {}, data, provider_id } = req.body
const { provider_id, data } = req.body
// If the customer is logged in, we auto-assign them to the payment collection
if (req.auth_context?.actor_id) {
;(context as any).customer = {
id: req.auth_context?.actor_id,
}
}
const workflowInput = {
payment_collection_id: collectionId,
provider_id: provider_id,
customer_id: req.auth_context?.actor_id,
data,
context,
}
await createPaymentSessionsWorkflow(req.scope).run({
@@ -12,7 +12,6 @@ export type StoreCreatePaymentSessionType = z.infer<
export const StoreCreatePaymentSession = z
.object({
provider_id: z.string(),
context: z.record(z.unknown()).optional(),
data: z.record(z.unknown()).optional(),
})
.strict()