@paygentic/sdk 0.9.16 → 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/invoice.d.ts +3 -3
- package/dist/commonjs/models/invoice.js +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/invoice.d.ts +3 -3
- package/dist/esm/models/invoice.js +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/invoice.ts +3 -3
- 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
|
@@ -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
|
+
}
|
|
@@ -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(),
|
package/src/sdk/revenue.ts
CHANGED
|
@@ -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
|
}
|