Skip to main content

ISplitOrderPaymentModuleService Reference

This section of the documentation provides a reference to the ISplitOrderPaymentModuleService interface’s methods. This is the interface developers use to use the functionalities provided by the Split Order Payment Module.
You should only use the methods in this reference when implementing complex customizations. For common cases, check out available workflows instead.
The main service interface for the Split Order Payment Module.

Methods


createSplitOrderPayments

This section provides a reference to the createSplitOrderPayments method. This belongs to the Split Order Payment Module.

createSplitOrderPayments(data, sharedContext?): Promise<SplitOrderPaymentDTO[]>

This method creates split order payments.

Example

const splitPayments = await splitOrderPaymentModuleService.createSplitOrderPayments([
  {
    order_id: "ord_123",
    status: "authorized",
    currency_code: "usd",
    authorized_amount: 5000,
    payment_collection_id: "paycol_123",
  },
])

Parameters

data
CreateSplitOrderPaymentsDTO[]
required
The split order payments to be created.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<SplitOrderPaymentDTO[]>
The created split order payments.

createSplitOrderPayments(data, sharedContext?): Promise<SplitOrderPaymentDTO>

This method creates a split order payment.

Example

const splitPayment = await splitOrderPaymentModuleService.createSplitOrderPayments({
  order_id: "ord_123",
  status: "authorized",
  currency_code: "usd",
  authorized_amount: 5000,
  payment_collection_id: "paycol_123",
})

Parameters

data
CreateSplitOrderPaymentsDTO
required
The split order payment to be created.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<SplitOrderPaymentDTO>
The created split order payment.

updateSplitOrderPayments

This section provides a reference to the updateSplitOrderPayments method. This belongs to the Split Order Payment Module.

updateSplitOrderPayments(id, data, sharedContext?): Promise<SplitOrderPaymentDTO>

This method updates an existing split order payment.

Example

const splitPayment = await splitOrderPaymentModuleService.updateSplitOrderPayments("sp_ord_pay_123", {
  status: "captured",
  captured_amount: 5000,
})

Parameters

id
string
required
The ID of the split order payment.
data
UpdateSplitOrderPaymentsDTO
required
The attributes to update in the split order payment.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<SplitOrderPaymentDTO>
The updated split order payment.

deleteSplitOrderPayments

This section provides a reference to the deleteSplitOrderPayments method. This belongs to the Split Order Payment Module.

deleteSplitOrderPayments(ids, sharedContext?): Promise<void>

This method deletes split order payments by their IDs.

Example

await splitOrderPaymentModuleService.deleteSplitOrderPayments(["sp_ord_pay_123", "sp_ord_pay_321"])

Parameters

ids
string[]
required
The IDs of the split order payments.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void>
Resolves when the split order payments are deleted successfully.

deleteSplitOrderPayments(id, sharedContext?): Promise<void>

This method deletes a split order payment by its ID.

Example

await splitOrderPaymentModuleService.deleteSplitOrderPayments("sp_ord_pay_123")

Parameters

id
string
required
The ID of the split order payment.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void>
Resolves when the split order payment is deleted successfully.

retrieveSplitOrderPayment

This section provides a reference to the retrieveSplitOrderPayment method. This belongs to the Split Order Payment Module. This method retrieves a split order payment by its ID.

Example

const splitPayment = await splitOrderPaymentModuleService.retrieveSplitOrderPayment("sp_ord_pay_123")

Parameters

id
string
required
The ID of the split order payment.
config
FindConfig<SplitOrderPaymentDTO>
The configurations determining how the split order payment is retrieved.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<SplitOrderPaymentDTO>
The retrieved split order payment.

listSplitOrderPayments

This section provides a reference to the listSplitOrderPayments method. This belongs to the Split Order Payment Module. This method retrieves a paginated list of split order payments based on optional filters and configuration.

Example

To retrieve split order payments for a specific payment collection:
const splitPayments = await splitOrderPaymentModuleService.listSplitOrderPayments({
  payment_collection_id: "paycol_123",
})
To filter by status:
const splitPayments = await splitOrderPaymentModuleService.listSplitOrderPayments({
  status: "captured",
})
By default, only the first 15 records are retrieved. You can control pagination:
const splitPayments = await splitOrderPaymentModuleService.listSplitOrderPayments(
  {
    payment_collection_id: "paycol_123",
  },
  {
    take: 20,
    skip: 2,
  }
)

Parameters

filters
FilterableSplitOrderPaymentProps
The filters to apply on the retrieved split order payments.
config
FindConfig<SplitOrderPaymentDTO>
The configurations determining how the split order payment is retrieved.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<SplitOrderPaymentDTO[]>
The list of split order payments.

listAndCountSplitOrderPayments

This section provides a reference to the listAndCountSplitOrderPayments method. This belongs to the Split Order Payment Module. This method retrieves a paginated list of split order payments along with the total count of available split order payments satisfying the provided filters.

Example

To retrieve a list of split order payments with count:
const [splitPayments, count] = await splitOrderPaymentModuleService.listAndCountSplitOrderPayments({
  payment_collection_id: "paycol_123",
})
By default, only the first 15 records are retrieved. You can control pagination:
const [splitPayments, count] = await splitOrderPaymentModuleService.listAndCountSplitOrderPayments(
  {
    status: "captured",
  },
  {
    take: 20,
    skip: 2,
  }
)

Parameters

filters
FilterableSplitOrderPaymentProps
The filters to apply on the retrieved split order payments.
config
FindConfig<SplitOrderPaymentDTO>
The configurations determining how the split order payment is retrieved.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<[SplitOrderPaymentDTO[], number]>
The list of split order payments along with their total count.

softDeleteSplitOrderPayments

This section provides a reference to the softDeleteSplitOrderPayments method. This belongs to the Split Order Payment Module. This method soft deletes split order payments by their IDs.

Example

await splitOrderPaymentModuleService.softDeleteSplitOrderPayments([
  "sp_ord_pay_123",
  "sp_ord_pay_321",
])

Parameters

splitOrderPaymentIds
string[]
required
The IDs of the split order payments.
config
SoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity’s related entities that should be soft-deleted when the main entity is soft-deleted.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void | Record<string, string[]>>
An object that includes the IDs of related records that were also soft deleted. If there are no related records, the promise resolves to void.

restoreSplitOrderPayments

This section provides a reference to the restoreSplitOrderPayments method. This belongs to the Split Order Payment Module. This method restores soft deleted split order payments by their IDs.

Example

await splitOrderPaymentModuleService.restoreSplitOrderPayments(["sp_ord_pay_123", "sp_ord_pay_321"])

Parameters

splitOrderPaymentIds
string[]
required
The IDs of the split order payments.
config
RestoreReturn<TReturnableLinkableKeys>
Configurations determining which relations to restore along with each of the split order payment.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void | Record<string, string[]>>
An object that includes the IDs of related records that were restored. If there are no related records restored, the promise resolves to void.