PaymentProviderService
Helps retrieve payment providers
constructor
Parameters
container
InjectedDependenciesRequiredProperties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>container_
InjectedDependenciesRequiredfeatureFlagRouter_
FlagRouterRequiredmanager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequiredAccessors
activeManager_
Returns
EntityManager
EntityManagerRequiredpaymentService_
Returns
PaymentService
objectRequiredMethods
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.
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>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
data
CreatePaymentInputRequiredReturns
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
deleteSession
Parameters
Returns
getStatus
Parameters
Returns
list
Returns
listPayments
List all the payments according to the given selector and config.
Parameters
Returns
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>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
stringRequiredsessionInput
PaymentSessionInputRequiredReturns
refundFromPayment
Parameters
Returns
refundPayment
Parameters
Returns
registerInstalledProviders
Parameters
providerIds
string[]RequiredReturns
Promise
Promise<void>RequiredretrievePayment
Retrieve a payment entity with the given id.
Parameters
paymentId
stringRequiredrelations
string[]RequiredDefault: []
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 : anyretrieveRefund
Parameters
id
stringRequiredDefault: {}
Returns
retrieveSession
Return the payment session for the given id.
Parameters
paymentSessionId
stringRequiredrelations
string[]RequiredDefault: []
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> | objectRequiredReturns
boolean
booleanthrowFromPaymentProcessorError
Parameters
Returns
void
voidupdatePayment
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
EntityManagerReturns
PaymentProviderService
objectRequired