fix: Allow setting the status of a payment session when updating (#12809)
This commit is contained in:
@@ -401,6 +401,7 @@ export default class PaymentModuleService
|
||||
currency_code: data.currency_code,
|
||||
context: data.context,
|
||||
data: data.data,
|
||||
metadata: data.metadata,
|
||||
},
|
||||
sharedContext
|
||||
)
|
||||
@@ -415,7 +416,7 @@ export default class PaymentModuleService
|
||||
): Promise<PaymentSessionDTO> {
|
||||
const session = await this.paymentSessionService_.retrieve(
|
||||
data.id,
|
||||
{ select: ["id", "data", "provider_id"] },
|
||||
{ select: ["id", "status", "data", "provider_id"] },
|
||||
sharedContext
|
||||
)
|
||||
|
||||
@@ -435,6 +436,9 @@ export default class PaymentModuleService
|
||||
amount: data.amount,
|
||||
currency_code: data.currency_code,
|
||||
data: providerData.data,
|
||||
// Allow the caller to explicitly set the status (eg. due to a webhook), fallback to the update response, and finally to the existing status.
|
||||
status: data.status ?? providerData.status ?? session.status,
|
||||
metadata: data.metadata,
|
||||
},
|
||||
sharedContext
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user