fix: Allow setting the status of a payment session when updating (#12809)

This commit is contained in:
Stevche Radevski
2025-06-24 13:15:10 +02:00
committed by GitHub
parent 474e97c9be
commit c0807f5496
6 changed files with 52 additions and 14 deletions

View File

@@ -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
)