PaymentProviderService
Helps retrieve payment providers
Properties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>manager_
EntityManagerRequiredthrowFromPaymentProcessorError
anyRequiredtransactionManager_
undefined | EntityManagerRequiredAccessors
activeManager_
Returns
EntityManager
EntityManagerRequiredpaymentService_
Returns
Methods
atomicPhase_
Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created.
Parameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise
Promise<TResult>RequiredauthorizePayment
Parameters
context
Record<string, unknown>RequiredReturns
buildPaymentProcessorContext
Build the create session context for both legacy and new API
Parameters
Returns
Cart & PaymentContext
Cart & PaymentContextcancelPayment
Parameters
Returns
capturePayment
Parameters
Returns
createPayment
Parameters
Returns
createSession
**createSession**(providerId, cart): Promise<[PaymentSession](/references/js-client/internal/classes/internal.PaymentSession)>
Parameters
providerId
stringRequiredReturns
Deprecated
**createSession**(sessionInput): Promise<[PaymentSession](/references/js-client/internal/classes/internal.PaymentSession)>
Creates a payment session with the given provider.
Parameters
Returns
deleteSession
Parameters
Returns
getStatus
Parameters
Returns
list
Returns
listPayments
List all the payments according to the given selector and config.
Parameters
config
FindConfig<Payment>Returns
processUpdateRequestsData
Process the collected data. Can be used every time we need to process some collected data returned by the provider
Parameters
data
undefined | { customer?: { id?: string } }RequiredReturns
Promise
Promise<void>RequiredrefreshSession
Refreshes a payment session with the given provider. This means, that we delete the current one and create a new.
Parameters
paymentSession
objectRequiredpaymentSession.data
Record<string, unknown>RequiredpaymentSession.id
stringRequiredpaymentSession.provider_id
stringRequiredReturns
refundFromPayment
Parameters
amount
numberRequiredreason
stringRequirednote
stringReturns
refundPayment
Parameters
Returns
registerInstalledProviders
Parameters
providerIds
string[]RequiredReturns
Promise
Promise<void>RequiredretrievePayment
Retrieve a payment entity with the given id.
Parameters
paymentId
stringRequiredrelations
string[]Returns
retrieveProvider
Finds a provider given an id
Parameters
providerId
stringRequiredReturns
TProvider extends AbstractPaymentService ? AbstractPaymentService : TProvider extends AbstractPaymentProcessor ? AbstractPaymentProcessor : any
TProvider extends AbstractPaymentService ? AbstractPaymentService : TProvider extends AbstractPaymentProcessor ? AbstractPaymentProcessor : anyretrieveRefund
Parameters
id
stringRequiredconfig
FindConfig<Refund>Returns
retrieveSession
Return the payment session for the given id.
Parameters
paymentSessionId
stringRequiredrelations
string[]Returns
saveSession
Create or update a Payment session data.
Parameters
providerId
stringRequireddata
objectRequireddata.amount
numberdata.cartId
stringdata.isInitiated
booleandata.isSelected
booleandata.payment_session_id
stringdata.sessionData
Record<string, unknown>Requireddata.status
PaymentSessionStatusReturns
shouldRetryTransaction_
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
booleanupdatePayment
Parameters
paymentId
stringRequireddata
objectRequireddata.order_id
stringdata.swap_id
stringReturns
updateSession
Update a payment session with the given provider.
Parameters
paymentSession
objectRequiredpaymentSession.data
Record<string, unknown>RequiredpaymentSession.id
stringRequiredpaymentSession.provider_id
stringRequiredReturns
updateSessionData
Parameters
data
Record<string, unknown>RequiredReturns
withTransaction
Parameters
transactionManager
EntityManager