@51eat/sdk 0.0.70 → 0.0.72

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.
Files changed (134) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/business/resources/stands/client/requests/UpdateStandRequest.d.ts +7 -0
  3. package/dist/cjs/api/resources/customer/client/Client.d.ts +0 -1
  4. package/dist/cjs/api/resources/customer/client/Client.js +1 -5
  5. package/dist/cjs/api/resources/customer/resources/ads/client/Client.d.ts +2 -4
  6. package/dist/cjs/api/resources/customer/resources/ads/client/Client.js +3 -11
  7. package/dist/cjs/api/resources/customer/resources/businesses/client/Client.d.ts +27 -34
  8. package/dist/cjs/api/resources/customer/resources/businesses/client/Client.js +83 -111
  9. package/dist/cjs/api/resources/customer/resources/businesses/resources/bulletins/client/Client.d.ts +0 -1
  10. package/dist/cjs/api/resources/customer/resources/businesses/resources/bulletins/client/Client.js +1 -5
  11. package/dist/cjs/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/client/Client.d.ts +0 -2
  12. package/dist/cjs/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/client/Client.js +2 -10
  13. package/dist/cjs/api/resources/customer/resources/businesses/resources/events/client/Client.d.ts +0 -3
  14. package/dist/cjs/api/resources/customer/resources/businesses/resources/events/client/Client.js +7 -19
  15. package/dist/cjs/api/resources/customer/resources/cart/types/CreatePaymentIntentCartResponse.d.ts +4 -0
  16. package/dist/cjs/api/resources/customer/resources/discovery/client/Client.d.ts +2 -14
  17. package/dist/cjs/api/resources/customer/resources/discovery/client/Client.js +33 -81
  18. package/dist/cjs/api/resources/customer/resources/editorials/client/Client.d.ts +3 -7
  19. package/dist/cjs/api/resources/customer/resources/editorials/client/Client.js +13 -30
  20. package/dist/cjs/api/resources/customer/resources/events/client/Client.d.ts +0 -1
  21. package/dist/cjs/api/resources/customer/resources/events/client/Client.js +1 -5
  22. package/dist/cjs/api/resources/customer/resources/explore/client/Client.d.ts +2 -3
  23. package/dist/cjs/api/resources/customer/resources/explore/client/Client.js +2 -6
  24. package/dist/cjs/api/resources/customer/resources/shop/client/Client.d.ts +2 -5
  25. package/dist/cjs/api/resources/customer/resources/shop/client/Client.js +4 -16
  26. package/dist/cjs/api/resources/customer/resources/stands/client/Client.d.ts +19 -9
  27. package/dist/cjs/api/resources/customer/resources/stands/client/Client.js +64 -30
  28. package/dist/cjs/api/resources/customer/resources/stands/client/requests/CheckoutStandsRequest.d.ts +7 -1
  29. package/dist/cjs/api/resources/customer/resources/stands/client/requests/CreatePaymentIntentStandsRequest.d.ts +1 -0
  30. package/dist/cjs/api/resources/customer/resources/stands/types/CheckoutStandsResponse.d.ts +4 -0
  31. package/dist/cjs/api/resources/customer/resources/stands/types/CreatePaymentIntentStandsResponse.d.ts +16 -0
  32. package/dist/cjs/api/resources/customer/resources/stands/types/CreatePaymentIntentStandsResponse.js +10 -0
  33. package/dist/cjs/api/resources/customer/resources/stands/types/index.d.ts +2 -0
  34. package/dist/cjs/api/resources/customer/resources/stands/types/index.js +2 -0
  35. package/dist/cjs/api/resources/customerStands/client/Client.d.ts +0 -32
  36. package/dist/cjs/api/resources/customerStands/client/Client.js +0 -119
  37. package/dist/cjs/api/resources/customerStands/client/requests/index.d.ts +0 -2
  38. package/dist/cjs/api/resources/customerStands/types/index.d.ts +0 -2
  39. package/dist/cjs/api/resources/customerStands/types/index.js +0 -2
  40. package/dist/cjs/api/types/AppHttpResourcesApiV1BusinessCommerceProductResource.d.ts +1 -1
  41. package/dist/cjs/api/types/CartResource.d.ts +1 -1
  42. package/dist/cjs/api/types/InventoryLevelResource.d.ts +3 -3
  43. package/dist/cjs/api/types/OrderItemResource.d.ts +10 -0
  44. package/dist/cjs/api/types/OrderResource.d.ts +24 -9
  45. package/dist/cjs/api/types/PaginationResource.d.ts +4 -4
  46. package/dist/cjs/api/types/PriceListResource.d.ts +1 -1
  47. package/dist/cjs/api/types/PriceResource.d.ts +3 -3
  48. package/dist/cjs/api/types/ProductResource.d.ts +5 -6
  49. package/dist/cjs/api/types/Transaction.d.ts +6 -6
  50. package/dist/cjs/api/types/VariantResource.d.ts +3 -3
  51. package/dist/cjs/api/types/index.d.ts +1 -2
  52. package/dist/cjs/api/types/index.js +1 -2
  53. package/dist/cjs/version.d.ts +1 -1
  54. package/dist/cjs/version.js +1 -1
  55. package/dist/esm/BaseClient.mjs +2 -2
  56. package/dist/esm/api/resources/business/resources/stands/client/requests/UpdateStandRequest.d.mts +7 -0
  57. package/dist/esm/api/resources/customer/client/Client.d.mts +0 -1
  58. package/dist/esm/api/resources/customer/client/Client.mjs +1 -5
  59. package/dist/esm/api/resources/customer/resources/ads/client/Client.d.mts +2 -4
  60. package/dist/esm/api/resources/customer/resources/ads/client/Client.mjs +4 -12
  61. package/dist/esm/api/resources/customer/resources/businesses/client/Client.d.mts +27 -34
  62. package/dist/esm/api/resources/customer/resources/businesses/client/Client.mjs +83 -111
  63. package/dist/esm/api/resources/customer/resources/businesses/resources/bulletins/client/Client.d.mts +0 -1
  64. package/dist/esm/api/resources/customer/resources/businesses/resources/bulletins/client/Client.mjs +1 -5
  65. package/dist/esm/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/client/Client.d.mts +0 -2
  66. package/dist/esm/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/client/Client.mjs +2 -10
  67. package/dist/esm/api/resources/customer/resources/businesses/resources/events/client/Client.d.mts +0 -3
  68. package/dist/esm/api/resources/customer/resources/businesses/resources/events/client/Client.mjs +7 -19
  69. package/dist/esm/api/resources/customer/resources/cart/types/CreatePaymentIntentCartResponse.d.mts +4 -0
  70. package/dist/esm/api/resources/customer/resources/discovery/client/Client.d.mts +2 -14
  71. package/dist/esm/api/resources/customer/resources/discovery/client/Client.mjs +34 -82
  72. package/dist/esm/api/resources/customer/resources/editorials/client/Client.d.mts +3 -7
  73. package/dist/esm/api/resources/customer/resources/editorials/client/Client.mjs +14 -31
  74. package/dist/esm/api/resources/customer/resources/events/client/Client.d.mts +0 -1
  75. package/dist/esm/api/resources/customer/resources/events/client/Client.mjs +1 -5
  76. package/dist/esm/api/resources/customer/resources/explore/client/Client.d.mts +2 -3
  77. package/dist/esm/api/resources/customer/resources/explore/client/Client.mjs +3 -7
  78. package/dist/esm/api/resources/customer/resources/shop/client/Client.d.mts +2 -5
  79. package/dist/esm/api/resources/customer/resources/shop/client/Client.mjs +5 -17
  80. package/dist/esm/api/resources/customer/resources/stands/client/Client.d.mts +19 -9
  81. package/dist/esm/api/resources/customer/resources/stands/client/Client.mjs +64 -30
  82. package/dist/esm/api/resources/customer/resources/stands/client/requests/CheckoutStandsRequest.d.mts +7 -1
  83. package/dist/esm/api/resources/customer/resources/stands/client/requests/CreatePaymentIntentStandsRequest.d.mts +1 -0
  84. package/dist/esm/api/resources/customer/resources/stands/types/CheckoutStandsResponse.d.mts +4 -0
  85. package/dist/esm/api/resources/customer/resources/stands/types/CreatePaymentIntentStandsResponse.d.mts +16 -0
  86. package/dist/esm/api/resources/customer/resources/stands/types/CreatePaymentIntentStandsResponse.mjs +7 -0
  87. package/dist/esm/api/resources/customer/resources/stands/types/index.d.mts +2 -0
  88. package/dist/esm/api/resources/customer/resources/stands/types/index.mjs +2 -0
  89. package/dist/esm/api/resources/customerStands/client/Client.d.mts +0 -32
  90. package/dist/esm/api/resources/customerStands/client/Client.mjs +0 -119
  91. package/dist/esm/api/resources/customerStands/client/requests/index.d.mts +0 -2
  92. package/dist/esm/api/resources/customerStands/types/index.d.mts +0 -2
  93. package/dist/esm/api/resources/customerStands/types/index.mjs +0 -2
  94. package/dist/esm/api/types/AppHttpResourcesApiV1BusinessCommerceProductResource.d.mts +1 -1
  95. package/dist/esm/api/types/CartResource.d.mts +1 -1
  96. package/dist/esm/api/types/InventoryLevelResource.d.mts +3 -3
  97. package/dist/esm/api/types/OrderItemResource.d.mts +10 -0
  98. package/dist/esm/api/types/OrderResource.d.mts +24 -9
  99. package/dist/esm/api/types/PaginationResource.d.mts +4 -4
  100. package/dist/esm/api/types/PriceListResource.d.mts +1 -1
  101. package/dist/esm/api/types/PriceResource.d.mts +3 -3
  102. package/dist/esm/api/types/ProductResource.d.mts +5 -6
  103. package/dist/esm/api/types/Transaction.d.mts +6 -6
  104. package/dist/esm/api/types/VariantResource.d.mts +3 -3
  105. package/dist/esm/api/types/index.d.mts +1 -2
  106. package/dist/esm/api/types/index.mjs +1 -2
  107. package/dist/esm/version.d.mts +1 -1
  108. package/dist/esm/version.mjs +1 -1
  109. package/package.json +1 -1
  110. package/reference.md +29 -131
  111. package/dist/cjs/api/resources/customerStands/client/requests/CustomerStandCheckoutRequest.d.ts +0 -15
  112. package/dist/cjs/api/resources/customerStands/client/requests/CustomerStandPaymentIntentRequest.d.ts +0 -10
  113. package/dist/cjs/api/resources/customerStands/types/CustomerStandCheckoutResponse.d.ts +0 -4
  114. package/dist/cjs/api/resources/customerStands/types/CustomerStandCheckoutResponse.js +0 -3
  115. package/dist/cjs/api/resources/customerStands/types/CustomerStandPaymentIntentResponse.d.ts +0 -12
  116. package/dist/cjs/api/resources/customerStands/types/CustomerStandPaymentIntentResponse.js +0 -10
  117. package/dist/cjs/api/types/ImageResource.d.ts +0 -6
  118. package/dist/cjs/api/types/ImageResource.js +0 -3
  119. package/dist/cjs/api/types/ProductCategoryResource.d.ts +0 -8
  120. package/dist/cjs/api/types/ProductCategoryResource.js +0 -3
  121. package/dist/esm/api/resources/customerStands/client/requests/CustomerStandCheckoutRequest.d.mts +0 -15
  122. package/dist/esm/api/resources/customerStands/client/requests/CustomerStandPaymentIntentRequest.d.mts +0 -10
  123. package/dist/esm/api/resources/customerStands/types/CustomerStandCheckoutResponse.d.mts +0 -4
  124. package/dist/esm/api/resources/customerStands/types/CustomerStandCheckoutResponse.mjs +0 -2
  125. package/dist/esm/api/resources/customerStands/types/CustomerStandPaymentIntentResponse.d.mts +0 -12
  126. package/dist/esm/api/resources/customerStands/types/CustomerStandPaymentIntentResponse.mjs +0 -7
  127. package/dist/esm/api/types/ImageResource.d.mts +0 -6
  128. package/dist/esm/api/types/ImageResource.mjs +0 -2
  129. package/dist/esm/api/types/ProductCategoryResource.d.mts +0 -8
  130. package/dist/esm/api/types/ProductCategoryResource.mjs +0 -2
  131. /package/dist/cjs/api/resources/{customerStands/client/requests/CustomerStandCheckoutRequest.js → customer/resources/stands/types/CheckoutStandsResponse.js} +0 -0
  132. /package/dist/cjs/api/{resources/customerStands/client/requests/CustomerStandPaymentIntentRequest.js → types/OrderItemResource.js} +0 -0
  133. /package/dist/esm/api/resources/{customerStands/client/requests/CustomerStandCheckoutRequest.mjs → customer/resources/stands/types/CheckoutStandsResponse.mjs} +0 -0
  134. /package/dist/esm/api/{resources/customerStands/client/requests/CustomerStandPaymentIntentRequest.mjs → types/OrderItemResource.mjs} +0 -0
@@ -53,13 +53,12 @@ const errors = __importStar(require("../../../../../../errors/index.js"));
53
53
  const FiveOneEat = __importStar(require("../../../../../index.js"));
54
54
  class ShopClient {
55
55
  constructor(options = {}) {
56
- this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
56
+ this._options = (0, BaseClient_js_1.normalizeClientOptions)(options);
57
57
  }
58
58
  /**
59
59
  * @param {FiveOneEat.customer.ListProductsShopRequest} request
60
60
  * @param {ShopClient.RequestOptions} requestOptions - Request-specific configuration.
61
61
  *
62
- * @throws {@link FiveOneEat.UnauthorizedError}
63
62
  * @throws {@link FiveOneEat.NotFoundError}
64
63
  *
65
64
  * @example
@@ -77,8 +76,7 @@ class ShopClient {
77
76
  const _queryParams = {
78
77
  category,
79
78
  };
80
- const _authRequest = yield this._options.authProvider.getAuthRequest();
81
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
79
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
82
80
  const _response = yield core.fetcher({
83
81
  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)}/shop`),
84
82
  method: "GET",
@@ -103,8 +101,6 @@ class ShopClient {
103
101
  }
104
102
  if (_response.error.reason === "status-code") {
105
103
  switch (_response.error.statusCode) {
106
- case 401:
107
- throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
108
104
  case 404:
109
105
  throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
110
106
  default:
@@ -122,7 +118,6 @@ class ShopClient {
122
118
  * @param {FiveOneEat.customer.GetProductShopRequest} request
123
119
  * @param {ShopClient.RequestOptions} requestOptions - Request-specific configuration.
124
120
  *
125
- * @throws {@link FiveOneEat.UnauthorizedError}
126
121
  * @throws {@link FiveOneEat.NotFoundError}
127
122
  *
128
123
  * @example
@@ -138,8 +133,7 @@ class ShopClient {
138
133
  return __awaiter(this, void 0, void 0, function* () {
139
134
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
140
135
  const { business, product } = request;
141
- const _authRequest = yield this._options.authProvider.getAuthRequest();
142
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
136
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
143
137
  const _response = yield core.fetcher({
144
138
  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)}/shop/products/${core.url.encodePathParam(product)}`),
145
139
  method: "GET",
@@ -159,8 +153,6 @@ class ShopClient {
159
153
  }
160
154
  if (_response.error.reason === "status-code") {
161
155
  switch (_response.error.statusCode) {
162
- case 401:
163
- throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
164
156
  case 404:
165
157
  throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
166
158
  default:
@@ -178,7 +170,6 @@ class ShopClient {
178
170
  * @param {FiveOneEat.customer.ListCategoriesShopRequest} request
179
171
  * @param {ShopClient.RequestOptions} requestOptions - Request-specific configuration.
180
172
  *
181
- * @throws {@link FiveOneEat.UnauthorizedError}
182
173
  * @throws {@link FiveOneEat.NotFoundError}
183
174
  *
184
175
  * @example
@@ -193,8 +184,7 @@ class ShopClient {
193
184
  return __awaiter(this, void 0, void 0, function* () {
194
185
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
195
186
  const { business } = request;
196
- const _authRequest = yield this._options.authProvider.getAuthRequest();
197
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
187
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
198
188
  const _response = yield core.fetcher({
199
189
  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)}/shop/categories`),
200
190
  method: "GET",
@@ -214,8 +204,6 @@ class ShopClient {
214
204
  }
215
205
  if (_response.error.reason === "status-code") {
216
206
  switch (_response.error.statusCode) {
217
- case 401:
218
- throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
219
207
  case 404:
220
208
  throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
221
209
  default:
@@ -27,25 +27,35 @@ export declare class StandsClient {
27
27
  scan(request: FiveOneEat.customer.ScanStandsRequest, requestOptions?: StandsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.ScanStandsResponse>;
28
28
  private __scan;
29
29
  /**
30
- * @param {FiveOneEat.customer.CheckoutStandsRequest} request
30
+ * @param {FiveOneEat.customer.CreatePaymentIntentStandsRequest} request
31
31
  * @param {StandsClient.RequestOptions} requestOptions - Request-specific configuration.
32
32
  *
33
+ * @throws {@link FiveOneEat.UnauthorizedError}
34
+ * @throws {@link FiveOneEat.NotFoundError}
35
+ *
33
36
  * @example
34
- * await client.customer.stands.checkout({
37
+ * await client.customer.stands.createPaymentIntent({
35
38
  * stand: "stand"
36
39
  * })
37
40
  */
38
- checkout(request: FiveOneEat.customer.CheckoutStandsRequest, requestOptions?: StandsClient.RequestOptions): core.HttpResponsePromise<void>;
39
- private __checkout;
41
+ createPaymentIntent(request: FiveOneEat.customer.CreatePaymentIntentStandsRequest, requestOptions?: StandsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.CreatePaymentIntentStandsResponse>;
42
+ private __createPaymentIntent;
40
43
  /**
41
- * @param {FiveOneEat.customer.CreatePaymentIntentStandsRequest} request
44
+ * @param {FiveOneEat.customer.CheckoutStandsRequest} request
42
45
  * @param {StandsClient.RequestOptions} requestOptions - Request-specific configuration.
43
46
  *
47
+ * @throws {@link FiveOneEat.UnauthorizedError}
48
+ * @throws {@link FiveOneEat.NotFoundError}
49
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
50
+ *
44
51
  * @example
45
- * await client.customer.stands.createPaymentIntent({
46
- * stand: "stand"
52
+ * await client.customer.stands.checkout({
53
+ * stand: "stand",
54
+ * body: {
55
+ * payment_intent_id: "payment_intent_id"
56
+ * }
47
57
  * })
48
58
  */
49
- createPaymentIntent(request: FiveOneEat.customer.CreatePaymentIntentStandsRequest, requestOptions?: StandsClient.RequestOptions): core.HttpResponsePromise<void>;
50
- private __createPaymentIntent;
59
+ checkout(request: FiveOneEat.customer.CheckoutStandsRequest, requestOptions?: StandsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.CheckoutStandsResponse>;
60
+ private __checkout;
51
61
  }
@@ -76,8 +76,7 @@ class StandsClient {
76
76
  return __awaiter(this, void 0, void 0, function* () {
77
77
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
78
78
  const { stand } = request;
79
- const _authRequest = yield this._options.authProvider.getAuthRequest();
80
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
79
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
81
80
  const _response = yield core.fetcher({
82
81
  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, `stand/${core.url.encodePathParam(stand)}`),
83
82
  method: "GET",
@@ -111,25 +110,28 @@ class StandsClient {
111
110
  });
112
111
  }
113
112
  /**
114
- * @param {FiveOneEat.customer.CheckoutStandsRequest} request
113
+ * @param {FiveOneEat.customer.CreatePaymentIntentStandsRequest} request
115
114
  * @param {StandsClient.RequestOptions} requestOptions - Request-specific configuration.
116
115
  *
116
+ * @throws {@link FiveOneEat.UnauthorizedError}
117
+ * @throws {@link FiveOneEat.NotFoundError}
118
+ *
117
119
  * @example
118
- * await client.customer.stands.checkout({
120
+ * await client.customer.stands.createPaymentIntent({
119
121
  * stand: "stand"
120
122
  * })
121
123
  */
122
- checkout(request, requestOptions) {
123
- return core.HttpResponsePromise.fromPromise(this.__checkout(request, requestOptions));
124
+ createPaymentIntent(request, requestOptions) {
125
+ return core.HttpResponsePromise.fromPromise(this.__createPaymentIntent(request, requestOptions));
124
126
  }
125
- __checkout(request, requestOptions) {
127
+ __createPaymentIntent(request, requestOptions) {
126
128
  return __awaiter(this, void 0, void 0, function* () {
127
129
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
128
130
  const { stand } = request;
129
131
  const _authRequest = yield this._options.authProvider.getAuthRequest();
130
132
  const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
131
133
  const _response = yield core.fetcher({
132
- 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/stands/${core.url.encodePathParam(stand)}/checkout`),
134
+ 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/stands/${core.url.encodePathParam(stand)}/cart/payment-intent`),
133
135
  method: "POST",
134
136
  headers: _headers,
135
137
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
@@ -140,41 +142,61 @@ class StandsClient {
140
142
  logging: this._options.logging,
141
143
  });
142
144
  if (_response.ok) {
143
- return { data: undefined, rawResponse: _response.rawResponse };
145
+ return {
146
+ data: _response.body,
147
+ rawResponse: _response.rawResponse,
148
+ };
144
149
  }
145
150
  if (_response.error.reason === "status-code") {
146
- throw new errors.FiveOneEatError({
147
- statusCode: _response.error.statusCode,
148
- body: _response.error.body,
149
- rawResponse: _response.rawResponse,
150
- });
151
+ switch (_response.error.statusCode) {
152
+ case 401:
153
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
154
+ case 404:
155
+ throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
156
+ default:
157
+ throw new errors.FiveOneEatError({
158
+ statusCode: _response.error.statusCode,
159
+ body: _response.error.body,
160
+ rawResponse: _response.rawResponse,
161
+ });
162
+ }
151
163
  }
152
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/customer/stands/{stand}/checkout");
164
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/customer/stands/{stand}/cart/payment-intent");
153
165
  });
154
166
  }
155
167
  /**
156
- * @param {FiveOneEat.customer.CreatePaymentIntentStandsRequest} request
168
+ * @param {FiveOneEat.customer.CheckoutStandsRequest} request
157
169
  * @param {StandsClient.RequestOptions} requestOptions - Request-specific configuration.
158
170
  *
171
+ * @throws {@link FiveOneEat.UnauthorizedError}
172
+ * @throws {@link FiveOneEat.NotFoundError}
173
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
174
+ *
159
175
  * @example
160
- * await client.customer.stands.createPaymentIntent({
161
- * stand: "stand"
176
+ * await client.customer.stands.checkout({
177
+ * stand: "stand",
178
+ * body: {
179
+ * payment_intent_id: "payment_intent_id"
180
+ * }
162
181
  * })
163
182
  */
164
- createPaymentIntent(request, requestOptions) {
165
- return core.HttpResponsePromise.fromPromise(this.__createPaymentIntent(request, requestOptions));
183
+ checkout(request, requestOptions) {
184
+ return core.HttpResponsePromise.fromPromise(this.__checkout(request, requestOptions));
166
185
  }
167
- __createPaymentIntent(request, requestOptions) {
186
+ __checkout(request, requestOptions) {
168
187
  return __awaiter(this, void 0, void 0, function* () {
169
188
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
170
- const { stand } = request;
189
+ const { stand, body: _body } = request;
171
190
  const _authRequest = yield this._options.authProvider.getAuthRequest();
172
191
  const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
173
192
  const _response = yield core.fetcher({
174
- 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/stands/${core.url.encodePathParam(stand)}/payment-intent`),
193
+ 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/stands/${core.url.encodePathParam(stand)}/cart/checkout`),
175
194
  method: "POST",
176
195
  headers: _headers,
196
+ contentType: "application/json",
177
197
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
198
+ requestType: "json",
199
+ body: _body,
178
200
  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,
179
201
  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,
180
202
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -182,16 +204,28 @@ class StandsClient {
182
204
  logging: this._options.logging,
183
205
  });
184
206
  if (_response.ok) {
185
- return { data: undefined, rawResponse: _response.rawResponse };
207
+ return {
208
+ data: _response.body,
209
+ rawResponse: _response.rawResponse,
210
+ };
186
211
  }
187
212
  if (_response.error.reason === "status-code") {
188
- throw new errors.FiveOneEatError({
189
- statusCode: _response.error.statusCode,
190
- body: _response.error.body,
191
- rawResponse: _response.rawResponse,
192
- });
213
+ switch (_response.error.statusCode) {
214
+ case 401:
215
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
216
+ case 404:
217
+ throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
218
+ case 422:
219
+ throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
220
+ default:
221
+ throw new errors.FiveOneEatError({
222
+ statusCode: _response.error.statusCode,
223
+ body: _response.error.body,
224
+ rawResponse: _response.rawResponse,
225
+ });
226
+ }
193
227
  }
194
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/customer/stands/{stand}/payment-intent");
228
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/customer/stands/{stand}/cart/checkout");
195
229
  });
196
230
  }
197
231
  }
@@ -1,9 +1,15 @@
1
+ import type * as FiveOneEat from "../../../../../../index.js";
1
2
  /**
2
3
  * @example
3
4
  * {
4
- * stand: "stand"
5
+ * stand: "stand",
6
+ * body: {
7
+ * payment_intent_id: "payment_intent_id"
8
+ * }
5
9
  * }
6
10
  */
7
11
  export interface CheckoutStandsRequest {
12
+ /** The stand ID */
8
13
  stand: string;
14
+ body: FiveOneEat.CheckoutRequest;
9
15
  }
@@ -5,5 +5,6 @@
5
5
  * }
6
6
  */
7
7
  export interface CreatePaymentIntentStandsRequest {
8
+ /** The stand ID */
8
9
  stand: string;
9
10
  }
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../../../index.js";
2
+ export interface CheckoutStandsResponse {
3
+ data: FiveOneEat.OrderResource;
4
+ }
@@ -0,0 +1,16 @@
1
+ export interface CreatePaymentIntentStandsResponse {
2
+ client_secret: string;
3
+ payment_intent_id: string;
4
+ subtotal: number;
5
+ tax_amount: number;
6
+ platform_fee: number;
7
+ total_amount: number;
8
+ amount: number;
9
+ currency: CreatePaymentIntentStandsResponse.Currency;
10
+ }
11
+ export declare namespace CreatePaymentIntentStandsResponse {
12
+ const Currency: {
13
+ readonly Usd: "usd";
14
+ };
15
+ type Currency = (typeof Currency)[keyof typeof Currency];
16
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CreatePaymentIntentStandsResponse = void 0;
5
+ var CreatePaymentIntentStandsResponse;
6
+ (function (CreatePaymentIntentStandsResponse) {
7
+ CreatePaymentIntentStandsResponse.Currency = {
8
+ Usd: "usd",
9
+ };
10
+ })(CreatePaymentIntentStandsResponse || (exports.CreatePaymentIntentStandsResponse = CreatePaymentIntentStandsResponse = {}));
@@ -1 +1,3 @@
1
+ export * from "./CheckoutStandsResponse.js";
2
+ export * from "./CreatePaymentIntentStandsResponse.js";
1
3
  export * from "./ScanStandsResponse.js";
@@ -14,4 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./CheckoutStandsResponse.js"), exports);
18
+ __exportStar(require("./CreatePaymentIntentStandsResponse.js"), exports);
17
19
  __exportStar(require("./ScanStandsResponse.js"), exports);
@@ -55,36 +55,4 @@ export declare class CustomerStandsClient {
55
55
  */
56
56
  customerClearStandCart(request: FiveOneEat.CustomerClearStandCartRequest, requestOptions?: CustomerStandsClient.RequestOptions): core.HttpResponsePromise<void>;
57
57
  private __customerClearStandCart;
58
- /**
59
- * @param {FiveOneEat.CustomerStandPaymentIntentRequest} request
60
- * @param {CustomerStandsClient.RequestOptions} requestOptions - Request-specific configuration.
61
- *
62
- * @throws {@link FiveOneEat.UnauthorizedError}
63
- * @throws {@link FiveOneEat.NotFoundError}
64
- *
65
- * @example
66
- * await client.customerStands.customerStandPaymentIntent({
67
- * stand: "stand"
68
- * })
69
- */
70
- customerStandPaymentIntent(request: FiveOneEat.CustomerStandPaymentIntentRequest, requestOptions?: CustomerStandsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.CustomerStandPaymentIntentResponse>;
71
- private __customerStandPaymentIntent;
72
- /**
73
- * @param {FiveOneEat.CustomerStandCheckoutRequest} request
74
- * @param {CustomerStandsClient.RequestOptions} requestOptions - Request-specific configuration.
75
- *
76
- * @throws {@link FiveOneEat.UnauthorizedError}
77
- * @throws {@link FiveOneEat.NotFoundError}
78
- * @throws {@link FiveOneEat.UnprocessableEntityError}
79
- *
80
- * @example
81
- * await client.customerStands.customerStandCheckout({
82
- * stand: "stand",
83
- * body: {
84
- * payment_intent_id: "payment_intent_id"
85
- * }
86
- * })
87
- */
88
- customerStandCheckout(request: FiveOneEat.CustomerStandCheckoutRequest, requestOptions?: CustomerStandsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.CustomerStandCheckoutResponse>;
89
- private __customerStandCheckout;
90
58
  }
@@ -236,124 +236,5 @@ class CustomerStandsClient {
236
236
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/customer/stands/{stand}/cart");
237
237
  });
238
238
  }
239
- /**
240
- * @param {FiveOneEat.CustomerStandPaymentIntentRequest} request
241
- * @param {CustomerStandsClient.RequestOptions} requestOptions - Request-specific configuration.
242
- *
243
- * @throws {@link FiveOneEat.UnauthorizedError}
244
- * @throws {@link FiveOneEat.NotFoundError}
245
- *
246
- * @example
247
- * await client.customerStands.customerStandPaymentIntent({
248
- * stand: "stand"
249
- * })
250
- */
251
- customerStandPaymentIntent(request, requestOptions) {
252
- return core.HttpResponsePromise.fromPromise(this.__customerStandPaymentIntent(request, requestOptions));
253
- }
254
- __customerStandPaymentIntent(request, requestOptions) {
255
- return __awaiter(this, void 0, void 0, function* () {
256
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
257
- const { stand } = request;
258
- const _authRequest = yield this._options.authProvider.getAuthRequest();
259
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
260
- const _response = yield core.fetcher({
261
- 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/stands/${core.url.encodePathParam(stand)}/cart/payment-intent`),
262
- method: "POST",
263
- headers: _headers,
264
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
265
- 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,
266
- 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,
267
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
268
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
269
- logging: this._options.logging,
270
- });
271
- if (_response.ok) {
272
- return {
273
- data: _response.body,
274
- rawResponse: _response.rawResponse,
275
- };
276
- }
277
- if (_response.error.reason === "status-code") {
278
- switch (_response.error.statusCode) {
279
- case 401:
280
- throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
281
- case 404:
282
- throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
283
- default:
284
- throw new errors.FiveOneEatError({
285
- statusCode: _response.error.statusCode,
286
- body: _response.error.body,
287
- rawResponse: _response.rawResponse,
288
- });
289
- }
290
- }
291
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/customer/stands/{stand}/cart/payment-intent");
292
- });
293
- }
294
- /**
295
- * @param {FiveOneEat.CustomerStandCheckoutRequest} request
296
- * @param {CustomerStandsClient.RequestOptions} requestOptions - Request-specific configuration.
297
- *
298
- * @throws {@link FiveOneEat.UnauthorizedError}
299
- * @throws {@link FiveOneEat.NotFoundError}
300
- * @throws {@link FiveOneEat.UnprocessableEntityError}
301
- *
302
- * @example
303
- * await client.customerStands.customerStandCheckout({
304
- * stand: "stand",
305
- * body: {
306
- * payment_intent_id: "payment_intent_id"
307
- * }
308
- * })
309
- */
310
- customerStandCheckout(request, requestOptions) {
311
- return core.HttpResponsePromise.fromPromise(this.__customerStandCheckout(request, requestOptions));
312
- }
313
- __customerStandCheckout(request, requestOptions) {
314
- return __awaiter(this, void 0, void 0, function* () {
315
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
316
- const { stand, body: _body } = request;
317
- const _authRequest = yield this._options.authProvider.getAuthRequest();
318
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
319
- const _response = yield core.fetcher({
320
- 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/stands/${core.url.encodePathParam(stand)}/cart/checkout`),
321
- method: "POST",
322
- headers: _headers,
323
- contentType: "application/json",
324
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
325
- requestType: "json",
326
- body: _body,
327
- 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,
328
- 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,
329
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
330
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
331
- logging: this._options.logging,
332
- });
333
- if (_response.ok) {
334
- return {
335
- data: _response.body,
336
- rawResponse: _response.rawResponse,
337
- };
338
- }
339
- if (_response.error.reason === "status-code") {
340
- switch (_response.error.statusCode) {
341
- case 401:
342
- throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
343
- case 404:
344
- throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
345
- case 422:
346
- throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
347
- default:
348
- throw new errors.FiveOneEatError({
349
- statusCode: _response.error.statusCode,
350
- body: _response.error.body,
351
- rawResponse: _response.rawResponse,
352
- });
353
- }
354
- }
355
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/customer/stands/{stand}/cart/checkout");
356
- });
357
- }
358
239
  }
359
240
  exports.CustomerStandsClient = CustomerStandsClient;
@@ -1,5 +1,3 @@
1
1
  export type { CustomerAddStandCartItemRequest } from "./CustomerAddStandCartItemRequest.js";
2
2
  export type { CustomerClearStandCartRequest } from "./CustomerClearStandCartRequest.js";
3
3
  export type { CustomerGetStandCartRequest } from "./CustomerGetStandCartRequest.js";
4
- export type { CustomerStandCheckoutRequest } from "./CustomerStandCheckoutRequest.js";
5
- export type { CustomerStandPaymentIntentRequest } from "./CustomerStandPaymentIntentRequest.js";
@@ -1,4 +1,2 @@
1
1
  export * from "./CustomerAddStandCartItemResponse.js";
2
2
  export * from "./CustomerGetStandCartResponse.js";
3
- export * from "./CustomerStandCheckoutResponse.js";
4
- export * from "./CustomerStandPaymentIntentResponse.js";
@@ -16,5 +16,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./CustomerAddStandCartItemResponse.js"), exports);
18
18
  __exportStar(require("./CustomerGetStandCartResponse.js"), exports);
19
- __exportStar(require("./CustomerStandCheckoutResponse.js"), exports);
20
- __exportStar(require("./CustomerStandPaymentIntentResponse.js"), exports);
@@ -4,7 +4,7 @@ export interface AppHttpResourcesApiV1BusinessCommerceProductResource {
4
4
  name: string;
5
5
  slug: string;
6
6
  description: string;
7
- is_active: string;
7
+ is_active: boolean;
8
8
  published_at: string;
9
9
  variants?: FiveOneEat.VariantResource[] | undefined;
10
10
  default_variant?: FiveOneEat.VariantResource | undefined;
@@ -2,7 +2,7 @@ export interface CartResource {
2
2
  id: string;
3
3
  items: CartResource.Items.Item[];
4
4
  subtotal_cents: number;
5
- subtotal: string;
5
+ subtotal: number;
6
6
  item_count: number;
7
7
  }
8
8
  export declare namespace CartResource {
@@ -1,7 +1,7 @@
1
1
  export interface InventoryLevelResource {
2
2
  id: string;
3
3
  sales_channel_id: string;
4
- quantity: string;
5
- tracks_inventory: string;
6
- allows_holds: string;
4
+ quantity: number;
5
+ tracks_inventory: boolean;
6
+ allows_holds: boolean;
7
7
  }
@@ -0,0 +1,10 @@
1
+ export interface OrderItemResource {
2
+ id: string;
3
+ variant_id: string;
4
+ product_name?: (string | null) | undefined;
5
+ variant_name?: string | undefined;
6
+ sku?: string | undefined;
7
+ quantity: number;
8
+ unit_price_cents: number;
9
+ total_cents: number;
10
+ }