Newer Version Available

This content describes an older version of this product. View Latest

OrderSummary Class

Work with orders in Order Management.

Namespace

ConnectApi

OrderSummary Methods

The following are methods for OrderSummary. All methods are static.

adjustPreview(orderSummaryId, adjustInput)

Retrieve the expected results of adjusting the price of one or more OrderItemSummaries from an OrderSummary, without actually executing the adjustment. The response data contains the financial changes that would result from submitting the proposed adjustment.

API Version

49.0

Requires Chatter

No

Signature

public static ConnectApi.AdjustOrderSummaryOutputRepresentation adjustPreview(String orderSummaryId, ConnectApi.AdjustOrderItemSummaryInputRepresentation adjustInput)

Parameters

orderSummaryId
Type: String
ID of the OrderSummary.
adjustInput
Type: ConnectApi.AdjustOrderItemSummaryInputRepresentation
A list of price adjustments to OrderItemSummaries that make up a price adjustment to an order.

adjustSubmit(orderSummaryId, adjustInput)

Adjust the price of one or more OrderItemSummaries from an OrderSummary, and create one or two corresponding change orders.

API Version

49.0

Requires Chatter

No

Signature

public static ConnectApi.AdjustOrderSummaryOutputRepresentation adjustSubmit(String orderSummaryId, ConnectApi.AdjustOrderItemSummaryInputRepresentation adjustInput)

Parameters

orderSummaryId
Type: String
ID of the OrderSummary.
adjustInput
Type: ConnectApi.AdjustOrderItemSummaryInputRepresentation
A list of price adjustments to OrderItemSummaries that make up a price adjustment to an order.

Usage

After submitting a price adjustment, process refunds as appropriate:

  • If the discount only applied to OrderItemSummaries for which payment has not been captured, it does not require a refund. This situation normally applies to OrderItemSummaries in the US that have not been fulfilled.
  • If the discount applied to OrderItemSummaries that have not been fulfilled and for which payment has been captured, process a refund. In this case, pass the totalExcessFundsAmount from the output representation to the ensureRefundsAsync() method.
  • If the discount applied to OrderItemSummaries that have been fulfilled, process a refund. Pass the postFulfillmentChangeOrderId from the output representation to the createCreditMemo() method, then pass the CreditMemo to the ensureRefundsAsync() method.
  • If the discount applied to both fulfilled and unfulfilled OrderItemSummaries for which payment has been captured, process both refunds. Pass the postFulfillmentChangeOrderId from the output representation to the createCreditMemo() method, then pass the credit memo and the totalExcessFundsAmount from the output representation to the ensureRefundsAsync() method.

createCreditMemo(orderSummaryId, creditMemoInput)

Create a credit memo to represent the refund for one or more change orders associated with an OrderSummary.

API Version

48.0

Requires Chatter

No

Signature

public static ConnectApi.CreateCreditMemoOutputRepresentation createCreditMemo(String orderSummaryId, ConnectApi.CreateCreditMemoInputRepresentation creditMemoInput)

Parameters

orderSummaryId
Type: String
ID of the OrderSummary.
creditMemoInput
Type: ConnectApi.CreateCreditMemoInputRepresentation
The list of change order IDs.

ensureFundsAsync(orderSummaryId, ensureFundsInput)

Ensure funds for an invoice and apply them to it. If needed, capture authorized funds by sending a request to a payment provider. This method inserts a background operation into an asynchronous job queue and returns the ID of that operation so you can track its status. Payment gateway responses appear in the payment gateway log and do not affect the background operation status.

API Version

48.0

Requires Chatter

No

Signature

public static ConnectApi.EnsureFundsAsyncOutputRepresentation ensureFundsAsync(String orderSummaryId, ConnectApi.EnsureFundsAsyncInputRepresentation ensureFundsInput)

Parameters

orderSummaryId
Type: String
ID of the OrderSummary.
ensureFundsInput
Type: ConnectApi.EnsureFundsAsyncInputRepresentation
The ID of the invoice.

Usage

This method checks the OrderPaymentSummaries associated with the specified OrderSummary for funds to apply to the invoice balance following this logic:

If multiple OrderPaymentSummaries have equal amounts, their order of selection is random.

Note

  1. Verify that the invoice balance doesn’t exceed the total amount of all the OrderPaymentSummaries.
  2. Look for an OrderPaymentSummary with a captured amount equal to the invoice balance. If one exists, apply those funds.
  3. If no exact match was found, identify all OrderPaymentSummaries with captured amounts greater than the invoice balance. If any exist, select the smallest one and apply funds from it equal to the invoice balance.
  4. If no captured amounts greater than the invoice balance were found, traverse the OrderPaymentSummaries in order of captured amount, from largest to smallest. Apply each captured amount to the invoice until the invoice balance is zero or all captured funds are applied.
  5. If the invoice still has a balance, look for an OrderPaymentSummary with an authorized amount equal to the remaining invoice balance. If one exists, capture and apply those funds.
  6. If no exact match was found, identify all OrderPaymentSummaries with authorized amounts greater than the invoice balance. If any exist, select the smallest one and apply funds from it equal to the invoice balance.
  7. If no authorized amounts greater than the invoice balance were found, traverse the OrderPaymentSummaries in order of authorized amount, from largest to smallest. Capture and apply funds until the invoice balance is zero.

ensureRefundsAsync(orderSummaryId, ensureRefundsInput)

Ensure refunds for a credit memo or excess funds by sending a request to a payment provider. This method inserts a background operation into an asynchronous job queue and returns the ID of that operation so you can track its status. Payment gateway responses appear in the payment gateway log and do not affect the background operation status.

API Version

48.0

Requires Chatter

No

Signature

public static ConnectApi.EnsureRefundsAsyncOutputRepresentation ensureRefundsAsync(String orderSummaryId, ConnectApi.EnsureRefundsAsyncInputRepresentation ensureRefundsInput)

Parameters

orderSummaryId
Type: String
ID of the OrderSummary.
ensureRefundsInput
Type: ConnectApi.EnsureRefundsAsyncInputRepresentation
Object that wraps the ID of the credit memo and the excess funds amount.

Usage

This method checks the OrderPaymentSummaries associated with the specified OrderSummary for amounts to refund following this logic:

If multiple OrderPaymentSummaries have equal amounts, their order of selection is random.

Note

  1. If a credit memo is specified, identify OrderPaymentSummaries with captured amounts that were applied to the corresponding invoice.
    1. Examine those OrderPaymentSummaries. If one has a captured amount matching the credit memo amount, apply the refund to that payment.
    2. If no exact match was found, look for captured amounts greater than the credit memo amount. If any exist, apply the refund to the smallest one.
    3. If no greater amounts were found, traverse the OrderPaymentSummaries in order of captured amount, from largest to smallest. Apply the refund to them until it’s fully applied.
  2. If an excess funds amount is specified, identify OrderPaymentSummaries with captured amounts that weren’t applied to any invoice.
    1. Examine those OrderPaymentSummaries. If one has a captured amount matching the excess funds amount, apply the refund to that payment.
    2. If no exact match was found, look for captured amounts greater than the excess funds amount. If any exist, apply the refund to the smallest one.
    3. If no greater amounts were found, traverse the OrderPaymentSummaries in order of captured amount, from largest to smallest. Apply the refund to them until it’s fully applied.

previewCancel(orderSummaryId, changeInput)

Retrieve the expected change order values for canceling one or more OrderItemSummaries from an OrderSummary, without actually executing the cancel.

API Version

48.0

Requires Chatter

No

Signature

public static ConnectApi.PreviewCancelOutputRepresentation previewCancel(String orderSummaryId, ConnectApi.ChangeInputRepresentation changeInput)

Parameters

orderSummaryId
Type: String
ID of the OrderSummary.
changeInput
Type: ConnectApi.ChangeInputRepresentation
A list of changes to OrderItemSummaries that make up an order change, such as a cancel or return.

previewReturn(orderSummaryId, changeInput)

Retrieve the expected change order values for returning one or more OrderItemSummaries from an OrderSummary, without actually executing the return.

API Version

48.0

Requires Chatter

No

Signature

public static ConnectApi.PreviewReturnOutputRepresentation previewReturn(String orderSummaryId, ConnectApi.ChangeInputRepresentation changeInput)

Parameters

orderSummaryId
Type: String
ID of the OrderSummary.
changeInput
Type: ConnectApi.ChangeInputRepresentation
A list of changes to OrderItemSummaries that make up an order change, such as a cancel or return.

submitCancel(orderSummaryId, changeInput)

Cancel one or more OrderItemSummaries from an OrderSummary, and create a corresponding change order.

API Version

48.0

Requires Chatter

No

Signature

public static ConnectApi.SubmitCancelOutputRepresentation submitCancel(String orderSummaryId, ConnectApi.ChangeInputRepresentation changeInput)

Parameters

orderSummaryId
Type: String
ID of the OrderSummary.
changeInput
Type: ConnectApi.ChangeInputRepresentation
A list of changes to OrderItemSummaries that make up an order change, such as a cancel or return.

submitReturn(orderSummaryId, changeInput)

Return one or more OrderItemSummaries from an OrderSummary, and create a corresponding change order.

API Version

48.0

Requires Chatter

No

Signature

public static ConnectApi.SubmitReturnOutputRepresentation submitReturn(String orderSummaryId, ConnectApi.ChangeInputRepresentation changeInput)

Parameters

orderSummaryId
Type: String
ID of the OrderSummary.
changeInput
Type: ConnectApi.ChangeInputRepresentation
A list of changes to OrderItemSummaries that make up an order change, such as a cancel or return.

Usage

After submitting a return, process a refund. Pass the changeOrderId from the output representation to the createCreditMemo() method, then pass the credit memo to the ensureRefundsAsync() method.