Skip to content

Commit

Permalink
chore: add updateSessionData unsupported error
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien2p committed Jan 26, 2023
1 parent f518642 commit 2269ff3
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/medusa/src/services/payment-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,11 +573,17 @@ export default class PaymentProviderService extends TransactionBaseService {

const provider = this.retrieveProvider(paymentSession.provider_id)

// TODO: Waiting discussion output before taking care of the processor support
session.data = await provider
.withTransaction(transactionManager)
.updatePaymentData(paymentSession.data, data)
session.status = paymentSession.status
if (provider instanceof AbstractPaymentProcessor) {
throw new MedusaError(
MedusaError.Types.NOT_ALLOWED,
`Updating payment session data is not supported by the provider ${paymentSession.provider_id}.`
)
} else {
session.data = await provider
.withTransaction(transactionManager)
.updatePaymentData(paymentSession.data, data)
session.status = paymentSession.status
}

const sessionRepo = transactionManager.getCustomRepository(
this.paymentSessionRepository_
Expand Down

0 comments on commit 2269ff3

Please sign in to comment.