Skip to main content
Skip to main content
You're viewing the documentation for v1, which isn't the latest Medusa version.Latest documentation

PaymentCollectionService

constructor​

Parameters​

__namedParametersInjectedDependenciesRequired

Properties​

manager_EntityManagerRequired
transactionManager_undefined | EntityManagerRequired
__container__anyRequired
EventsobjectRequired
Events.CREATEDstringRequired

Default: "payment-collection.created"

Events.UPDATEDstringRequired

Default: "payment-collection.updated"

Events.DELETEDstringRequired

Default: "payment-collection.deleted"

Events.PAYMENT_AUTHORIZEDstringRequired

Default: "payment-collection.payment_authorized"

eventBusService_EventBusServiceRequired
paymentProviderService_PaymentProviderServiceRequired
customerService_CustomerServiceRequired
paymentCollectionRepository_Repository<PaymentCollection> & objectRequired
__configModule__Record<string, unknown>
__moduleDeclaration__Record<string, unknown>

Accessors​

activeManager_​

Returns​

EntityManagerEntityManagerRequired

Methods​

withTransaction​

Parameters​

transactionManagerEntityManager

Returns​

thisthisRequired

shouldRetryTransaction_​

Parameters​

errRecord<string, unknown> | objectRequired

Returns​

booleanbooleanRequired

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

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.

create​

Creates a new payment collection.

Parameters​

dataCreatePaymentCollectionInputRequired
info to create the payment collection

Returns​

PromisePromise<PaymentCollection>Required
the payment collection created.

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.

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​

booleanbooleanRequired

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.

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.

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.

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.

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.
Was this section helpful?