Skip to main content
Skip to main content

PaymentCollectionService

internal.internal.PaymentCollectionService

Properties

__configModule__Record<string, unknown>
__container__anyRequired
__moduleDeclaration__Record<string, unknown>
customerService_CustomerServiceRequired
eventBusService_EventBusServiceRequired
isValidTotalAmountanyRequired
manager_EntityManagerRequired
paymentCollectionRepository_Repository<PaymentCollection> & { getPaymentCollectionIdByPaymentId: Method getPaymentCollectionIdByPaymentId ; getPaymentCollectionIdBySessionId: Method getPaymentCollectionIdBySessionId }Required
paymentProviderService_PaymentProviderServiceRequired
transactionManager_undefined | EntityManagerRequired
EventsobjectRequired
Events.CREATEDstringRequired
Events.DELETEDstringRequired
Events.PAYMENT_AUTHORIZEDstringRequired
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_


authorizePaymentSessions

authorizePaymentSessions(paymentCollectionId, sessionIds, context?): Promise<PaymentCollection>

Authorizes the payment sessions of a payment collection.

Parameters

paymentCollectionIdstringRequired
the id of the payment collection
sessionIdsstring[]Required
array of payment session ids to be authorized
contextRecord<string, unknown>
additional data required by payment providers

Returns

Promise<PaymentCollection>

PromisePromise<PaymentCollection>Required
the payment collection and its payment session.

create

create(data): Promise<PaymentCollection>

Creates a new payment collection.

Parameters

info to create the payment collection

Returns

Promise<PaymentCollection>

PromisePromise<PaymentCollection>Required
the payment collection created.

delete

delete(paymentCollectionId): Promise<undefined | PaymentCollection>

Deletes a payment collection.

Parameters

paymentCollectionIdstringRequired
the id of the payment collection to be removed

Returns

Promise<undefined | PaymentCollection>

PromisePromise<undefined | PaymentCollection>Required
the payment collection removed.

markAsAuthorized

markAsAuthorized(paymentCollectionId): Promise<PaymentCollection>

Marks a payment collection as authorized bypassing the payment flow.

Parameters

paymentCollectionIdstringRequired
the id of the payment collection

Returns

Promise<PaymentCollection>

PromisePromise<PaymentCollection>Required
the payment session authorized.

refreshPaymentSession

refreshPaymentSession(paymentCollectionId, sessionId, customerId): Promise<PaymentSession>

Removes and recreate a payment session of a payment collection.

Parameters

paymentCollectionIdstringRequired
the id of the payment collection
sessionIdstringRequired
the id of the payment session to be replaced
customerIdstringRequired
the id of the customer

Returns

Promise<PaymentSession>

PromisePromise<PaymentSession>Required
the new payment session created.

retrieve

retrieve(paymentCollectionId, config?): Promise<PaymentCollection>

Retrieves a payment collection by id.

Parameters

paymentCollectionIdstringRequired
the id of the payment collection
the config to retrieve the payment collection

Returns

Promise<PaymentCollection>

PromisePromise<PaymentCollection>Required
the payment collection.

setPaymentSession

setPaymentSession(paymentCollectionId, sessionInput, customerId): Promise<PaymentCollection>

Manages a single payment sessions of a payment collection.

Parameters

paymentCollectionIdstringRequired
the id of the payment collection
object containing payment session info
customerIdstringRequired
the id of the customer

Returns

Promise<PaymentCollection>

PromisePromise<PaymentCollection>Required
the payment collection and its payment session.

setPaymentSessionsBatch

setPaymentSessionsBatch(paymentCollectionOrId, sessionsInput, customerId): Promise<PaymentCollection>

Manages multiple payment sessions of a payment collection.

Parameters

paymentCollectionOrIdstring | PaymentCollectionRequired
the id of the payment collection
array containing payment session info
customerIdstringRequired
the id of the customer

Returns

Promise<PaymentCollection>

PromisePromise<PaymentCollection>Required
the payment collection and its payment sessions.

shouldRetryTransaction_

Protected shouldRetryTransaction_(err): boolean

Parameters

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

Returns

boolean

booleanboolean

Inherited from

TransactionBaseService.shouldRetryTransaction_


update

update(paymentCollectionId, data): Promise<PaymentCollection>

Updates a payment collection.

Parameters

paymentCollectionIdstringRequired
the id of the payment collection to update
dataDeepPartial<PaymentCollection>Required
info to be updated

Returns

Promise<PaymentCollection>

PromisePromise<PaymentCollection>Required
the payment collection updated.

withTransaction

withTransaction(transactionManager?): PaymentCollectionService

Parameters

transactionManagerEntityManager

Returns

PaymentCollectionService

Inherited from

TransactionBaseService.withTransaction

Was this section helpful?