PaymentService
constructor
Parameters
__namedParameters
InjectedDependenciesRequiredProperties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequiredEvents
objectRequiredEvents.CREATED
stringRequiredDefault: "payment.created"
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"
Events.UPDATED
stringRequiredDefault: "payment.updated"
Accessors
activeManager_
Returns
EntityManager
EntityManagerRequiredMethods
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
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
capture
Captures a payment.
Parameters
the id or the class instance of the payment
Returns
the payment captured.
create
Created a new payment.
Parameters
paymentInput
PaymentDataInputRequiredinfo to create the payment
Returns
the payment created.
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.
retrieve
Retrieves a payment by id.
Parameters
paymentId
stringRequiredthe id of the payment
the config to retrieve the payment
Default: {}
Returns
the payment.
shouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanupdate
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.
withTransaction
Parameters
transactionManager
EntityManagerReturns
PaymentService
objectRequiredWas this section helpful?