@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.
- package/README.md +9 -7
- package/dist/commonjs/funcs/revenueGetRevenueAccounts.d.ts +23 -0
- package/dist/commonjs/funcs/revenueGetRevenueAccounts.d.ts.map +1 -0
- package/dist/commonjs/funcs/revenueGetRevenueAccounts.js +129 -0
- package/dist/commonjs/funcs/revenueGetRevenueAccounts.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/accountfigure.d.ts +20 -0
- package/dist/commonjs/models/accountfigure.d.ts.map +1 -0
- package/dist/commonjs/models/accountfigure.js +51 -0
- package/dist/commonjs/models/accountfigure.js.map +1 -0
- package/dist/commonjs/models/index.d.ts +5 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +5 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/operations/getrevenue.d.ts +7 -7
- package/dist/commonjs/models/operations/getrevenue.js +1 -1
- package/dist/commonjs/models/operations/getrevenueaccounts.d.ts +30 -0
- package/dist/commonjs/models/operations/getrevenueaccounts.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getrevenueaccounts.js +52 -0
- package/dist/commonjs/models/operations/getrevenueaccounts.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +1 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +1 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/outstandingblock.d.ts +29 -0
- package/dist/commonjs/models/outstandingblock.d.ts.map +1 -0
- package/dist/commonjs/models/outstandingblock.js +54 -0
- package/dist/commonjs/models/outstandingblock.js.map +1 -0
- package/dist/commonjs/models/revenueaccountrow.d.ts +26 -0
- package/dist/commonjs/models/revenueaccountrow.d.ts.map +1 -0
- package/dist/commonjs/models/revenueaccountrow.js +54 -0
- package/dist/commonjs/models/revenueaccountrow.js.map +1 -0
- package/dist/commonjs/models/revenueaccountsresponse.d.ts +41 -0
- package/dist/commonjs/models/revenueaccountsresponse.d.ts.map +1 -0
- package/dist/commonjs/models/revenueaccountsresponse.js +64 -0
- package/dist/commonjs/models/revenueaccountsresponse.js.map +1 -0
- package/dist/commonjs/models/revenueaccounttotal.d.ts +18 -0
- package/dist/commonjs/models/revenueaccounttotal.d.ts.map +1 -0
- package/dist/commonjs/models/revenueaccounttotal.js +52 -0
- package/dist/commonjs/models/revenueaccounttotal.js.map +1 -0
- package/dist/commonjs/models/revenuesummaryresponse.d.ts +4 -0
- package/dist/commonjs/models/revenuesummaryresponse.d.ts.map +1 -1
- package/dist/commonjs/models/revenuesummaryresponse.js +1 -0
- package/dist/commonjs/models/revenuesummaryresponse.js.map +1 -1
- package/dist/commonjs/sdk/revenue.d.ts +11 -0
- package/dist/commonjs/sdk/revenue.d.ts.map +1 -1
- package/dist/commonjs/sdk/revenue.js +14 -0
- package/dist/commonjs/sdk/revenue.js.map +1 -1
- package/dist/esm/funcs/revenueGetRevenueAccounts.d.ts +23 -0
- package/dist/esm/funcs/revenueGetRevenueAccounts.d.ts.map +1 -0
- package/dist/esm/funcs/revenueGetRevenueAccounts.js +93 -0
- package/dist/esm/funcs/revenueGetRevenueAccounts.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/accountfigure.d.ts +20 -0
- package/dist/esm/models/accountfigure.d.ts.map +1 -0
- package/dist/esm/models/accountfigure.js +14 -0
- package/dist/esm/models/accountfigure.js.map +1 -0
- package/dist/esm/models/index.d.ts +5 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +5 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/operations/getrevenue.d.ts +7 -7
- package/dist/esm/models/operations/getrevenue.js +1 -1
- package/dist/esm/models/operations/getrevenueaccounts.d.ts +30 -0
- package/dist/esm/models/operations/getrevenueaccounts.d.ts.map +1 -0
- package/dist/esm/models/operations/getrevenueaccounts.js +15 -0
- package/dist/esm/models/operations/getrevenueaccounts.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +1 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +1 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/outstandingblock.d.ts +29 -0
- package/dist/esm/models/outstandingblock.d.ts.map +1 -0
- package/dist/esm/models/outstandingblock.js +17 -0
- package/dist/esm/models/outstandingblock.js.map +1 -0
- package/dist/esm/models/revenueaccountrow.d.ts +26 -0
- package/dist/esm/models/revenueaccountrow.d.ts.map +1 -0
- package/dist/esm/models/revenueaccountrow.js +17 -0
- package/dist/esm/models/revenueaccountrow.js.map +1 -0
- package/dist/esm/models/revenueaccountsresponse.d.ts +41 -0
- package/dist/esm/models/revenueaccountsresponse.d.ts.map +1 -0
- package/dist/esm/models/revenueaccountsresponse.js +27 -0
- package/dist/esm/models/revenueaccountsresponse.js.map +1 -0
- package/dist/esm/models/revenueaccounttotal.d.ts +18 -0
- package/dist/esm/models/revenueaccounttotal.d.ts.map +1 -0
- package/dist/esm/models/revenueaccounttotal.js +15 -0
- package/dist/esm/models/revenueaccounttotal.js.map +1 -0
- package/dist/esm/models/revenuesummaryresponse.d.ts +4 -0
- package/dist/esm/models/revenuesummaryresponse.d.ts.map +1 -1
- package/dist/esm/models/revenuesummaryresponse.js +1 -0
- package/dist/esm/models/revenuesummaryresponse.js.map +1 -1
- package/dist/esm/sdk/revenue.d.ts +11 -0
- package/dist/esm/sdk/revenue.d.ts.map +1 -1
- package/dist/esm/sdk/revenue.js +14 -0
- package/dist/esm/sdk/revenue.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/revenueGetRevenueAccounts.ts +186 -0
- package/src/lib/config.ts +2 -2
- package/src/models/accountfigure.ts +42 -0
- package/src/models/index.ts +5 -0
- package/src/models/operations/getrevenue.ts +7 -7
- package/src/models/operations/getrevenueaccounts.ts +52 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/outstandingblock.ts +53 -0
- package/src/models/revenueaccountrow.ts +53 -0
- package/src/models/revenueaccountsresponse.ts +80 -0
- package/src/models/revenueaccounttotal.ts +43 -0
- package/src/models/revenuesummaryresponse.ts +5 -0
- package/src/sdk/revenue.ts +22 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revenuesummaryresponse.js","sourceRoot":"","sources":["../../../src/models/revenuesummaryresponse.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAEL,oCAAoC,GACrC,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAEL,iCAAiC,GAClC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,4BAA4B,GAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,4BAA4B,GAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,gCAAgC,GACjC,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"revenuesummaryresponse.js","sourceRoot":"","sources":["../../../src/models/revenuesummaryresponse.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAEL,oCAAoC,GACrC,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAEL,iCAAiC,GAClC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,4BAA4B,GAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,4BAA4B,GAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,gCAAgC,GACjC,MAAM,yBAAyB,CAAC;AAiEjC,gBAAgB;AAChB,MAAM,CAAC,MAAM,gDAAgD,GAIzD,CAAC,CAAC,MAAM,CAAC;IACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IACvE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;CACtE,CAAC,CAAC;AAEH,MAAM,UAAU,0CAA0C,CACxD,UAAkB;IAElB,OAAO,SAAS,CACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CACJ,gDAAgD,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACvE,gEAAgE,CACjE,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,oCAAoC,GAI7C,CAAC,CAAC,MAAM,CAAC;IACX,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,QAAQ,EAAE,4BAA4B,CAAC,QAAQ,EAAE;IACjD,QAAQ,EAAE,4BAA4B,CAAC,QAAQ,EAAE;IACjD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC,QAAQ,EAAE;IAC3D,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC,QAAQ,EAAE;IACrE,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC,QAAQ,EAAE;IAC3E,YAAY,EAAE,CAAC,CAAC,QAAQ,CACtB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,gDAAgD,CAAC,CAC/D,CAAC,QAAQ,EAAE;CACb,CAAC,CAAC;AAEH,MAAM,UAAU,8BAA8B,CAC5C,UAAkB;IAElB,OAAO,SAAS,CACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,oCAAoC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAChE,oDAAoD,CACrD,CAAC;AACJ,CAAC"}
|
|
@@ -9,5 +9,16 @@ export declare class Revenue extends ClientSDK {
|
|
|
9
9
|
* Returns revenue summary with invoice and payment breakdowns (outstanding/paid/writtenOff), plus a time-series trend. Revenue is what was billed in the period (by default, invoices issued in it; see periodBasis), whatever their status since, less refunds, both excluding tax; completed payments are reported under payments, never in revenue.
|
|
10
10
|
*/
|
|
11
11
|
get(request: operations.GetRevenueRequest, options?: RequestOptions): Promise<models.RevenueSummaryResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* List customer accounts
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* 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.
|
|
17
|
+
*
|
|
18
|
+
* `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.
|
|
19
|
+
*
|
|
20
|
+
* 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.
|
|
21
|
+
*/
|
|
22
|
+
getRevenueAccounts(request: operations.GetRevenueAccountsRequest, options?: RequestOptions): Promise<models.RevenueAccountsResponse>;
|
|
12
23
|
}
|
|
13
24
|
//# sourceMappingURL=revenue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revenue.d.ts","sourceRoot":"","sources":["../../../src/sdk/revenue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"revenue.d.ts","sourceRoot":"","sources":["../../../src/sdk/revenue.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAG5D,qBAAa,OAAQ,SAAQ,SAAS;IACpC;;;;;OAKG;IACG,GAAG,CACP,OAAO,EAAE,UAAU,CAAC,iBAAiB,EACrC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,sBAAsB,CAAC;IAQzC;;;;;;;;;OASG;IACG,kBAAkB,CACtB,OAAO,EAAE,UAAU,CAAC,yBAAyB,EAC7C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAAC;CAO3C"}
|
package/dist/esm/sdk/revenue.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
import { revenueGet } from "../funcs/revenueGet.js";
|
|
5
|
+
import { revenueGetRevenueAccounts } from "../funcs/revenueGetRevenueAccounts.js";
|
|
5
6
|
import { ClientSDK } from "../lib/sdks.js";
|
|
6
7
|
import { unwrapAsync } from "../types/fp.js";
|
|
7
8
|
export class Revenue extends ClientSDK {
|
|
@@ -14,5 +15,18 @@ export class Revenue extends ClientSDK {
|
|
|
14
15
|
async get(request, options) {
|
|
15
16
|
return unwrapAsync(revenueGet(this, request, options));
|
|
16
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* List customer accounts
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* 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.
|
|
23
|
+
*
|
|
24
|
+
* `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.
|
|
25
|
+
*
|
|
26
|
+
* 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.
|
|
27
|
+
*/
|
|
28
|
+
async getRevenueAccounts(request, options) {
|
|
29
|
+
return unwrapAsync(revenueGetRevenueAccounts(this, request, options));
|
|
30
|
+
}
|
|
17
31
|
}
|
|
18
32
|
//# sourceMappingURL=revenue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revenue.js","sourceRoot":"","sources":["../../../src/sdk/revenue.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,OAAO,OAAQ,SAAQ,SAAS;IACpC;;;;;OAKG;IACH,KAAK,CAAC,GAAG,CACP,OAAqC,EACrC,OAAwB;QAExB,OAAO,WAAW,CAAC,UAAU,CAC3B,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"revenue.js","sourceRoot":"","sources":["../../../src/sdk/revenue.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,OAAO,OAAQ,SAAQ,SAAS;IACpC;;;;;OAKG;IACH,KAAK,CAAC,GAAG,CACP,OAAqC,EACrC,OAAwB;QAExB,OAAO,WAAW,CAAC,UAAU,CAC3B,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,kBAAkB,CACtB,OAA6C,EAC7C,OAAwB;QAExB,OAAO,WAAW,CAAC,yBAAyB,CAC1C,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { PaygenticCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import {
|
|
14
|
+
ConnectionError,
|
|
15
|
+
InvalidRequestError,
|
|
16
|
+
RequestAbortedError,
|
|
17
|
+
RequestTimeoutError,
|
|
18
|
+
UnexpectedClientError,
|
|
19
|
+
} from "../models/errors/httpclienterrors.js";
|
|
20
|
+
import * as errors from "../models/errors/index.js";
|
|
21
|
+
import { PaygenticError } from "../models/errors/paygenticerror.js";
|
|
22
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as models from "../models/index.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* List customer accounts
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* 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.
|
|
34
|
+
*
|
|
35
|
+
* `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.
|
|
36
|
+
*
|
|
37
|
+
* 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.
|
|
38
|
+
*/
|
|
39
|
+
export function revenueGetRevenueAccounts(
|
|
40
|
+
client: PaygenticCore,
|
|
41
|
+
request: operations.GetRevenueAccountsRequest,
|
|
42
|
+
options?: RequestOptions,
|
|
43
|
+
): APIPromise<
|
|
44
|
+
Result<
|
|
45
|
+
models.RevenueAccountsResponse,
|
|
46
|
+
| errors.BadRequest
|
|
47
|
+
| errors.ErrorT
|
|
48
|
+
| PaygenticError
|
|
49
|
+
| ResponseValidationError
|
|
50
|
+
| ConnectionError
|
|
51
|
+
| RequestAbortedError
|
|
52
|
+
| RequestTimeoutError
|
|
53
|
+
| InvalidRequestError
|
|
54
|
+
| UnexpectedClientError
|
|
55
|
+
| SDKValidationError
|
|
56
|
+
>
|
|
57
|
+
> {
|
|
58
|
+
return new APIPromise($do(
|
|
59
|
+
client,
|
|
60
|
+
request,
|
|
61
|
+
options,
|
|
62
|
+
));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function $do(
|
|
66
|
+
client: PaygenticCore,
|
|
67
|
+
request: operations.GetRevenueAccountsRequest,
|
|
68
|
+
options?: RequestOptions,
|
|
69
|
+
): Promise<
|
|
70
|
+
[
|
|
71
|
+
Result<
|
|
72
|
+
models.RevenueAccountsResponse,
|
|
73
|
+
| errors.BadRequest
|
|
74
|
+
| errors.ErrorT
|
|
75
|
+
| PaygenticError
|
|
76
|
+
| ResponseValidationError
|
|
77
|
+
| ConnectionError
|
|
78
|
+
| RequestAbortedError
|
|
79
|
+
| RequestTimeoutError
|
|
80
|
+
| InvalidRequestError
|
|
81
|
+
| UnexpectedClientError
|
|
82
|
+
| SDKValidationError
|
|
83
|
+
>,
|
|
84
|
+
APICall,
|
|
85
|
+
]
|
|
86
|
+
> {
|
|
87
|
+
const parsed = safeParse(
|
|
88
|
+
request,
|
|
89
|
+
(value) => operations.GetRevenueAccountsRequest$outboundSchema.parse(value),
|
|
90
|
+
"Input validation failed",
|
|
91
|
+
);
|
|
92
|
+
if (!parsed.ok) {
|
|
93
|
+
return [parsed, { status: "invalid" }];
|
|
94
|
+
}
|
|
95
|
+
const payload = parsed.value;
|
|
96
|
+
const body = null;
|
|
97
|
+
|
|
98
|
+
const path = pathToFunc("/v0/revenue/accounts")();
|
|
99
|
+
|
|
100
|
+
const query = encodeFormQuery({
|
|
101
|
+
"customerIds": payload.customerIds,
|
|
102
|
+
"limit": payload.limit,
|
|
103
|
+
"merchantId": payload.merchantId,
|
|
104
|
+
"offset": payload.offset,
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
const headers = new Headers(compactMap({
|
|
108
|
+
Accept: "application/json",
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
112
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
113
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
114
|
+
|
|
115
|
+
const context = {
|
|
116
|
+
options: client._options,
|
|
117
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
118
|
+
operationID: "getRevenueAccounts",
|
|
119
|
+
oAuth2Scopes: null,
|
|
120
|
+
|
|
121
|
+
resolvedSecurity: requestSecurity,
|
|
122
|
+
|
|
123
|
+
securitySource: client._options.bearerAuth,
|
|
124
|
+
retryConfig: options?.retries
|
|
125
|
+
|| client._options.retryConfig
|
|
126
|
+
|| { strategy: "none" },
|
|
127
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const requestRes = client._createRequest(context, {
|
|
131
|
+
security: requestSecurity,
|
|
132
|
+
method: "GET",
|
|
133
|
+
baseURL: options?.serverURL,
|
|
134
|
+
path: path,
|
|
135
|
+
headers: headers,
|
|
136
|
+
query: query,
|
|
137
|
+
body: body,
|
|
138
|
+
userAgent: client._options.userAgent,
|
|
139
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
140
|
+
}, options);
|
|
141
|
+
if (!requestRes.ok) {
|
|
142
|
+
return [requestRes, { status: "invalid" }];
|
|
143
|
+
}
|
|
144
|
+
const req = requestRes.value;
|
|
145
|
+
|
|
146
|
+
const doResult = await client._do(req, {
|
|
147
|
+
context,
|
|
148
|
+
errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
|
|
149
|
+
retryConfig: context.retryConfig,
|
|
150
|
+
retryCodes: context.retryCodes,
|
|
151
|
+
});
|
|
152
|
+
if (!doResult.ok) {
|
|
153
|
+
return [doResult, { status: "request-error", request: req }];
|
|
154
|
+
}
|
|
155
|
+
const response = doResult.value;
|
|
156
|
+
|
|
157
|
+
const responseFields = {
|
|
158
|
+
HttpMeta: { Response: response, Request: req },
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const [result] = await M.match<
|
|
162
|
+
models.RevenueAccountsResponse,
|
|
163
|
+
| errors.BadRequest
|
|
164
|
+
| errors.ErrorT
|
|
165
|
+
| PaygenticError
|
|
166
|
+
| ResponseValidationError
|
|
167
|
+
| ConnectionError
|
|
168
|
+
| RequestAbortedError
|
|
169
|
+
| RequestTimeoutError
|
|
170
|
+
| InvalidRequestError
|
|
171
|
+
| UnexpectedClientError
|
|
172
|
+
| SDKValidationError
|
|
173
|
+
>(
|
|
174
|
+
M.json(200, models.RevenueAccountsResponse$inboundSchema),
|
|
175
|
+
M.jsonErr(400, errors.BadRequest$inboundSchema),
|
|
176
|
+
M.jsonErr([401, 403, 404], errors.ErrorT$inboundSchema),
|
|
177
|
+
M.jsonErr(500, errors.ErrorT$inboundSchema),
|
|
178
|
+
M.fail("4XX"),
|
|
179
|
+
M.fail("5XX"),
|
|
180
|
+
)(response, req, { extraFields: responseFields });
|
|
181
|
+
if (!result.ok) {
|
|
182
|
+
return [result, { status: "complete", request: req, response }];
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return [result, { status: "complete", request: req, response }];
|
|
186
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -65,7 +65,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
65
65
|
export const SDK_METADATA = {
|
|
66
66
|
language: "typescript",
|
|
67
67
|
openapiDocVersion: "0.1.0",
|
|
68
|
-
sdkVersion: "0.9.
|
|
68
|
+
sdkVersion: "0.9.18",
|
|
69
69
|
genVersion: "2.879.13",
|
|
70
|
-
userAgent: "speakeasy-sdk/typescript 0.9.
|
|
70
|
+
userAgent: "speakeasy-sdk/typescript 0.9.18 2.879.13 0.1.0 @paygentic/sdk",
|
|
71
71
|
} as const;
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A number of invoices and their total amount due, gross of tax.
|
|
12
|
+
*/
|
|
13
|
+
export type AccountFigure = {
|
|
14
|
+
/**
|
|
15
|
+
* Number of invoices with an amount due above zero. A credit invoice, or one whose amount due rounds to zero, is not counted.
|
|
16
|
+
*/
|
|
17
|
+
count: number;
|
|
18
|
+
/**
|
|
19
|
+
* Total amount due in major units of the currency, in its decimal places
|
|
20
|
+
*/
|
|
21
|
+
amount: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** @internal */
|
|
25
|
+
export const AccountFigure$inboundSchema: z.ZodType<
|
|
26
|
+
AccountFigure,
|
|
27
|
+
z.ZodTypeDef,
|
|
28
|
+
unknown
|
|
29
|
+
> = z.object({
|
|
30
|
+
count: z.number().int(),
|
|
31
|
+
amount: z.string(),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export function accountFigureFromJSON(
|
|
35
|
+
jsonString: string,
|
|
36
|
+
): SafeParseResult<AccountFigure, SDKValidationError> {
|
|
37
|
+
return safeParse(
|
|
38
|
+
jsonString,
|
|
39
|
+
(x) => AccountFigure$inboundSchema.parse(JSON.parse(x)),
|
|
40
|
+
`Failed to parse 'AccountFigure' from JSON`,
|
|
41
|
+
);
|
|
42
|
+
}
|
package/src/models/index.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
export * from "./accountfigure.js";
|
|
5
6
|
export * from "./address.js";
|
|
6
7
|
export * from "./approval.js";
|
|
7
8
|
export * from "./approvallist.js";
|
|
@@ -84,6 +85,7 @@ export * from "./orderbillingschedule.js";
|
|
|
84
85
|
export * from "./orderlineitem.js";
|
|
85
86
|
export * from "./orderlist.js";
|
|
86
87
|
export * from "./outofbandpaymentresult.js";
|
|
88
|
+
export * from "./outstandingblock.js";
|
|
87
89
|
export * from "./payment.js";
|
|
88
90
|
export * from "./paymentmethod.js";
|
|
89
91
|
export * from "./paymentsession.js";
|
|
@@ -117,6 +119,9 @@ export * from "./replacescheduleintervalsrequest.js";
|
|
|
117
119
|
export * from "./resolveditem.js";
|
|
118
120
|
export * from "./retrypaymenterror.js";
|
|
119
121
|
export * from "./retrypaymentresponse.js";
|
|
122
|
+
export * from "./revenueaccountrow.js";
|
|
123
|
+
export * from "./revenueaccountsresponse.js";
|
|
124
|
+
export * from "./revenueaccounttotal.js";
|
|
120
125
|
export * from "./revenuesummaryresponse.js";
|
|
121
126
|
export * from "./revenuetrendbucket.js";
|
|
122
127
|
export * from "./rulecondition.js";
|
|
@@ -19,7 +19,7 @@ export const GetRevenueBucketWidth = {
|
|
|
19
19
|
export type GetRevenueBucketWidth = ClosedEnum<typeof GetRevenueBucketWidth>;
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Group invoice data by dimension. Allowed values: 'plan' (max 5 groups, top 4 + 'other' when exceeding), 'customer' (max 25 groups, top 24 + 'other' when exceeding, sorted by revenue descending), 'currency' (one entry per currency, primary currency first then alphabetical). Note: groupBy values are mutually exclusive — combining them returns a 400 error. When groupBy=currency is active, top-level netRevenue, invoices, and payments fields are omitted; currencyBreakdown is the sole data source.
|
|
22
|
+
* Group invoice data by dimension. Allowed values: 'plan' (max 5 groups, top 4 + 'other' when exceeding), 'customer' (max 25 groups, top 24 + 'other' when exceeding, sorted by revenue descending), both in one currency like an ungrouped read, 'currency' (one entry per currency, primary currency first then alphabetical). Note: groupBy values are mutually exclusive — combining them returns a 400 error. When groupBy=currency is active, top-level netRevenue, invoices, and payments fields are omitted; currencyBreakdown is the sole data source.
|
|
23
23
|
*/
|
|
24
24
|
export const GroupBy = {
|
|
25
25
|
Plan: "plan",
|
|
@@ -27,7 +27,7 @@ export const GroupBy = {
|
|
|
27
27
|
Currency: "currency",
|
|
28
28
|
} as const;
|
|
29
29
|
/**
|
|
30
|
-
* Group invoice data by dimension. Allowed values: 'plan' (max 5 groups, top 4 + 'other' when exceeding), 'customer' (max 25 groups, top 24 + 'other' when exceeding, sorted by revenue descending), 'currency' (one entry per currency, primary currency first then alphabetical). Note: groupBy values are mutually exclusive — combining them returns a 400 error. When groupBy=currency is active, top-level netRevenue, invoices, and payments fields are omitted; currencyBreakdown is the sole data source.
|
|
30
|
+
* Group invoice data by dimension. Allowed values: 'plan' (max 5 groups, top 4 + 'other' when exceeding), 'customer' (max 25 groups, top 24 + 'other' when exceeding, sorted by revenue descending), both in one currency like an ungrouped read, 'currency' (one entry per currency, primary currency first then alphabetical). Note: groupBy values are mutually exclusive — combining them returns a 400 error. When groupBy=currency is active, top-level netRevenue, invoices, and payments fields are omitted; currencyBreakdown is the sole data source.
|
|
31
31
|
*/
|
|
32
32
|
export type GroupBy = ClosedEnum<typeof GroupBy>;
|
|
33
33
|
|
|
@@ -57,23 +57,23 @@ export type GetRevenueRequest = {
|
|
|
57
57
|
*/
|
|
58
58
|
bucketWidth?: GetRevenueBucketWidth | undefined;
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
60
|
+
* The merchant whose revenue to read. Defaults to the merchant your API key belongs to, and is required when you belong to several merchants. Every read is scoped to one merchant; customerId and subscriptionIds narrow it further.
|
|
61
61
|
*/
|
|
62
62
|
merchantId?: string | undefined;
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
64
|
+
* Narrow the read to one of the merchant's customers.
|
|
65
65
|
*/
|
|
66
66
|
customerId?: string | undefined;
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* Narrow the invoice figures to some of the merchant's subscriptions. A payment is not tied to a subscription, so the payment figures are not narrowed by it.
|
|
69
69
|
*/
|
|
70
70
|
subscriptionIds?: Array<string> | undefined;
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* ISO 4217 currency code (e.g. 'USD') to scope every figure to. Defaults to the merchant's primary currency, except with groupBy=currency, where omitting it returns every currency.
|
|
73
73
|
*/
|
|
74
74
|
currency?: string | undefined;
|
|
75
75
|
/**
|
|
76
|
-
* Group invoice data by dimension. Allowed values: 'plan' (max 5 groups, top 4 + 'other' when exceeding), 'customer' (max 25 groups, top 24 + 'other' when exceeding, sorted by revenue descending), 'currency' (one entry per currency, primary currency first then alphabetical). Note: groupBy values are mutually exclusive — combining them returns a 400 error. When groupBy=currency is active, top-level netRevenue, invoices, and payments fields are omitted; currencyBreakdown is the sole data source.
|
|
76
|
+
* Group invoice data by dimension. Allowed values: 'plan' (max 5 groups, top 4 + 'other' when exceeding), 'customer' (max 25 groups, top 24 + 'other' when exceeding, sorted by revenue descending), both in one currency like an ungrouped read, 'currency' (one entry per currency, primary currency first then alphabetical). Note: groupBy values are mutually exclusive — combining them returns a 400 error. When groupBy=currency is active, top-level netRevenue, invoices, and payments fields are omitted; currencyBreakdown is the sole data source.
|
|
77
77
|
*/
|
|
78
78
|
groupBy?: GroupBy | undefined;
|
|
79
79
|
/**
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
|
|
7
|
+
export type GetRevenueAccountsRequest = {
|
|
8
|
+
/**
|
|
9
|
+
* Merchant whose customer accounts to report
|
|
10
|
+
*/
|
|
11
|
+
merchantId: string;
|
|
12
|
+
/**
|
|
13
|
+
* Limit the rows and the totals to these customers of the merchant. A customer of another merchant, or one that does not exist, returns 404. A customer billed in several currencies has a row for each, so set `limit` to cover them.
|
|
14
|
+
*/
|
|
15
|
+
customerIds?: Array<string> | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Number of rows to return
|
|
18
|
+
*/
|
|
19
|
+
limit?: number | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Number of rows to skip
|
|
22
|
+
*/
|
|
23
|
+
offset?: number | undefined;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** @internal */
|
|
27
|
+
export type GetRevenueAccountsRequest$Outbound = {
|
|
28
|
+
merchantId: string;
|
|
29
|
+
customerIds?: Array<string> | undefined;
|
|
30
|
+
limit: number;
|
|
31
|
+
offset: number;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** @internal */
|
|
35
|
+
export const GetRevenueAccountsRequest$outboundSchema: z.ZodType<
|
|
36
|
+
GetRevenueAccountsRequest$Outbound,
|
|
37
|
+
z.ZodTypeDef,
|
|
38
|
+
GetRevenueAccountsRequest
|
|
39
|
+
> = z.object({
|
|
40
|
+
merchantId: z.string(),
|
|
41
|
+
customerIds: z.array(z.string()).optional(),
|
|
42
|
+
limit: z.number().int().default(50),
|
|
43
|
+
offset: z.number().int().default(0),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export function getRevenueAccountsRequestToJSON(
|
|
47
|
+
getRevenueAccountsRequest: GetRevenueAccountsRequest,
|
|
48
|
+
): string {
|
|
49
|
+
return JSON.stringify(
|
|
50
|
+
GetRevenueAccountsRequest$outboundSchema.parse(getRevenueAccountsRequest),
|
|
51
|
+
);
|
|
52
|
+
}
|
|
@@ -71,6 +71,7 @@ export * from "./getprice.js";
|
|
|
71
71
|
export * from "./getproduct.js";
|
|
72
72
|
export * from "./getprofitability.js";
|
|
73
73
|
export * from "./getrevenue.js";
|
|
74
|
+
export * from "./getrevenueaccounts.js";
|
|
74
75
|
export * from "./getsource.js";
|
|
75
76
|
export * from "./getsourcerule.js";
|
|
76
77
|
export * from "./getsubscription.js";
|
|
@@ -0,0 +1,53 @@
|
|
|
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 { AccountFigure, AccountFigure$inboundSchema } from "./accountfigure.js";
|
|
9
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* What is owed, gross of tax, from any date. `awaitingPayment` and `paymentFailed` add up to it, in count and amount.
|
|
13
|
+
*/
|
|
14
|
+
export type OutstandingBlock = {
|
|
15
|
+
/**
|
|
16
|
+
* Number of unpaid invoices with an amount due above zero. A credit invoice, or one whose amount due rounds to zero, is not counted.
|
|
17
|
+
*/
|
|
18
|
+
count: number;
|
|
19
|
+
/**
|
|
20
|
+
* Total amount due in major units of the currency, in its decimal places (for example "123.00"). Negative when credits exceed what is owed.
|
|
21
|
+
*/
|
|
22
|
+
amount: string;
|
|
23
|
+
/**
|
|
24
|
+
* The part with status `ISSUED`, including any credit invoice
|
|
25
|
+
*/
|
|
26
|
+
awaitingPayment: AccountFigure;
|
|
27
|
+
/**
|
|
28
|
+
* The part with status `PAYMENT_FAILED`: collection has ended
|
|
29
|
+
*/
|
|
30
|
+
paymentFailed: AccountFigure;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** @internal */
|
|
34
|
+
export const OutstandingBlock$inboundSchema: z.ZodType<
|
|
35
|
+
OutstandingBlock,
|
|
36
|
+
z.ZodTypeDef,
|
|
37
|
+
unknown
|
|
38
|
+
> = z.object({
|
|
39
|
+
count: z.number().int(),
|
|
40
|
+
amount: z.string(),
|
|
41
|
+
awaitingPayment: AccountFigure$inboundSchema,
|
|
42
|
+
paymentFailed: AccountFigure$inboundSchema,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export function outstandingBlockFromJSON(
|
|
46
|
+
jsonString: string,
|
|
47
|
+
): SafeParseResult<OutstandingBlock, SDKValidationError> {
|
|
48
|
+
return safeParse(
|
|
49
|
+
jsonString,
|
|
50
|
+
(x) => OutstandingBlock$inboundSchema.parse(JSON.parse(x)),
|
|
51
|
+
`Failed to parse 'OutstandingBlock' from JSON`,
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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 RevenueAccountRow = {
|
|
15
|
+
/**
|
|
16
|
+
* Customer ID
|
|
17
|
+
*/
|
|
18
|
+
customerId: string;
|
|
19
|
+
/**
|
|
20
|
+
* Customer display name, or the customer ID when no name is recorded. A deleted customer who still owes money keeps its row.
|
|
21
|
+
*/
|
|
22
|
+
customerName: string;
|
|
23
|
+
/**
|
|
24
|
+
* ISO 4217 currency code of every amount in this row
|
|
25
|
+
*/
|
|
26
|
+
currency: string;
|
|
27
|
+
/**
|
|
28
|
+
* What is owed, gross of tax, from any date. `awaitingPayment` and `paymentFailed` add up to it, in count and amount.
|
|
29
|
+
*/
|
|
30
|
+
outstanding: OutstandingBlock;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** @internal */
|
|
34
|
+
export const RevenueAccountRow$inboundSchema: z.ZodType<
|
|
35
|
+
RevenueAccountRow,
|
|
36
|
+
z.ZodTypeDef,
|
|
37
|
+
unknown
|
|
38
|
+
> = z.object({
|
|
39
|
+
customerId: z.string(),
|
|
40
|
+
customerName: z.string(),
|
|
41
|
+
currency: z.string(),
|
|
42
|
+
outstanding: OutstandingBlock$inboundSchema,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export function revenueAccountRowFromJSON(
|
|
46
|
+
jsonString: string,
|
|
47
|
+
): SafeParseResult<RevenueAccountRow, SDKValidationError> {
|
|
48
|
+
return safeParse(
|
|
49
|
+
jsonString,
|
|
50
|
+
(x) => RevenueAccountRow$inboundSchema.parse(JSON.parse(x)),
|
|
51
|
+
`Failed to parse 'RevenueAccountRow' from JSON`,
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
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 { ClosedEnum } from "../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
OffsetPagination,
|
|
12
|
+
OffsetPagination$inboundSchema,
|
|
13
|
+
} from "./offsetpagination.js";
|
|
14
|
+
import {
|
|
15
|
+
RevenueAccountRow,
|
|
16
|
+
RevenueAccountRow$inboundSchema,
|
|
17
|
+
} from "./revenueaccountrow.js";
|
|
18
|
+
import {
|
|
19
|
+
RevenueAccountTotal,
|
|
20
|
+
RevenueAccountTotal$inboundSchema,
|
|
21
|
+
} from "./revenueaccounttotal.js";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Object type identifier
|
|
25
|
+
*/
|
|
26
|
+
export const RevenueAccountsResponseObject = {
|
|
27
|
+
List: "list",
|
|
28
|
+
} as const;
|
|
29
|
+
/**
|
|
30
|
+
* Object type identifier
|
|
31
|
+
*/
|
|
32
|
+
export type RevenueAccountsResponseObject = ClosedEnum<
|
|
33
|
+
typeof RevenueAccountsResponseObject
|
|
34
|
+
>;
|
|
35
|
+
|
|
36
|
+
export type RevenueAccountsResponse = {
|
|
37
|
+
/**
|
|
38
|
+
* Object type identifier
|
|
39
|
+
*/
|
|
40
|
+
object: RevenueAccountsResponseObject;
|
|
41
|
+
/**
|
|
42
|
+
* One entry per currency with at least one row in the filter, over every row and not only this page. The merchant's primary currency comes first, then the rest in alphabetical order. Empty when there are no rows.
|
|
43
|
+
*/
|
|
44
|
+
totals: Array<RevenueAccountTotal>;
|
|
45
|
+
/**
|
|
46
|
+
* One row per customer and currency with at least one unpaid invoice, in the currency order of `totals`, then by `outstanding.amount` descending, then by `customerId`. A customer billed in two currencies has two rows.
|
|
47
|
+
*/
|
|
48
|
+
data: Array<RevenueAccountRow>;
|
|
49
|
+
/**
|
|
50
|
+
* Offset-based pagination response.
|
|
51
|
+
*/
|
|
52
|
+
pagination: OffsetPagination;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/** @internal */
|
|
56
|
+
export const RevenueAccountsResponseObject$inboundSchema: z.ZodNativeEnum<
|
|
57
|
+
typeof RevenueAccountsResponseObject
|
|
58
|
+
> = z.nativeEnum(RevenueAccountsResponseObject);
|
|
59
|
+
|
|
60
|
+
/** @internal */
|
|
61
|
+
export const RevenueAccountsResponse$inboundSchema: z.ZodType<
|
|
62
|
+
RevenueAccountsResponse,
|
|
63
|
+
z.ZodTypeDef,
|
|
64
|
+
unknown
|
|
65
|
+
> = z.object({
|
|
66
|
+
object: RevenueAccountsResponseObject$inboundSchema,
|
|
67
|
+
totals: z.array(RevenueAccountTotal$inboundSchema),
|
|
68
|
+
data: z.array(RevenueAccountRow$inboundSchema),
|
|
69
|
+
pagination: OffsetPagination$inboundSchema,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export function revenueAccountsResponseFromJSON(
|
|
73
|
+
jsonString: string,
|
|
74
|
+
): SafeParseResult<RevenueAccountsResponse, SDKValidationError> {
|
|
75
|
+
return safeParse(
|
|
76
|
+
jsonString,
|
|
77
|
+
(x) => RevenueAccountsResponse$inboundSchema.parse(JSON.parse(x)),
|
|
78
|
+
`Failed to parse 'RevenueAccountsResponse' from JSON`,
|
|
79
|
+
);
|
|
80
|
+
}
|