16. The trolley_remove method¶
This method takes a “trolley_token” plus a list of orders to remove, specified by their item numbers, and produces a trolley with those items removed from it. More than one item may be removed at a time, and an item may be removed more than once without error. As item numbers are not re-used within a trolley then it is not necessary to check that item numbers are actually present in the trolley, as the end result is a trolley absent of those items. As with all other trolley manipulation methods, it is possible to ask the method to produce a full description of the altered trolley in the output XML tree.
16.1. Required inputs¶
A “crypto_block” from “start_session” method must be present. This may come from the original “start_session” or may be one of the crypto blocks produced from any of the other methods which are documented as generating a “start_session” compatible block. A “trolley_token” holding the trolley from which the items are to be removed must also be present. The items are then specified by zero or more “remove_item” elements, each containing an integer specifying the item number of the order to be removed.
An optional “describe_trolley” element may be present to indicate that the output data should contain the full trolley description.
16.1.1. Example input¶
<trolley_remove>
<user_id>demo</user_id>
<crypto_block>U_--LfP7rp3MoitCr2ofVaNShLkdOlMurxfADnkYLSOFxUoQo
YUZz_Kq23SaaVvPmF43Ndbq2o1t5Nq60tvNucAoeODYcVYViU_lXNIqmcKQa9ID
lXCTGZEvwqddnGIUevnZY</crypto_block>
<trolley_token>k1---IHQgb4xt2KimGiw-fPma5Oh1PFVyQJAx1hTrvv60DMz
73WJH8WgUVjBoxB5BLQo9pEilPGEmlk0uVX1Xb5gdejnDvVPYmf205VUlPVYwtd
zGfr1vBNznQp8OYLwx7kwNbQAFbcF_KlquVRXGLIH9YFGQARVJWGGLUDixXEkyq
fsF7DLEHd6kJYTaN0jzPGMMLdWsMIh1Nnms4jrDs1vzjUBVrv_uNX0CK4ezWxgp
jy1toCmQ-aWcrxkO7N-U1-Z9HX44b1CWwXDXVxecEhDjSUPrcKIB0Y6ZaHQABER
XTyMSsp3j4SZ36ESZjbOP8PfZ</trolley_token>
<remove_item>2</remove_item>
<remove_item>0</remove_item>
</trolley_remove>
16.2. Output data¶
The output contains a “crypto_block”marked as coming from “start_session” for use in any subsequent calls, together with the modified trolley in a “trolley_token” element. The number of items in the modified trolley is present as “trolley_order_count”. If the “describe_trolley” element was present at the input then a “trolley” element will be produced in the output containing the description of the new trolley as documented for the “trolley_describe” method.
16.2.1. Example output¶
<trolley_remove_result>
<crypto_block>U_--LfP7rp3MoitCr2ofVaNShLkdOlMurxfADnkYLSOFxUoQo
YUZz_Kq23SaaVvPmF43Ndbq2o1t5Nq60tvNucAoe8EDBCmbWAKI6wq5NjH60XHD
lXCTGZEvwqddnGIUevnZY</crypto_block>
<trolley_token>k---w8xO3m6u8WH90wHc5Z9zQAeJBtYfbKEOoi5Xy5DgPJnp
P8i4zXEux9q1VOV0vqDOY</trolley_token>
<trolley_order_count>0</trolley_order_count>
</trolley_remove_result>
16.3. Potential failure codes¶
- 1 - the supplied crypto block was not generated by
- “start_session”
- 2 - the requested “mime_text_type” was not a supported value
- 801 - no “trolley_token” has been supplied
- 802 - the supplied “trolley_token” is corrupt
- 803 - the trolley has already been purchased
- 804 - the trolley has already been reserved