feat: Add support for managing account holder in payment module (#11015)
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user