PaymentProviderService
Helps retrieve payment providers
constructor
Parameters
container
InjectedDependenciesRequiredProperties
manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequired__container__
anyRequiredcontainer_
InjectedDependenciesRequiredfeatureFlagRouter_
FlagRouterRequired__configModule__
Record<string, unknown>__moduleDeclaration__
Record<string, unknown>Accessors
activeManager_
Returns
EntityManager
EntityManagerRequiredpaymentService_
Returns
PaymentService
objectRequiredMethods
withTransaction
Parameters
transactionManager
EntityManagerReturns
this
thisRequiredshouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanRequiredatomicPhase_
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.
Type Parameters
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise
Promise<TResult>RequiredregisterInstalledProviders
Parameters
providerIds
string[]RequiredReturns
Promise
Promise<void>Requiredlist
Returns
retrievePayment
Retrieve a payment entity with the given id.
Parameters
paymentId
stringRequiredrelations
string[]RequiredDefault: []
Returns
listPayments
List all the payments according to the given selector and config.
Parameters
Returns
retrieveSession
Return the payment session for the given id.
Parameters
paymentSessionId
stringRequiredrelations
string[]RequiredDefault: []
Returns
createSession
**createSession**(providerId, cart): Promise<[PaymentSession](/references/entities/classes/PaymentSession)>
Parameters
providerId
stringRequiredReturns
Deprecated
**createSession**(sessionInput): Promise<[PaymentSession](/references/entities/classes/PaymentSession)>
Creates a payment session with the given provider.
Parameters
sessionInput
PaymentSessionInputRequiredReturns
refreshSession
Refreshes a payment session with the given provider. This means, that we delete the current one and create a new.
Parameters
paymentSession
objectRequiredpaymentSession.id
stringRequiredpaymentSession.data
Record<string, unknown>RequiredpaymentSession.provider_id
stringRequiredsessionInput
PaymentSessionInputRequiredReturns
updateSession
Update a payment session with the given provider.
Parameters
paymentSession
objectRequiredpaymentSession.id
stringRequiredpaymentSession.data
Record<string, unknown>RequiredpaymentSession.provider_id
stringRequiredReturns
deleteSession
Parameters
Returns
retrieveProvider
Finds a provider given an id
Type Parameters
TProvider
unknownRequiredParameters
providerId
stringRequiredReturns
TProvider extends AbstractPaymentService ? AbstractPaymentService : TProvider extends AbstractPaymentProcessor ? AbstractPaymentProcessor : any
TProvider extends AbstractPaymentService ? AbstractPaymentService : TProvider extends AbstractPaymentProcessor ? AbstractPaymentProcessor : anyRequiredcreatePayment
Parameters
data
CreatePaymentInputRequiredReturns
updatePayment
Parameters
paymentId
stringRequireddata
objectRequireddata.order_id
stringdata.swap_id
stringReturns
authorizePayment
Parameters
context
Record<string, unknown>RequiredReturns
updateSessionData
Parameters
data
Record<string, unknown>RequiredReturns
cancelPayment
Parameters
Returns
getStatus
Parameters
Returns
capturePayment
Parameters
Returns
refundPayment
Parameters
Returns
refundFromPayment
Parameters
Returns
retrieveRefund
Parameters
id
stringRequiredDefault: {}
Returns
buildPaymentProcessorContext
Build the create session context for both legacy and new API
Parameters
Returns
Cart
objectRequiredPaymentContext
objectRequiredsaveSession
Create or update a Payment session data.
Parameters
providerId
stringRequireddata
objectRequireddata.sessionData
Record<string, unknown>Requireddata.payment_session_id
stringdata.cartId
stringdata.amount
numberdata.isSelected
booleandata.isInitiated
booleandata.status
PaymentSessionStatusReturns
processUpdateRequestsData
Process the collected data. Can be used every time we need to process some collected data returned by the provider
Parameters
data
objectRequiredDefault: {}
data.customer
objectdata.customer.id
stringReturns
Promise
Promise<void>RequiredthrowFromPaymentProcessorError
Parameters
Returns
void
voidRequired