@paygentic/sdk 0.9.17 → 0.9.18

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 (112) hide show
  1. package/README.md +9 -7
  2. package/dist/commonjs/funcs/revenueGetRevenueAccounts.d.ts +23 -0
  3. package/dist/commonjs/funcs/revenueGetRevenueAccounts.d.ts.map +1 -0
  4. package/dist/commonjs/funcs/revenueGetRevenueAccounts.js +129 -0
  5. package/dist/commonjs/funcs/revenueGetRevenueAccounts.js.map +1 -0
  6. package/dist/commonjs/lib/config.d.ts +2 -2
  7. package/dist/commonjs/lib/config.js +2 -2
  8. package/dist/commonjs/models/accountfigure.d.ts +20 -0
  9. package/dist/commonjs/models/accountfigure.d.ts.map +1 -0
  10. package/dist/commonjs/models/accountfigure.js +51 -0
  11. package/dist/commonjs/models/accountfigure.js.map +1 -0
  12. package/dist/commonjs/models/index.d.ts +5 -0
  13. package/dist/commonjs/models/index.d.ts.map +1 -1
  14. package/dist/commonjs/models/index.js +5 -0
  15. package/dist/commonjs/models/index.js.map +1 -1
  16. package/dist/commonjs/models/operations/getrevenue.d.ts +7 -7
  17. package/dist/commonjs/models/operations/getrevenue.js +1 -1
  18. package/dist/commonjs/models/operations/getrevenueaccounts.d.ts +30 -0
  19. package/dist/commonjs/models/operations/getrevenueaccounts.d.ts.map +1 -0
  20. package/dist/commonjs/models/operations/getrevenueaccounts.js +52 -0
  21. package/dist/commonjs/models/operations/getrevenueaccounts.js.map +1 -0
  22. package/dist/commonjs/models/operations/index.d.ts +1 -0
  23. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  24. package/dist/commonjs/models/operations/index.js +1 -0
  25. package/dist/commonjs/models/operations/index.js.map +1 -1
  26. package/dist/commonjs/models/outstandingblock.d.ts +29 -0
  27. package/dist/commonjs/models/outstandingblock.d.ts.map +1 -0
  28. package/dist/commonjs/models/outstandingblock.js +54 -0
  29. package/dist/commonjs/models/outstandingblock.js.map +1 -0
  30. package/dist/commonjs/models/revenueaccountrow.d.ts +26 -0
  31. package/dist/commonjs/models/revenueaccountrow.d.ts.map +1 -0
  32. package/dist/commonjs/models/revenueaccountrow.js +54 -0
  33. package/dist/commonjs/models/revenueaccountrow.js.map +1 -0
  34. package/dist/commonjs/models/revenueaccountsresponse.d.ts +41 -0
  35. package/dist/commonjs/models/revenueaccountsresponse.d.ts.map +1 -0
  36. package/dist/commonjs/models/revenueaccountsresponse.js +64 -0
  37. package/dist/commonjs/models/revenueaccountsresponse.js.map +1 -0
  38. package/dist/commonjs/models/revenueaccounttotal.d.ts +18 -0
  39. package/dist/commonjs/models/revenueaccounttotal.d.ts.map +1 -0
  40. package/dist/commonjs/models/revenueaccounttotal.js +52 -0
  41. package/dist/commonjs/models/revenueaccounttotal.js.map +1 -0
  42. package/dist/commonjs/models/revenuesummaryresponse.d.ts +4 -0
  43. package/dist/commonjs/models/revenuesummaryresponse.d.ts.map +1 -1
  44. package/dist/commonjs/models/revenuesummaryresponse.js +1 -0
  45. package/dist/commonjs/models/revenuesummaryresponse.js.map +1 -1
  46. package/dist/commonjs/sdk/revenue.d.ts +11 -0
  47. package/dist/commonjs/sdk/revenue.d.ts.map +1 -1
  48. package/dist/commonjs/sdk/revenue.js +14 -0
  49. package/dist/commonjs/sdk/revenue.js.map +1 -1
  50. package/dist/esm/funcs/revenueGetRevenueAccounts.d.ts +23 -0
  51. package/dist/esm/funcs/revenueGetRevenueAccounts.d.ts.map +1 -0
  52. package/dist/esm/funcs/revenueGetRevenueAccounts.js +93 -0
  53. package/dist/esm/funcs/revenueGetRevenueAccounts.js.map +1 -0
  54. package/dist/esm/lib/config.d.ts +2 -2
  55. package/dist/esm/lib/config.js +2 -2
  56. package/dist/esm/models/accountfigure.d.ts +20 -0
  57. package/dist/esm/models/accountfigure.d.ts.map +1 -0
  58. package/dist/esm/models/accountfigure.js +14 -0
  59. package/dist/esm/models/accountfigure.js.map +1 -0
  60. package/dist/esm/models/index.d.ts +5 -0
  61. package/dist/esm/models/index.d.ts.map +1 -1
  62. package/dist/esm/models/index.js +5 -0
  63. package/dist/esm/models/index.js.map +1 -1
  64. package/dist/esm/models/operations/getrevenue.d.ts +7 -7
  65. package/dist/esm/models/operations/getrevenue.js +1 -1
  66. package/dist/esm/models/operations/getrevenueaccounts.d.ts +30 -0
  67. package/dist/esm/models/operations/getrevenueaccounts.d.ts.map +1 -0
  68. package/dist/esm/models/operations/getrevenueaccounts.js +15 -0
  69. package/dist/esm/models/operations/getrevenueaccounts.js.map +1 -0
  70. package/dist/esm/models/operations/index.d.ts +1 -0
  71. package/dist/esm/models/operations/index.d.ts.map +1 -1
  72. package/dist/esm/models/operations/index.js +1 -0
  73. package/dist/esm/models/operations/index.js.map +1 -1
  74. package/dist/esm/models/outstandingblock.d.ts +29 -0
  75. package/dist/esm/models/outstandingblock.d.ts.map +1 -0
  76. package/dist/esm/models/outstandingblock.js +17 -0
  77. package/dist/esm/models/outstandingblock.js.map +1 -0
  78. package/dist/esm/models/revenueaccountrow.d.ts +26 -0
  79. package/dist/esm/models/revenueaccountrow.d.ts.map +1 -0
  80. package/dist/esm/models/revenueaccountrow.js +17 -0
  81. package/dist/esm/models/revenueaccountrow.js.map +1 -0
  82. package/dist/esm/models/revenueaccountsresponse.d.ts +41 -0
  83. package/dist/esm/models/revenueaccountsresponse.d.ts.map +1 -0
  84. package/dist/esm/models/revenueaccountsresponse.js +27 -0
  85. package/dist/esm/models/revenueaccountsresponse.js.map +1 -0
  86. package/dist/esm/models/revenueaccounttotal.d.ts +18 -0
  87. package/dist/esm/models/revenueaccounttotal.d.ts.map +1 -0
  88. package/dist/esm/models/revenueaccounttotal.js +15 -0
  89. package/dist/esm/models/revenueaccounttotal.js.map +1 -0
  90. package/dist/esm/models/revenuesummaryresponse.d.ts +4 -0
  91. package/dist/esm/models/revenuesummaryresponse.d.ts.map +1 -1
  92. package/dist/esm/models/revenuesummaryresponse.js +1 -0
  93. package/dist/esm/models/revenuesummaryresponse.js.map +1 -1
  94. package/dist/esm/sdk/revenue.d.ts +11 -0
  95. package/dist/esm/sdk/revenue.d.ts.map +1 -1
  96. package/dist/esm/sdk/revenue.js +14 -0
  97. package/dist/esm/sdk/revenue.js.map +1 -1
  98. package/jsr.json +1 -1
  99. package/package.json +1 -1
  100. package/src/funcs/revenueGetRevenueAccounts.ts +186 -0
  101. package/src/lib/config.ts +2 -2
  102. package/src/models/accountfigure.ts +42 -0
  103. package/src/models/index.ts +5 -0
  104. package/src/models/operations/getrevenue.ts +7 -7
  105. package/src/models/operations/getrevenueaccounts.ts +52 -0
  106. package/src/models/operations/index.ts +1 -0
  107. package/src/models/outstandingblock.ts +53 -0
  108. package/src/models/revenueaccountrow.ts +53 -0
  109. package/src/models/revenueaccountsresponse.ts +80 -0
  110. package/src/models/revenueaccounttotal.ts +43 -0
  111. package/src/models/revenuesummaryresponse.ts +5 -0
  112. package/src/sdk/revenue.ts +22 -0
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../types/fp.js";
8
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
9
+ import {
10
+ OutstandingBlock,
11
+ OutstandingBlock$inboundSchema,
12
+ } from "./outstandingblock.js";
13
+
14
+ export type RevenueAccountTotal = {
15
+ /**
16
+ * ISO 4217 currency code of every amount in this entry
17
+ */
18
+ currency: string;
19
+ /**
20
+ * What is owed, gross of tax, from any date. `awaitingPayment` and `paymentFailed` add up to it, in count and amount.
21
+ */
22
+ outstanding: OutstandingBlock;
23
+ };
24
+
25
+ /** @internal */
26
+ export const RevenueAccountTotal$inboundSchema: z.ZodType<
27
+ RevenueAccountTotal,
28
+ z.ZodTypeDef,
29
+ unknown
30
+ > = z.object({
31
+ currency: z.string(),
32
+ outstanding: OutstandingBlock$inboundSchema,
33
+ });
34
+
35
+ export function revenueAccountTotalFromJSON(
36
+ jsonString: string,
37
+ ): SafeParseResult<RevenueAccountTotal, SDKValidationError> {
38
+ return safeParse(
39
+ jsonString,
40
+ (x) => RevenueAccountTotal$inboundSchema.parse(JSON.parse(x)),
41
+ `Failed to parse 'RevenueAccountTotal' from JSON`,
42
+ );
43
+ }
@@ -46,6 +46,10 @@ export type RevenueSummaryResponse = {
46
46
  * Object type identifier
47
47
  */
48
48
  object: "revenue_summary";
49
+ /**
50
+ * ISO 4217 currency code every figure in the response is in: the requested currency, or the merchant's primary currency when none was requested. Omitted when groupBy=currency is active.
51
+ */
52
+ currency?: string | undefined;
49
53
  /**
50
54
  * Revenue: what was billed in the period, excluding tax, in units of the currency. On the default issue-date basis it is recognised when each invoice is issued; with periodBasis=billingPeriod, each invoice line counts in the period it bills, and a refund splits across its invoice's lines. An invoice counts whether it was since paid, is still outstanding, failed payment or was written off, less non-voided refunds. It is billings, not cash collected: what customers still owe is invoices.outstanding, including tax, and payment-link collections are under payments. Omitted when groupBy=currency is active.
51
55
  */
@@ -114,6 +118,7 @@ export const RevenueSummaryResponse$inboundSchema: z.ZodType<
114
118
  unknown
115
119
  > = z.object({
116
120
  object: z.literal("revenue_summary"),
121
+ currency: z.string().optional(),
117
122
  netRevenue: z.string().optional(),
118
123
  totalRefunds: z.string().optional(),
119
124
  refundCount: z.number().optional(),
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import { revenueGet } from "../funcs/revenueGet.js";
6
+ import { revenueGetRevenueAccounts } from "../funcs/revenueGetRevenueAccounts.js";
6
7
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
7
8
  import * as models from "../models/index.js";
8
9
  import * as operations from "../models/operations/index.js";
@@ -25,4 +26,25 @@ export class Revenue extends ClientSDK {
25
26
  options,
26
27
  ));
27
28
  }
29
+
30
+ /**
31
+ * List customer accounts
32
+ *
33
+ * @remarks
34
+ * Returns each customer's account as at today, one row per customer and currency, with a total per currency. Every figure covers all dates: there is no date window.
35
+ *
36
+ * `outstanding` is what customers owe: every invoice with status `ISSUED` or `PAYMENT_FAILED`, at the amount due printed on the invoice (subtotal and tax, each rounded to the currency's minor unit), so it is gross of tax. Revenue (`GET /v0/revenue`) is net of tax. `outstanding` splits into `awaitingPayment` (status `ISSUED`) and `paymentFailed` (status `PAYMENT_FAILED`, collection has ended); the two always add up to it, in count and amount. A credit invoice (a negative amount due) nets against what is owed and is counted in no `count`; nor is an invoice whose amount due rounds to zero. A customer with nothing counted and nothing owed has no row.
37
+ *
38
+ * Amounts are grouped by currency and never combined or converted. `totals` covers every row in the filter, not only the returned page, so the rows on one page add up to `totals` only when the page holds every row. Pages fetched in separate requests are separate reads.
39
+ */
40
+ async getRevenueAccounts(
41
+ request: operations.GetRevenueAccountsRequest,
42
+ options?: RequestOptions,
43
+ ): Promise<models.RevenueAccountsResponse> {
44
+ return unwrapAsync(revenueGetRevenueAccounts(
45
+ this,
46
+ request,
47
+ options,
48
+ ));
49
+ }
28
50
  }