Skip to main content
Skip to main content

AbstractPaymentService

This will be

Deprecated

in the near future use the AbstractPaymentProcessor instead

Implements

Constructors

constructor

Protected **new AbstractPaymentService**(container, config?)

Parameters
containerunknownRequired
configRecord<string, unknown>

Properties

__configModule__Record<string, unknown>
__container__anyRequired
__moduleDeclaration__Record<string, unknown>
manager_EntityManagerRequired
transactionManager_undefined | EntityManagerRequired
identifierstringRequired

Accessors

activeManager_

Protected activeManager_: [object Object]

Methods

atomicPhase_

Protected **atomicPhase_**<TypeParameter TResult, TypeParameter TError>(work, isolationOrErrorHandler?, maybeErrorHandlerOrDontFail?): Promise&#60;TResult&#62;

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

Promise<TResult>

PromisePromise<TResult>Required
the result of the transactional work

authorizePayment

Abstract **authorizePayment**(paymentSession, context): Promise&#60;&#123; data: [Data](/references/services/types/Data) ; status: [PaymentSessionStatus](/references/services/enums/PaymentSessionStatus) &#125;&#62;

Parameters
paymentSessionPaymentSessionRequired
A Payment Session is created when a Customer initilizes the checkout flow, and can be used to hold the state of a payment flow. Each Payment Session is controlled by a Payment Provider, which is responsible for the communication with external payment services. Authorized Payment Sessions will eventually get promoted to Payments to indicate that they are authorized for payment processing such as capture or refund. Payment sessions can also be used as part of payment collections.
contextDataRequired
Returns

Promise<{ data: Data ; status: PaymentSessionStatus }>

PromisePromise<{ data: Data ; status: PaymentSessionStatus }>Required

Deprecated


cancelPayment

Abstract **cancelPayment**(payment): Promise&#60;[Data](/references/services/types/Data)&#62;

This will be

Parameters
paymentPaymentRequired
A payment is originally created from a payment session. Once a payment session is authorized, the payment is created to represent the authorized amount with a given payment method. Payments can be captured, canceled or refunded. Payments can be made towards orders, swaps, order edits, or other resources.
Returns

Promise<Data>

PromisePromise<Data>Required

Deprecated

in the near future


capturePayment

Abstract **capturePayment**(payment): Promise&#60;[Data](/references/services/types/Data)&#62;

This will be

Parameters
paymentPaymentRequired
A payment is originally created from a payment session. Once a payment session is authorized, the payment is created to represent the authorized amount with a given payment method. Payments can be captured, canceled or refunded. Payments can be made towards orders, swaps, order edits, or other resources.
Returns

Promise<Data>

PromisePromise<Data>Required

Deprecated

in the near future


createPayment

Abstract **createPayment**(context): Promise&#60;[PaymentSessionResponse](/references/services/types/PaymentSessionResponse)&#62;

Parameters
contextCart & PaymentContextRequired
The type of this argument is meant to be temporary and once the previous method signature will be removed, the type will only be PaymentContext instead of Cart & PaymentContext
Returns

Promise<PaymentSessionResponse>

PromisePromise<PaymentSessionResponse>Required

Abstract **createPayment**(cart): Promise&#60;[Data](/references/services/types/Data)&#62;

This will be

Parameters
cartCartRequired
Returns

Promise<Data>

PromisePromise<Data>Required

Deprecated

in the near future use createPayment(context: Cart & PaymentContext): Promise<PaymentSessionResponse> instead


deletePayment

Abstract **deletePayment**(paymentSession): Promise&#60;void&#62;

This will be

Parameters
paymentSessionPaymentSessionRequired
A Payment Session is created when a Customer initilizes the checkout flow, and can be used to hold the state of a payment flow. Each Payment Session is controlled by a Payment Provider, which is responsible for the communication with external payment services. Authorized Payment Sessions will eventually get promoted to Payments to indicate that they are authorized for payment processing such as capture or refund. Payment sessions can also be used as part of payment collections.
Returns

Promise<void>

PromisePromise<void>Required

Deprecated

in the near future


getIdentifier

**getIdentifier**(): string

Returns

string

stringstring

getPaymentData

Abstract **getPaymentData**(paymentSession): Promise&#60;[Data](/references/services/types/Data)&#62;

Parameters
paymentSessionPaymentSessionRequired
A Payment Session is created when a Customer initilizes the checkout flow, and can be used to hold the state of a payment flow. Each Payment Session is controlled by a Payment Provider, which is responsible for the communication with external payment services. Authorized Payment Sessions will eventually get promoted to Payments to indicate that they are authorized for payment processing such as capture or refund. Payment sessions can also be used as part of payment collections.
Returns

Promise<Data>

PromisePromise<Data>Required

Deprecated


getStatus

Abstract **getStatus**(data): Promise&#60;[PaymentSessionStatus](/references/services/enums/PaymentSessionStatus)&#62;

This will be

Parameters
dataDataRequired
Returns

Promise<PaymentSessionStatus>

PromisePromise<PaymentSessionStatus>Required

Deprecated

in the near future


refundPayment

Abstract **refundPayment**(payment, refundAmount): Promise&#60;[Data](/references/services/types/Data)&#62;

This will be

Parameters
paymentPaymentRequired
A payment is originally created from a payment session. Once a payment session is authorized, the payment is created to represent the authorized amount with a given payment method. Payments can be captured, canceled or refunded. Payments can be made towards orders, swaps, order edits, or other resources.
refundAmountnumberRequired
Returns

Promise<Data>

PromisePromise<Data>Required

Deprecated

in the near future


retrievePayment

Abstract **retrievePayment**(paymentData): Promise&#60;[Data](/references/services/types/Data)&#62;

Parameters
paymentDataDataRequired
Returns

Promise<Data>

PromisePromise<Data>Required

Deprecated


retrieveSavedMethods

**retrieveSavedMethods**(customer): Promise&#60;[Data](/references/services/types/Data)[]&#62;

This will be

Parameters
customerCustomerRequired
A customer can make purchases in your store and manage their profile.
Returns

Promise<Data[]>

PromisePromise<Data[]>Required

Deprecated

in the near future


shouldRetryTransaction_

Protected **shouldRetryTransaction_**(err): boolean

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

boolean

booleanboolean

updatePayment

Abstract **updatePayment**(paymentSessionData, context): Promise&#60;Record&#60;string, unknown&#62; \| [PaymentSessionResponse](/references/services/types/PaymentSessionResponse)&#62;

Parameters
paymentSessionDataDataRequired
contextCart & PaymentContextRequired
The type of this argument is meant to be temporary and once the previous method signature will be removed, the type will only be PaymentContext instead of Cart & PaymentContext
Returns

Promise<Record<string, unknown> | PaymentSessionResponse>

PromisePromise<Record<string, unknown> | PaymentSessionResponse>Required
it return either a PaymentSessionResponse or PaymentSessionResponse["session_data"] to maintain backward compatibility

Abstract **updatePayment**(paymentSessionData, cart): Promise&#60;[Data](/references/services/types/Data)&#62;

This will be

Parameters
paymentSessionDataDataRequired
cartCartRequired
Returns

Promise<Data>

PromisePromise<Data>Required

Deprecated

in the near future use updatePayment(paymentSessionData: PaymentSessionData, context: Cart & PaymentContext): Promise<PaymentSessionResponse> instead


updatePaymentData

Abstract **updatePaymentData**(paymentSessionData, data): Promise&#60;[Data](/references/services/types/Data)&#62;

Parameters
paymentSessionDataDataRequired
dataDataRequired
Returns

Promise<Data>

PromisePromise<Data>Required

Deprecated


withTransaction

**withTransaction**(transactionManager?): [AbstractPaymentService](/references/services/classes/AbstractPaymentService)

Parameters
transactionManagerEntityManager
Returns

AbstractPaymentService

AbstractPaymentServiceAbstractPaymentServiceRequired
Was this section helpful?