PaymentService
constructor
Parameters
__namedParametersInjectedDependenciesRequiredProperties
manager_EntityManagerRequiredtransactionManager_undefined | EntityManagerRequired__container__anyRequiredEventsobjectRequiredEvents.CREATEDstringRequiredDefault: "payment.created"
Events.UPDATEDstringRequiredDefault: "payment.updated"
Events.PAYMENT_CAPTUREDstringRequiredDefault: "payment.payment_captured"
Events.PAYMENT_CAPTURE_FAILEDstringRequiredDefault: "payment.payment_capture_failed"
Events.REFUND_CREATEDstringRequiredDefault: "payment.payment_refund_created"
Events.REFUND_FAILEDstringRequiredDefault: "payment.payment_refund_failed"
__configModule__Record<string, unknown>__moduleDeclaration__Record<string, unknown>Accessors
activeManager_
Returns
EntityManagerEntityManagerRequiredMethods
withTransaction
Parameters
transactionManagerEntityManagerReturns
thisthisRequiredshouldRetryTransaction_
Parameters
errRecord<string, unknown> | objectRequiredReturns
booleanbooleanRequiredatomicPhase_
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
TResultobjectRequiredTErrorobjectRequiredParameters
work(transactionManager: EntityManager) => Promise<TResult>Requiredthe 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>Requiredthe result of the transactional work
retrieve
Retrieves a payment by id.
Parameters
paymentIdstringRequiredthe id of the payment
the config to retrieve the payment
Default: {}
Returns
the payment.
create
Created a new payment.
Parameters
paymentInputPaymentDataInputRequiredinfo to create the payment
Returns
the payment created.
update
Updates a payment in order to link it to an order or a swap.
Parameters
paymentIdstringRequiredthe id of the payment
dataobjectRequiredorder_id or swap_id to link the payment
data.order_idstringdata.swap_idstringReturns
the payment updated.
capture
Captures a payment.
Parameters
the id or the class instance of the payment
Returns
the payment captured.
refund
refunds a payment.
Parameters
the id or the class instance of the payment
amountnumberRequiredthe amount to be refunded from the payment
reasonstringRequiredthe refund reason
notestringadditional note of the refund
Returns
the refund created.
Was this section helpful?