PaymentService
constructor
Parameters
__namedParameters
InjectedDependenciesRequiredProperties
manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequired__container__
anyRequiredEvents
objectRequiredEvents.CREATED
stringRequiredDefault: "payment.created"
Events.UPDATED
stringRequiredDefault: "payment.updated"
Events.PAYMENT_CAPTURED
stringRequiredDefault: "payment.payment_captured"
Events.PAYMENT_CAPTURE_FAILED
stringRequiredDefault: "payment.payment_capture_failed"
Events.REFUND_CREATED
stringRequiredDefault: "payment.payment_refund_created"
Events.REFUND_FAILED
stringRequiredDefault: "payment.payment_refund_failed"
__configModule__
Record<string, unknown>__moduleDeclaration__
Record<string, unknown>Accessors
activeManager_
Returns
EntityManager
EntityManagerRequiredMethods
withTransaction
Parameters
transactionManager
EntityManagerReturns
this
thisRequiredshouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanRequiredatomicPhase_
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
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>Requiredthe transactional work to be done
isolationOrErrorHandler
IsolationLevel | (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
Promise<TResult>Requiredthe result of the transactional work
retrieve
Retrieves a payment by id.
Parameters
paymentId
stringRequiredthe id of the payment
the config to retrieve the payment
Default: {}
Returns
the payment.
create
Created a new payment.
Parameters
paymentInput
PaymentDataInputRequiredinfo to create the payment
Returns
the payment created.
update
Updates a payment in order to link it to an order or a swap.
Parameters
paymentId
stringRequiredthe id of the payment
data
objectRequiredorder_id or swap_id to link the payment
data.order_id
stringdata.swap_id
stringReturns
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
amount
numberRequiredthe amount to be refunded from the payment
reason
stringRequiredthe refund reason
note
stringadditional note of the refund
Returns
the refund created.
Was this section helpful?