PaymentProviderService
internal.internal.PaymentProviderService
Helps retrieve payment providers
Properties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>manager_
EntityManagerRequiredthrowFromPaymentProcessorError
anyRequiredtransactionManager_
undefined | EntityManagerRequiredAccessors
activeManager_
Protected
get
activeManager_(): EntityManager
Returns
EntityManager
EntityManager
EntityManagerRequiredInherited from
TransactionBaseService.activeManager_
paymentService_
Protected
get
paymentService_(): PaymentService
Returns
Methods
atomicPhase_
Protected
atomicPhase_<TResult
, TError
>(work
, isolationOrErrorHandler?
, maybeErrorHandlerOrDontFail?
): Promise
<TResult
>
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.
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise
<TResult
>
Promise
Promise<TResult>RequiredInherited from
TransactionBaseService.atomicPhase_
authorizePayment
authorizePayment(paymentSession
, context
): Promise
<undefined
| PaymentSession
>
Parameters
context
Record<string, unknown>RequiredReturns
Promise
<undefined
| PaymentSession
>
buildPaymentProcessorContext
Protected
buildPaymentProcessorContext(cartOrData
): Cart
& PaymentContext
Build the create session context for both legacy and new API
Parameters
Returns
[`Cart`](/references/js-client/internal/classes/admin_collections.internal.Cart) & [`PaymentContext`](/references/js-client/internal/modules/admin_discounts.internal.internal#paymentcontext)
Cart & PaymentContextcancelPayment
cancelPayment(paymentObj
): Promise
<Payment
>
Parameters
Returns
Promise
<Payment
>
capturePayment
capturePayment(paymentObj
): Promise
<Payment
>
Parameters
Returns
Promise
<Payment
>
createPayment
createPayment(data
): Promise
<Payment
>
Parameters
Returns
Promise
<Payment
>
createSession
createSession(providerId
, cart
): Promise
<PaymentSession
>
Parameters
providerId
stringRequiredReturns
Promise
<PaymentSession
>
Deprecated
createSession(sessionInput
): Promise
<PaymentSession
>
Creates a payment session with the given provider.
Parameters
Returns
Promise
<PaymentSession
>
deleteSession
deleteSession(paymentSession
): Promise
<undefined
| PaymentSession
>
Parameters
Returns
Promise
<undefined
| PaymentSession
>
getStatus
getStatus(payment
): Promise
<PaymentSessionStatus
>
Parameters
Returns
Promise
<PaymentSessionStatus
>
list
list(): Promise
<PaymentProvider
[]>
Returns
Promise
<PaymentProvider
[]>
listPayments
listPayments(selector
, config?
): Promise
<Payment
[]>
List all the payments according to the given selector and config.
Parameters
config
FindConfig<Payment>Returns
Promise
<Payment
[]>
processUpdateRequestsData
Protected
processUpdateRequestsData(data
, paymentResponse
): Promise
<void
>
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
<void
>
Promise
Promise<void>RequiredrefreshSession
refreshSession(paymentSession
, sessionInput
): Promise
<PaymentSession
>
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
Promise
<PaymentSession
>
the payment session
refundFromPayment
refundFromPayment(payment
, amount
, reason
, note?
): Promise
<Refund
>
Parameters
Returns
Promise
<Refund
>
refundPayment
refundPayment(payObjs
, amount
, reason
, note?
): Promise
<Refund
>
Parameters
Returns
Promise
<Refund
>
registerInstalledProviders
registerInstalledProviders(providerIds
): Promise
<void
>
Parameters
providerIds
string[]RequiredReturns
Promise
<void
>
Promise
Promise<void>RequiredretrievePayment
retrievePayment(paymentId
, relations?
): Promise
<Payment
>
Retrieve a payment entity with the given id.
Parameters
paymentId
stringRequiredrelations
string[]Returns
Promise
<Payment
>
retrieveProvider
retrieveProvider<TProvider
>(providerId
): TProvider
extends AbstractPaymentService
? AbstractPaymentService
: TProvider
extends AbstractPaymentProcessor
? AbstractPaymentProcessor
: any
Finds a provider given an id
TProvider
unknownRequiredParameters
providerId
stringRequiredReturns
TProvider
extends AbstractPaymentService
? AbstractPaymentService
: TProvider
extends AbstractPaymentProcessor
? AbstractPaymentProcessor
: any
`TProvider` extends [`AbstractPaymentService`](/references/js-client/internal/classes/admin_discounts.internal.internal.AbstractPaymentService) ? [`AbstractPaymentService`](/references/js-client/internal/classes/admin_discounts.internal.internal.AbstractPaymentService) : `TProvider` extends [`AbstractPaymentProcessor`](/references/js-client/internal/classes/admin_discounts.internal.internal.AbstractPaymentProcessor) ? [`AbstractPaymentProcessor`](/references/js-client/internal/classes/admin_discounts.internal.internal.AbstractPaymentProcessor) : `any`
TProvider extends AbstractPaymentService ? AbstractPaymentService : TProvider extends AbstractPaymentProcessor ? AbstractPaymentProcessor : anyretrieveRefund
retrieveRefund(id
, config?
): Promise
<Refund
>
Parameters
id
stringRequiredconfig
FindConfig<Refund>Returns
Promise
<Refund
>
retrieveSession
retrieveSession(paymentSessionId
, relations?
): Promise
<PaymentSession
>
Return the payment session for the given id.
Parameters
paymentSessionId
stringRequiredrelations
string[]Returns
Promise
<PaymentSession
>
saveSession
Protected
saveSession(providerId
, data
): Promise
<PaymentSession
>
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
Promise
<PaymentSession
>
shouldRetryTransaction_
Protected
shouldRetryTransaction_(err
): boolean
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
boolean
booleanInherited from
TransactionBaseService.shouldRetryTransaction_
updatePayment
updatePayment(paymentId
, data
): Promise
<Payment
>
Parameters
paymentId
stringRequireddata
objectRequireddata.order_id
stringdata.swap_id
stringReturns
Promise
<Payment
>
updateSession
updateSession(paymentSession
, sessionInput
): Promise
<PaymentSession
>
Update a payment session with the given provider.
Parameters
paymentSession
objectRequiredpaymentSession.data
Record<string, unknown>RequiredpaymentSession.id
stringRequiredpaymentSession.provider_id
stringRequiredReturns
Promise
<PaymentSession
>
the payment session
updateSessionData
updateSessionData(paymentSession
, data
): Promise
<PaymentSession
>
Parameters
data
Record<string, unknown>RequiredReturns
Promise
<PaymentSession
>
withTransaction
withTransaction(transactionManager?
): PaymentProviderService
Parameters
transactionManager
EntityManager