PaymentService
Constructors
constructor
new PaymentService(«destructured»
)
Parameters
Properties
__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_
Protected
get
activeManager_(): EntityManager
Returns
EntityManager
EntityManager
EntityManagerRequiredMethods
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.
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise
<TResult
>
Promise
Promise<TResult>Requiredcapture
capture(paymentOrId
): Promise
<Payment
>
Captures a payment.
Parameters
Returns
Promise
<Payment
>
create
create(paymentInput
): Promise
<Payment
>
Created a new payment.
Parameters
Returns
Promise
<Payment
>
refund
refund(paymentOrId
, amount
, reason
, note?
): Promise
<Refund
>
refunds a payment.
Parameters
amount
numberRequiredreason
stringRequirednote
stringReturns
Promise
<Refund
>
retrieve
retrieve(paymentId
, config?
): Promise
<Payment
>
Retrieves a payment by id.
Parameters
paymentId
stringRequiredDefault: {}
Returns
Promise
<Payment
>
shouldRetryTransaction_
Protected
shouldRetryTransaction_(err
): boolean
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
boolean
booleanupdate
update(paymentId
, data
): Promise
<Payment
>
Updates a payment in order to link it to an order or a swap.
Parameters
paymentId
stringRequireddata
objectRequireddata.order_id
stringdata.swap_id
stringReturns
Promise
<Payment
>
withTransaction
withTransaction(transactionManager?
): PaymentService
Parameters
transactionManager
EntityManager