@naturalpay/sdk 0.13.0 → 0.14.0
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/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/resources/agents.d.mts +27 -54
- package/resources/agents.d.mts.map +1 -1
- package/resources/agents.d.ts +27 -54
- package/resources/agents.d.ts.map +1 -1
- package/resources/api-keys.d.mts +12 -24
- package/resources/api-keys.d.mts.map +1 -1
- package/resources/api-keys.d.ts +12 -24
- package/resources/api-keys.d.ts.map +1 -1
- package/resources/approvals.d.mts +12 -24
- package/resources/approvals.d.mts.map +1 -1
- package/resources/approvals.d.ts +12 -24
- package/resources/approvals.d.ts.map +1 -1
- package/resources/counterparties.d.mts +3 -6
- package/resources/counterparties.d.mts.map +1 -1
- package/resources/counterparties.d.ts +3 -6
- package/resources/counterparties.d.ts.map +1 -1
- package/resources/customers.d.mts +6 -12
- package/resources/customers.d.mts.map +1 -1
- package/resources/customers.d.ts +6 -12
- package/resources/customers.d.ts.map +1 -1
- package/resources/external-accounts.d.mts +6 -12
- package/resources/external-accounts.d.mts.map +1 -1
- package/resources/external-accounts.d.ts +6 -12
- package/resources/external-accounts.d.ts.map +1 -1
- package/resources/invitations.d.mts +9 -18
- package/resources/invitations.d.mts.map +1 -1
- package/resources/invitations.d.ts +9 -18
- package/resources/invitations.d.ts.map +1 -1
- package/resources/parties.d.mts +12 -24
- package/resources/parties.d.mts.map +1 -1
- package/resources/parties.d.ts +12 -24
- package/resources/parties.d.ts.map +1 -1
- package/resources/payment-requests.d.mts +59 -66
- package/resources/payment-requests.d.mts.map +1 -1
- package/resources/payment-requests.d.ts +59 -66
- package/resources/payment-requests.d.ts.map +1 -1
- package/resources/payment-requests.js +33 -46
- package/resources/payment-requests.js.map +1 -1
- package/resources/payment-requests.mjs +33 -46
- package/resources/payment-requests.mjs.map +1 -1
- package/resources/payments.d.mts +43 -46
- package/resources/payments.d.mts.map +1 -1
- package/resources/payments.d.ts +43 -46
- package/resources/payments.d.ts.map +1 -1
- package/resources/payments.js +23 -30
- package/resources/payments.js.map +1 -1
- package/resources/payments.mjs +23 -30
- package/resources/payments.mjs.map +1 -1
- package/resources/transactions.d.mts +15 -23
- package/resources/transactions.d.mts.map +1 -1
- package/resources/transactions.d.ts +15 -23
- package/resources/transactions.d.ts.map +1 -1
- package/resources/transactions.js +6 -18
- package/resources/transactions.js.map +1 -1
- package/resources/transactions.mjs +6 -18
- package/resources/transactions.mjs.map +1 -1
- package/resources/transfers.d.mts +43 -48
- package/resources/transfers.d.mts.map +1 -1
- package/resources/transfers.d.ts +43 -48
- package/resources/transfers.d.ts.map +1 -1
- package/resources/transfers.js +20 -29
- package/resources/transfers.js.map +1 -1
- package/resources/transfers.mjs +20 -29
- package/resources/transfers.mjs.map +1 -1
- package/resources/wallet.d.mts +6 -12
- package/resources/wallet.d.mts.map +1 -1
- package/resources/wallet.d.ts +6 -12
- package/resources/wallet.d.ts.map +1 -1
- package/resources/webhooks.d.mts +18 -36
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +18 -36
- package/resources/webhooks.d.ts.map +1 -1
- package/src/resources/agents.ts +27 -54
- package/src/resources/api-keys.ts +12 -24
- package/src/resources/approvals.ts +12 -24
- package/src/resources/counterparties.ts +3 -6
- package/src/resources/customers.ts +6 -12
- package/src/resources/external-accounts.ts +6 -12
- package/src/resources/invitations.ts +9 -18
- package/src/resources/parties.ts +12 -24
- package/src/resources/payment-requests.ts +70 -110
- package/src/resources/payments.ts +53 -83
- package/src/resources/transactions.ts +21 -44
- package/src/resources/transfers.ts +51 -79
- package/src/resources/wallet.ts +6 -12
- package/src/resources/webhooks.ts +18 -36
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -21,6 +21,8 @@ export class PaymentRequests extends APIResource {
|
|
|
21
21
|
* amount: 1,
|
|
22
22
|
* payer: { type: 'email', value: 'dev@stainless.com' },
|
|
23
23
|
* 'Idempotency-Key': 'Idempotency-Key',
|
|
24
|
+
* 'X-Agent-ID': 'X-Agent-ID',
|
|
25
|
+
* 'X-Instance-ID': 'X-Instance-ID',
|
|
24
26
|
* });
|
|
25
27
|
* ```
|
|
26
28
|
*/
|
|
@@ -38,11 +40,7 @@ export class PaymentRequests extends APIResource {
|
|
|
38
40
|
body,
|
|
39
41
|
...options,
|
|
40
42
|
headers: buildHeaders([
|
|
41
|
-
{
|
|
42
|
-
'Idempotency-Key': idempotencyKey,
|
|
43
|
-
...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
|
|
44
|
-
...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
|
|
45
|
-
},
|
|
43
|
+
{ 'Idempotency-Key': idempotencyKey, 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID },
|
|
46
44
|
options?.headers,
|
|
47
45
|
]),
|
|
48
46
|
});
|
|
@@ -53,24 +51,18 @@ export class PaymentRequests extends APIResource {
|
|
|
53
51
|
*
|
|
54
52
|
* @example
|
|
55
53
|
* ```ts
|
|
56
|
-
* const paymentRequests = await client.paymentRequests.list(
|
|
54
|
+
* const paymentRequests = await client.paymentRequests.list({
|
|
55
|
+
* 'X-Agent-ID': 'X-Agent-ID',
|
|
56
|
+
* 'X-Instance-ID': 'X-Instance-ID',
|
|
57
|
+
* });
|
|
57
58
|
* ```
|
|
58
59
|
*/
|
|
59
|
-
list(
|
|
60
|
-
|
|
61
|
-
options?: RequestOptions,
|
|
62
|
-
): APIPromise<PaymentRequestListResponse> {
|
|
63
|
-
const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
|
|
60
|
+
list(params: PaymentRequestListParams, options?: RequestOptions): APIPromise<PaymentRequestListResponse> {
|
|
61
|
+
const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params;
|
|
64
62
|
return this._client.get('/payment-requests', {
|
|
65
63
|
query,
|
|
66
64
|
...options,
|
|
67
|
-
headers: buildHeaders([
|
|
68
|
-
{
|
|
69
|
-
...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
|
|
70
|
-
...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
|
|
71
|
-
},
|
|
72
|
-
options?.headers,
|
|
73
|
-
]),
|
|
65
|
+
headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
|
|
74
66
|
});
|
|
75
67
|
}
|
|
76
68
|
|
|
@@ -82,7 +74,11 @@ export class PaymentRequests extends APIResource {
|
|
|
82
74
|
* ```ts
|
|
83
75
|
* const response = await client.paymentRequests.decline(
|
|
84
76
|
* 'prq_ecc2efdd09bd231a9ad9bd2aada37aa7',
|
|
85
|
-
* {
|
|
77
|
+
* {
|
|
78
|
+
* 'Idempotency-Key': 'Idempotency-Key',
|
|
79
|
+
* 'X-Agent-ID': 'X-Agent-ID',
|
|
80
|
+
* 'X-Instance-ID': 'X-Instance-ID',
|
|
81
|
+
* },
|
|
86
82
|
* );
|
|
87
83
|
* ```
|
|
88
84
|
*/
|
|
@@ -99,11 +95,7 @@ export class PaymentRequests extends APIResource {
|
|
|
99
95
|
return this._client.post(path`/payment-requests/${paymentRequestID}/decline`, {
|
|
100
96
|
...options,
|
|
101
97
|
headers: buildHeaders([
|
|
102
|
-
{
|
|
103
|
-
'Idempotency-Key': idempotencyKey,
|
|
104
|
-
...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
|
|
105
|
-
...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
|
|
106
|
-
},
|
|
98
|
+
{ 'Idempotency-Key': idempotencyKey, 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID },
|
|
107
99
|
options?.headers,
|
|
108
100
|
]),
|
|
109
101
|
});
|
|
@@ -122,6 +114,8 @@ export class PaymentRequests extends APIResource {
|
|
|
122
114
|
* walletId: 'wal_ecc2efdd09bd231a9ad9bd2aada37aa7',
|
|
123
115
|
* },
|
|
124
116
|
* 'Idempotency-Key': 'Idempotency-Key',
|
|
117
|
+
* 'X-Agent-ID': 'X-Agent-ID',
|
|
118
|
+
* 'X-Instance-ID': 'X-Instance-ID',
|
|
125
119
|
* },
|
|
126
120
|
* );
|
|
127
121
|
* ```
|
|
@@ -141,11 +135,7 @@ export class PaymentRequests extends APIResource {
|
|
|
141
135
|
body,
|
|
142
136
|
...options,
|
|
143
137
|
headers: buildHeaders([
|
|
144
|
-
{
|
|
145
|
-
'Idempotency-Key': idempotencyKey,
|
|
146
|
-
...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
|
|
147
|
-
...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
|
|
148
|
-
},
|
|
138
|
+
{ 'Idempotency-Key': idempotencyKey, 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID },
|
|
149
139
|
options?.headers,
|
|
150
140
|
]),
|
|
151
141
|
});
|
|
@@ -158,24 +148,22 @@ export class PaymentRequests extends APIResource {
|
|
|
158
148
|
* ```ts
|
|
159
149
|
* const paymentRequest = await client.paymentRequests.get(
|
|
160
150
|
* 'prq_ecc2efdd09bd231a9ad9bd2aada37aa7',
|
|
151
|
+
* {
|
|
152
|
+
* 'X-Agent-ID': 'X-Agent-ID',
|
|
153
|
+
* 'X-Instance-ID': 'X-Instance-ID',
|
|
154
|
+
* },
|
|
161
155
|
* );
|
|
162
156
|
* ```
|
|
163
157
|
*/
|
|
164
158
|
get(
|
|
165
159
|
paymentRequestID: string,
|
|
166
|
-
params: PaymentRequestGetParams
|
|
160
|
+
params: PaymentRequestGetParams,
|
|
167
161
|
options?: RequestOptions,
|
|
168
162
|
): APIPromise<PaymentRequestGetResponse> {
|
|
169
|
-
const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID } = params
|
|
163
|
+
const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID } = params;
|
|
170
164
|
return this._client.get(path`/payment-requests/${paymentRequestID}`, {
|
|
171
165
|
...options,
|
|
172
|
-
headers: buildHeaders([
|
|
173
|
-
{
|
|
174
|
-
...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
|
|
175
|
-
...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
|
|
176
|
-
},
|
|
177
|
-
options?.headers,
|
|
178
|
-
]),
|
|
166
|
+
headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
|
|
179
167
|
});
|
|
180
168
|
}
|
|
181
169
|
|
|
@@ -184,25 +172,21 @@ export class PaymentRequests extends APIResource {
|
|
|
184
172
|
*
|
|
185
173
|
* @example
|
|
186
174
|
* ```ts
|
|
187
|
-
* const response =
|
|
188
|
-
*
|
|
175
|
+
* const response = await client.paymentRequests.listIncoming({
|
|
176
|
+
* 'X-Agent-ID': 'X-Agent-ID',
|
|
177
|
+
* 'X-Instance-ID': 'X-Instance-ID',
|
|
178
|
+
* });
|
|
189
179
|
* ```
|
|
190
180
|
*/
|
|
191
181
|
listIncoming(
|
|
192
|
-
params: PaymentRequestListIncomingParams
|
|
182
|
+
params: PaymentRequestListIncomingParams,
|
|
193
183
|
options?: RequestOptions,
|
|
194
184
|
): APIPromise<PaymentRequestListIncomingResponse> {
|
|
195
|
-
const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params
|
|
185
|
+
const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params;
|
|
196
186
|
return this._client.get('/payment-requests/incoming', {
|
|
197
187
|
query,
|
|
198
188
|
...options,
|
|
199
|
-
headers: buildHeaders([
|
|
200
|
-
{
|
|
201
|
-
...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
|
|
202
|
-
...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
|
|
203
|
-
},
|
|
204
|
-
options?.headers,
|
|
205
|
-
]),
|
|
189
|
+
headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
|
|
206
190
|
});
|
|
207
191
|
}
|
|
208
192
|
}
|
|
@@ -1656,6 +1640,16 @@ export interface PaymentRequestCreateParams {
|
|
|
1656
1640
|
*/
|
|
1657
1641
|
'Idempotency-Key': string;
|
|
1658
1642
|
|
|
1643
|
+
/**
|
|
1644
|
+
* Header param: Agent ID (agt_xxx) used for attribution and audit.
|
|
1645
|
+
*/
|
|
1646
|
+
'X-Agent-ID': string;
|
|
1647
|
+
|
|
1648
|
+
/**
|
|
1649
|
+
* Header param: Stable run, session, or conversation ID for agent observability.
|
|
1650
|
+
*/
|
|
1651
|
+
'X-Instance-ID': string;
|
|
1652
|
+
|
|
1659
1653
|
/**
|
|
1660
1654
|
* Body param: Currency code (currently only USD)
|
|
1661
1655
|
*/
|
|
@@ -1682,20 +1676,6 @@ export interface PaymentRequestCreateParams {
|
|
|
1682
1676
|
* party's default wallet.
|
|
1683
1677
|
*/
|
|
1684
1678
|
walletId?: string;
|
|
1685
|
-
|
|
1686
|
-
/**
|
|
1687
|
-
* Header param: Conditionally required for payment-related API requests. Pass an
|
|
1688
|
-
* agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
|
|
1689
|
-
* one active agent, which Natural defaults automatically.
|
|
1690
|
-
*/
|
|
1691
|
-
'X-Agent-ID'?: string;
|
|
1692
|
-
|
|
1693
|
-
/**
|
|
1694
|
-
* Header param: Stable run, session, or conversation ID for agent observability.
|
|
1695
|
-
* If omitted on a payment-related API request, Natural generates one after
|
|
1696
|
-
* resolving the attribution agent.
|
|
1697
|
-
*/
|
|
1698
|
-
'X-Instance-ID'?: string;
|
|
1699
1679
|
}
|
|
1700
1680
|
|
|
1701
1681
|
export namespace PaymentRequestCreateParams {
|
|
@@ -1738,28 +1718,24 @@ export namespace PaymentRequestCreateParams {
|
|
|
1738
1718
|
|
|
1739
1719
|
export interface PaymentRequestListParams {
|
|
1740
1720
|
/**
|
|
1741
|
-
*
|
|
1721
|
+
* Header param: Agent ID (agt_xxx) used for attribution and audit.
|
|
1742
1722
|
*/
|
|
1743
|
-
|
|
1723
|
+
'X-Agent-ID': string;
|
|
1744
1724
|
|
|
1745
1725
|
/**
|
|
1746
|
-
*
|
|
1726
|
+
* Header param: Stable run, session, or conversation ID for agent observability.
|
|
1747
1727
|
*/
|
|
1748
|
-
|
|
1728
|
+
'X-Instance-ID': string;
|
|
1749
1729
|
|
|
1750
1730
|
/**
|
|
1751
|
-
*
|
|
1752
|
-
* agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
|
|
1753
|
-
* one active agent, which Natural defaults automatically.
|
|
1731
|
+
* Query param: Pagination cursor returned by the previous response
|
|
1754
1732
|
*/
|
|
1755
|
-
|
|
1733
|
+
cursor?: string;
|
|
1756
1734
|
|
|
1757
1735
|
/**
|
|
1758
|
-
*
|
|
1759
|
-
* If omitted on a payment-related API request, Natural generates one after
|
|
1760
|
-
* resolving the attribution agent.
|
|
1736
|
+
* Query param: Results per page (1-100)
|
|
1761
1737
|
*/
|
|
1762
|
-
|
|
1738
|
+
limit?: number;
|
|
1763
1739
|
}
|
|
1764
1740
|
|
|
1765
1741
|
export interface PaymentRequestDeclineParams {
|
|
@@ -1770,18 +1746,14 @@ export interface PaymentRequestDeclineParams {
|
|
|
1770
1746
|
'Idempotency-Key': string;
|
|
1771
1747
|
|
|
1772
1748
|
/**
|
|
1773
|
-
*
|
|
1774
|
-
* (agt_xxx) for attribution, or omit it only when your party has exactly one
|
|
1775
|
-
* active agent, which Natural defaults automatically.
|
|
1749
|
+
* Agent ID (agt_xxx) used for attribution and audit.
|
|
1776
1750
|
*/
|
|
1777
|
-
'X-Agent-ID'
|
|
1751
|
+
'X-Agent-ID': string;
|
|
1778
1752
|
|
|
1779
1753
|
/**
|
|
1780
|
-
* Stable run, session, or conversation ID for agent observability.
|
|
1781
|
-
* payment-related API request, Natural generates one after resolving the
|
|
1782
|
-
* attribution agent.
|
|
1754
|
+
* Stable run, session, or conversation ID for agent observability.
|
|
1783
1755
|
*/
|
|
1784
|
-
'X-Instance-ID'
|
|
1756
|
+
'X-Instance-ID': string;
|
|
1785
1757
|
}
|
|
1786
1758
|
|
|
1787
1759
|
export interface PaymentRequestFulfillParams {
|
|
@@ -1797,18 +1769,14 @@ export interface PaymentRequestFulfillParams {
|
|
|
1797
1769
|
'Idempotency-Key': string;
|
|
1798
1770
|
|
|
1799
1771
|
/**
|
|
1800
|
-
* Header param:
|
|
1801
|
-
* agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
|
|
1802
|
-
* one active agent, which Natural defaults automatically.
|
|
1772
|
+
* Header param: Agent ID (agt_xxx) used for attribution and audit.
|
|
1803
1773
|
*/
|
|
1804
|
-
'X-Agent-ID'
|
|
1774
|
+
'X-Agent-ID': string;
|
|
1805
1775
|
|
|
1806
1776
|
/**
|
|
1807
1777
|
* Header param: Stable run, session, or conversation ID for agent observability.
|
|
1808
|
-
* If omitted on a payment-related API request, Natural generates one after
|
|
1809
|
-
* resolving the attribution agent.
|
|
1810
1778
|
*/
|
|
1811
|
-
'X-Instance-ID'
|
|
1779
|
+
'X-Instance-ID': string;
|
|
1812
1780
|
}
|
|
1813
1781
|
|
|
1814
1782
|
export namespace PaymentRequestFulfillParams {
|
|
@@ -1827,44 +1795,36 @@ export namespace PaymentRequestFulfillParams {
|
|
|
1827
1795
|
|
|
1828
1796
|
export interface PaymentRequestGetParams {
|
|
1829
1797
|
/**
|
|
1830
|
-
*
|
|
1831
|
-
* (agt_xxx) for attribution, or omit it only when your party has exactly one
|
|
1832
|
-
* active agent, which Natural defaults automatically.
|
|
1798
|
+
* Agent ID (agt_xxx) used for attribution and audit.
|
|
1833
1799
|
*/
|
|
1834
|
-
'X-Agent-ID'
|
|
1800
|
+
'X-Agent-ID': string;
|
|
1835
1801
|
|
|
1836
1802
|
/**
|
|
1837
|
-
* Stable run, session, or conversation ID for agent observability.
|
|
1838
|
-
* payment-related API request, Natural generates one after resolving the
|
|
1839
|
-
* attribution agent.
|
|
1803
|
+
* Stable run, session, or conversation ID for agent observability.
|
|
1840
1804
|
*/
|
|
1841
|
-
'X-Instance-ID'
|
|
1805
|
+
'X-Instance-ID': string;
|
|
1842
1806
|
}
|
|
1843
1807
|
|
|
1844
1808
|
export interface PaymentRequestListIncomingParams {
|
|
1845
1809
|
/**
|
|
1846
|
-
*
|
|
1810
|
+
* Header param: Agent ID (agt_xxx) used for attribution and audit.
|
|
1847
1811
|
*/
|
|
1848
|
-
|
|
1812
|
+
'X-Agent-ID': string;
|
|
1849
1813
|
|
|
1850
1814
|
/**
|
|
1851
|
-
*
|
|
1815
|
+
* Header param: Stable run, session, or conversation ID for agent observability.
|
|
1852
1816
|
*/
|
|
1853
|
-
|
|
1817
|
+
'X-Instance-ID': string;
|
|
1854
1818
|
|
|
1855
1819
|
/**
|
|
1856
|
-
*
|
|
1857
|
-
* agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
|
|
1858
|
-
* one active agent, which Natural defaults automatically.
|
|
1820
|
+
* Query param: Pagination cursor returned by the previous response
|
|
1859
1821
|
*/
|
|
1860
|
-
|
|
1822
|
+
cursor?: string;
|
|
1861
1823
|
|
|
1862
1824
|
/**
|
|
1863
|
-
*
|
|
1864
|
-
* If omitted on a payment-related API request, Natural generates one after
|
|
1865
|
-
* resolving the attribution agent.
|
|
1825
|
+
* Query param: Results per page (1-100)
|
|
1866
1826
|
*/
|
|
1867
|
-
|
|
1827
|
+
limit?: number;
|
|
1868
1828
|
}
|
|
1869
1829
|
|
|
1870
1830
|
export declare namespace PaymentRequests {
|
|
@@ -22,6 +22,8 @@ export class Payments extends APIResource {
|
|
|
22
22
|
* value: 'dev@stainless.com',
|
|
23
23
|
* },
|
|
24
24
|
* 'Idempotency-Key': 'Idempotency-Key',
|
|
25
|
+
* 'X-Agent-ID': 'X-Agent-ID',
|
|
26
|
+
* 'X-Instance-ID': 'X-Instance-ID',
|
|
25
27
|
* });
|
|
26
28
|
* ```
|
|
27
29
|
*/
|
|
@@ -36,11 +38,7 @@ export class Payments extends APIResource {
|
|
|
36
38
|
body,
|
|
37
39
|
...options,
|
|
38
40
|
headers: buildHeaders([
|
|
39
|
-
{
|
|
40
|
-
'Idempotency-Key': idempotencyKey,
|
|
41
|
-
...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
|
|
42
|
-
...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
|
|
43
|
-
},
|
|
41
|
+
{ 'Idempotency-Key': idempotencyKey, 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID },
|
|
44
42
|
options?.headers,
|
|
45
43
|
]),
|
|
46
44
|
});
|
|
@@ -51,24 +49,18 @@ export class Payments extends APIResource {
|
|
|
51
49
|
*
|
|
52
50
|
* @example
|
|
53
51
|
* ```ts
|
|
54
|
-
* const payments = await client.payments.list(
|
|
52
|
+
* const payments = await client.payments.list({
|
|
53
|
+
* 'X-Agent-ID': 'X-Agent-ID',
|
|
54
|
+
* 'X-Instance-ID': 'X-Instance-ID',
|
|
55
|
+
* });
|
|
55
56
|
* ```
|
|
56
57
|
*/
|
|
57
|
-
list(
|
|
58
|
-
|
|
59
|
-
options?: RequestOptions,
|
|
60
|
-
): APIPromise<PaymentListResponse> {
|
|
61
|
-
const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
|
|
58
|
+
list(params: PaymentListParams, options?: RequestOptions): APIPromise<PaymentListResponse> {
|
|
59
|
+
const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params;
|
|
62
60
|
return this._client.get('/payments', {
|
|
63
61
|
query,
|
|
64
62
|
...options,
|
|
65
|
-
headers: buildHeaders([
|
|
66
|
-
{
|
|
67
|
-
...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
|
|
68
|
-
...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
|
|
69
|
-
},
|
|
70
|
-
options?.headers,
|
|
71
|
-
]),
|
|
63
|
+
headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
|
|
72
64
|
});
|
|
73
65
|
}
|
|
74
66
|
|
|
@@ -79,7 +71,11 @@ export class Payments extends APIResource {
|
|
|
79
71
|
* ```ts
|
|
80
72
|
* const response = await client.payments.cancel(
|
|
81
73
|
* 'pay_ecc2efdd09bd231a9ad9bd2aada37aa7',
|
|
82
|
-
* {
|
|
74
|
+
* {
|
|
75
|
+
* 'Idempotency-Key': 'Idempotency-Key',
|
|
76
|
+
* 'X-Agent-ID': 'X-Agent-ID',
|
|
77
|
+
* 'X-Instance-ID': 'X-Instance-ID',
|
|
78
|
+
* },
|
|
83
79
|
* );
|
|
84
80
|
* ```
|
|
85
81
|
*/
|
|
@@ -96,11 +92,7 @@ export class Payments extends APIResource {
|
|
|
96
92
|
return this._client.post(path`/payments/${paymentID}/cancel`, {
|
|
97
93
|
...options,
|
|
98
94
|
headers: buildHeaders([
|
|
99
|
-
{
|
|
100
|
-
'Idempotency-Key': idempotencyKey,
|
|
101
|
-
...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
|
|
102
|
-
...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
|
|
103
|
-
},
|
|
95
|
+
{ 'Idempotency-Key': idempotencyKey, 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID },
|
|
104
96
|
options?.headers,
|
|
105
97
|
]),
|
|
106
98
|
});
|
|
@@ -113,25 +105,19 @@ export class Payments extends APIResource {
|
|
|
113
105
|
* ```ts
|
|
114
106
|
* const payment = await client.payments.get(
|
|
115
107
|
* 'pay_ecc2efdd09bd231a9ad9bd2aada37aa7',
|
|
108
|
+
* {
|
|
109
|
+
* 'X-Agent-ID': 'X-Agent-ID',
|
|
110
|
+
* 'X-Instance-ID': 'X-Instance-ID',
|
|
111
|
+
* },
|
|
116
112
|
* );
|
|
117
113
|
* ```
|
|
118
114
|
*/
|
|
119
|
-
get(
|
|
120
|
-
|
|
121
|
-
params: PaymentGetParams | null | undefined = {},
|
|
122
|
-
options?: RequestOptions,
|
|
123
|
-
): APIPromise<PaymentGetResponse> {
|
|
124
|
-
const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
|
|
115
|
+
get(paymentID: string, params: PaymentGetParams, options?: RequestOptions): APIPromise<PaymentGetResponse> {
|
|
116
|
+
const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params;
|
|
125
117
|
return this._client.get(path`/payments/${paymentID}`, {
|
|
126
118
|
query,
|
|
127
119
|
...options,
|
|
128
|
-
headers: buildHeaders([
|
|
129
|
-
{
|
|
130
|
-
...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
|
|
131
|
-
...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
|
|
132
|
-
},
|
|
133
|
-
options?.headers,
|
|
134
|
-
]),
|
|
120
|
+
headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
|
|
135
121
|
});
|
|
136
122
|
}
|
|
137
123
|
}
|
|
@@ -1060,6 +1046,16 @@ export interface PaymentCreateParams {
|
|
|
1060
1046
|
*/
|
|
1061
1047
|
'Idempotency-Key': string;
|
|
1062
1048
|
|
|
1049
|
+
/**
|
|
1050
|
+
* Header param: Agent ID (agt_xxx) used for attribution and audit.
|
|
1051
|
+
*/
|
|
1052
|
+
'X-Agent-ID': string;
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* Header param: Stable run, session, or conversation ID for agent observability.
|
|
1056
|
+
*/
|
|
1057
|
+
'X-Instance-ID': string;
|
|
1058
|
+
|
|
1063
1059
|
/**
|
|
1064
1060
|
* Body param: Currency code
|
|
1065
1061
|
*/
|
|
@@ -1075,20 +1071,6 @@ export interface PaymentCreateParams {
|
|
|
1075
1071
|
* Body param: Payment description. Maximum 500 characters.
|
|
1076
1072
|
*/
|
|
1077
1073
|
description?: string;
|
|
1078
|
-
|
|
1079
|
-
/**
|
|
1080
|
-
* Header param: Conditionally required for payment-related API requests. Pass an
|
|
1081
|
-
* agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
|
|
1082
|
-
* one active agent, which Natural defaults automatically.
|
|
1083
|
-
*/
|
|
1084
|
-
'X-Agent-ID'?: string;
|
|
1085
|
-
|
|
1086
|
-
/**
|
|
1087
|
-
* Header param: Stable run, session, or conversation ID for agent observability.
|
|
1088
|
-
* If omitted on a payment-related API request, Natural generates one after
|
|
1089
|
-
* resolving the attribution agent.
|
|
1090
|
-
*/
|
|
1091
|
-
'X-Instance-ID'?: string;
|
|
1092
1074
|
}
|
|
1093
1075
|
|
|
1094
1076
|
export namespace PaymentCreateParams {
|
|
@@ -1131,33 +1113,29 @@ export namespace PaymentCreateParams {
|
|
|
1131
1113
|
|
|
1132
1114
|
export interface PaymentListParams {
|
|
1133
1115
|
/**
|
|
1134
|
-
*
|
|
1116
|
+
* Header param: Agent ID (agt_xxx) used for attribution and audit.
|
|
1135
1117
|
*/
|
|
1136
|
-
|
|
1118
|
+
'X-Agent-ID': string;
|
|
1137
1119
|
|
|
1138
1120
|
/**
|
|
1139
|
-
*
|
|
1121
|
+
* Header param: Stable run, session, or conversation ID for agent observability.
|
|
1140
1122
|
*/
|
|
1141
|
-
|
|
1123
|
+
'X-Instance-ID': string;
|
|
1142
1124
|
|
|
1143
1125
|
/**
|
|
1144
|
-
* Query param:
|
|
1126
|
+
* Query param: Pagination cursor from previous response
|
|
1145
1127
|
*/
|
|
1146
|
-
|
|
1128
|
+
cursor?: string;
|
|
1147
1129
|
|
|
1148
1130
|
/**
|
|
1149
|
-
*
|
|
1150
|
-
* agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
|
|
1151
|
-
* one active agent, which Natural defaults automatically.
|
|
1131
|
+
* Query param: Results per page
|
|
1152
1132
|
*/
|
|
1153
|
-
|
|
1133
|
+
limit?: number;
|
|
1154
1134
|
|
|
1155
1135
|
/**
|
|
1156
|
-
*
|
|
1157
|
-
* If omitted on a payment-related API request, Natural generates one after
|
|
1158
|
-
* resolving the attribution agent.
|
|
1136
|
+
* Query param: Party ID for delegated payment lookup
|
|
1159
1137
|
*/
|
|
1160
|
-
|
|
1138
|
+
partyId?: string;
|
|
1161
1139
|
}
|
|
1162
1140
|
|
|
1163
1141
|
export interface PaymentCancelParams {
|
|
@@ -1168,39 +1146,31 @@ export interface PaymentCancelParams {
|
|
|
1168
1146
|
'Idempotency-Key': string;
|
|
1169
1147
|
|
|
1170
1148
|
/**
|
|
1171
|
-
*
|
|
1172
|
-
* (agt_xxx) for attribution, or omit it only when your party has exactly one
|
|
1173
|
-
* active agent, which Natural defaults automatically.
|
|
1149
|
+
* Agent ID (agt_xxx) used for attribution and audit.
|
|
1174
1150
|
*/
|
|
1175
|
-
'X-Agent-ID'
|
|
1151
|
+
'X-Agent-ID': string;
|
|
1176
1152
|
|
|
1177
1153
|
/**
|
|
1178
|
-
* Stable run, session, or conversation ID for agent observability.
|
|
1179
|
-
* payment-related API request, Natural generates one after resolving the
|
|
1180
|
-
* attribution agent.
|
|
1154
|
+
* Stable run, session, or conversation ID for agent observability.
|
|
1181
1155
|
*/
|
|
1182
|
-
'X-Instance-ID'
|
|
1156
|
+
'X-Instance-ID': string;
|
|
1183
1157
|
}
|
|
1184
1158
|
|
|
1185
1159
|
export interface PaymentGetParams {
|
|
1186
1160
|
/**
|
|
1187
|
-
*
|
|
1161
|
+
* Header param: Agent ID (agt_xxx) used for attribution and audit.
|
|
1188
1162
|
*/
|
|
1189
|
-
|
|
1163
|
+
'X-Agent-ID': string;
|
|
1190
1164
|
|
|
1191
1165
|
/**
|
|
1192
|
-
* Header param:
|
|
1193
|
-
* agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
|
|
1194
|
-
* one active agent, which Natural defaults automatically.
|
|
1166
|
+
* Header param: Stable run, session, or conversation ID for agent observability.
|
|
1195
1167
|
*/
|
|
1196
|
-
'X-
|
|
1168
|
+
'X-Instance-ID': string;
|
|
1197
1169
|
|
|
1198
1170
|
/**
|
|
1199
|
-
*
|
|
1200
|
-
* If omitted on a payment-related API request, Natural generates one after
|
|
1201
|
-
* resolving the attribution agent.
|
|
1171
|
+
* Query param: Party ID for delegated payment lookup
|
|
1202
1172
|
*/
|
|
1203
|
-
|
|
1173
|
+
partyId?: string;
|
|
1204
1174
|
}
|
|
1205
1175
|
|
|
1206
1176
|
export declare namespace Payments {
|