@51eat/sdk 0.0.76 → 0.0.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/business/client/Client.d.ts +3 -0
- package/dist/cjs/api/resources/business/client/Client.js +7 -2
- package/dist/cjs/api/resources/business/resources/events/client/requests/StoreEventRequest.d.ts +7 -0
- package/dist/cjs/api/resources/business/resources/events/client/requests/UpdateEventRequest.d.ts +7 -0
- package/dist/cjs/api/resources/business/resources/events/resources/ticketTypes/client/requests/StoreTicketTypeRequest.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/events/resources/ticketTypes/client/requests/UpdateTicketTypeRequest.d.ts +7 -0
- package/dist/cjs/api/resources/business/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/index.js +3 -1
- package/dist/cjs/api/resources/business/resources/productOrders/client/Client.d.ts +26 -9
- package/dist/cjs/api/resources/business/resources/productOrders/client/Client.js +61 -30
- package/dist/cjs/api/resources/business/resources/productOrders/client/requests/AddTrackingProductOrdersRequest.d.ts +3 -2
- package/dist/cjs/api/resources/business/resources/productOrders/client/requests/FulfillProductOrdersRequest.d.ts +3 -2
- package/dist/cjs/api/resources/business/resources/productOrders/client/requests/GetLabelRatesProductOrdersRequest.d.ts +3 -2
- package/dist/cjs/api/resources/business/resources/productOrders/client/requests/GetProductOrdersRequest.d.ts +3 -2
- package/dist/cjs/api/resources/business/resources/productOrders/client/requests/MarkPickedUpProductOrdersRequest.d.ts +3 -2
- package/dist/cjs/api/resources/business/resources/productOrders/client/requests/PurchaseLabelProductOrdersRequest.d.ts +3 -2
- package/dist/cjs/api/resources/business/resources/productOrders/client/requests/RefundOrderRequest.d.ts +14 -0
- package/dist/cjs/api/resources/business/resources/productOrders/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/business/resources/products/client/Client.d.ts +4 -2
- package/dist/cjs/api/resources/business/resources/products/client/Client.js +4 -2
- package/dist/cjs/api/resources/business/resources/products/client/requests/StoreProductRequest.d.ts +3 -1
- package/dist/cjs/api/resources/business/resources/products/client/requests/UpdateProductRequest.d.ts +3 -1
- package/dist/cjs/api/resources/business/resources/taxCodes/client/Client.d.ts +27 -0
- package/dist/cjs/api/resources/business/resources/taxCodes/client/Client.js +111 -0
- package/dist/cjs/api/resources/business/resources/taxCodes/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/taxCodes/client/index.js +2 -0
- package/dist/cjs/api/resources/business/resources/taxCodes/exports.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/taxCodes/exports.js +21 -0
- package/dist/cjs/api/resources/business/resources/taxCodes/index.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/taxCodes/index.js +18 -0
- package/dist/cjs/api/resources/business/resources/taxCodes/types/ListTaxCodesResponse.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/taxCodes/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/taxCodes/types/index.js +17 -0
- package/dist/cjs/api/resources/customer/resources/cart/client/Client.d.ts +98 -8
- package/dist/cjs/api/resources/customer/resources/cart/client/Client.js +242 -11
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/AddItemCartRequest.d.ts +1 -1
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/CheckoutCartRequest.d.ts +1 -1
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/ChooseFulfillmentMethodRequest.d.ts +13 -0
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/ClearCartRequest.d.ts +1 -1
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/CreatePaymentIntentCartRequest.d.ts +1 -1
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/GetCartRequest.d.ts +1 -1
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/ListShippingOptionsCartRequest.d.ts +10 -0
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/RefreshCartPaymentRequest.d.ts +12 -0
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/RefreshCartPaymentRequest.js +3 -0
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/SelectShippingRateRequest.d.ts +12 -0
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/SelectShippingRateRequest.js +3 -0
- package/dist/{esm/api/resources/customer/resources/cart/client/requests/GetShippingOptionsCartRequest.d.mts → cjs/api/resources/customer/resources/cart/client/requests/ShippingAddressRequest.d.ts} +6 -5
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/ShippingAddressRequest.js +3 -0
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/index.d.ts +5 -2
- package/dist/cjs/api/resources/customer/resources/cart/types/CreatePaymentIntentCartResponse.d.ts +1 -0
- package/dist/cjs/api/resources/customer/resources/cart/types/ListShippingOptionsCartResponse.d.ts +18 -0
- package/dist/cjs/api/resources/customer/resources/cart/types/ListShippingOptionsCartResponse.js +3 -0
- package/dist/cjs/api/resources/customer/resources/cart/types/RefreshPaymentIntentCartResponse.d.ts +18 -0
- package/dist/cjs/api/resources/customer/resources/cart/types/RefreshPaymentIntentCartResponse.js +10 -0
- package/dist/cjs/api/resources/customer/resources/cart/types/SetFulfillmentCartResponse.d.ts +4 -0
- package/dist/cjs/api/resources/customer/resources/cart/types/SetFulfillmentCartResponse.js +3 -0
- package/dist/cjs/api/resources/customer/resources/cart/types/SetShippingAddressCartResponse.d.ts +4 -0
- package/dist/cjs/api/resources/customer/resources/cart/types/SetShippingAddressCartResponse.js +3 -0
- package/dist/cjs/api/resources/customer/resources/cart/types/index.d.ts +4 -1
- package/dist/cjs/api/resources/customer/resources/cart/types/index.js +4 -1
- package/dist/cjs/api/resources/customer/resources/events/resources/ticketing/client/Client.d.ts +2 -0
- package/dist/cjs/api/resources/customer/resources/events/resources/ticketing/client/Client.js +6 -0
- package/dist/cjs/api/resources/customer/resources/events/resources/ticketing/client/requests/CreatePaymentIntentRequest.d.ts +1 -0
- package/dist/cjs/api/resources/customer/resources/events/resources/ticketing/types/CreatePaymentIntentTicketingResponse.d.ts +7 -0
- package/dist/cjs/api/resources/customer/resources/productOrders/client/Client.d.ts +1 -0
- package/dist/cjs/api/resources/customer/resources/productOrders/client/Client.js +3 -0
- package/dist/cjs/api/resources/customer/resources/productOrders/client/requests/GetProductOrdersRequest.d.ts +1 -0
- package/dist/cjs/api/resources/customer/resources/stands/client/Client.d.ts +1 -0
- package/dist/cjs/api/resources/customer/resources/stands/client/Client.js +3 -0
- package/dist/cjs/api/types/AppHttpResourcesApiV1BusinessCommerceProductResource.d.ts +10 -0
- package/dist/cjs/api/types/BusinessEvent.d.ts +7 -0
- package/dist/cjs/api/types/BusinessEventTicketType.d.ts +2 -0
- package/dist/cjs/api/types/BusinessProfile.d.ts +1 -1
- package/dist/cjs/api/types/CartResource.d.ts +24 -0
- package/dist/cjs/api/types/ConflictErrorBody.d.ts +7 -1
- package/dist/cjs/api/types/ConflictErrorBody.js +4 -1
- package/dist/cjs/api/types/CustomerBusinessProfile.d.ts +1 -1
- package/dist/cjs/api/types/FulfillmentType.d.ts +6 -0
- package/dist/cjs/api/types/FulfillmentType.js +9 -0
- package/dist/cjs/api/types/ProductResource.d.ts +5 -0
- package/dist/cjs/api/types/TaxCode.d.ts +21 -0
- package/dist/cjs/api/types/TaxCode.js +15 -0
- package/dist/cjs/api/types/index.d.ts +2 -0
- package/dist/cjs/api/types/index.js +2 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/business/client/Client.d.mts +3 -0
- package/dist/esm/api/resources/business/client/Client.mjs +5 -0
- package/dist/esm/api/resources/business/resources/events/client/requests/StoreEventRequest.d.mts +7 -0
- package/dist/esm/api/resources/business/resources/events/client/requests/UpdateEventRequest.d.mts +7 -0
- package/dist/esm/api/resources/business/resources/events/resources/ticketTypes/client/requests/StoreTicketTypeRequest.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/events/resources/ticketTypes/client/requests/UpdateTicketTypeRequest.d.mts +7 -0
- package/dist/esm/api/resources/business/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/index.mjs +2 -0
- package/dist/esm/api/resources/business/resources/productOrders/client/Client.d.mts +26 -9
- package/dist/esm/api/resources/business/resources/productOrders/client/Client.mjs +62 -31
- package/dist/esm/api/resources/business/resources/productOrders/client/requests/AddTrackingProductOrdersRequest.d.mts +3 -2
- package/dist/esm/api/resources/business/resources/productOrders/client/requests/FulfillProductOrdersRequest.d.mts +3 -2
- package/dist/esm/api/resources/business/resources/productOrders/client/requests/GetLabelRatesProductOrdersRequest.d.mts +3 -2
- package/dist/esm/api/resources/business/resources/productOrders/client/requests/GetProductOrdersRequest.d.mts +3 -2
- package/dist/esm/api/resources/business/resources/productOrders/client/requests/MarkPickedUpProductOrdersRequest.d.mts +3 -2
- package/dist/esm/api/resources/business/resources/productOrders/client/requests/PurchaseLabelProductOrdersRequest.d.mts +3 -2
- package/dist/esm/api/resources/business/resources/productOrders/client/requests/RefundOrderRequest.d.mts +14 -0
- package/dist/esm/api/resources/business/resources/productOrders/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/business/resources/products/client/Client.d.mts +4 -2
- package/dist/esm/api/resources/business/resources/products/client/Client.mjs +4 -2
- package/dist/esm/api/resources/business/resources/products/client/requests/StoreProductRequest.d.mts +3 -1
- package/dist/esm/api/resources/business/resources/products/client/requests/UpdateProductRequest.d.mts +3 -1
- package/dist/esm/api/resources/business/resources/taxCodes/client/Client.d.mts +27 -0
- package/dist/esm/api/resources/business/resources/taxCodes/client/Client.mjs +74 -0
- package/dist/esm/api/resources/business/resources/taxCodes/client/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/taxCodes/client/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/taxCodes/exports.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/taxCodes/exports.mjs +3 -0
- package/dist/esm/api/resources/business/resources/taxCodes/index.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/taxCodes/index.mjs +2 -0
- package/dist/esm/api/resources/business/resources/taxCodes/types/ListTaxCodesResponse.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/taxCodes/types/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/taxCodes/types/index.mjs +1 -0
- package/dist/esm/api/resources/customer/resources/cart/client/Client.d.mts +98 -8
- package/dist/esm/api/resources/customer/resources/cart/client/Client.mjs +242 -11
- package/dist/esm/api/resources/customer/resources/cart/client/requests/AddItemCartRequest.d.mts +1 -1
- package/dist/esm/api/resources/customer/resources/cart/client/requests/CheckoutCartRequest.d.mts +1 -1
- package/dist/esm/api/resources/customer/resources/cart/client/requests/ChooseFulfillmentMethodRequest.d.mts +13 -0
- package/dist/esm/api/resources/customer/resources/cart/client/requests/ClearCartRequest.d.mts +1 -1
- package/dist/esm/api/resources/customer/resources/cart/client/requests/CreatePaymentIntentCartRequest.d.mts +1 -1
- package/dist/esm/api/resources/customer/resources/cart/client/requests/GetCartRequest.d.mts +1 -1
- package/dist/esm/api/resources/customer/resources/cart/client/requests/ListShippingOptionsCartRequest.d.mts +10 -0
- package/dist/esm/api/resources/customer/resources/cart/client/requests/RefreshCartPaymentRequest.d.mts +12 -0
- package/dist/esm/api/resources/customer/resources/cart/client/requests/RefreshCartPaymentRequest.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/cart/client/requests/SelectShippingRateRequest.d.mts +12 -0
- package/dist/esm/api/resources/customer/resources/cart/client/requests/SelectShippingRateRequest.mjs +2 -0
- package/dist/{cjs/api/resources/customer/resources/cart/client/requests/GetShippingOptionsCartRequest.d.ts → esm/api/resources/customer/resources/cart/client/requests/ShippingAddressRequest.d.mts} +6 -5
- package/dist/esm/api/resources/customer/resources/cart/client/requests/ShippingAddressRequest.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/cart/client/requests/index.d.mts +5 -2
- package/dist/esm/api/resources/customer/resources/cart/types/CreatePaymentIntentCartResponse.d.mts +1 -0
- package/dist/esm/api/resources/customer/resources/cart/types/ListShippingOptionsCartResponse.d.mts +18 -0
- package/dist/esm/api/resources/customer/resources/cart/types/ListShippingOptionsCartResponse.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/cart/types/RefreshPaymentIntentCartResponse.d.mts +18 -0
- package/dist/esm/api/resources/customer/resources/cart/types/RefreshPaymentIntentCartResponse.mjs +7 -0
- package/dist/esm/api/resources/customer/resources/cart/types/SetFulfillmentCartResponse.d.mts +4 -0
- package/dist/esm/api/resources/customer/resources/cart/types/SetFulfillmentCartResponse.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/cart/types/SetShippingAddressCartResponse.d.mts +4 -0
- package/dist/esm/api/resources/customer/resources/cart/types/SetShippingAddressCartResponse.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/cart/types/index.d.mts +4 -1
- package/dist/esm/api/resources/customer/resources/cart/types/index.mjs +4 -1
- package/dist/esm/api/resources/customer/resources/events/resources/ticketing/client/Client.d.mts +2 -0
- package/dist/esm/api/resources/customer/resources/events/resources/ticketing/client/Client.mjs +6 -0
- package/dist/esm/api/resources/customer/resources/events/resources/ticketing/client/requests/CreatePaymentIntentRequest.d.mts +1 -0
- package/dist/esm/api/resources/customer/resources/events/resources/ticketing/types/CreatePaymentIntentTicketingResponse.d.mts +7 -0
- package/dist/esm/api/resources/customer/resources/productOrders/client/Client.d.mts +1 -0
- package/dist/esm/api/resources/customer/resources/productOrders/client/Client.mjs +3 -0
- package/dist/esm/api/resources/customer/resources/productOrders/client/requests/GetProductOrdersRequest.d.mts +1 -0
- package/dist/esm/api/resources/customer/resources/stands/client/Client.d.mts +1 -0
- package/dist/esm/api/resources/customer/resources/stands/client/Client.mjs +3 -0
- package/dist/esm/api/types/AppHttpResourcesApiV1BusinessCommerceProductResource.d.mts +10 -0
- package/dist/esm/api/types/BusinessEvent.d.mts +7 -0
- package/dist/esm/api/types/BusinessEventTicketType.d.mts +2 -0
- package/dist/esm/api/types/BusinessProfile.d.mts +1 -1
- package/dist/esm/api/types/CartResource.d.mts +24 -0
- package/dist/esm/api/types/ConflictErrorBody.d.mts +7 -1
- package/dist/esm/api/types/ConflictErrorBody.mjs +4 -1
- package/dist/esm/api/types/CustomerBusinessProfile.d.mts +1 -1
- package/dist/esm/api/types/FulfillmentType.d.mts +6 -0
- package/dist/esm/api/types/FulfillmentType.mjs +6 -0
- package/dist/esm/api/types/ProductResource.d.mts +5 -0
- package/dist/esm/api/types/TaxCode.d.mts +21 -0
- package/dist/esm/api/types/TaxCode.mjs +12 -0
- package/dist/esm/api/types/index.d.mts +2 -0
- package/dist/esm/api/types/index.mjs +2 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +12 -1
- package/reference.md +377 -16
- package/dist/cjs/api/resources/business/resources/productOrders/client/requests/RefundProductOrdersRequest.d.ts +0 -11
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/SelectShippingOptionCartRequest.d.ts +0 -14
- package/dist/cjs/api/resources/customer/resources/cart/types/GetShippingOptionsCartResponse.d.ts +0 -14
- package/dist/esm/api/resources/business/resources/productOrders/client/requests/RefundProductOrdersRequest.d.mts +0 -11
- package/dist/esm/api/resources/customer/resources/cart/client/requests/SelectShippingOptionCartRequest.d.mts +0 -14
- package/dist/esm/api/resources/customer/resources/cart/types/GetShippingOptionsCartResponse.d.mts +0 -14
- /package/dist/cjs/api/resources/business/resources/productOrders/client/requests/{RefundProductOrdersRequest.js → RefundOrderRequest.js} +0 -0
- /package/dist/cjs/api/resources/{customer/resources/cart/client/requests/GetShippingOptionsCartRequest.js → business/resources/taxCodes/types/ListTaxCodesResponse.js} +0 -0
- /package/dist/cjs/api/resources/customer/resources/cart/client/requests/{SelectShippingOptionCartRequest.js → ChooseFulfillmentMethodRequest.js} +0 -0
- /package/dist/cjs/api/resources/customer/resources/cart/{types/GetShippingOptionsCartResponse.js → client/requests/ListShippingOptionsCartRequest.js} +0 -0
- /package/dist/esm/api/resources/business/resources/productOrders/client/requests/{RefundProductOrdersRequest.mjs → RefundOrderRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{customer/resources/cart/client/requests/GetShippingOptionsCartRequest.mjs → business/resources/taxCodes/types/ListTaxCodesResponse.mjs} +0 -0
- /package/dist/esm/api/resources/customer/resources/cart/client/requests/{SelectShippingOptionCartRequest.mjs → ChooseFulfillmentMethodRequest.mjs} +0 -0
- /package/dist/esm/api/resources/customer/resources/cart/{types/GetShippingOptionsCartResponse.mjs → client/requests/ListShippingOptionsCartRequest.mjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ListTaxCodesResponse.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ListTaxCodesResponse.mjs";
|
|
@@ -88,11 +88,21 @@ export declare class CartClient {
|
|
|
88
88
|
removeItem(request: FiveOneEat.customer.RemoveItemCartRequest, requestOptions?: CartClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.RemoveItemCartResponse>;
|
|
89
89
|
private __removeItem;
|
|
90
90
|
/**
|
|
91
|
+
* Refused with a 422 and a message while the order can't be priced yet: no
|
|
92
|
+
* fulfillment method chosen (when the shop offers several), a shipped order
|
|
93
|
+
* with no shipping address, or calculated shipping with no option chosen.
|
|
94
|
+
* The message is also in the cart's `fulfillment.checkout_blocker`.
|
|
95
|
+
*
|
|
96
|
+
* A 409 `{status: "paid", message, payment_intent_id}` means the cart's
|
|
97
|
+
* payment already went through (never a second payment): finish checkout
|
|
98
|
+
* with that id. A 409 with only a message means it is still processing.
|
|
99
|
+
*
|
|
91
100
|
* @param {FiveOneEat.customer.CreatePaymentIntentCartRequest} request
|
|
92
101
|
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
93
102
|
*
|
|
94
103
|
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
95
104
|
* @throws {@link FiveOneEat.NotFoundError}
|
|
105
|
+
* @throws {@link FiveOneEat.ConflictError}
|
|
96
106
|
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
97
107
|
*
|
|
98
108
|
* @example
|
|
@@ -103,11 +113,51 @@ export declare class CartClient {
|
|
|
103
113
|
createPaymentIntent(request: FiveOneEat.customer.CreatePaymentIntentCartRequest, requestOptions?: CartClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.CreatePaymentIntentCartResponse>;
|
|
104
114
|
private __createPaymentIntent;
|
|
105
115
|
/**
|
|
116
|
+
* Call immediately before presenting or confirming the payment sheet. The
|
|
117
|
+
* cart may have changed since its payment intent was created (another
|
|
118
|
+
* device, a changed address or shipping option), so it is re-priced and
|
|
119
|
+
* the intent brought up to date. Send `amount`, the total in cents the
|
|
120
|
+
* buyer is looking at.
|
|
121
|
+
*
|
|
122
|
+
* - `total_changed: false` — pay with the returned `client_secret`.
|
|
123
|
+
* - `total_changed: true` — show "Your total changed to $X", re-initialise
|
|
124
|
+
* the payment sheet with the returned `client_secret` (it carries the new
|
|
125
|
+
* amount), and let the buyer confirm again.
|
|
126
|
+
* - 422 with a message — the order can't be priced yet (the same message
|
|
127
|
+
* as `fulfillment.checkout_blocker`); the old intent is cancelled.
|
|
128
|
+
* - 409 `status: paid` with `payment_intent_id` — the payment already went
|
|
129
|
+
* through; call checkout with that id instead.
|
|
130
|
+
* - 409 `status: processing` — the payment is still processing; don't pay
|
|
131
|
+
* again, check back later.
|
|
132
|
+
*
|
|
133
|
+
* @param {FiveOneEat.customer.RefreshCartPaymentRequest} request
|
|
134
|
+
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
135
|
+
*
|
|
136
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
137
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
138
|
+
* @throws {@link FiveOneEat.ConflictError}
|
|
139
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* await client.customer.cart.refreshPaymentIntent({
|
|
143
|
+
* business: "business",
|
|
144
|
+
* amount: 1
|
|
145
|
+
* })
|
|
146
|
+
*/
|
|
147
|
+
refreshPaymentIntent(request: FiveOneEat.customer.RefreshCartPaymentRequest, requestOptions?: CartClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.RefreshPaymentIntentCartResponse>;
|
|
148
|
+
private __refreshPaymentIntent;
|
|
149
|
+
/**
|
|
150
|
+
* Not gated on commerce readiness: the customer has already paid, so a
|
|
151
|
+
* lapsed readiness check must not stop the order from being recorded.
|
|
152
|
+
* A 409 means the cart changed after the payment was priced: the payment
|
|
153
|
+
* was refunded in full and no order was placed — re-check and pay again.
|
|
154
|
+
*
|
|
106
155
|
* @param {FiveOneEat.customer.CheckoutCartRequest} request
|
|
107
156
|
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
108
157
|
*
|
|
109
158
|
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
110
159
|
* @throws {@link FiveOneEat.NotFoundError}
|
|
160
|
+
* @throws {@link FiveOneEat.ConflictError}
|
|
111
161
|
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
112
162
|
*
|
|
113
163
|
* @example
|
|
@@ -121,7 +171,28 @@ export declare class CartClient {
|
|
|
121
171
|
checkout(request: FiveOneEat.customer.CheckoutCartRequest, requestOptions?: CartClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.CheckoutCartResponse>;
|
|
122
172
|
private __checkout;
|
|
123
173
|
/**
|
|
124
|
-
*
|
|
174
|
+
* Switching away from shipping clears the saved shipping address and option.
|
|
175
|
+
*
|
|
176
|
+
* @param {FiveOneEat.customer.ChooseFulfillmentMethodRequest} request
|
|
177
|
+
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
178
|
+
*
|
|
179
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
180
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
181
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* await client.customer.cart.setFulfillment({
|
|
185
|
+
* business: "business",
|
|
186
|
+
* fulfillment_method: "ship"
|
|
187
|
+
* })
|
|
188
|
+
*/
|
|
189
|
+
setFulfillment(request: FiveOneEat.customer.ChooseFulfillmentMethodRequest, requestOptions?: CartClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.SetFulfillmentCartResponse>;
|
|
190
|
+
private __setFulfillment;
|
|
191
|
+
/**
|
|
192
|
+
* Sales tax on a shipped order is worked out from this address. Saving a
|
|
193
|
+
* different address clears the chosen shipping option.
|
|
194
|
+
*
|
|
195
|
+
* @param {FiveOneEat.customer.ShippingAddressRequest} request
|
|
125
196
|
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
126
197
|
*
|
|
127
198
|
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
@@ -129,7 +200,7 @@ export declare class CartClient {
|
|
|
129
200
|
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
130
201
|
*
|
|
131
202
|
* @example
|
|
132
|
-
* await client.customer.cart.
|
|
203
|
+
* await client.customer.cart.setShippingAddress({
|
|
133
204
|
* business: "business",
|
|
134
205
|
* address: {
|
|
135
206
|
* line1: "line1",
|
|
@@ -139,10 +210,30 @@ export declare class CartClient {
|
|
|
139
210
|
* }
|
|
140
211
|
* })
|
|
141
212
|
*/
|
|
142
|
-
|
|
143
|
-
private
|
|
213
|
+
setShippingAddress(request: FiveOneEat.customer.ShippingAddressRequest, requestOptions?: CartClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.SetShippingAddressCartResponse>;
|
|
214
|
+
private __setShippingAddress;
|
|
215
|
+
/**
|
|
216
|
+
* Options are held for 30 minutes; choose one by its `provider_rate_id`.
|
|
217
|
+
*
|
|
218
|
+
* @param {FiveOneEat.customer.ListShippingOptionsCartRequest} request
|
|
219
|
+
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
220
|
+
*
|
|
221
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
222
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
223
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* await client.customer.cart.listShippingOptions({
|
|
227
|
+
* business: "business"
|
|
228
|
+
* })
|
|
229
|
+
*/
|
|
230
|
+
listShippingOptions(request: FiveOneEat.customer.ListShippingOptionsCartRequest, requestOptions?: CartClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.ListShippingOptionsCartResponse>;
|
|
231
|
+
private __listShippingOptions;
|
|
144
232
|
/**
|
|
145
|
-
*
|
|
233
|
+
* Send only the `provider_rate_id` from the shipping options. The price is
|
|
234
|
+
* the one quoted; an option older than 30 minutes is refused with a 422.
|
|
235
|
+
*
|
|
236
|
+
* @param {FiveOneEat.customer.SelectShippingRateRequest} request
|
|
146
237
|
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
147
238
|
*
|
|
148
239
|
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
@@ -152,10 +243,9 @@ export declare class CartClient {
|
|
|
152
243
|
* @example
|
|
153
244
|
* await client.customer.cart.selectShippingOption({
|
|
154
245
|
* business: "business",
|
|
155
|
-
* provider_rate_id: "provider_rate_id"
|
|
156
|
-
* amount_cents: 1
|
|
246
|
+
* provider_rate_id: "provider_rate_id"
|
|
157
247
|
* })
|
|
158
248
|
*/
|
|
159
|
-
selectShippingOption(request: FiveOneEat.customer.
|
|
249
|
+
selectShippingOption(request: FiveOneEat.customer.SelectShippingRateRequest, requestOptions?: CartClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.SelectShippingOptionCartResponse>;
|
|
160
250
|
private __selectShippingOption;
|
|
161
251
|
}
|
|
@@ -321,11 +321,21 @@ export class CartClient {
|
|
|
321
321
|
});
|
|
322
322
|
}
|
|
323
323
|
/**
|
|
324
|
+
* Refused with a 422 and a message while the order can't be priced yet: no
|
|
325
|
+
* fulfillment method chosen (when the shop offers several), a shipped order
|
|
326
|
+
* with no shipping address, or calculated shipping with no option chosen.
|
|
327
|
+
* The message is also in the cart's `fulfillment.checkout_blocker`.
|
|
328
|
+
*
|
|
329
|
+
* A 409 `{status: "paid", message, payment_intent_id}` means the cart's
|
|
330
|
+
* payment already went through (never a second payment): finish checkout
|
|
331
|
+
* with that id. A 409 with only a message means it is still processing.
|
|
332
|
+
*
|
|
324
333
|
* @param {FiveOneEat.customer.CreatePaymentIntentCartRequest} request
|
|
325
334
|
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
326
335
|
*
|
|
327
336
|
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
328
337
|
* @throws {@link FiveOneEat.NotFoundError}
|
|
338
|
+
* @throws {@link FiveOneEat.ConflictError}
|
|
329
339
|
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
330
340
|
*
|
|
331
341
|
* @example
|
|
@@ -365,6 +375,8 @@ export class CartClient {
|
|
|
365
375
|
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
366
376
|
case 404:
|
|
367
377
|
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
378
|
+
case 409:
|
|
379
|
+
throw new FiveOneEat.ConflictError(_response.error.body, _response.rawResponse);
|
|
368
380
|
case 422:
|
|
369
381
|
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
370
382
|
default:
|
|
@@ -379,11 +391,99 @@ export class CartClient {
|
|
|
379
391
|
});
|
|
380
392
|
}
|
|
381
393
|
/**
|
|
394
|
+
* Call immediately before presenting or confirming the payment sheet. The
|
|
395
|
+
* cart may have changed since its payment intent was created (another
|
|
396
|
+
* device, a changed address or shipping option), so it is re-priced and
|
|
397
|
+
* the intent brought up to date. Send `amount`, the total in cents the
|
|
398
|
+
* buyer is looking at.
|
|
399
|
+
*
|
|
400
|
+
* - `total_changed: false` — pay with the returned `client_secret`.
|
|
401
|
+
* - `total_changed: true` — show "Your total changed to $X", re-initialise
|
|
402
|
+
* the payment sheet with the returned `client_secret` (it carries the new
|
|
403
|
+
* amount), and let the buyer confirm again.
|
|
404
|
+
* - 422 with a message — the order can't be priced yet (the same message
|
|
405
|
+
* as `fulfillment.checkout_blocker`); the old intent is cancelled.
|
|
406
|
+
* - 409 `status: paid` with `payment_intent_id` — the payment already went
|
|
407
|
+
* through; call checkout with that id instead.
|
|
408
|
+
* - 409 `status: processing` — the payment is still processing; don't pay
|
|
409
|
+
* again, check back later.
|
|
410
|
+
*
|
|
411
|
+
* @param {FiveOneEat.customer.RefreshCartPaymentRequest} request
|
|
412
|
+
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
413
|
+
*
|
|
414
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
415
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
416
|
+
* @throws {@link FiveOneEat.ConflictError}
|
|
417
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
418
|
+
*
|
|
419
|
+
* @example
|
|
420
|
+
* await client.customer.cart.refreshPaymentIntent({
|
|
421
|
+
* business: "business",
|
|
422
|
+
* amount: 1
|
|
423
|
+
* })
|
|
424
|
+
*/
|
|
425
|
+
refreshPaymentIntent(request, requestOptions) {
|
|
426
|
+
return core.HttpResponsePromise.fromPromise(this.__refreshPaymentIntent(request, requestOptions));
|
|
427
|
+
}
|
|
428
|
+
__refreshPaymentIntent(request, requestOptions) {
|
|
429
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
430
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
431
|
+
const { business } = request, _body = __rest(request, ["business"]);
|
|
432
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
433
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
434
|
+
const _response = yield core.fetcher({
|
|
435
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `customer/businesses/${core.url.encodePathParam(business)}/cart/payment-intent/refresh`),
|
|
436
|
+
method: "POST",
|
|
437
|
+
headers: _headers,
|
|
438
|
+
contentType: "application/json",
|
|
439
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
440
|
+
requestType: "json",
|
|
441
|
+
body: _body,
|
|
442
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
443
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
444
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
445
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
446
|
+
logging: this._options.logging,
|
|
447
|
+
});
|
|
448
|
+
if (_response.ok) {
|
|
449
|
+
return {
|
|
450
|
+
data: _response.body,
|
|
451
|
+
rawResponse: _response.rawResponse,
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
if (_response.error.reason === "status-code") {
|
|
455
|
+
switch (_response.error.statusCode) {
|
|
456
|
+
case 401:
|
|
457
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
458
|
+
case 404:
|
|
459
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
460
|
+
case 409:
|
|
461
|
+
throw new FiveOneEat.ConflictError(_response.error.body, _response.rawResponse);
|
|
462
|
+
case 422:
|
|
463
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
464
|
+
default:
|
|
465
|
+
throw new errors.FiveOneEatError({
|
|
466
|
+
statusCode: _response.error.statusCode,
|
|
467
|
+
body: _response.error.body,
|
|
468
|
+
rawResponse: _response.rawResponse,
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/customer/businesses/{business}/cart/payment-intent/refresh");
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Not gated on commerce readiness: the customer has already paid, so a
|
|
477
|
+
* lapsed readiness check must not stop the order from being recorded.
|
|
478
|
+
* A 409 means the cart changed after the payment was priced: the payment
|
|
479
|
+
* was refunded in full and no order was placed — re-check and pay again.
|
|
480
|
+
*
|
|
382
481
|
* @param {FiveOneEat.customer.CheckoutCartRequest} request
|
|
383
482
|
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
384
483
|
*
|
|
385
484
|
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
386
485
|
* @throws {@link FiveOneEat.NotFoundError}
|
|
486
|
+
* @throws {@link FiveOneEat.ConflictError}
|
|
387
487
|
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
388
488
|
*
|
|
389
489
|
* @example
|
|
@@ -429,6 +529,8 @@ export class CartClient {
|
|
|
429
529
|
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
430
530
|
case 404:
|
|
431
531
|
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
532
|
+
case 409:
|
|
533
|
+
throw new FiveOneEat.ConflictError(_response.error.body, _response.rawResponse);
|
|
432
534
|
case 422:
|
|
433
535
|
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
434
536
|
default:
|
|
@@ -443,7 +545,74 @@ export class CartClient {
|
|
|
443
545
|
});
|
|
444
546
|
}
|
|
445
547
|
/**
|
|
446
|
-
*
|
|
548
|
+
* Switching away from shipping clears the saved shipping address and option.
|
|
549
|
+
*
|
|
550
|
+
* @param {FiveOneEat.customer.ChooseFulfillmentMethodRequest} request
|
|
551
|
+
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
552
|
+
*
|
|
553
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
554
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
555
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
556
|
+
*
|
|
557
|
+
* @example
|
|
558
|
+
* await client.customer.cart.setFulfillment({
|
|
559
|
+
* business: "business",
|
|
560
|
+
* fulfillment_method: "ship"
|
|
561
|
+
* })
|
|
562
|
+
*/
|
|
563
|
+
setFulfillment(request, requestOptions) {
|
|
564
|
+
return core.HttpResponsePromise.fromPromise(this.__setFulfillment(request, requestOptions));
|
|
565
|
+
}
|
|
566
|
+
__setFulfillment(request, requestOptions) {
|
|
567
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
568
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
569
|
+
const { business } = request, _body = __rest(request, ["business"]);
|
|
570
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
571
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
572
|
+
const _response = yield core.fetcher({
|
|
573
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `customer/businesses/${core.url.encodePathParam(business)}/cart/fulfillment`),
|
|
574
|
+
method: "PUT",
|
|
575
|
+
headers: _headers,
|
|
576
|
+
contentType: "application/json",
|
|
577
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
578
|
+
requestType: "json",
|
|
579
|
+
body: _body,
|
|
580
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
581
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
582
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
583
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
584
|
+
logging: this._options.logging,
|
|
585
|
+
});
|
|
586
|
+
if (_response.ok) {
|
|
587
|
+
return {
|
|
588
|
+
data: _response.body,
|
|
589
|
+
rawResponse: _response.rawResponse,
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
if (_response.error.reason === "status-code") {
|
|
593
|
+
switch (_response.error.statusCode) {
|
|
594
|
+
case 401:
|
|
595
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
596
|
+
case 404:
|
|
597
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
598
|
+
case 422:
|
|
599
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
600
|
+
default:
|
|
601
|
+
throw new errors.FiveOneEatError({
|
|
602
|
+
statusCode: _response.error.statusCode,
|
|
603
|
+
body: _response.error.body,
|
|
604
|
+
rawResponse: _response.rawResponse,
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/customer/businesses/{business}/cart/fulfillment");
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Sales tax on a shipped order is worked out from this address. Saving a
|
|
613
|
+
* different address clears the chosen shipping option.
|
|
614
|
+
*
|
|
615
|
+
* @param {FiveOneEat.customer.ShippingAddressRequest} request
|
|
447
616
|
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
448
617
|
*
|
|
449
618
|
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
@@ -451,7 +620,7 @@ export class CartClient {
|
|
|
451
620
|
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
452
621
|
*
|
|
453
622
|
* @example
|
|
454
|
-
* await client.customer.cart.
|
|
623
|
+
* await client.customer.cart.setShippingAddress({
|
|
455
624
|
* business: "business",
|
|
456
625
|
* address: {
|
|
457
626
|
* line1: "line1",
|
|
@@ -461,18 +630,18 @@ export class CartClient {
|
|
|
461
630
|
* }
|
|
462
631
|
* })
|
|
463
632
|
*/
|
|
464
|
-
|
|
465
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
633
|
+
setShippingAddress(request, requestOptions) {
|
|
634
|
+
return core.HttpResponsePromise.fromPromise(this.__setShippingAddress(request, requestOptions));
|
|
466
635
|
}
|
|
467
|
-
|
|
636
|
+
__setShippingAddress(request, requestOptions) {
|
|
468
637
|
return __awaiter(this, void 0, void 0, function* () {
|
|
469
638
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
470
639
|
const { business } = request, _body = __rest(request, ["business"]);
|
|
471
640
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
472
641
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
473
642
|
const _response = yield core.fetcher({
|
|
474
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `customer/businesses/${core.url.encodePathParam(business)}/cart/shipping-
|
|
475
|
-
method: "
|
|
643
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `customer/businesses/${core.url.encodePathParam(business)}/cart/shipping-address`),
|
|
644
|
+
method: "PUT",
|
|
476
645
|
headers: _headers,
|
|
477
646
|
contentType: "application/json",
|
|
478
647
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
@@ -506,11 +675,74 @@ export class CartClient {
|
|
|
506
675
|
});
|
|
507
676
|
}
|
|
508
677
|
}
|
|
509
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "
|
|
678
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/customer/businesses/{business}/cart/shipping-address");
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Options are held for 30 minutes; choose one by its `provider_rate_id`.
|
|
683
|
+
*
|
|
684
|
+
* @param {FiveOneEat.customer.ListShippingOptionsCartRequest} request
|
|
685
|
+
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
686
|
+
*
|
|
687
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
688
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
689
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
690
|
+
*
|
|
691
|
+
* @example
|
|
692
|
+
* await client.customer.cart.listShippingOptions({
|
|
693
|
+
* business: "business"
|
|
694
|
+
* })
|
|
695
|
+
*/
|
|
696
|
+
listShippingOptions(request, requestOptions) {
|
|
697
|
+
return core.HttpResponsePromise.fromPromise(this.__listShippingOptions(request, requestOptions));
|
|
698
|
+
}
|
|
699
|
+
__listShippingOptions(request, requestOptions) {
|
|
700
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
701
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
702
|
+
const { business } = request;
|
|
703
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
704
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
705
|
+
const _response = yield core.fetcher({
|
|
706
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `customer/businesses/${core.url.encodePathParam(business)}/cart/shipping-options`),
|
|
707
|
+
method: "GET",
|
|
708
|
+
headers: _headers,
|
|
709
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
710
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
711
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
712
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
713
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
714
|
+
logging: this._options.logging,
|
|
715
|
+
});
|
|
716
|
+
if (_response.ok) {
|
|
717
|
+
return {
|
|
718
|
+
data: _response.body,
|
|
719
|
+
rawResponse: _response.rawResponse,
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
if (_response.error.reason === "status-code") {
|
|
723
|
+
switch (_response.error.statusCode) {
|
|
724
|
+
case 401:
|
|
725
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
726
|
+
case 404:
|
|
727
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
728
|
+
case 422:
|
|
729
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
730
|
+
default:
|
|
731
|
+
throw new errors.FiveOneEatError({
|
|
732
|
+
statusCode: _response.error.statusCode,
|
|
733
|
+
body: _response.error.body,
|
|
734
|
+
rawResponse: _response.rawResponse,
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/customer/businesses/{business}/cart/shipping-options");
|
|
510
739
|
});
|
|
511
740
|
}
|
|
512
741
|
/**
|
|
513
|
-
*
|
|
742
|
+
* Send only the `provider_rate_id` from the shipping options. The price is
|
|
743
|
+
* the one quoted; an option older than 30 minutes is refused with a 422.
|
|
744
|
+
*
|
|
745
|
+
* @param {FiveOneEat.customer.SelectShippingRateRequest} request
|
|
514
746
|
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
515
747
|
*
|
|
516
748
|
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
@@ -520,8 +752,7 @@ export class CartClient {
|
|
|
520
752
|
* @example
|
|
521
753
|
* await client.customer.cart.selectShippingOption({
|
|
522
754
|
* business: "business",
|
|
523
|
-
* provider_rate_id: "provider_rate_id"
|
|
524
|
-
* amount_cents: 1
|
|
755
|
+
* provider_rate_id: "provider_rate_id"
|
|
525
756
|
* })
|
|
526
757
|
*/
|
|
527
758
|
selectShippingOption(request, requestOptions) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type * as FiveOneEat from "../../../../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* business: "business",
|
|
6
|
+
* fulfillment_method: "ship"
|
|
7
|
+
* }
|
|
8
|
+
*/
|
|
9
|
+
export interface ChooseFulfillmentMethodRequest {
|
|
10
|
+
/** The business handle */
|
|
11
|
+
business: string;
|
|
12
|
+
fulfillment_method: FiveOneEat.FulfillmentType;
|
|
13
|
+
}
|
|
@@ -10,17 +10,18 @@
|
|
|
10
10
|
* }
|
|
11
11
|
* }
|
|
12
12
|
*/
|
|
13
|
-
export interface
|
|
14
|
-
/** The business
|
|
13
|
+
export interface ShippingAddressRequest {
|
|
14
|
+
/** The business handle */
|
|
15
15
|
business: string;
|
|
16
|
-
address:
|
|
16
|
+
address: ShippingAddressRequest.Address;
|
|
17
17
|
}
|
|
18
|
-
export declare namespace
|
|
18
|
+
export declare namespace ShippingAddressRequest {
|
|
19
19
|
interface Address {
|
|
20
20
|
line1: string;
|
|
21
|
+
line2?: (string | null) | undefined;
|
|
21
22
|
city: string;
|
|
22
23
|
state: string;
|
|
23
24
|
postal_code: string;
|
|
24
|
-
country?:
|
|
25
|
+
country?: string | undefined;
|
|
25
26
|
}
|
|
26
27
|
}
|