Skip to content

Commit

Permalink
chore(types, utils): update the TSDocs of AbstractFulfillmentProvider…
Browse files Browse the repository at this point in the history
…Service (#9349)

Updates the `AbstractFulfillmentProviderService` with TSDocs for more useful information and examples

Closes DOCS-950
  • Loading branch information
shahednasser authored Oct 2, 2024
1 parent 86badc6 commit 7ce9121
Show file tree
Hide file tree
Showing 3 changed files with 370 additions and 22 deletions.
29 changes: 15 additions & 14 deletions packages/core/types/src/fulfillment/provider.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
export type FulfillmentOption = {
/**
* The option's ID.
*
* @example express
*/
id: string
/**
* Whether the option can be used to return items.
*/
is_return?: boolean
[k: string]: unknown
}

export interface IFulfillmentProvider {
/**
* @ignore
*
* Return a unique identifier to retrieve the fulfillment plugin provider
*/
getIdentifier(): string
/**
* @ignore
*
* Return the available fulfillment options for the given data.
*/
getFulfillmentOptions(): Promise<Record<string, unknown>[]>
getFulfillmentOptions(): Promise<FulfillmentOption[]>
/**
* @ignore
*
* Validate the given fulfillment data.
*/
Expand All @@ -22,19 +33,16 @@ export interface IFulfillmentProvider {
context: Record<string, unknown>
): Promise<any>
/**
* @ignore
*
* Validate the given option.
*/
validateOption(data: Record<string, unknown>): Promise<boolean>
/**
* @ignore
*
* Check if the provider can calculate the fulfillment price.
*/
canCalculate(data: Record<string, unknown>): Promise<any>
/**
* @ignore
*
* Calculate the price for the given fulfillment option.
*/
Expand All @@ -44,7 +52,6 @@ export interface IFulfillmentProvider {
context: Record<string, unknown>
): Promise<any>
/**
* @ignore
*
* Create a fulfillment for the given data.
*/
Expand All @@ -55,25 +62,21 @@ export interface IFulfillmentProvider {
fulfillment: Record<string, unknown>
): Promise<Record<string, unknown>>
/**
* @ignore
*
* Cancel the given fulfillment.
*/
cancelFulfillment(fulfillment: Record<string, unknown>): Promise<any>
/**
* @ignore
*
* Get the documents for the given fulfillment data.
*/
getFulfillmentDocuments(data: Record<string, unknown>): Promise<any>
/**
* @ignore
*
* Create a return for the given data.
*/
createReturnFulfillment(fromData: Record<string, unknown>): Promise<any>
/**
* @ignore
*
* Get the documents for the given return data.
*/
Expand All @@ -82,13 +85,11 @@ export interface IFulfillmentProvider {
documentType: string
): Promise<any>
/**
* @ignore
*
* Get the documents for the given return data.
*/
getReturnDocuments(data: Record<string, unknown>): Promise<any>
/**
* @ignore
*
* Get the documents for the given shipment data.
*/
Expand Down
Loading

0 comments on commit 7ce9121

Please sign in to comment.