@whop/sdk 0.0.15 → 0.0.16

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 (67) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/client.d.mts +7 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +7 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/courses.d.mts +33 -0
  12. package/resources/courses.d.mts.map +1 -1
  13. package/resources/courses.d.ts +33 -0
  14. package/resources/courses.d.ts.map +1 -1
  15. package/resources/index.d.mts +3 -2
  16. package/resources/index.d.mts.map +1 -1
  17. package/resources/index.d.ts +3 -2
  18. package/resources/index.d.ts.map +1 -1
  19. package/resources/index.js +3 -1
  20. package/resources/index.js.map +1 -1
  21. package/resources/index.mjs +1 -0
  22. package/resources/index.mjs.map +1 -1
  23. package/resources/payment-methods.d.mts +202 -54
  24. package/resources/payment-methods.d.mts.map +1 -1
  25. package/resources/payment-methods.d.ts +202 -54
  26. package/resources/payment-methods.d.ts.map +1 -1
  27. package/resources/payments.d.mts +55 -1
  28. package/resources/payments.d.mts.map +1 -1
  29. package/resources/payments.d.ts +55 -1
  30. package/resources/payments.d.ts.map +1 -1
  31. package/resources/payments.js +23 -0
  32. package/resources/payments.js.map +1 -1
  33. package/resources/payments.mjs +23 -0
  34. package/resources/payments.mjs.map +1 -1
  35. package/resources/payout-methods.d.mts +78 -0
  36. package/resources/payout-methods.d.mts.map +1 -0
  37. package/resources/payout-methods.d.ts +78 -0
  38. package/resources/payout-methods.d.ts.map +1 -0
  39. package/resources/payout-methods.js +23 -0
  40. package/resources/payout-methods.js.map +1 -0
  41. package/resources/payout-methods.mjs +19 -0
  42. package/resources/payout-methods.mjs.map +1 -0
  43. package/resources/shared.d.mts +30 -0
  44. package/resources/shared.d.mts.map +1 -1
  45. package/resources/shared.d.ts +30 -0
  46. package/resources/shared.d.ts.map +1 -1
  47. package/resources/withdrawals.d.mts +170 -1
  48. package/resources/withdrawals.d.mts.map +1 -1
  49. package/resources/withdrawals.d.ts +170 -1
  50. package/resources/withdrawals.d.ts.map +1 -1
  51. package/resources/withdrawals.js +38 -0
  52. package/resources/withdrawals.js.map +1 -1
  53. package/resources/withdrawals.mjs +38 -0
  54. package/resources/withdrawals.mjs.map +1 -1
  55. package/src/client.ts +25 -0
  56. package/src/resources/courses.ts +38 -0
  57. package/src/resources/index.ts +11 -0
  58. package/src/resources/payment-methods.ts +236 -54
  59. package/src/resources/payments.ts +105 -0
  60. package/src/resources/payout-methods.ts +105 -0
  61. package/src/resources/shared.ts +34 -0
  62. package/src/resources/withdrawals.ts +247 -0
  63. package/src/version.ts +1 -1
  64. package/version.d.mts +1 -1
  65. package/version.d.ts +1 -1
  66. package/version.js +1 -1
  67. package/version.mjs +1 -1
@@ -8,12 +8,41 @@ import { RequestOptions } from '../internal/request-options';
8
8
  import { path } from '../internal/utils/path';
9
9
 
10
10
  export class Withdrawals extends APIResource {
11
+ /**
12
+ * Creates a withdrawal request for a ledger account
13
+ *
14
+ * Required permissions:
15
+ *
16
+ * - `payout:withdraw_funds`
17
+ * - `payout:destination:read`
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const withdrawal = await client.withdrawals.create({
22
+ * amount: 6.9,
23
+ * company_id: 'biz_xxxxxxxxxxxxxx',
24
+ * currency: 'usd',
25
+ * });
26
+ * ```
27
+ */
28
+ create(body: WithdrawalCreateParams, options?: RequestOptions): APIPromise<WithdrawalCreateResponse> {
29
+ return this._client.post('/withdrawals', { body, ...options });
30
+ }
31
+
11
32
  /**
12
33
  * Retrieves a withdrawal by ID
13
34
  *
14
35
  * Required permissions:
15
36
  *
16
37
  * - `payout:withdrawal:read`
38
+ * - `payout:destination:read`
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const withdrawal = await client.withdrawals.retrieve(
43
+ * 'wdrl_xxxxxxxxxxxxx',
44
+ * );
45
+ * ```
17
46
  */
18
47
  retrieve(id: string, options?: RequestOptions): APIPromise<WithdrawalRetrieveResponse> {
19
48
  return this._client.get(path`/withdrawals/${id}`, options);
@@ -25,6 +54,16 @@ export class Withdrawals extends APIResource {
25
54
  * Required permissions:
26
55
  *
27
56
  * - `payout:withdrawal:read`
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * // Automatically fetches more pages as needed.
61
+ * for await (const withdrawalListResponse of client.withdrawals.list(
62
+ * { company_id: 'biz_xxxxxxxxxxxxxx' },
63
+ * )) {
64
+ * // ...
65
+ * }
66
+ * ```
28
67
  */
29
68
  list(
30
69
  query: WithdrawalListParams,
@@ -63,6 +102,190 @@ export type WithdrawalStatus =
63
102
  */
64
103
  export type WithdrawalTypes = 'regular' | 'clawback';
65
104
 
105
+ /**
106
+ * A withdrawal request.
107
+ */
108
+ export interface WithdrawalCreateResponse {
109
+ /**
110
+ * Internal ID of the withdrawal request.
111
+ */
112
+ id: string;
113
+
114
+ /**
115
+ * How much money was attempted to be withdrawn, in a float type.
116
+ */
117
+ amount: number;
118
+
119
+ /**
120
+ * When the withdrawal request was created.
121
+ */
122
+ created_at: string;
123
+
124
+ /**
125
+ * The currency of the withdrawal request.
126
+ */
127
+ currency: Shared.Currency;
128
+
129
+ /**
130
+ * The different error codes a payout can be in.
131
+ */
132
+ error_code:
133
+ | 'account_closed'
134
+ | 'account_does_not_exist'
135
+ | 'account_information_invalid'
136
+ | 'account_number_invalid_region'
137
+ | 'account_frozen'
138
+ | 'account_lookup_failed'
139
+ | 'account_not_found'
140
+ | 'amount_out_of_bounds'
141
+ | 'attributes_not_validated'
142
+ | 'b2b_payments_prohibited'
143
+ | 'bank_statement_required'
144
+ | 'compliance_review'
145
+ | 'currency_not_supported'
146
+ | 'deposit_canceled'
147
+ | 'deposit_failed'
148
+ | 'deposit_rejected'
149
+ | 'destination_unavailable'
150
+ | 'exceeded_account_limit'
151
+ | 'expired_quote'
152
+ | 'generic_payout_error'
153
+ | 'technical_problem'
154
+ | 'identification_number_invalid'
155
+ | 'invalid_account_number'
156
+ | 'invalid_bank_code'
157
+ | 'invalid_beneficiary'
158
+ | 'invalid_branch_number'
159
+ | 'invalid_branch_code'
160
+ | 'invalid_phone_number'
161
+ | 'invalid_routing_number'
162
+ | 'invalid_swift_code'
163
+ | 'invalid_company_details'
164
+ | 'manual_cancelation'
165
+ | 'misc_error'
166
+ | 'missing_city_and_country'
167
+ | 'missing_phone_number'
168
+ | 'missing_remittance_info'
169
+ | 'payee_name_invalid'
170
+ | 'receiving_account_locked'
171
+ | 'rejected_by_compliance'
172
+ | 'rtp_not_supported'
173
+ | 'non_transaction_account'
174
+ | 'source_token_insufficient_funds'
175
+ | 'ssn_invalid'
176
+ | 'wallet_screenshot_required'
177
+ | 'unsupported_region'
178
+ | null;
179
+
180
+ /**
181
+ * The error message for the withdrawal, if any.
182
+ */
183
+ error_message: string | null;
184
+
185
+ /**
186
+ * The estimated availability date for the withdrawal, if any.
187
+ */
188
+ estimated_availability: string | null;
189
+
190
+ /**
191
+ * The fee amount that was charged for the withdrawal. This is in the same currency
192
+ * as the withdrawal amount.
193
+ */
194
+ fee_amount: number;
195
+
196
+ /**
197
+ * The different fee types for a withdrawal.
198
+ */
199
+ fee_type: WithdrawalFeeTypes | null;
200
+
201
+ /**
202
+ * The ledger account associated with the withdrawal.
203
+ */
204
+ ledger_account: WithdrawalCreateResponse.LedgerAccount;
205
+
206
+ /**
207
+ * The markup fee that was charged for the withdrawal. This is in the same currency
208
+ * as the withdrawal amount. This only applies to platform accounts using Whop
209
+ * Rails.
210
+ */
211
+ markup_fee: number;
212
+
213
+ /**
214
+ * The payout token used for the withdrawal, if applicable.
215
+ */
216
+ payout_token: WithdrawalCreateResponse.PayoutToken | null;
217
+
218
+ /**
219
+ * The speed of the withdrawal.
220
+ */
221
+ speed: WithdrawalSpeeds;
222
+
223
+ /**
224
+ * Status of the withdrawal.
225
+ */
226
+ status: WithdrawalStatus;
227
+
228
+ /**
229
+ * The trace code for the payout, if applicable. Provided on ACH transactions when
230
+ * available.
231
+ */
232
+ trace_code: string | null;
233
+
234
+ /**
235
+ * The type of withdrawal.
236
+ */
237
+ withdrawal_type: WithdrawalTypes;
238
+ }
239
+
240
+ export namespace WithdrawalCreateResponse {
241
+ /**
242
+ * The ledger account associated with the withdrawal.
243
+ */
244
+ export interface LedgerAccount {
245
+ /**
246
+ * The ID of the LedgerAccount.
247
+ */
248
+ id: string;
249
+
250
+ /**
251
+ * The ID of the company associated with this ledger account.
252
+ */
253
+ company_id: string | null;
254
+ }
255
+
256
+ /**
257
+ * The payout token used for the withdrawal, if applicable.
258
+ */
259
+ export interface PayoutToken {
260
+ /**
261
+ * The ID of the payout token
262
+ */
263
+ id: string;
264
+
265
+ /**
266
+ * The date and time the payout token was created
267
+ */
268
+ created_at: string;
269
+
270
+ /**
271
+ * The currency code of the payout destination. This is the currency that payouts
272
+ * will be made in for this token.
273
+ */
274
+ destination_currency_code: string;
275
+
276
+ /**
277
+ * An optional nickname for the payout token to help the user identify it. This is
278
+ * not used by the provider and is only for the user's reference.
279
+ */
280
+ nickname: string | null;
281
+
282
+ /**
283
+ * The name of the payer associated with the payout token.
284
+ */
285
+ payer_name: string | null;
286
+ }
287
+ }
288
+
66
289
  /**
67
290
  * A withdrawal request.
68
291
  */
@@ -305,6 +528,28 @@ export interface WithdrawalListResponse {
305
528
  withdrawal_type: WithdrawalTypes;
306
529
  }
307
530
 
531
+ export interface WithdrawalCreateParams {
532
+ /**
533
+ * The amount to withdraw in the specified currency
534
+ */
535
+ amount: number;
536
+
537
+ /**
538
+ * The ID of the company to withdraw from.
539
+ */
540
+ company_id: string;
541
+
542
+ /**
543
+ * The currency that is being withdrawn.
544
+ */
545
+ currency: Shared.Currency;
546
+
547
+ /**
548
+ * The ID of the payout method to use for the withdrawal.
549
+ */
550
+ payout_method_id?: string | null;
551
+ }
552
+
308
553
  export interface WithdrawalListParams extends CursorPageParams {
309
554
  /**
310
555
  * The ID of the company to list withdrawals for
@@ -348,9 +593,11 @@ export declare namespace Withdrawals {
348
593
  type WithdrawalSpeeds as WithdrawalSpeeds,
349
594
  type WithdrawalStatus as WithdrawalStatus,
350
595
  type WithdrawalTypes as WithdrawalTypes,
596
+ type WithdrawalCreateResponse as WithdrawalCreateResponse,
351
597
  type WithdrawalRetrieveResponse as WithdrawalRetrieveResponse,
352
598
  type WithdrawalListResponse as WithdrawalListResponse,
353
599
  type WithdrawalListResponsesCursorPage as WithdrawalListResponsesCursorPage,
600
+ type WithdrawalCreateParams as WithdrawalCreateParams,
354
601
  type WithdrawalListParams as WithdrawalListParams,
355
602
  };
356
603
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.0.15'; // x-release-please-version
1
+ export const VERSION = '0.0.16'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.0.15";
1
+ export declare const VERSION = "0.0.16";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.0.15";
1
+ export declare const VERSION = "0.0.16";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.0.15'; // x-release-please-version
4
+ exports.VERSION = '0.0.16'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.0.15'; // x-release-please-version
1
+ export const VERSION = '0.0.16'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map