@chrt-inc/typescript-sdk 0.0.203 → 0.0.205

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 (54) hide show
  1. package/dist/cjs/Client.js +2 -2
  2. package/dist/cjs/api/resources/courierPayDriverRateSheets/client/Client.d.ts +13 -13
  3. package/dist/cjs/api/resources/courierPayDriverRateSheets/client/Client.js +57 -57
  4. package/dist/cjs/api/resources/index.d.ts +1 -0
  5. package/dist/cjs/api/resources/index.js +1 -0
  6. package/dist/cjs/api/resources/shipperPayCourierLineItemGroups/client/Client.d.ts +16 -16
  7. package/dist/cjs/api/resources/shipperPayCourierLineItemGroups/client/Client.js +45 -45
  8. package/dist/cjs/api/resources/shipperPayCourierPayments/client/Client.d.ts +50 -30
  9. package/dist/cjs/api/resources/shipperPayCourierPayments/client/Client.js +134 -59
  10. package/dist/cjs/api/resources/shipperPayCourierPayments/client/index.d.ts +1 -0
  11. package/dist/cjs/api/resources/shipperPayCourierPayments/client/index.js +15 -0
  12. package/dist/cjs/api/resources/shipperPayCourierPayments/client/requests/ListPaymentsByCourierReq.d.ts +16 -0
  13. package/dist/cjs/api/resources/shipperPayCourierPayments/client/requests/ListPaymentsByShipperReq.d.ts +15 -0
  14. package/dist/cjs/api/resources/shipperPayCourierPayments/client/requests/ListPaymentsByShipperReq.js +5 -0
  15. package/dist/cjs/api/resources/shipperPayCourierPayments/client/requests/index.d.ts +2 -0
  16. package/dist/cjs/api/resources/shipperPayCourierPayments/client/requests/index.js +2 -0
  17. package/dist/cjs/api/types/CreateShipperPayCourierPaymentReq.d.ts +0 -3
  18. package/dist/cjs/api/types/GetShipperPayCourierPaymentsForShipperRes.d.ts +0 -3
  19. package/dist/cjs/api/types/PaymentPreviewResponse.d.ts +0 -3
  20. package/dist/cjs/api/types/ShipperPayCourierPayment1.d.ts +4 -3
  21. package/dist/cjs/api/types/index.d.ts +0 -1
  22. package/dist/cjs/api/types/index.js +0 -1
  23. package/dist/cjs/version.d.ts +1 -1
  24. package/dist/cjs/version.js +1 -1
  25. package/dist/esm/Client.mjs +2 -2
  26. package/dist/esm/api/resources/courierPayDriverRateSheets/client/Client.d.mts +13 -13
  27. package/dist/esm/api/resources/courierPayDriverRateSheets/client/Client.mjs +57 -57
  28. package/dist/esm/api/resources/index.d.mts +1 -0
  29. package/dist/esm/api/resources/index.mjs +1 -0
  30. package/dist/esm/api/resources/shipperPayCourierLineItemGroups/client/Client.d.mts +16 -16
  31. package/dist/esm/api/resources/shipperPayCourierLineItemGroups/client/Client.mjs +45 -45
  32. package/dist/esm/api/resources/shipperPayCourierPayments/client/Client.d.mts +50 -30
  33. package/dist/esm/api/resources/shipperPayCourierPayments/client/Client.mjs +134 -59
  34. package/dist/esm/api/resources/shipperPayCourierPayments/client/index.d.mts +1 -0
  35. package/dist/esm/api/resources/shipperPayCourierPayments/client/index.mjs +1 -1
  36. package/dist/esm/api/resources/shipperPayCourierPayments/client/requests/ListPaymentsByCourierReq.d.mts +16 -0
  37. package/dist/esm/api/resources/shipperPayCourierPayments/client/requests/ListPaymentsByShipperReq.d.mts +15 -0
  38. package/dist/esm/api/resources/shipperPayCourierPayments/client/requests/ListPaymentsByShipperReq.mjs +4 -0
  39. package/dist/esm/api/resources/shipperPayCourierPayments/client/requests/index.d.mts +2 -0
  40. package/dist/esm/api/resources/shipperPayCourierPayments/client/requests/index.mjs +1 -0
  41. package/dist/esm/api/types/CreateShipperPayCourierPaymentReq.d.mts +0 -3
  42. package/dist/esm/api/types/GetShipperPayCourierPaymentsForShipperRes.d.mts +0 -3
  43. package/dist/esm/api/types/PaymentPreviewResponse.d.mts +0 -3
  44. package/dist/esm/api/types/ShipperPayCourierPayment1.d.mts +4 -3
  45. package/dist/esm/api/types/index.d.mts +0 -1
  46. package/dist/esm/api/types/index.mjs +0 -1
  47. package/dist/esm/version.d.mts +1 -1
  48. package/dist/esm/version.mjs +1 -1
  49. package/package.json +1 -1
  50. package/reference.md +159 -84
  51. package/dist/cjs/api/types/GetShipperPayCourierPaymentsRes.d.ts +0 -10
  52. package/dist/esm/api/types/GetShipperPayCourierPaymentsRes.d.mts +0 -10
  53. /package/dist/cjs/api/{types/GetShipperPayCourierPaymentsRes.js → resources/shipperPayCourierPayments/client/requests/ListPaymentsByCourierReq.js} +0 -0
  54. /package/dist/esm/api/{types/GetShipperPayCourierPaymentsRes.mjs → resources/shipperPayCourierPayments/client/requests/ListPaymentsByCourierReq.mjs} +0 -0
@@ -20,24 +20,24 @@ export class ShipperPayCourierPayments {
20
20
  this._options = _options;
21
21
  }
22
22
  /**
23
- * Retrieves all shipper-to-courier payments for a specific order by ID or short ID.
23
+ * Get a shipper pay courier payment by its ID
24
24
  *
25
- * @param {string} orderIdOrShortId
25
+ * @param {string} shipperPayCourierPaymentId
26
26
  * @param {ShipperPayCourierPayments.RequestOptions} requestOptions - Request-specific configuration.
27
27
  *
28
28
  * @throws {@link Chrt.UnprocessableEntityError}
29
29
  *
30
30
  * @example
31
- * await client.shipperPayCourierPayments.getByOrderIdOrShortId("order_id_or_short_id")
31
+ * await client.shipperPayCourierPayments.getById("shipper_pay_courier_payment_id")
32
32
  */
33
- getByOrderIdOrShortId(orderIdOrShortId, requestOptions) {
34
- return core.HttpResponsePromise.fromPromise(this.__getByOrderIdOrShortId(orderIdOrShortId, requestOptions));
33
+ getById(shipperPayCourierPaymentId, requestOptions) {
34
+ return core.HttpResponsePromise.fromPromise(this.__getById(shipperPayCourierPaymentId, requestOptions));
35
35
  }
36
- __getByOrderIdOrShortId(orderIdOrShortId, requestOptions) {
36
+ __getById(shipperPayCourierPaymentId, requestOptions) {
37
37
  return __awaiter(this, void 0, void 0, function* () {
38
38
  var _a, _b, _c, _d;
39
39
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
40
- 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.ChrtEnvironment.Local, `oort/shipper_pay_courier_payments/${encodeURIComponent(orderIdOrShortId)}`),
40
+ 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.ChrtEnvironment.Local, `oort/shipper_pay_courier_payments/${encodeURIComponent(shipperPayCourierPaymentId)}`),
41
41
  method: "GET",
42
42
  headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
43
43
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -67,7 +67,7 @@ export class ShipperPayCourierPayments {
67
67
  rawResponse: _response.rawResponse,
68
68
  });
69
69
  case "timeout":
70
- throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /oort/shipper_pay_courier_payments/{order_id_or_short_id}.");
70
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /oort/shipper_pay_courier_payments/{shipper_pay_courier_payment_id}.");
71
71
  case "unknown":
72
72
  throw new errors.ChrtError({
73
73
  message: _response.error.errorMessage,
@@ -77,31 +77,26 @@ export class ShipperPayCourierPayments {
77
77
  });
78
78
  }
79
79
  /**
80
- * Create a shipper-to-courier payment record based on all task groups in an order
80
+ * Deletes a shipper-to-courier payment record. Only allowed if the payment status is PENDING.
81
81
  *
82
- * @param {Chrt.CreateShipperPayCourierPaymentReq} request
82
+ * @param {string} shipperPayCourierPaymentId
83
83
  * @param {ShipperPayCourierPayments.RequestOptions} requestOptions - Request-specific configuration.
84
84
  *
85
85
  * @throws {@link Chrt.UnprocessableEntityError}
86
86
  *
87
87
  * @example
88
- * await client.shipperPayCourierPayments.create({
89
- * order_id_or_short_id: "order_id_or_short_id"
90
- * })
88
+ * await client.shipperPayCourierPayments.delete("shipper_pay_courier_payment_id")
91
89
  */
92
- create(request, requestOptions) {
93
- return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
90
+ delete(shipperPayCourierPaymentId, requestOptions) {
91
+ return core.HttpResponsePromise.fromPromise(this.__delete(shipperPayCourierPaymentId, requestOptions));
94
92
  }
95
- __create(request, requestOptions) {
93
+ __delete(shipperPayCourierPaymentId, requestOptions) {
96
94
  return __awaiter(this, void 0, void 0, function* () {
97
95
  var _a, _b, _c, _d;
98
96
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
99
- 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.ChrtEnvironment.Local, "oort/shipper_pay_courier_payments/create"),
100
- method: "POST",
97
+ 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.ChrtEnvironment.Local, `oort/shipper_pay_courier_payments/${encodeURIComponent(shipperPayCourierPaymentId)}`),
98
+ method: "DELETE",
101
99
  headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
102
- contentType: "application/json",
103
- requestType: "json",
104
- body: request,
105
100
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
106
101
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
107
102
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -129,7 +124,7 @@ export class ShipperPayCourierPayments {
129
124
  rawResponse: _response.rawResponse,
130
125
  });
131
126
  case "timeout":
132
- throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /oort/shipper_pay_courier_payments/create.");
127
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling DELETE /oort/shipper_pay_courier_payments/{shipper_pay_courier_payment_id}.");
133
128
  case "unknown":
134
129
  throw new errors.ChrtError({
135
130
  message: _response.error.errorMessage,
@@ -139,27 +134,92 @@ export class ShipperPayCourierPayments {
139
134
  });
140
135
  }
141
136
  /**
142
- * Retrieves all shipper-to-courier payments for the authenticated shipper organization.
137
+ * Get a shipper pay courier payment by order ID or short ID
143
138
  *
139
+ * @param {string} orderIdOrShortId
144
140
  * @param {ShipperPayCourierPayments.RequestOptions} requestOptions - Request-specific configuration.
145
141
  *
142
+ * @throws {@link Chrt.UnprocessableEntityError}
143
+ *
146
144
  * @example
147
- * await client.shipperPayCourierPayments.listByShipperOrg()
145
+ * await client.shipperPayCourierPayments.getByOrderIdOrShortId("order_id_or_short_id")
148
146
  */
149
- listByShipperOrg(requestOptions) {
150
- return core.HttpResponsePromise.fromPromise(this.__listByShipperOrg(requestOptions));
147
+ getByOrderIdOrShortId(orderIdOrShortId, requestOptions) {
148
+ return core.HttpResponsePromise.fromPromise(this.__getByOrderIdOrShortId(orderIdOrShortId, requestOptions));
151
149
  }
152
- __listByShipperOrg(requestOptions) {
150
+ __getByOrderIdOrShortId(orderIdOrShortId, requestOptions) {
153
151
  return __awaiter(this, void 0, void 0, function* () {
154
152
  var _a, _b, _c, _d;
155
153
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
156
- 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.ChrtEnvironment.Local, "oort/shipper_pay_courier_payments/shipper/all"),
154
+ 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.ChrtEnvironment.Local, `oort/shipper_pay_courier_payments/by_order/${encodeURIComponent(orderIdOrShortId)}`),
157
155
  method: "GET",
158
156
  headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
159
157
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
160
158
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
161
159
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
162
160
  });
161
+ if (_response.ok) {
162
+ return { data: _response.body, rawResponse: _response.rawResponse };
163
+ }
164
+ if (_response.error.reason === "status-code") {
165
+ switch (_response.error.statusCode) {
166
+ case 422:
167
+ throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
168
+ default:
169
+ throw new errors.ChrtError({
170
+ statusCode: _response.error.statusCode,
171
+ body: _response.error.body,
172
+ rawResponse: _response.rawResponse,
173
+ });
174
+ }
175
+ }
176
+ switch (_response.error.reason) {
177
+ case "non-json":
178
+ throw new errors.ChrtError({
179
+ statusCode: _response.error.statusCode,
180
+ body: _response.error.rawBody,
181
+ rawResponse: _response.rawResponse,
182
+ });
183
+ case "timeout":
184
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /oort/shipper_pay_courier_payments/by_order/{order_id_or_short_id}.");
185
+ case "unknown":
186
+ throw new errors.ChrtError({
187
+ message: _response.error.errorMessage,
188
+ rawResponse: _response.rawResponse,
189
+ });
190
+ }
191
+ });
192
+ }
193
+ /**
194
+ * List shipper pay courier payments by shipper org ID with status filtering
195
+ *
196
+ * @param {Chrt.ListPaymentsByShipperReq} request
197
+ * @param {ShipperPayCourierPayments.RequestOptions} requestOptions - Request-specific configuration.
198
+ *
199
+ * @throws {@link Chrt.UnprocessableEntityError}
200
+ *
201
+ * @example
202
+ * await client.shipperPayCourierPayments.listByShipperOrgId({
203
+ * statuses: ["invoice_not_yet_created"]
204
+ * })
205
+ */
206
+ listByShipperOrgId(request, requestOptions) {
207
+ return core.HttpResponsePromise.fromPromise(this.__listByShipperOrgId(request, requestOptions));
208
+ }
209
+ __listByShipperOrgId(request, requestOptions) {
210
+ return __awaiter(this, void 0, void 0, function* () {
211
+ var _a, _b, _c, _d;
212
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
213
+ 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.ChrtEnvironment.Local, "oort/shipper_pay_courier_payments/list/by_shipper_org_id"),
214
+ method: "POST",
215
+ headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
216
+ contentType: "application/json",
217
+ requestType: "json",
218
+ body: request,
219
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
220
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
221
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
222
+ });
163
223
  if (_response.ok) {
164
224
  return {
165
225
  data: _response.body,
@@ -167,11 +227,16 @@ export class ShipperPayCourierPayments {
167
227
  };
168
228
  }
169
229
  if (_response.error.reason === "status-code") {
170
- throw new errors.ChrtError({
171
- statusCode: _response.error.statusCode,
172
- body: _response.error.body,
173
- rawResponse: _response.rawResponse,
174
- });
230
+ switch (_response.error.statusCode) {
231
+ case 422:
232
+ throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
233
+ default:
234
+ throw new errors.ChrtError({
235
+ statusCode: _response.error.statusCode,
236
+ body: _response.error.body,
237
+ rawResponse: _response.rawResponse,
238
+ });
239
+ }
175
240
  }
176
241
  switch (_response.error.reason) {
177
242
  case "non-json":
@@ -181,7 +246,7 @@ export class ShipperPayCourierPayments {
181
246
  rawResponse: _response.rawResponse,
182
247
  });
183
248
  case "timeout":
184
- throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /oort/shipper_pay_courier_payments/shipper/all.");
249
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /oort/shipper_pay_courier_payments/list/by_shipper_org_id.");
185
250
  case "unknown":
186
251
  throw new errors.ChrtError({
187
252
  message: _response.error.errorMessage,
@@ -191,26 +256,31 @@ export class ShipperPayCourierPayments {
191
256
  });
192
257
  }
193
258
  /**
194
- * Retrieves shipper-to-courier payments for the authenticated shipper organization filtered by payment status.
259
+ * List shipper pay courier payments by courier org ID with status filtering
195
260
  *
196
- * @param {Chrt.StripeConnectInvoiceStatusEnum} paymentStatus
261
+ * @param {Chrt.ListPaymentsByCourierReq} request
197
262
  * @param {ShipperPayCourierPayments.RequestOptions} requestOptions - Request-specific configuration.
198
263
  *
199
264
  * @throws {@link Chrt.UnprocessableEntityError}
200
265
  *
201
266
  * @example
202
- * await client.shipperPayCourierPayments.listByShipperOrgAndStatus("invoice_not_yet_created")
267
+ * await client.shipperPayCourierPayments.listByCourierOrgId({
268
+ * statuses: ["invoice_not_yet_created"]
269
+ * })
203
270
  */
204
- listByShipperOrgAndStatus(paymentStatus, requestOptions) {
205
- return core.HttpResponsePromise.fromPromise(this.__listByShipperOrgAndStatus(paymentStatus, requestOptions));
271
+ listByCourierOrgId(request, requestOptions) {
272
+ return core.HttpResponsePromise.fromPromise(this.__listByCourierOrgId(request, requestOptions));
206
273
  }
207
- __listByShipperOrgAndStatus(paymentStatus, requestOptions) {
274
+ __listByCourierOrgId(request, requestOptions) {
208
275
  return __awaiter(this, void 0, void 0, function* () {
209
276
  var _a, _b, _c, _d;
210
277
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
211
- 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.ChrtEnvironment.Local, `oort/shipper_pay_courier_payments/shipper/status/${encodeURIComponent(paymentStatus)}`),
212
- method: "GET",
278
+ 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.ChrtEnvironment.Local, "oort/shipper_pay_courier_payments/list/by_courier_org_id"),
279
+ method: "POST",
213
280
  headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
281
+ contentType: "application/json",
282
+ requestType: "json",
283
+ body: request,
214
284
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
215
285
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
216
286
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -241,7 +311,7 @@ export class ShipperPayCourierPayments {
241
311
  rawResponse: _response.rawResponse,
242
312
  });
243
313
  case "timeout":
244
- throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /oort/shipper_pay_courier_payments/shipper/status/{payment_status}.");
314
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /oort/shipper_pay_courier_payments/list/by_courier_org_id.");
245
315
  case "unknown":
246
316
  throw new errors.ChrtError({
247
317
  message: _response.error.errorMessage,
@@ -251,7 +321,7 @@ export class ShipperPayCourierPayments {
251
321
  });
252
322
  }
253
323
  /**
254
- * Preview a shipper-to-courier payment showing task groups, line item groups, total amount, and readiness status
324
+ * Create a shipper-to-courier payment record based on all task groups in an order
255
325
  *
256
326
  * @param {Chrt.CreateShipperPayCourierPaymentReq} request
257
327
  * @param {ShipperPayCourierPayments.RequestOptions} requestOptions - Request-specific configuration.
@@ -259,18 +329,18 @@ export class ShipperPayCourierPayments {
259
329
  * @throws {@link Chrt.UnprocessableEntityError}
260
330
  *
261
331
  * @example
262
- * await client.shipperPayCourierPayments.preview({
332
+ * await client.shipperPayCourierPayments.create({
263
333
  * order_id_or_short_id: "order_id_or_short_id"
264
334
  * })
265
335
  */
266
- preview(request, requestOptions) {
267
- return core.HttpResponsePromise.fromPromise(this.__preview(request, requestOptions));
336
+ create(request, requestOptions) {
337
+ return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
268
338
  }
269
- __preview(request, requestOptions) {
339
+ __create(request, requestOptions) {
270
340
  return __awaiter(this, void 0, void 0, function* () {
271
341
  var _a, _b, _c, _d;
272
342
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
273
- 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.ChrtEnvironment.Local, "oort/shipper_pay_courier_payments/preview"),
343
+ 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.ChrtEnvironment.Local, "oort/shipper_pay_courier_payments/create"),
274
344
  method: "POST",
275
345
  headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
276
346
  contentType: "application/json",
@@ -303,7 +373,7 @@ export class ShipperPayCourierPayments {
303
373
  rawResponse: _response.rawResponse,
304
374
  });
305
375
  case "timeout":
306
- throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /oort/shipper_pay_courier_payments/preview.");
376
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /oort/shipper_pay_courier_payments/create.");
307
377
  case "unknown":
308
378
  throw new errors.ChrtError({
309
379
  message: _response.error.errorMessage,
@@ -313,26 +383,31 @@ export class ShipperPayCourierPayments {
313
383
  });
314
384
  }
315
385
  /**
316
- * Deletes a shipper-to-courier payment record. Only allowed if the payment status is PENDING.
386
+ * Preview a shipper-to-courier payment showing task groups, line item groups, total amount, and readiness status
317
387
  *
318
- * @param {string} shipperPayCourierPaymentId
388
+ * @param {Chrt.CreateShipperPayCourierPaymentReq} request
319
389
  * @param {ShipperPayCourierPayments.RequestOptions} requestOptions - Request-specific configuration.
320
390
  *
321
391
  * @throws {@link Chrt.UnprocessableEntityError}
322
392
  *
323
393
  * @example
324
- * await client.shipperPayCourierPayments.delete("shipper_pay_courier_payment_id")
394
+ * await client.shipperPayCourierPayments.preview({
395
+ * order_id_or_short_id: "order_id_or_short_id"
396
+ * })
325
397
  */
326
- delete(shipperPayCourierPaymentId, requestOptions) {
327
- return core.HttpResponsePromise.fromPromise(this.__delete(shipperPayCourierPaymentId, requestOptions));
398
+ preview(request, requestOptions) {
399
+ return core.HttpResponsePromise.fromPromise(this.__preview(request, requestOptions));
328
400
  }
329
- __delete(shipperPayCourierPaymentId, requestOptions) {
401
+ __preview(request, requestOptions) {
330
402
  return __awaiter(this, void 0, void 0, function* () {
331
403
  var _a, _b, _c, _d;
332
404
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
333
- 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.ChrtEnvironment.Local, `oort/shipper_pay_courier_payments/${encodeURIComponent(shipperPayCourierPaymentId)}`),
334
- method: "DELETE",
405
+ 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.ChrtEnvironment.Local, "oort/shipper_pay_courier_payments/preview"),
406
+ method: "POST",
335
407
  headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
408
+ contentType: "application/json",
409
+ requestType: "json",
410
+ body: request,
336
411
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
337
412
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
338
413
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -360,7 +435,7 @@ export class ShipperPayCourierPayments {
360
435
  rawResponse: _response.rawResponse,
361
436
  });
362
437
  case "timeout":
363
- throw new errors.ChrtTimeoutError("Timeout exceeded when calling DELETE /oort/shipper_pay_courier_payments/{shipper_pay_courier_payment_id}.");
438
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /oort/shipper_pay_courier_payments/preview.");
364
439
  case "unknown":
365
440
  throw new errors.ChrtError({
366
441
  message: _response.error.errorMessage,
@@ -1 +1,2 @@
1
1
  export {};
2
+ export * from "./requests/index.mjs";
@@ -1 +1 @@
1
- export {};
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Chrt from "../../../../index.mjs";
5
+ /**
6
+ * @example
7
+ * {
8
+ * statuses: ["invoice_not_yet_created"]
9
+ * }
10
+ */
11
+ export interface ListPaymentsByCourierReq {
12
+ statuses: Chrt.StripeConnectInvoiceStatusEnum[];
13
+ /** Must be a string starting with `org_` */
14
+ shipper_org_id?: string | null;
15
+ off_chrt_shipper_org_info_id?: string | null;
16
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Chrt from "../../../../index.mjs";
5
+ /**
6
+ * @example
7
+ * {
8
+ * statuses: ["invoice_not_yet_created"]
9
+ * }
10
+ */
11
+ export interface ListPaymentsByShipperReq {
12
+ statuses: Chrt.StripeConnectInvoiceStatusEnum[];
13
+ /** Must be a string starting with `org_` */
14
+ courier_org_id?: string | null;
15
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,2 @@
1
+ export { type ListPaymentsByShipperReq } from "./ListPaymentsByShipperReq.mjs";
2
+ export { type ListPaymentsByCourierReq } from "./ListPaymentsByCourierReq.mjs";
@@ -1,9 +1,6 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- /**
5
- * Request model for creating a payment.
6
- */
7
4
  export interface CreateShipperPayCourierPaymentReq {
8
5
  order_id_or_short_id: string;
9
6
  }
@@ -2,9 +2,6 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as Chrt from "../index.mjs";
5
- /**
6
- * Response model for getting shipper pay courier payments for a shipper organization.
7
- */
8
5
  export interface GetShipperPayCourierPaymentsForShipperRes {
9
6
  payments: Chrt.ShipperPayCourierPayment1[];
10
7
  }
@@ -2,9 +2,6 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as Chrt from "../index.mjs";
5
- /**
6
- * Response model for payment preview.
7
- */
8
5
  export interface PaymentPreviewResponse {
9
6
  task_groups: Chrt.TaskGroup1[];
10
7
  line_item_groups: Chrt.ShipperPayCourierLineItemGroup1[];
@@ -11,13 +11,14 @@ export interface ShipperPayCourierPayment1 {
11
11
  shipper_org_id?: string | null;
12
12
  /** Must be a string starting with `org_` */
13
13
  courier_org_id: string;
14
+ stripe_connect_shipper_pay_courier_customer_id?: string | null;
15
+ stripe_invoice_id?: string | null;
16
+ stripe_invoice_url?: string | null;
14
17
  stripe_invoice_created_timestamp?: string | null;
15
- stripe_invoice_completed_timestamp?: string | null;
16
18
  /** Must be a string starting with `user_` */
17
19
  stripe_invoice_created_by_user_id?: string | null;
18
20
  payment_amount: number;
19
21
  stripe_invoice_status?: Chrt.StripeConnectInvoiceStatusEnum;
20
- stripe_invoice_id?: string | null;
21
- stripe_connect_shipper_pay_courier_customer_id?: string | null;
22
+ stripe_invoice_completed_timestamp?: string | null;
22
23
  _id: string;
23
24
  }
@@ -25,7 +25,6 @@ export * from "./GeometryCollectionOutputGeometriesItem.mjs";
25
25
  export * from "./GetOrderFullRes.mjs";
26
26
  export * from "./GetOrderRes.mjs";
27
27
  export * from "./GetShipperPayCourierPaymentsForShipperRes.mjs";
28
- export * from "./GetShipperPayCourierPaymentsRes.mjs";
29
28
  export * from "./HttpValidationError.mjs";
30
29
  export * from "./LineItem1.mjs";
31
30
  export * from "./LineItemClientCreate1.mjs";
@@ -25,7 +25,6 @@ export * from "./GeometryCollectionOutputGeometriesItem.mjs";
25
25
  export * from "./GetOrderFullRes.mjs";
26
26
  export * from "./GetOrderRes.mjs";
27
27
  export * from "./GetShipperPayCourierPaymentsForShipperRes.mjs";
28
- export * from "./GetShipperPayCourierPaymentsRes.mjs";
29
28
  export * from "./HttpValidationError.mjs";
30
29
  export * from "./LineItem1.mjs";
31
30
  export * from "./LineItemClientCreate1.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.203";
1
+ export declare const SDK_VERSION = "0.0.205";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.0.203";
1
+ export const SDK_VERSION = "0.0.205";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrt-inc/typescript-sdk",
3
- "version": "0.0.203",
3
+ "version": "0.0.205",
4
4
  "private": false,
5
5
  "repository": "github:chrt-inc/typescript-sdk",
6
6
  "type": "commonjs",