Skip to main content
Skip to main content

PaymentCollectionService

constructor

Parameters

__namedParametersInjectedDependenciesRequired

Properties

__configModule__Record<string, unknown>
__container__anyRequired
__moduleDeclaration__Record<string, unknown>
customerService_CustomerServiceRequired
eventBusService_EventBusServiceRequired
manager_EntityManagerRequired
paymentCollectionRepository_Repository<PaymentCollection> & objectRequired
paymentProviderService_PaymentProviderServiceRequired
transactionManager_undefined | EntityManagerRequired
EventsobjectRequired
Events.CREATEDstringRequired

Default: "payment-collection.created"

Events.DELETEDstringRequired

Default: "payment-collection.deleted"

Events.PAYMENT_AUTHORIZEDstringRequired

Default: "payment-collection.payment_authorized"

Events.UPDATEDstringRequired

Default: "payment-collection.updated"


Accessors

activeManager_

Returns

EntityManagerEntityManagerRequired

Methods

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

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

PromisePromise<TResult>Required
the result of the transactional work

authorizePaymentSessions

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>Required
additional data required by payment providers

Default: {}

Returns

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

create

Creates a new payment collection.

Parameters

dataCreatePaymentCollectionInputRequired
info to create the payment collection

Returns

PromisePromise<PaymentCollection>Required
the payment collection created.

delete

Deletes a payment collection.

Parameters

paymentCollectionIdstringRequired
the id of the payment collection to be removed

Returns

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

isValidTotalAmount

Parameters

totalnumberRequired
sessionsInputPaymentCollectionsSessionsBatchInput[]Required

Returns

booleanboolean

markAsAuthorized

Marks a payment collection as authorized bypassing the payment flow.

Parameters

paymentCollectionIdstringRequired
the id of the payment collection

Returns

PromisePromise<PaymentCollection>Required
the payment session authorized.

refreshPaymentSession

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

PromisePromise<PaymentSession>Required
the new payment session created.

retrieve

Retrieves a payment collection by id.

Parameters

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

Default: {}

Returns

PromisePromise<PaymentCollection>Required
the payment collection.

setPaymentSession

Manages a single payment sessions of a payment collection.

Parameters

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

Returns

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

setPaymentSessionsBatch

Manages multiple payment sessions of a payment collection.

Parameters

paymentCollectionOrIdstring | PaymentCollectionRequired
the id of the payment collection
sessionsInputPaymentCollectionsSessionsBatchInput[]Required
array containing payment session info
customerIdstringRequired
the id of the customer

Returns

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

shouldRetryTransaction_

Parameters

errRecord<string, unknown> | objectRequired

Returns

booleanboolean

update

Updates a payment collection.

Parameters

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

Returns

PromisePromise<PaymentCollection>Required
the payment collection updated.

withTransaction

Parameters

transactionManagerEntityManager

Returns

PaymentCollectionServiceobjectRequired
Was this section helpful?