Skip to main content
Skip to main content

PaymentService

Properties

__configModule__Record<string, unknown>
__container__anyRequired
__moduleDeclaration__Record<string, unknown>
eventBusService_EventBusServiceRequired
manager_EntityManagerRequired
paymentProviderService_PaymentProviderServiceRequired
paymentRepository_Repository<Payment>Required
transactionManager_undefined | EntityManagerRequired
EventsobjectRequired
Events.CREATEDstringRequired
Events.PAYMENT_CAPTUREDstringRequired
Events.PAYMENT_CAPTURE_FAILEDstringRequired
Events.REFUND_CREATEDstringRequired
Events.REFUND_FAILEDstringRequired
Events.UPDATEDstringRequired

Accessors

activeManager_

Inherited from

TransactionBaseService.activeManager_

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>Required
the transactional work to be done
isolationOrErrorHandlerIsolationLevel | (error: TError) => Promise<void | TResult>
the isolation level to be used for the work.
maybeErrorHandlerOrDontFail(error: TError) => Promise<void | TResult>
Potential error handler
Returns
PromisePromise<TResult>Required
the result of the transactional work

capture

Captures a payment.

Parameters
paymentOrIdstring | PaymentRequired
the id or the class instance of the payment
Returns
PromisePromise<Payment>Required
the payment captured.

create

Created a new payment.

Parameters
paymentInputPaymentDataInputRequired
info to create the payment
Returns
PromisePromise<Payment>Required
the payment created.

refund

refunds a payment.

Parameters
paymentOrIdstring | PaymentRequired
the id or the class instance of the payment
amountnumberRequired
the amount to be refunded from the payment
reasonstringRequired
the refund reason
notestring
additional note of the refund
Returns
PromisePromise<Refund>Required
the refund created.

retrieve

Retrieves a payment by id.

Parameters
paymentIdstringRequired
the id of the payment
the config to retrieve the payment
Returns
PromisePromise<Payment>Required
the payment.

shouldRetryTransaction_

Parameters
errRecord<string, unknown> | { code: string }Required
Returns
booleanboolean

update

Updates a payment in order to link it to an order or a swap.

Parameters
paymentIdstringRequired
the id of the payment
dataobjectRequired
order_id or swap_id to link the payment
data.order_idstring
data.swap_idstring
Returns
PromisePromise<Payment>Required
the payment updated.

withTransaction

Parameters
transactionManagerEntityManager
Returns
defaultPaymentServiceRequired
Was this section helpful?