@greensecurity/javascript-sdk 0.48.0-beta.6 → 0.48.0-beta.8

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 (69) hide show
  1. package/dist/commonjs/__tests__/vendors.test.js +1 -1
  2. package/dist/commonjs/__tests__/zones.test.js +14 -8
  3. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  4. package/dist/commonjs/funcs/invoicesConvertQuote.d.ts +4 -1
  5. package/dist/commonjs/funcs/invoicesConvertQuote.d.ts.map +1 -1
  6. package/dist/commonjs/funcs/invoicesConvertQuote.js +6 -2
  7. package/dist/commonjs/funcs/invoicesConvertQuote.js.map +1 -1
  8. package/dist/commonjs/lib/config.d.ts +2 -2
  9. package/dist/commonjs/lib/config.js +2 -2
  10. package/dist/commonjs/models/components/invoice.d.ts +5 -0
  11. package/dist/commonjs/models/components/invoice.d.ts.map +1 -1
  12. package/dist/commonjs/models/components/invoice.js +4 -0
  13. package/dist/commonjs/models/components/invoice.js.map +1 -1
  14. package/dist/commonjs/models/operations/convertquote.d.ts +21 -0
  15. package/dist/commonjs/models/operations/convertquote.d.ts.map +1 -1
  16. package/dist/commonjs/models/operations/convertquote.js +18 -1
  17. package/dist/commonjs/models/operations/convertquote.js.map +1 -1
  18. package/dist/commonjs/models/operations/createinvoice.d.ts +25 -0
  19. package/dist/commonjs/models/operations/createinvoice.d.ts.map +1 -1
  20. package/dist/commonjs/models/operations/createinvoice.js +10 -0
  21. package/dist/commonjs/models/operations/createinvoice.js.map +1 -1
  22. package/dist/commonjs/react-query/invoicesConvertQuote.d.ts +4 -1
  23. package/dist/commonjs/react-query/invoicesConvertQuote.d.ts.map +1 -1
  24. package/dist/commonjs/react-query/invoicesConvertQuote.js +4 -1
  25. package/dist/commonjs/react-query/invoicesConvertQuote.js.map +1 -1
  26. package/dist/commonjs/sdk/invoices.d.ts +4 -1
  27. package/dist/commonjs/sdk/invoices.d.ts.map +1 -1
  28. package/dist/commonjs/sdk/invoices.js +4 -1
  29. package/dist/commonjs/sdk/invoices.js.map +1 -1
  30. package/dist/esm/__tests__/vendors.test.js +1 -1
  31. package/dist/esm/__tests__/zones.test.js +14 -8
  32. package/dist/esm/__tests__/zones.test.js.map +1 -1
  33. package/dist/esm/funcs/invoicesConvertQuote.d.ts +4 -1
  34. package/dist/esm/funcs/invoicesConvertQuote.d.ts.map +1 -1
  35. package/dist/esm/funcs/invoicesConvertQuote.js +7 -3
  36. package/dist/esm/funcs/invoicesConvertQuote.js.map +1 -1
  37. package/dist/esm/lib/config.d.ts +2 -2
  38. package/dist/esm/lib/config.js +2 -2
  39. package/dist/esm/models/components/invoice.d.ts +5 -0
  40. package/dist/esm/models/components/invoice.d.ts.map +1 -1
  41. package/dist/esm/models/components/invoice.js +4 -0
  42. package/dist/esm/models/components/invoice.js.map +1 -1
  43. package/dist/esm/models/operations/convertquote.d.ts +21 -0
  44. package/dist/esm/models/operations/convertquote.d.ts.map +1 -1
  45. package/dist/esm/models/operations/convertquote.js +16 -0
  46. package/dist/esm/models/operations/convertquote.js.map +1 -1
  47. package/dist/esm/models/operations/createinvoice.d.ts +25 -0
  48. package/dist/esm/models/operations/createinvoice.d.ts.map +1 -1
  49. package/dist/esm/models/operations/createinvoice.js +10 -0
  50. package/dist/esm/models/operations/createinvoice.js.map +1 -1
  51. package/dist/esm/react-query/invoicesConvertQuote.d.ts +4 -1
  52. package/dist/esm/react-query/invoicesConvertQuote.d.ts.map +1 -1
  53. package/dist/esm/react-query/invoicesConvertQuote.js +4 -1
  54. package/dist/esm/react-query/invoicesConvertQuote.js.map +1 -1
  55. package/dist/esm/sdk/invoices.d.ts +4 -1
  56. package/dist/esm/sdk/invoices.d.ts.map +1 -1
  57. package/dist/esm/sdk/invoices.js +4 -1
  58. package/dist/esm/sdk/invoices.js.map +1 -1
  59. package/jsr.json +1 -1
  60. package/package.json +1 -1
  61. package/src/__tests__/vendors.test.ts +1 -1
  62. package/src/__tests__/zones.test.ts +14 -8
  63. package/src/funcs/invoicesConvertQuote.ts +7 -3
  64. package/src/lib/config.ts +2 -2
  65. package/src/models/components/invoice.ts +9 -0
  66. package/src/models/operations/convertquote.ts +46 -0
  67. package/src/models/operations/createinvoice.ts +35 -0
  68. package/src/react-query/invoicesConvertQuote.ts +4 -1
  69. package/src/sdk/invoices.ts +4 -1
@@ -9,11 +9,25 @@ import { Result as SafeParseResult } from "../../types/fp.js";
9
9
  import * as types from "../../types/primitives.js";
10
10
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
11
 
12
+ /**
13
+ * Whether the vendor is sending the converted invoice to their company managers.
14
+ */
15
+ export type ConvertQuoteRequestBody = {
16
+ /**
17
+ * Set to `true` when the vendor is sending the converted invoice to their company managers to pay instead of paying it themselves, and `false` to take it back. Recorded on the invoice as `date_sent_to_company_manager`; the managers are asked to pay once the credential is submitted. Omit the field to leave the invoice as it is. Ignored when no `VendorCredential` is linked to the quote, for an invoice with nothing left to pay, and when the caller is not the vendor. A vendor whose company has no active company manager who sends `true` is refused with `400` and the quote is not converted.
18
+ */
19
+ sendToCompanyManager?: boolean | undefined;
20
+ };
21
+
12
22
  export type ConvertQuoteRequest = {
13
23
  /**
14
24
  * The identifier of the object.
15
25
  */
16
26
  id: number;
27
+ /**
28
+ * Whether the vendor is sending the converted invoice to their company managers.
29
+ */
30
+ requestBody?: ConvertQuoteRequestBody | undefined;
17
31
  };
18
32
 
19
33
  /**
@@ -43,9 +57,36 @@ export type ConvertQuoteConvertQuoteOk = {
43
57
  total?: number | null | undefined;
44
58
  };
45
59
 
60
+ /** @internal */
61
+ export type ConvertQuoteRequestBody$Outbound = {
62
+ send_to_company_manager?: boolean | undefined;
63
+ };
64
+
65
+ /** @internal */
66
+ export const ConvertQuoteRequestBody$outboundSchema: z.ZodType<
67
+ ConvertQuoteRequestBody$Outbound,
68
+ z.ZodTypeDef,
69
+ ConvertQuoteRequestBody
70
+ > = z.object({
71
+ sendToCompanyManager: z.boolean().optional(),
72
+ }).transform((v) => {
73
+ return remap$(v, {
74
+ sendToCompanyManager: "send_to_company_manager",
75
+ });
76
+ });
77
+
78
+ export function convertQuoteRequestBodyToJSON(
79
+ convertQuoteRequestBody: ConvertQuoteRequestBody,
80
+ ): string {
81
+ return JSON.stringify(
82
+ ConvertQuoteRequestBody$outboundSchema.parse(convertQuoteRequestBody),
83
+ );
84
+ }
85
+
46
86
  /** @internal */
47
87
  export type ConvertQuoteRequest$Outbound = {
48
88
  id: number;
89
+ RequestBody?: ConvertQuoteRequestBody$Outbound | undefined;
49
90
  };
50
91
 
51
92
  /** @internal */
@@ -55,6 +96,11 @@ export const ConvertQuoteRequest$outboundSchema: z.ZodType<
55
96
  ConvertQuoteRequest
56
97
  > = z.object({
57
98
  id: z.number().int(),
99
+ requestBody: z.lazy(() => ConvertQuoteRequestBody$outboundSchema).optional(),
100
+ }).transform((v) => {
101
+ return remap$(v, {
102
+ requestBody: "RequestBody",
103
+ });
58
104
  });
59
105
 
60
106
  export function convertQuoteRequestToJSON(
@@ -62,6 +62,10 @@ export type Five = {
62
62
  * Set to `true` when the payer intends to settle this order from their credit balance before their payment method is charged. This affects only how the convenience fee is calculated: the fee pays for card processing, so it is assessed on the amount the card is left to cover once credits have been applied, and an order a balance covers in full carries none. No credits are debited here, and the balance is read from the payer's own ledger rather than taken from this request. Settle the credits with `POST /invoices/{id}/payment` and `use_credits: true`.
63
63
  */
64
64
  useCredits?: boolean | undefined;
65
+ /**
66
+ * For a `vendor_credential_id` invoice, set to `true` when the vendor is sending the invoice to their company managers to pay instead of paying it themselves. The server records it on the invoice as `date_sent_to_company_manager`, and asks the managers to pay once the credential is submitted. Send it without `credential_pricing_ids` to send an invoice the credential already has. Set to `false` to take the invoice back. Omit the field to leave the invoice as it is. Ignored for a quote, for an invoice with nothing left to pay, and when the caller is not the vendor. A vendor whose company has no active company manager who sends `true` is refused with `400` before anything is created.
67
+ */
68
+ sendToCompanyManager?: boolean | undefined;
65
69
  };
66
70
 
67
71
  export const CreateInvoiceRequestBodyInvoicesPaymentHandler = {
@@ -113,6 +117,10 @@ export type Four = {
113
117
  * Set to `true` when the payer intends to settle this order from their credit balance before their payment method is charged. This affects only how the convenience fee is calculated: the fee pays for card processing, so it is assessed on the amount the card is left to cover once credits have been applied, and an order a balance covers in full carries none. No credits are debited here, and the balance is read from the payer's own ledger rather than taken from this request. Settle the credits with `POST /invoices/{id}/payment` and `use_credits: true`.
114
118
  */
115
119
  useCredits?: boolean | undefined;
120
+ /**
121
+ * For a `vendor_credential_id` invoice, set to `true` when the vendor is sending the invoice to their company managers to pay instead of paying it themselves. The server records it on the invoice as `date_sent_to_company_manager`, and asks the managers to pay once the credential is submitted. Send it without `credential_pricing_ids` to send an invoice the credential already has. Set to `false` to take the invoice back. Omit the field to leave the invoice as it is. Ignored for a quote, for an invoice with nothing left to pay, and when the caller is not the vendor. A vendor whose company has no active company manager who sends `true` is refused with `400` before anything is created.
122
+ */
123
+ sendToCompanyManager?: boolean | undefined;
116
124
  };
117
125
 
118
126
  export const CreateInvoiceRequestBodyPaymentHandler = {
@@ -164,6 +172,10 @@ export type Three = {
164
172
  * Set to `true` when the payer intends to settle this order from their credit balance before their payment method is charged. This affects only how the convenience fee is calculated: the fee pays for card processing, so it is assessed on the amount the card is left to cover once credits have been applied, and an order a balance covers in full carries none. No credits are debited here, and the balance is read from the payer's own ledger rather than taken from this request. Settle the credits with `POST /invoices/{id}/payment` and `use_credits: true`.
165
173
  */
166
174
  useCredits?: boolean | undefined;
175
+ /**
176
+ * For a `vendor_credential_id` invoice, set to `true` when the vendor is sending the invoice to their company managers to pay instead of paying it themselves. The server records it on the invoice as `date_sent_to_company_manager`, and asks the managers to pay once the credential is submitted. Send it without `credential_pricing_ids` to send an invoice the credential already has. Set to `false` to take the invoice back. Omit the field to leave the invoice as it is. Ignored for a quote, for an invoice with nothing left to pay, and when the caller is not the vendor. A vendor whose company has no active company manager who sends `true` is refused with `400` before anything is created.
177
+ */
178
+ sendToCompanyManager?: boolean | undefined;
167
179
  };
168
180
 
169
181
  export const RequestBodyPaymentHandler = {
@@ -213,6 +225,10 @@ export type CreateInvoiceRequestBody2 = {
213
225
  * Set to `true` when the payer intends to settle this order from their credit balance before their payment method is charged. This affects only how the convenience fee is calculated: the fee pays for card processing, so it is assessed on the amount the card is left to cover once credits have been applied, and an order a balance covers in full carries none. No credits are debited here, and the balance is read from the payer's own ledger rather than taken from this request. Settle the credits with `POST /invoices/{id}/payment` and `use_credits: true`.
214
226
  */
215
227
  useCredits?: boolean | undefined;
228
+ /**
229
+ * For a `vendor_credential_id` invoice, set to `true` when the vendor is sending the invoice to their company managers to pay instead of paying it themselves. The server records it on the invoice as `date_sent_to_company_manager`, and asks the managers to pay once the credential is submitted. Send it without `credential_pricing_ids` to send an invoice the credential already has. Set to `false` to take the invoice back. Omit the field to leave the invoice as it is. Ignored for a quote, for an invoice with nothing left to pay, and when the caller is not the vendor. A vendor whose company has no active company manager who sends `true` is refused with `400` before anything is created.
230
+ */
231
+ sendToCompanyManager?: boolean | undefined;
216
232
  };
217
233
 
218
234
  export const PaymentHandler = {
@@ -260,6 +276,10 @@ export type RequestBody1 = {
260
276
  * Set to `true` when the payer intends to settle this order from their credit balance before their payment method is charged. This affects only how the convenience fee is calculated: the fee pays for card processing, so it is assessed on the amount the card is left to cover once credits have been applied, and an order a balance covers in full carries none. No credits are debited here, and the balance is read from the payer's own ledger rather than taken from this request. Settle the credits with `POST /invoices/{id}/payment` and `use_credits: true`.
261
277
  */
262
278
  useCredits?: boolean | undefined;
279
+ /**
280
+ * For a `vendor_credential_id` invoice, set to `true` when the vendor is sending the invoice to their company managers to pay instead of paying it themselves. The server records it on the invoice as `date_sent_to_company_manager`, and asks the managers to pay once the credential is submitted. Send it without `credential_pricing_ids` to send an invoice the credential already has. Set to `false` to take the invoice back. Omit the field to leave the invoice as it is. Ignored for a quote, for an invoice with nothing left to pay, and when the caller is not the vendor. A vendor whose company has no active company manager who sends `true` is refused with `400` before anything is created.
281
+ */
282
+ sendToCompanyManager?: boolean | undefined;
263
283
  };
264
284
 
265
285
  /**
@@ -357,6 +377,7 @@ export type Five$Outbound = {
357
377
  invoice_type?: string | undefined;
358
378
  promo?: string | undefined;
359
379
  use_credits: boolean;
380
+ send_to_company_manager?: boolean | undefined;
360
381
  };
361
382
 
362
383
  /** @internal */
@@ -372,12 +393,14 @@ export const Five$outboundSchema: z.ZodType<Five$Outbound, z.ZodTypeDef, Five> =
372
393
  .optional(),
373
394
  promo: z.string().optional(),
374
395
  useCredits: z.boolean().default(false),
396
+ sendToCompanyManager: z.boolean().optional(),
375
397
  }).transform((v) => {
376
398
  return remap$(v, {
377
399
  vendorCredentialId: "vendor_credential_id",
378
400
  credentialPricingIds: "credential_pricing_ids",
379
401
  invoiceType: "invoice_type",
380
402
  useCredits: "use_credits",
403
+ sendToCompanyManager: "send_to_company_manager",
381
404
  });
382
405
  });
383
406
 
@@ -456,6 +479,7 @@ export type Four$Outbound = {
456
479
  invoice_type?: string | undefined;
457
480
  promo?: string | undefined;
458
481
  use_credits: boolean;
482
+ send_to_company_manager?: boolean | undefined;
459
483
  };
460
484
 
461
485
  /** @internal */
@@ -470,12 +494,14 @@ export const Four$outboundSchema: z.ZodType<Four$Outbound, z.ZodTypeDef, Four> =
470
494
  .optional(),
471
495
  promo: z.string().optional(),
472
496
  useCredits: z.boolean().default(false),
497
+ sendToCompanyManager: z.boolean().optional(),
473
498
  }).transform((v) => {
474
499
  return remap$(v, {
475
500
  systemId: "system_id",
476
501
  credentialPricingIds: "credential_pricing_ids",
477
502
  invoiceType: "invoice_type",
478
503
  useCredits: "use_credits",
504
+ sendToCompanyManager: "send_to_company_manager",
479
505
  });
480
506
  });
481
507
 
@@ -556,6 +582,7 @@ export type Three$Outbound = {
556
582
  invoice_type?: string | undefined;
557
583
  promo?: string | undefined;
558
584
  use_credits: boolean;
585
+ send_to_company_manager?: boolean | undefined;
559
586
  };
560
587
 
561
588
  /** @internal */
@@ -571,12 +598,14 @@ export const Three$outboundSchema: z.ZodType<
571
598
  invoiceType: CreateInvoiceRequestBodyInvoiceType$outboundSchema.optional(),
572
599
  promo: z.string().optional(),
573
600
  useCredits: z.boolean().default(false),
601
+ sendToCompanyManager: z.boolean().optional(),
574
602
  }).transform((v) => {
575
603
  return remap$(v, {
576
604
  facilityId: "facility_id",
577
605
  credentialPricingIds: "credential_pricing_ids",
578
606
  invoiceType: "invoice_type",
579
607
  useCredits: "use_credits",
608
+ sendToCompanyManager: "send_to_company_manager",
580
609
  });
581
610
  });
582
611
 
@@ -652,6 +681,7 @@ export type CreateInvoiceRequestBody2$Outbound = {
652
681
  invoice_type?: string | undefined;
653
682
  promo?: string | undefined;
654
683
  use_credits: boolean;
684
+ send_to_company_manager?: boolean | undefined;
655
685
  };
656
686
 
657
687
  /** @internal */
@@ -666,12 +696,14 @@ export const CreateInvoiceRequestBody2$outboundSchema: z.ZodType<
666
696
  invoiceType: RequestBodyInvoiceType$outboundSchema.optional(),
667
697
  promo: z.string().optional(),
668
698
  useCredits: z.boolean().default(false),
699
+ sendToCompanyManager: z.boolean().optional(),
669
700
  }).transform((v) => {
670
701
  return remap$(v, {
671
702
  companyId: "company_id",
672
703
  credentialPricingIds: "credential_pricing_ids",
673
704
  invoiceType: "invoice_type",
674
705
  useCredits: "use_credits",
706
+ sendToCompanyManager: "send_to_company_manager",
675
707
  });
676
708
  });
677
709
 
@@ -746,6 +778,7 @@ export type RequestBody1$Outbound = {
746
778
  invoice_type?: string | undefined;
747
779
  promo?: string | undefined;
748
780
  use_credits: boolean;
781
+ send_to_company_manager?: boolean | undefined;
749
782
  };
750
783
 
751
784
  /** @internal */
@@ -760,12 +793,14 @@ export const RequestBody1$outboundSchema: z.ZodType<
760
793
  invoiceType: InvoiceType$outboundSchema.optional(),
761
794
  promo: z.string().optional(),
762
795
  useCredits: z.boolean().default(false),
796
+ sendToCompanyManager: z.boolean().optional(),
763
797
  }).transform((v) => {
764
798
  return remap$(v, {
765
799
  vendorId: "vendor_id",
766
800
  credentialPricingIds: "credential_pricing_ids",
767
801
  invoiceType: "invoice_type",
768
802
  useCredits: "use_credits",
803
+ sendToCompanyManager: "send_to_company_manager",
769
804
  });
770
805
  });
771
806
 
@@ -63,7 +63,10 @@ export type InvoicesConvertQuoteMutationError =
63
63
  * invoices; a caller allowed to create the invoice but not to update the
64
64
  * linked `VendorCredential` responds `401`.
65
65
  *
66
- * Takes no request body.
66
+ * Optionally takes `send_to_company_manager`, for a quote linked to a
67
+ * `VendorCredential`: send `true` when the vendor is sending the
68
+ * converted invoice to their company managers to pay instead of paying
69
+ * it themselves. It follows the same rules as on `POST /invoices`.
67
70
  *
68
71
  * **Permissions.** Requires a valid token. This endpoint is not gated on a named permission—the caller's role and their relationship to the record decide what it returns.
69
72
  */
@@ -185,7 +185,10 @@ export class Invoices extends ClientSDK {
185
185
  * invoices; a caller allowed to create the invoice but not to update the
186
186
  * linked `VendorCredential` responds `401`.
187
187
  *
188
- * Takes no request body.
188
+ * Optionally takes `send_to_company_manager`, for a quote linked to a
189
+ * `VendorCredential`: send `true` when the vendor is sending the
190
+ * converted invoice to their company managers to pay instead of paying
191
+ * it themselves. It follows the same rules as on `POST /invoices`.
189
192
  *
190
193
  * **Permissions.** Requires a valid token. This endpoint is not gated on a named permission—the caller's role and their relationship to the record decide what it returns.
191
194
  */