Skip to main content
Skip to main content

PaymentService

constructor

Parameters

__namedParametersInjectedDependenciesRequired

Properties

manager_EntityManagerRequired
transactionManager_undefined | EntityManagerRequired
__container__anyRequired
eventBusService_EventBusServiceRequired
paymentProviderService_PaymentProviderServiceRequired
paymentRepository_Repository<Payment>Required
EventsobjectRequired
Events.CREATEDstringRequired

Default: "payment.created"

Events.UPDATEDstringRequired

Default: "payment.updated"

Events.PAYMENT_CAPTUREDstringRequired

Default: "payment.payment_captured"

Events.PAYMENT_CAPTURE_FAILEDstringRequired

Default: "payment.payment_capture_failed"

Events.REFUND_CREATEDstringRequired

Default: "payment.payment_refund_created"

Events.REFUND_FAILEDstringRequired

Default: "payment.payment_refund_failed"

__configModule__Record<string, unknown>
__moduleDeclaration__Record<string, unknown>

Accessors

activeManager_

Returns

EntityManagerEntityManagerRequired

Methods

withTransaction

Parameters

transactionManagerEntityManager

Returns

thisthisRequired

shouldRetryTransaction_

Parameters

errRecord<string, unknown> | objectRequired

Returns

booleanbooleanRequired

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

TResultobjectRequired
TErrorobjectRequired

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

retrieve

Retrieves a payment by id.

Parameters

paymentIdstringRequired
the id of the payment
configFindConfig<Payment>Required
the config to retrieve the payment

Default: {}

Returns

PromisePromise<Payment>Required
the payment.

create

Created a new payment.

Parameters

paymentInputPaymentDataInputRequired
info to create the payment

Returns

PromisePromise<Payment>Required
the payment created.

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.

capture

Captures a payment.

Parameters

paymentOrIdstring | PaymentRequired
the id or the class instance of the payment

Returns

PromisePromise<Payment>Required
the payment captured.

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.
Was this section helpful?