orderItemsGetCancellationPreviewWithHttpInfo method
Preview an item cancellation
Previews the cancellation penalty and expected refund for an order item. Requires the read order permission. Returns penaltyAmount, the cancellationFee kept in addition to it (null when none applies) and the expected refundAmount, all in the order currency, isRefundable, the cancellation band in effect, priced at the penalty (appliedPenalties: at most one { from, penaltyAmount }), effectiveCancellationDate and checkInDate, calculated with the same rules as the partner portal. The fee comes out of what the penalty leaves, so the refund is never negative. isRefundable: false means the penalty alone keeps the whole price, so the item cannot be cancelled; it is not an error. A fee that takes what the penalty leaves does not make it false: the item can still be cancelled, with a refund of 0. The preview does not cancel the item or change its state, and it does not lock the penalty: the cancel call recalculates it, so a later cancellation band may apply. A kind of item that can never be cancelled returns 422 with code 18000 (CANCELLATION_NOT_SUPPORTED); an item of another partner, or an unknown id, returns 404 with code 10004.
Note: This method returns the HTTP Response.
Parameters:
- String id (required):
Order item id (
items[].idfrom the order response).
Implementation
Future<Response> orderItemsGetCancellationPreviewWithHttpInfo(String id, { Future<void>? abortTrigger, }) async {
// ignore: prefer_const_declarations
final path = r'/api/v1/b2b/order-items/{id}/cancellation-preview'
.replaceAll('{id}', id);
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
abortTrigger: abortTrigger,
);
}