@getivy/node-sdk 0.1.0-alpha.2

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 (249) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/LICENSE +201 -0
  3. package/README.md +303 -0
  4. package/_shims/MultipartBody.d.ts +9 -0
  5. package/_shims/MultipartBody.d.ts.map +1 -0
  6. package/_shims/MultipartBody.js +16 -0
  7. package/_shims/MultipartBody.js.map +1 -0
  8. package/_shims/MultipartBody.mjs +12 -0
  9. package/_shims/MultipartBody.mjs.map +1 -0
  10. package/_shims/README.md +46 -0
  11. package/_shims/auto/runtime-bun.d.ts +5 -0
  12. package/_shims/auto/runtime-bun.d.ts.map +1 -0
  13. package/_shims/auto/runtime-bun.js +21 -0
  14. package/_shims/auto/runtime-bun.js.map +1 -0
  15. package/_shims/auto/runtime-bun.mjs +2 -0
  16. package/_shims/auto/runtime-bun.mjs.map +1 -0
  17. package/_shims/auto/runtime-node.d.ts +5 -0
  18. package/_shims/auto/runtime-node.d.ts.map +1 -0
  19. package/_shims/auto/runtime-node.js +21 -0
  20. package/_shims/auto/runtime-node.js.map +1 -0
  21. package/_shims/auto/runtime-node.mjs +2 -0
  22. package/_shims/auto/runtime-node.mjs.map +1 -0
  23. package/_shims/auto/runtime.d.ts +5 -0
  24. package/_shims/auto/runtime.d.ts.map +1 -0
  25. package/_shims/auto/runtime.js +21 -0
  26. package/_shims/auto/runtime.js.map +1 -0
  27. package/_shims/auto/runtime.mjs +2 -0
  28. package/_shims/auto/runtime.mjs.map +1 -0
  29. package/_shims/auto/types-node.d.ts +5 -0
  30. package/_shims/auto/types-node.d.ts.map +1 -0
  31. package/_shims/auto/types-node.js +21 -0
  32. package/_shims/auto/types-node.js.map +1 -0
  33. package/_shims/auto/types-node.mjs +2 -0
  34. package/_shims/auto/types-node.mjs.map +1 -0
  35. package/_shims/auto/types.d.ts +101 -0
  36. package/_shims/auto/types.js +3 -0
  37. package/_shims/auto/types.mjs +3 -0
  38. package/_shims/bun-runtime.d.ts +6 -0
  39. package/_shims/bun-runtime.d.ts.map +1 -0
  40. package/_shims/bun-runtime.js +14 -0
  41. package/_shims/bun-runtime.js.map +1 -0
  42. package/_shims/bun-runtime.mjs +10 -0
  43. package/_shims/bun-runtime.mjs.map +1 -0
  44. package/_shims/index.d.ts +81 -0
  45. package/_shims/index.js +13 -0
  46. package/_shims/index.mjs +7 -0
  47. package/_shims/manual-types.d.ts +12 -0
  48. package/_shims/manual-types.js +3 -0
  49. package/_shims/manual-types.mjs +3 -0
  50. package/_shims/node-runtime.d.ts +3 -0
  51. package/_shims/node-runtime.d.ts.map +1 -0
  52. package/_shims/node-runtime.js +89 -0
  53. package/_shims/node-runtime.js.map +1 -0
  54. package/_shims/node-runtime.mjs +56 -0
  55. package/_shims/node-runtime.mjs.map +1 -0
  56. package/_shims/node-types.d.ts +42 -0
  57. package/_shims/node-types.js +3 -0
  58. package/_shims/node-types.mjs +3 -0
  59. package/_shims/registry.d.ts +37 -0
  60. package/_shims/registry.d.ts.map +1 -0
  61. package/_shims/registry.js +41 -0
  62. package/_shims/registry.js.map +1 -0
  63. package/_shims/registry.mjs +37 -0
  64. package/_shims/registry.mjs.map +1 -0
  65. package/_shims/web-runtime.d.ts +5 -0
  66. package/_shims/web-runtime.d.ts.map +1 -0
  67. package/_shims/web-runtime.js +78 -0
  68. package/_shims/web-runtime.js.map +1 -0
  69. package/_shims/web-runtime.mjs +71 -0
  70. package/_shims/web-runtime.mjs.map +1 -0
  71. package/_shims/web-types.d.ts +83 -0
  72. package/_shims/web-types.js +3 -0
  73. package/_shims/web-types.mjs +3 -0
  74. package/core.d.ts +241 -0
  75. package/core.d.ts.map +1 -0
  76. package/core.js +908 -0
  77. package/core.js.map +1 -0
  78. package/core.mjs +876 -0
  79. package/core.mjs.map +1 -0
  80. package/error.d.ts +47 -0
  81. package/error.d.ts.map +1 -0
  82. package/error.js +113 -0
  83. package/error.js.map +1 -0
  84. package/error.mjs +97 -0
  85. package/error.mjs.map +1 -0
  86. package/index.d.mts +157 -0
  87. package/index.d.ts +157 -0
  88. package/index.d.ts.map +1 -0
  89. package/index.js +164 -0
  90. package/index.js.map +1 -0
  91. package/index.mjs +121 -0
  92. package/index.mjs.map +1 -0
  93. package/package.json +103 -0
  94. package/resource.d.ts +6 -0
  95. package/resource.d.ts.map +1 -0
  96. package/resource.js +11 -0
  97. package/resource.js.map +1 -0
  98. package/resource.mjs +7 -0
  99. package/resource.mjs.map +1 -0
  100. package/resources/balance.d.ts +34 -0
  101. package/resources/balance.d.ts.map +1 -0
  102. package/resources/balance.js +16 -0
  103. package/resources/balance.js.map +1 -0
  104. package/resources/balance.mjs +12 -0
  105. package/resources/balance.mjs.map +1 -0
  106. package/resources/banks.d.ts +223 -0
  107. package/resources/banks.d.ts.map +1 -0
  108. package/resources/banks.js +30 -0
  109. package/resources/banks.js.map +1 -0
  110. package/resources/banks.mjs +26 -0
  111. package/resources/banks.mjs.map +1 -0
  112. package/resources/capabilities.d.ts +28 -0
  113. package/resources/capabilities.d.ts.map +1 -0
  114. package/resources/capabilities.js +16 -0
  115. package/resources/capabilities.js.map +1 -0
  116. package/resources/capabilities.mjs +12 -0
  117. package/resources/capabilities.mjs.map +1 -0
  118. package/resources/charges.d.ts +86 -0
  119. package/resources/charges.d.ts.map +1 -0
  120. package/resources/charges.js +15 -0
  121. package/resources/charges.js.map +1 -0
  122. package/resources/charges.mjs +11 -0
  123. package/resources/charges.mjs.map +1 -0
  124. package/resources/checkoutsession.d.ts +2370 -0
  125. package/resources/checkoutsession.d.ts.map +1 -0
  126. package/resources/checkoutsession.js +30 -0
  127. package/resources/checkoutsession.js.map +1 -0
  128. package/resources/checkoutsession.mjs +26 -0
  129. package/resources/checkoutsession.mjs.map +1 -0
  130. package/resources/customers.d.ts +37 -0
  131. package/resources/customers.d.ts.map +1 -0
  132. package/resources/customers.js +21 -0
  133. package/resources/customers.js.map +1 -0
  134. package/resources/customers.mjs +17 -0
  135. package/resources/customers.mjs.map +1 -0
  136. package/resources/index.d.ts +13 -0
  137. package/resources/index.d.ts.map +1 -0
  138. package/resources/index.js +29 -0
  139. package/resources/index.js.map +1 -0
  140. package/resources/index.mjs +14 -0
  141. package/resources/index.mjs.map +1 -0
  142. package/resources/mandates.d.ts +91 -0
  143. package/resources/mandates.d.ts.map +1 -0
  144. package/resources/mandates.js +27 -0
  145. package/resources/mandates.js.map +1 -0
  146. package/resources/mandates.mjs +23 -0
  147. package/resources/mandates.mjs.map +1 -0
  148. package/resources/orders.d.ts +1255 -0
  149. package/resources/orders.d.ts.map +1 -0
  150. package/resources/orders.js +23 -0
  151. package/resources/orders.js.map +1 -0
  152. package/resources/orders.mjs +19 -0
  153. package/resources/orders.mjs.map +1 -0
  154. package/resources/payouts.d.ts +224 -0
  155. package/resources/payouts.d.ts.map +1 -0
  156. package/resources/payouts.js +28 -0
  157. package/resources/payouts.js.map +1 -0
  158. package/resources/payouts.mjs +24 -0
  159. package/resources/payouts.mjs.map +1 -0
  160. package/resources/refunds.d.ts +138 -0
  161. package/resources/refunds.d.ts.map +1 -0
  162. package/resources/refunds.js +28 -0
  163. package/resources/refunds.js.map +1 -0
  164. package/resources/refunds.mjs +24 -0
  165. package/resources/refunds.mjs.map +1 -0
  166. package/resources/reports.d.ts +120 -0
  167. package/resources/reports.d.ts.map +1 -0
  168. package/resources/reports.js +31 -0
  169. package/resources/reports.js.map +1 -0
  170. package/resources/reports.mjs +27 -0
  171. package/resources/reports.mjs.map +1 -0
  172. package/resources/subaccounts.d.ts +49 -0
  173. package/resources/subaccounts.d.ts.map +1 -0
  174. package/resources/subaccounts.js +22 -0
  175. package/resources/subaccounts.js.map +1 -0
  176. package/resources/subaccounts.mjs +18 -0
  177. package/resources/subaccounts.mjs.map +1 -0
  178. package/shims/node.d.ts +30 -0
  179. package/shims/node.d.ts.map +1 -0
  180. package/shims/node.js +31 -0
  181. package/shims/node.js.map +1 -0
  182. package/shims/node.mjs +5 -0
  183. package/shims/node.mjs.map +1 -0
  184. package/shims/web.d.ts +26 -0
  185. package/shims/web.d.ts.map +1 -0
  186. package/shims/web.js +31 -0
  187. package/shims/web.js.map +1 -0
  188. package/shims/web.mjs +5 -0
  189. package/shims/web.mjs.map +1 -0
  190. package/src/_shims/MultipartBody.ts +9 -0
  191. package/src/_shims/README.md +46 -0
  192. package/src/_shims/auto/runtime-bun.ts +4 -0
  193. package/src/_shims/auto/runtime-node.ts +4 -0
  194. package/src/_shims/auto/runtime.ts +4 -0
  195. package/src/_shims/auto/types-node.ts +4 -0
  196. package/src/_shims/auto/types.d.ts +101 -0
  197. package/src/_shims/auto/types.js +3 -0
  198. package/src/_shims/auto/types.mjs +3 -0
  199. package/src/_shims/bun-runtime.ts +14 -0
  200. package/src/_shims/index.d.ts +81 -0
  201. package/src/_shims/index.js +13 -0
  202. package/src/_shims/index.mjs +7 -0
  203. package/src/_shims/manual-types.d.ts +12 -0
  204. package/src/_shims/manual-types.js +3 -0
  205. package/src/_shims/manual-types.mjs +3 -0
  206. package/src/_shims/node-runtime.ts +81 -0
  207. package/src/_shims/node-types.d.ts +42 -0
  208. package/src/_shims/node-types.js +3 -0
  209. package/src/_shims/node-types.mjs +3 -0
  210. package/src/_shims/registry.ts +67 -0
  211. package/src/_shims/web-runtime.ts +103 -0
  212. package/src/_shims/web-types.d.ts +83 -0
  213. package/src/_shims/web-types.js +3 -0
  214. package/src/_shims/web-types.mjs +3 -0
  215. package/src/core.ts +1200 -0
  216. package/src/error.ts +130 -0
  217. package/src/index.ts +393 -0
  218. package/src/lib/.keep +4 -0
  219. package/src/resource.ts +11 -0
  220. package/src/resources/balance.ts +49 -0
  221. package/src/resources/banks.ts +1536 -0
  222. package/src/resources/capabilities.ts +291 -0
  223. package/src/resources/charges.ts +108 -0
  224. package/src/resources/checkoutsession.ts +9254 -0
  225. package/src/resources/customers.ts +60 -0
  226. package/src/resources/index.ts +75 -0
  227. package/src/resources/mandates.ts +135 -0
  228. package/src/resources/orders.ts +3195 -0
  229. package/src/resources/payouts.ts +297 -0
  230. package/src/resources/refunds.ts +184 -0
  231. package/src/resources/reports.ts +172 -0
  232. package/src/resources/subaccounts.ts +73 -0
  233. package/src/shims/node.ts +50 -0
  234. package/src/shims/web.ts +50 -0
  235. package/src/tsconfig.json +11 -0
  236. package/src/uploads.ts +255 -0
  237. package/src/version.ts +1 -0
  238. package/uploads.d.ts +75 -0
  239. package/uploads.d.ts.map +1 -0
  240. package/uploads.js +171 -0
  241. package/uploads.js.map +1 -0
  242. package/uploads.mjs +158 -0
  243. package/uploads.mjs.map +1 -0
  244. package/version.d.ts +2 -0
  245. package/version.d.ts.map +1 -0
  246. package/version.js +5 -0
  247. package/version.js.map +1 -0
  248. package/version.mjs +2 -0
  249. package/version.mjs.map +1 -0
@@ -0,0 +1,297 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../resource';
4
+ import * as Core from '../core';
5
+
6
+ export class Payouts extends APIResource {
7
+ /**
8
+ * Create a Customer Payout to a customer's bank account for withdrawals or similar
9
+ * purposes.
10
+ */
11
+ create(body: PayoutCreateParams, options?: Core.RequestOptions): Core.APIPromise<PublicUserPayout> {
12
+ return this._client.post('/api/service/payout/create', { body, ...options });
13
+ }
14
+
15
+ /**
16
+ * Retrieve a Customer Payout by id
17
+ */
18
+ retrieve(body: PayoutRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<PublicUserPayout> {
19
+ return this._client.post('/api/service/payout/retrieve', { body, ...options });
20
+ }
21
+
22
+ /**
23
+ * List all Customer Payouts made by this merchant account.
24
+ */
25
+ list(body: PayoutListParams, options?: Core.RequestOptions): Core.APIPromise<PayoutListResponse> {
26
+ return this._client.post('/api/service/payout/list', { body, ...options });
27
+ }
28
+ }
29
+
30
+ export interface PublicUserPayout {
31
+ id: string;
32
+
33
+ amount: number;
34
+
35
+ currency: 'EUR' | 'GBP' | 'PLN';
36
+
37
+ /**
38
+ * The validation logic is based on the "type" field. For example, if "type" is set
39
+ * to "iban", the "iban" object must be filled out.
40
+ */
41
+ destination: PublicUserPayout.Destination;
42
+
43
+ status: 'paid' | 'pending' | 'failed';
44
+
45
+ createdAt?: string;
46
+
47
+ /**
48
+ * Any key-value pairs, which will be stored to the object. See
49
+ * [here](https://docs.getivy.de/reference/metadata) for more info.
50
+ */
51
+ metadata?: Record<string, unknown>;
52
+
53
+ updatedAt?: string;
54
+ }
55
+
56
+ export namespace PublicUserPayout {
57
+ /**
58
+ * The validation logic is based on the "type" field. For example, if "type" is set
59
+ * to "iban", the "iban" object must be filled out.
60
+ */
61
+ export interface Destination {
62
+ /**
63
+ * The type of the financial address. The actual destination is determined by this
64
+ * field which can be either "iban", "sortCode", "bankCode", or "bban". The
65
+ * validation will fail if you set e.g. type="iban", but then not fill any values
66
+ * in the "iban" object.
67
+ *
68
+ * - iban: The IBAN of the account
69
+ * - sort_code: The sort code of the account
70
+ * - bank_code: The bank code of the account
71
+ * - bban: The BBAN of the account
72
+ */
73
+ type: string;
74
+
75
+ bankCode?: Destination.BankCode;
76
+
77
+ bban?: Destination.Bban;
78
+
79
+ iban?: Destination.Iban;
80
+
81
+ sortCode?: Destination.SortCode;
82
+ }
83
+
84
+ export namespace Destination {
85
+ export interface BankCode {
86
+ /**
87
+ * The name of the account holder.
88
+ */
89
+ accountHolderName: string;
90
+
91
+ accountNumber: string;
92
+
93
+ code: string;
94
+ }
95
+
96
+ export interface Bban {
97
+ /**
98
+ * The name of the account holder.
99
+ */
100
+ accountHolderName: string;
101
+
102
+ bban: string;
103
+
104
+ bic?: string;
105
+ }
106
+
107
+ export interface Iban {
108
+ /**
109
+ * The name of the account holder.
110
+ */
111
+ accountHolderName: string;
112
+
113
+ iban: string;
114
+
115
+ bic?: string;
116
+ }
117
+
118
+ export interface SortCode {
119
+ /**
120
+ * The name of the account holder.
121
+ */
122
+ accountHolderName: string;
123
+
124
+ accountNumber: string;
125
+
126
+ sortCode: string;
127
+ }
128
+ }
129
+ }
130
+
131
+ export interface PayoutListResponse {
132
+ /**
133
+ * The total number of items
134
+ */
135
+ count: number;
136
+
137
+ /**
138
+ * Whether there are more items to retrieve
139
+ */
140
+ hasNext: boolean;
141
+
142
+ items: Array<PublicUserPayout>;
143
+
144
+ /**
145
+ * The number of items skipped
146
+ */
147
+ skip: number;
148
+ }
149
+
150
+ export interface PayoutCreateParams {
151
+ /**
152
+ * The amount of the customer payout
153
+ */
154
+ amount: number;
155
+
156
+ /**
157
+ * The currency of the customer payout
158
+ */
159
+ currency: 'EUR' | 'GBP' | 'PLN';
160
+
161
+ /**
162
+ * The destination of the customer payout.
163
+ */
164
+ destination: PayoutCreateParams.Destination;
165
+
166
+ /**
167
+ * The metadata of the customer payout
168
+ */
169
+ metadata?: Record<string, unknown>;
170
+
171
+ /**
172
+ * The payment reference of the customer payout. The customer will see this
173
+ * reference in their bank statement.
174
+ */
175
+ paymentReference?: string;
176
+ }
177
+
178
+ export namespace PayoutCreateParams {
179
+ /**
180
+ * The destination of the customer payout.
181
+ */
182
+ export interface Destination {
183
+ /**
184
+ * Used for open-loop customer payouts. Disabled by default for merchants.
185
+ */
186
+ financialAddress?: Destination.FinancialAddress;
187
+
188
+ /**
189
+ * For closed-loop customer payouts. The destination account will be taken from the
190
+ * payer of this order.
191
+ */
192
+ orderId?: string;
193
+ }
194
+
195
+ export namespace Destination {
196
+ /**
197
+ * Used for open-loop customer payouts. Disabled by default for merchants.
198
+ */
199
+ export interface FinancialAddress {
200
+ /**
201
+ * The type of the financial address. The actual destination is determined by this
202
+ * field which can be either "iban", "sortCode", "bankCode", or "bban". The
203
+ * validation will fail if you set e.g. type="iban", but then not fill any values
204
+ * in the "iban" object.
205
+ *
206
+ * - iban: The IBAN of the account
207
+ * - sort_code: The sort code of the account
208
+ * - bank_code: The bank code of the account
209
+ * - bban: The BBAN of the account
210
+ */
211
+ type: string;
212
+
213
+ bankCode?: FinancialAddress.BankCode;
214
+
215
+ bban?: FinancialAddress.Bban;
216
+
217
+ iban?: FinancialAddress.Iban;
218
+
219
+ sortCode?: FinancialAddress.SortCode;
220
+ }
221
+
222
+ export namespace FinancialAddress {
223
+ export interface BankCode {
224
+ /**
225
+ * The name of the account holder.
226
+ */
227
+ accountHolderName: string;
228
+
229
+ accountNumber: string;
230
+
231
+ code: string;
232
+ }
233
+
234
+ export interface Bban {
235
+ /**
236
+ * The name of the account holder.
237
+ */
238
+ accountHolderName: string;
239
+
240
+ bban: string;
241
+
242
+ bic?: string;
243
+ }
244
+
245
+ export interface Iban {
246
+ /**
247
+ * The name of the account holder.
248
+ */
249
+ accountHolderName: string;
250
+
251
+ iban: string;
252
+
253
+ bic?: string;
254
+ }
255
+
256
+ export interface SortCode {
257
+ /**
258
+ * The name of the account holder.
259
+ */
260
+ accountHolderName: string;
261
+
262
+ accountNumber: string;
263
+
264
+ sortCode: string;
265
+ }
266
+ }
267
+ }
268
+ }
269
+
270
+ export interface PayoutRetrieveParams {
271
+ /**
272
+ * The unique identifier of the Customer Payout
273
+ */
274
+ id: string;
275
+ }
276
+
277
+ export interface PayoutListParams {
278
+ /**
279
+ * The number of items to retrieve
280
+ */
281
+ limit?: number;
282
+
283
+ /**
284
+ * The number of items to skip
285
+ */
286
+ skip?: number;
287
+ }
288
+
289
+ export declare namespace Payouts {
290
+ export {
291
+ type PublicUserPayout as PublicUserPayout,
292
+ type PayoutListResponse as PayoutListResponse,
293
+ type PayoutCreateParams as PayoutCreateParams,
294
+ type PayoutRetrieveParams as PayoutRetrieveParams,
295
+ type PayoutListParams as PayoutListParams,
296
+ };
297
+ }
@@ -0,0 +1,184 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../resource';
4
+ import * as Core from '../core';
5
+ import * as RefundsAPI from './refunds';
6
+
7
+ export class Refunds extends APIResource {
8
+ /**
9
+ * Initiates a refund for the specified order. The order can be specified either by
10
+ * Ivy\'s internal `orderId` or by the `referenceId` provided by the merchant
11
+ * during checkout creation. If the refund should only be partial, you can specifiy
12
+ * this with the `amount` parameter.
13
+ */
14
+ create(body: RefundCreateParams, options?: Core.RequestOptions): Core.APIPromise<RefundResponse> {
15
+ return this._client.post('/api/service/merchant/payment/refund', { body, ...options });
16
+ }
17
+
18
+ /**
19
+ * Initiates a batch refund for all provided orders. The orders can be specified
20
+ * either by Ivy\'s internal id ("orderId") or by id provided by the merchant
21
+ * ("referenceId"). If only a partial amount should be refunded the desired amount
22
+ * can be set with the "amount" parameter. Additional information regarding the
23
+ * refund can be provided through the "description" parameter.
24
+ */
25
+ batch(body: RefundBatchParams, options?: Core.RequestOptions): Core.APIPromise<RefundBatchResponse> {
26
+ return this._client.post('/api/service/merchant/payment/refund/batch', { body, ...options });
27
+ }
28
+ }
29
+
30
+ export interface RefundResponse {
31
+ /**
32
+ * The internal Ivy id of the order.
33
+ */
34
+ orderId: string;
35
+
36
+ /**
37
+ * The order status. This status symbolises the state of the user's payment
38
+ * attempt. See [the guide](https://docs.getivy.de/docs/payment-status) for more
39
+ * information.
40
+ */
41
+ orderStatus:
42
+ | 'failed'
43
+ | 'canceled'
44
+ | 'processing'
45
+ | 'in_handshake'
46
+ | 'waiting_for_payment'
47
+ | 'paid'
48
+ | 'in_refund'
49
+ | 'refunded'
50
+ | 'refund_failed'
51
+ | 'partially_refunded'
52
+ | 'in_dispute'
53
+ | 'disputed'
54
+ | 'refused';
55
+
56
+ /**
57
+ * A unique identifier for the newly created refund. You can use this id to
58
+ * retrieve the refund from the order object.
59
+ */
60
+ referenceId: string;
61
+
62
+ /**
63
+ * The status of the refund. Always use the status of the order as your source of
64
+ * truth to trigger actions in your dashboard.
65
+ */
66
+ refundStatus: 'pending' | 'succeeded' | 'failed' | 'requires_action' | 'partially_refunded';
67
+ }
68
+
69
+ export interface RefundBatchResponse {
70
+ /**
71
+ * An array of refund responses.
72
+ */
73
+ requestedRefunds: Array<RefundBatchResponse.RequestedRefund>;
74
+ }
75
+
76
+ export namespace RefundBatchResponse {
77
+ export interface RequestedRefund extends RefundsAPI.RefundResponse {
78
+ /**
79
+ * The Ivy id of the corresponding order.
80
+ */
81
+ orderId: string;
82
+
83
+ /**
84
+ * The error message why the refund failed.
85
+ */
86
+ error?: string;
87
+ }
88
+ }
89
+
90
+ export interface RefundCreateParams {
91
+ /**
92
+ * The amount to refund in decimals, e.g. 10.23 for EUR 10.23. If not specified,
93
+ * the full order amount will be refunded.
94
+ */
95
+ amount?: number;
96
+
97
+ /**
98
+ * A description for the refund. This will be retrievable in the API and in the Ivy
99
+ * dashboard.
100
+ */
101
+ description?: string;
102
+
103
+ /**
104
+ * An optional custom text that will be shown on the customer's payment reference.
105
+ * Input has to be maximum 16 alpha-numeric characters. If not provided, a default
106
+ * Ivy refund referenceId will be shown.
107
+ */
108
+ displayedPaymentReference?: string;
109
+
110
+ /**
111
+ * The email of the customer. If provided, Ivy may use this email to contact the
112
+ * customer directly in case of issues or need for clarification regarding the
113
+ * refund. If not provided, Ivy will contact the merchant in such cases. However,
114
+ * this is a rare occurrence.
115
+ */
116
+ email?: string;
117
+
118
+ /**
119
+ * The internal Ivy id of the order.
120
+ */
121
+ orderId?: string;
122
+
123
+ /**
124
+ * The external id set by the merchant during checkout creation.
125
+ */
126
+ referenceId?: string;
127
+ }
128
+
129
+ export interface RefundBatchParams {
130
+ /**
131
+ * An array of refunds to be triggered.
132
+ */
133
+ requestedRefunds: Array<RefundBatchParams.RequestedRefund>;
134
+ }
135
+
136
+ export namespace RefundBatchParams {
137
+ export interface RequestedRefund {
138
+ /**
139
+ * The amount to refund in decimals, e.g. 10.23 for EUR 10.23. If not specified,
140
+ * the full order amount will be refunded.
141
+ */
142
+ amount?: number;
143
+
144
+ /**
145
+ * A description for the refund. This will be retrievable in the API and in the Ivy
146
+ * dashboard.
147
+ */
148
+ description?: string;
149
+
150
+ /**
151
+ * An optional custom text that will be shown on the customer's payment reference.
152
+ * Input has to be maximum 16 alpha-numeric characters. If not provided, a default
153
+ * Ivy refund referenceId will be shown.
154
+ */
155
+ displayedPaymentReference?: string;
156
+
157
+ /**
158
+ * The email of the customer. If provided, Ivy may use this email to contact the
159
+ * customer directly in case of issues or need for clarification regarding the
160
+ * refund. If not provided, Ivy will contact the merchant in such cases. However,
161
+ * this is a rare occurrence.
162
+ */
163
+ email?: string;
164
+
165
+ /**
166
+ * The internal Ivy id of the order.
167
+ */
168
+ orderId?: string;
169
+
170
+ /**
171
+ * The external id set by the merchant during checkout creation.
172
+ */
173
+ referenceId?: string;
174
+ }
175
+ }
176
+
177
+ export declare namespace Refunds {
178
+ export {
179
+ type RefundResponse as RefundResponse,
180
+ type RefundBatchResponse as RefundBatchResponse,
181
+ type RefundCreateParams as RefundCreateParams,
182
+ type RefundBatchParams as RefundBatchParams,
183
+ };
184
+ }
@@ -0,0 +1,172 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../resource';
4
+ import * as Core from '../core';
5
+
6
+ export class Reports extends APIResource {
7
+ /**
8
+ * Create a Payout Report for a given timerange. A Payout Report is generated
9
+ * async. Please follow [this guide](https://docs.getivy.de/docs/payout-report-1)
10
+ * to learn more in detail.
11
+ */
12
+ create(body: ReportCreateParams, options?: Core.RequestOptions): Core.APIPromise<ReportCreateResponse> {
13
+ return this._client.post('/api/service/merchant/payout/export/create', { body, ...options });
14
+ }
15
+
16
+ /**
17
+ * Retrieve the status of an existing Payout Report. Use this endpoint to poll for
18
+ * the status before downloading a Payout Report.
19
+ */
20
+ retrieve(
21
+ body: ReportRetrieveParams,
22
+ options?: Core.RequestOptions,
23
+ ): Core.APIPromise<ReportRetrieveResponse> {
24
+ return this._client.post('/api/service/merchant/payout/export/retrieve', { body, ...options });
25
+ }
26
+
27
+ /**
28
+ * Download the actual Payout Report once the creation succeeded with this
29
+ * endpoint.
30
+ */
31
+ download(body: ReportDownloadParams, options?: Core.RequestOptions): Core.APIPromise<PayoutReport> {
32
+ return this._client.post('/api/service/merchant/payout/export/download', { body, ...options });
33
+ }
34
+ }
35
+
36
+ export interface PayoutReport {
37
+ payouts: Array<PayoutReport.Payout>;
38
+ }
39
+
40
+ export namespace PayoutReport {
41
+ export interface Payout {
42
+ id: string;
43
+
44
+ amount: number;
45
+
46
+ availableAt: string;
47
+
48
+ merchantAppId: string;
49
+
50
+ transactions: Array<Payout.Transaction>;
51
+ }
52
+
53
+ export namespace Payout {
54
+ export interface Transaction {
55
+ currency: 'EUR' | 'GBP' | 'PLN';
56
+
57
+ fee: number;
58
+
59
+ gross: number;
60
+
61
+ net: number;
62
+
63
+ reportingCategory: string;
64
+
65
+ billingFullName?: string;
66
+
67
+ createdAt?: string;
68
+
69
+ description?: string;
70
+
71
+ displayId?: string;
72
+
73
+ orderId?: string;
74
+
75
+ referenceId?: string;
76
+
77
+ subaccountId?: string;
78
+
79
+ userMail?: string;
80
+ }
81
+ }
82
+ }
83
+
84
+ export interface ReportCreateResponse {
85
+ /**
86
+ * The unique identifier of the new Payout Report Object that was created.
87
+ */
88
+ id: string;
89
+
90
+ /**
91
+ * Status of the Payout Report creation. This will be `pending` when the run is
92
+ * initially created. As soon as the report is created, this will be set to
93
+ * `succeeded`. Rarely, we may encounter an error, at which point this will be set
94
+ * to `failed`. See [the guide](https://docs.getivy.de/docs/payout-report-1) to
95
+ * learn more.
96
+ */
97
+ status: string;
98
+
99
+ /**
100
+ * @deprecated
101
+ */
102
+ fileUrl?: string;
103
+ }
104
+
105
+ export interface ReportRetrieveResponse {
106
+ /**
107
+ * Status of this Payout Report creation. This will be `pending` when the run is
108
+ * initially created. When the run finishes, this will be set to `succeeded`.
109
+ * Rarely, we may encounter an error, at which point this will be set to `failed`.
110
+ */
111
+ status: string;
112
+
113
+ /**
114
+ * @deprecated
115
+ */
116
+ fileUrl?: string;
117
+ }
118
+
119
+ export interface ReportCreateParams {
120
+ /**
121
+ * Unix timestamp. The end of the timerange to create a Payout Report for.
122
+ */
123
+ intervalEnd: number;
124
+
125
+ /**
126
+ * Unix timestamp. The start of the timerange to create a Payout Report for.
127
+ */
128
+ intervalStart: number;
129
+
130
+ /**
131
+ * If provided, the report will be generated for this currency only. If not
132
+ * provided, the report will be generated for all currencies.
133
+ */
134
+ currency?: 'EUR' | 'GBP' | 'PLN';
135
+
136
+ /**
137
+ * Optional URL of a webhook. If provided, the report, once generated, will be sent
138
+ * there in JSON format.
139
+ */
140
+ webhookUrl?: string;
141
+ }
142
+
143
+ export interface ReportRetrieveParams {
144
+ /**
145
+ * The unique identifier of the Payout Report to retrieve.
146
+ */
147
+ reportId: string;
148
+ }
149
+
150
+ export interface ReportDownloadParams {
151
+ /**
152
+ * The unique identifier of the report you want to download. This was returned when
153
+ * creating a new Payout Report.
154
+ */
155
+ reportId: string;
156
+
157
+ /**
158
+ * The format in which you want to download the report. Default is csv.
159
+ */
160
+ format?: 'csv' | 'json' | 'datev';
161
+ }
162
+
163
+ export declare namespace Reports {
164
+ export {
165
+ type PayoutReport as PayoutReport,
166
+ type ReportCreateResponse as ReportCreateResponse,
167
+ type ReportRetrieveResponse as ReportRetrieveResponse,
168
+ type ReportCreateParams as ReportCreateParams,
169
+ type ReportRetrieveParams as ReportRetrieveParams,
170
+ type ReportDownloadParams as ReportDownloadParams,
171
+ };
172
+ }