Skip to main content
Skip to main content

FulfillmentProviderService

internal.internal.FulfillmentProviderService

Helps retrieve fulfillment providers

Properties

__configModule__Record<string, unknown>
__container__anyRequired
__moduleDeclaration__Record<string, unknown>
fulfillmentProviderRepository_Repository<FulfillmentProvider>Required
manager_EntityManagerRequired
transactionManager_undefined | EntityManagerRequired

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_


calculatePrice

calculatePrice(option, data, cart?): Promise<number>

Parameters

optionShippingOptionRequired
dataRecord<string, unknown>Required
cartOrder | Cart

Returns

Promise<number>

PromisePromise<number>Required

canCalculate

canCalculate(option): Promise<boolean>

Parameters

Returns

Promise<boolean>

PromisePromise<boolean>Required

cancelFulfillment

cancelFulfillment(fulfillment): Promise<Fulfillment>

Parameters

fulfillmentFulfillmentRequired

Returns

Promise<Fulfillment>

PromisePromise<Fulfillment>Required

createFulfillment

createFulfillment(method, items, order, fulfillment): Promise<Record<string, unknown>>

Parameters

methodShippingMethodRequired
itemsLineItem[]Required
fulfillmentOmit<Fulfillment, "beforeInsert">Required

Returns

Promise<Record<string, unknown>>

PromisePromise<Record<string, unknown>>Required

createReturn

createReturn(returnOrder): Promise<Record<string, unknown>>

Parameters

returnOrderCreateReturnTypeRequired

Returns

Promise<Record<string, unknown>>

PromisePromise<Record<string, unknown>>Required

list

list(): Promise<FulfillmentProvider[]>

Returns

Promise<FulfillmentProvider[]>

PromisePromise<FulfillmentProvider[]>Required

listFulfillmentOptions

listFulfillmentOptions(providerIds): Promise<FulfillmentOptions[]>

Parameters

providerIdsstring[]Required

Returns

Promise<FulfillmentOptions[]>

PromisePromise<FulfillmentOptions[]>Required

registerInstalledProviders

registerInstalledProviders(providers): Promise<void>

Parameters

providersstring[]Required

Returns

Promise<void>

PromisePromise<void>Required

retrieveDocuments

retrieveDocuments(providerId, fulfillmentData, documentType): Promise<any>

Fetches documents from the fulfillment provider

Parameters

providerIdstringRequired
the id of the provider
fulfillmentDataRecord<string, unknown>Required
the data relating to the fulfillment
documentType"label" | "invoice"Required
the typ of

Returns

Promise<any>

PromisePromise<any>Required
document to fetch

retrieveProvider

retrieveProvider(providerId): any

Parameters

providerIdstringRequired
the provider id

Returns

any

anyany
the payment fulfillment provider

shouldRetryTransaction_

Protected shouldRetryTransaction_(err): boolean

Parameters

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

Returns

boolean

booleanboolean

Inherited from

TransactionBaseService.shouldRetryTransaction_


validateFulfillmentData

validateFulfillmentData(option, data, cart): Promise<Record<string, unknown>>

Parameters

optionShippingOptionRequired
dataRecord<string, unknown>Required
cartRecord<string, unknown> | CartRequired

Returns

Promise<Record<string, unknown>>

PromisePromise<Record<string, unknown>>Required

validateOption

validateOption(option): Promise<boolean>

Parameters

optionShippingOptionRequired

Returns

Promise<boolean>

PromisePromise<boolean>Required

withTransaction

withTransaction(transactionManager?): FulfillmentProviderService

Parameters

transactionManagerEntityManager

Returns

FulfillmentProviderService

FulfillmentProviderServiceFulfillmentProviderServiceRequired

Inherited from

TransactionBaseService.withTransaction

Was this section helpful?