Skip to content

Commit 4efef59

Browse files
committed
Added cancellation dry-run
1 parent d8b2505 commit 4efef59

File tree

4 files changed

+79
-34
lines changed

4 files changed

+79
-34
lines changed

EditorsDraft/customercancelled.png

10.4 KB
Loading

EditorsDraft/edit.html

+12-6
Original file line numberDiff line numberDiff line change
@@ -948,15 +948,13 @@
948948

949949
1. Use the latest state of the `Order` stored during the booking flow and updated via the <a>Orders feed</a> to determine which `OrderItem`s may be cancelled. If `allowSimpleCancellation` is `true` and `latestCancellationBeforeStartDate` subtracted from the opportunity `startDate` is in the future, a PATCH against the `Order` including the `OrderItem` with `"orderItemStatus": "https://openactive.io/CustomerCancelled"` MUST succeed.
950950

951-
2. Inform the <a>Customer</a> of the expected refund before they commit to cancellation, where the value of the refund for each `OrderItem` MUST be equal to:
952-
(i) for `taxMode` of `https://openactive/TaxNet`, the sum of the `price` in the `acceptedOffer` and all the prices in `unitTaxSpecification`;
953-
(ii) for `taxMode` of `https://openactive/TaxGross`, the `price` in the `acceptedOffer`.
951+
2. Inform the <a>Customer</a> of the expected refund before they commit to cancellation, where the value of the refund for each `OrderItem` can be obtained by submitting a PATCH of type `OrderQuote` including only the `id` for each of the `OrderItem`s to be cancelled, with an `"orderItemStatus": "https://openactive.io/CustomerCancelled"` set on each. This will return an updated `OrderQuote` with a `totalPaymentDue`, which can be used by the `Broker` to display the expected refund to the `Customer` and have them confirm they wish to proceed.
954952

955953
3. Submit a PATCH for the `Order` including only the `id` for each of the `OrderItem`s to be cancelled, with an `"orderItemStatus": "https://openactive.io/CustomerCancelled"` set on each. On success, a 204 response will be received, without any body. On failure a 5xx response will be received with an error message.
956954

957-
4. Process any refunds based on the resulting updates to the <a>Orders feed</a>. Successfully cancelled `OrderItems` will have `orderItemStatus` set to `https://openactive.io/CustomerCancelled`. Note refunds MUST NOT be processed except in response to updates in the <a>Orders feed</a>.
955+
4. Process any refunds based on the resulting updates to the <a>Orders feed</a>, based on the updated `totalPaymentDue`. Successfully cancelled `OrderItems` will have `orderItemStatus` set to `https://openactive.io/CustomerCancelled`. Note refunds MUST NOT be processed except in response to updates in the <a>Orders feed</a>.
958956

959-
To cancel an entire `Order`, a single PATCH request MUST be made including `"orderItemStatus": "https://openactive.io/CustomerCancelled"` for each `OrderItem` within it.
957+
To cancel an entire `Order`, the PATCH request MUST include `"orderItemStatus": "https://openactive.io/CustomerCancelled"` for each `OrderItem` within it.
960958

961959
Note that there is no provision for a <a>Customer</a> to cancel an `Order` after the cancellation window specified by `latestCancellationBeforeStartDate. They may wish to do this out of politeness even though no refund is possible, with the benefit that their place may be taken by another participant, which can be included in future versions of this specification.
962960

@@ -965,6 +963,7 @@
965963
<div class="issue" data-number="102"></div>
966964

967965

966+
968967
### Seller requested cancellation
969968

970969
<figure>
@@ -1266,7 +1265,14 @@
12661265

12671266
All other properties except the `id` and `orderItemStatus` inside the `OrderItem` MUST be ignored. `OrderItem`s omitted from the PATCH request MUST also be ignored.
12681267

1269-
<pre class="example" title="OrderItem Cancellation: example request" data-transform="dataExampleOrderItemCancellationRequest">
1268+
A dry-run of the call MAY be used to inform the user of the refund they can expect (note the response represents only a partial `OrderQuote`, which SHOULD be combined with the `Order` stored in the `Broker` to create a full view).
1269+
1270+
<pre class="example" title="OrderItem Cancellation: example OrderQuote request" data-transform="dataExampleOrderItemCancellationQuoteRequest">
1271+
</pre>
1272+
1273+
Whether or not the dry-run was completed, the cancellation may be requested:
1274+
1275+
<pre class="example" title="OrderItem Cancellation: example Order request" data-transform="dataExampleOrderItemCancellationRequest">
12701276
</pre>
12711277

12721278
The cancellation request succeeds and fails atomically.

EditorsDraft/examples.js

+21
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,26 @@ function dataExampleOrderFeedResponse(utils, content) {
252252
});
253253
}
254254

255+
function dataExampleOrderItemCancellationQuoteRequest(utils, content) {
256+
return generateRequest("PATCH", API_PATH + "/orders/" + UUID, OPERATIONS_MEDIA_TYPE, {
257+
"@context": CONTEXT,
258+
"type": "OrderQuote",
259+
"orderedItem": [responseCancelledOrderItem]
260+
});
261+
}
262+
263+
function dataExampleOrderItemCancellationQuoteResponse(utils, content) {
264+
return generateResponse("200 OK", API_PATH + "/orders/" + UUID, OPERATIONS_MEDIA_TYPE, {
265+
"@context": CONTEXT,
266+
"type": "OrderQuote",
267+
"id": fullOrderExampleContent.id,
268+
"taxMode": fullOrderExampleContent.taxMode,
269+
"orderedItem": [responseCancelledOrderItem],
270+
"totalPaymentDue": fullOrderExampleContent.totalPaymentDue.zeroItems,
271+
"totalTaxSpecification": fullOrderExampleContent.totalTaxSpecification.zeroItems
272+
});
273+
}
274+
255275
function dataExampleOrderItemCancellationRequest(utils, content) {
256276
return generateRequest("PATCH", API_PATH + "/orders/" + UUID, OPERATIONS_MEDIA_TYPE, {
257277
"@context": CONTEXT,
@@ -260,6 +280,7 @@ function dataExampleOrderItemCancellationRequest(utils, content) {
260280
});
261281
}
262282

283+
263284
function dataExampleOrderItemCancellationSuccessResponse(utils, content) {
264285
return generateResponse("204 No Content", null, OPERATIONS_MEDIA_TYPE);
265286
}

0 commit comments

Comments
 (0)