Skip to main content
Skip to main content

PaymentService

admin/discounts.internal.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_

Protected get activeManager_(): EntityManager

Returns

EntityManager

EntityManagerEntityManagerRequired

Inherited from

TransactionBaseService.activeManager_

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.

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

Promise<TResult>

PromisePromise<TResult>Required
the result of the transactional work

Inherited from

TransactionBaseService.atomicPhase_


capture

capture(paymentOrId): Promise<Payment>

Captures a payment.

Parameters

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

Returns

Promise<Payment>

PromisePromise<Payment>Required
the payment captured.

create

create(paymentInput): Promise<Payment>

Created a new payment.

Parameters

paymentInputPaymentDataInputRequired
info to create the payment

Returns

Promise<Payment>

PromisePromise<Payment>Required
the payment created.

refund

refund(paymentOrId, amount, reason, note?): Promise<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

Promise<Refund>

PromisePromise<Refund>Required
the refund created.

retrieve

retrieve(paymentId, config?): Promise<Payment>

Retrieves a payment by id.

Parameters

paymentIdstringRequired
the id of the payment
the config to retrieve the payment

Returns

Promise<Payment>

PromisePromise<Payment>Required
the payment.

shouldRetryTransaction_

Protected shouldRetryTransaction_(err): boolean

Parameters

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

Returns

boolean

booleanboolean

Inherited from

TransactionBaseService.shouldRetryTransaction_


update

update(paymentId, data): Promise<Payment>

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

Promise<Payment>

PromisePromise<Payment>Required
the payment updated.

withTransaction

withTransaction(transactionManager?): PaymentService

Parameters

transactionManagerEntityManager

Returns

PaymentService

defaultPaymentServiceRequired

Inherited from

TransactionBaseService.withTransaction

Was this section helpful?