@gofynd/fdk-client-javascript 1.4.8 → 1.4.10-beta.1

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.
@@ -1,102 +1,5 @@
1
1
  const Joi = require("joi");
2
2
 
3
- /**
4
- * @typedef CompanyInfo
5
- * @property {string} [company_name] - Name of the company
6
- * @property {string} [gstin] - Goods and Services Tax Identification Number
7
- * @property {string} [address] - Main address of the company
8
- * @property {AddressDetails} [address_details]
9
- * @property {string} [pan] - Permanent Account Number of the company
10
- * @property {string} [phone] - Contact phone number for the company
11
- * @property {string} [email] - Contact email address for the company
12
- * @property {string} [cin] - Corporate Identification Number
13
- */
14
-
15
- /**
16
- * @typedef AddressDetails
17
- * @property {string} [address_line_1] - First line of the address
18
- * @property {string} [address_line_2] - Second line of the address (optional)
19
- * @property {string} [city] - Company city
20
- * @property {string} [pincode] - Company pincode
21
- * @property {string} [state] - Company state
22
- * @property {string} [country] - Company country
23
- */
24
-
25
- /**
26
- * @typedef InvoiceData
27
- * @property {InvoiceDetailsData} [invoice]
28
- * @property {InvoiceItems[]} [invoice_items]
29
- * @property {CompanyInfo} [shopsense_details]
30
- */
31
-
32
- /**
33
- * @typedef InvoiceDetailsData
34
- * @property {number} [attemp] - Number of attempts made to collect the invoice payment
35
- * @property {Object} [documents] - Documents associated with the invoice
36
- * @property {Object} [payment] - Payment details related to the invoice
37
- * @property {Period} [period]
38
- * @property {Client} [client]
39
- * @property {Object} [discount] - Discount applied to the invoice
40
- * @property {Object} [taxation] - Taxation applied to the invoice
41
- * @property {string} [_id] - Unique identifier for the invoice
42
- * @property {boolean} [auto_advance] - Indicates if the invoice will
43
- * automatically advance to the next stage of collection
44
- * @property {string} [collection_method] - Method of collection (e.g.,
45
- * charge_automatically, send_invoice)
46
- * @property {string} [subscriber_id] - Identifier for the subscriber associated
47
- * with the invoice
48
- * @property {string} [currency] - Currency in which the invoice is issued
49
- * @property {string} [invoice_url] - URL to view the invoice pdf
50
- * @property {string} [number] - Invoice number
51
- * @property {boolean} [paid] - Indicates if the invoice has been paid
52
- * @property {Object} [pg_data] - Payment gateway data related to the invoice
53
- * @property {string} [receipt_number] - Receipt number for the invoice payment
54
- * @property {string} [statement_descriptor] - Statement descriptor for the invoice
55
- * @property {string} [current_status] - Current status of the invoice (e.g., paid, open)
56
- * @property {StatusTrail[]} [status_trail] - Trail of status changes for the invoice
57
- * @property {number} [subtotal] - Subtotal amount of the invoice
58
- * @property {number} [total] - Total amount of the invoice
59
- * @property {number} [old_settlement] - Previous settlement amount (if any)
60
- * @property {number} [credit_balance] - Credit balance applied to the invoice
61
- * @property {string} [subscription] - Subscription associated with the invoice
62
- * @property {number} [attempt] - Number of attempts made to pay the invoice
63
- * @property {string} [next_action_time] - Timestamp for the next action on the invoice
64
- * @property {number} [credit_note_amount] - Amount of credit notes applied to the invoice
65
- * @property {string} [created_at] - Timestamp when the invoice was created
66
- * @property {string} [modified_at] - Timestamp when the invoice was last modified
67
- * @property {string} [invoice_type] - Type of invoice (e.g., subscription, extension)
68
- */
69
-
70
- /**
71
- * @typedef Client
72
- * @property {string} [name] - Name of the client
73
- * @property {string} [email] - Email address of the client
74
- * @property {string} [phone] - Phone number of the client
75
- * @property {string[]} [address_lines] - List of address lines for the client's address
76
- */
77
-
78
- /**
79
- * @typedef Period
80
- * @property {string} [start] - Start date of the period
81
- * @property {string} [end] - End date of the period
82
- */
83
-
84
- /**
85
- * @typedef StatusTrail
86
- * @property {string} [value] - The status value of the invoice at a particular
87
- * timestamp (e.g., open, paid, payment_due)
88
- * @property {string} [timestamp] - The date and time when the status was
89
- * recorded, in ISO 8601 format
90
- * @property {string} [_id] - Unique identifier for the status trail entry
91
- */
92
-
93
- /**
94
- * @typedef PaymentCollectRes
95
- * @property {string} [transaction_id] - Unique identifier for the transaction
96
- * @property {string} [current_status] - Current status of the payment
97
- * collection (e.g., pending, completed, failed)
98
- */
99
-
100
3
  /**
101
4
  * @typedef SubscriptionChargeRes
102
5
  * @property {string} [_id] - Unique identifier for the subscription charge
@@ -117,53 +20,57 @@ const Joi = require("joi");
117
20
  */
118
21
 
119
22
  /**
120
- * @typedef PostDowngradeRes
121
- * @property {boolean} [success]
122
- * @property {DowngradeRes} [data]
23
+ * @typedef ChargeDetails
24
+ * @property {string} [_id] - Unique identifier for the charge.
25
+ * @property {string} [entity_type] - The type of entity associated with the
26
+ * charge (e.g., 'extension', 'subscription').
27
+ * @property {string} [entity_id] - Unique identifier for the entity associated
28
+ * with the charge.
29
+ * @property {string} [name] - The name of the charge.
30
+ * @property {string} [term] - Description of the charge term.
31
+ * @property {string} [charge_type] - The type of charge (e.g., 'standalone',
32
+ * 'recurring').
33
+ * @property {string} [pricing_type] - The pricing model for the charge (e.g.,
34
+ * 'one_time', 'recurring').
35
+ * @property {EntityChargePrice} [price]
36
+ * @property {ChargeRecurring} [recurring]
37
+ * @property {string} [status] - Current status of the charge.
38
+ * @property {number} [capped_amount] - Maximum amount that can be charged, if applicable.
39
+ * @property {string} [activated_on] - Date and time when the charge was activated.
40
+ * @property {string} [cancelled_on] - Date and time when the charge was cancelled.
41
+ * @property {string} [billing_date] - Date and time when the charge was billed.
42
+ * @property {SubscriptionTrialPeriod} [current_period]
43
+ * @property {string} [modified_at] - Date and time when the charge details were
44
+ * last modified.
45
+ * @property {string} [created_at] - Date and time when the charge was created.
46
+ * @property {boolean} [is_test] - Indicates whether the charge is for testing purposes.
47
+ * @property {string} [company_id] - Company id.
48
+ * @property {Object} [meta] - Additional metadata associated with the charge.
49
+ * @property {number} [__v] - Internal version key for the charge record.
123
50
  */
124
51
 
125
52
  /**
126
- * @typedef DowngradeRes
127
- * @property {string} [_id] - Unique identifier for the downgrade request
128
- * @property {string} [status] - Current status of the downgrade request (e.g.,
129
- * pending, completed)
130
- * @property {string} [subscriber_id] - Unique identifier for the subscriber
131
- * making the downgrade request
132
- * @property {boolean} [activated] - Indicates if the downgrade has been activated
133
- * @property {string} [created_at] - Timestamp when the downgrade request was created
134
- * @property {string} [modified_at] - Timestamp when the downgrade request was
135
- * last modified
136
- * @property {string} [plan_id] - ID of the plan to which the subscriber is downgrading
137
- * @property {string} [reason] - Reason provided for the downgrade request
138
- * @property {string} [request_user_id] - ID of the user who initiated the
139
- * downgrade request
140
- * @property {string} [subscription_id] - ID of the subscription associated with
141
- * the downgrade request
53
+ * @typedef ResourceNotFound
54
+ * @property {string} [message] - Resource not found with {id}
55
+ * @property {Object} [code]
56
+ * @property {Object} [success]
142
57
  */
143
58
 
144
59
  /**
145
- * @typedef PaymentStatusData
146
- * @property {string} [_id] - Unique identifier for the payment status data
147
- * @property {string} [journey] - Payment journey status, such as 'forward' or 'backward'
148
- * @property {Object[]} [webhook_response] - List of responses received from
149
- * webhooks related to the payment
150
- * @property {string} [aggregator_status] - Status of the payment as provided by
151
- * the aggregator (e.g., succeeded, failed)
152
- * @property {string} [current_status] - Current status of the payment (e.g.,
153
- * paid, pending)
154
- * @property {string} [created_at] - Timestamp when the payment status data was created
155
- * @property {string} [modified_at] - Timestamp when the payment status data was
156
- * last modified
157
- * @property {number} [__v] - Version key for the payment status data (typically
158
- * used for versioning in databases)
159
- * @property {string} [aggregator_order_id] - Unique identifier for the order
160
- * provided by the payment aggregator
60
+ * @typedef CreateOneTimeCharge
61
+ * @property {string} [name] - The name of the one-time charge to be created.
62
+ * @property {OneTimeChargeItem} [charge]
63
+ * @property {boolean} [is_test] - Indicates whether the charge creation is for
64
+ * testing purposes.
65
+ * @property {string} [return_url] - URL to which the user will be redirected
66
+ * after creating the charge.
161
67
  */
162
68
 
163
69
  /**
164
- * @typedef PaymentStatusResponse
165
- * @property {string} [status] - The status of the payment.
166
- * @property {PaymentStatusData} [data]
70
+ * @typedef CreateOneTimeChargeResponse
71
+ * @property {Charge} [charge]
72
+ * @property {string} [confirm_url] - URL to which users are redirected to
73
+ * confirm or complete the payment or subscription process.
167
74
  */
168
75
 
169
76
  /**
@@ -172,86 +79,32 @@ const Joi = require("joi");
172
79
  */
173
80
 
174
81
  /**
175
- * @typedef ResourceNotFound
176
- * @property {string} [message] - Resource not found with {id}
177
- * @property {Object} [code]
178
- * @property {Object} [success]
179
- */
180
-
181
- /**
182
- * @typedef InternalServerError
183
- * @property {string} [message] - Internal server error
184
- * @property {string} [code] - Error code
185
- */
186
-
187
- /**
188
- * @typedef CheckValidityResponse
189
- * @property {boolean} [is_valid] - Indicates whether the request is valid.
190
- * @property {number} [discount_amount] - The amount of discount applicable.
191
- */
192
-
193
- /**
194
- * @typedef PlanRecurring
195
- * @property {string} [interval] - The interval at which the plan recurs.
196
- * @property {number} [interval_count]
82
+ * @typedef CreateSubscriptionCharge
83
+ * @property {string} name - The name of the charge.
84
+ * @property {number} [trial_days]
85
+ * @property {ChargeLineItem[]} line_items
86
+ * @property {boolean} [is_test] - Indicates whether the charge is for testing purposes.
87
+ * @property {string} return_url - The URL passed in request which extension
88
+ * expects in return.
197
89
  */
198
90
 
199
91
  /**
200
- * @typedef PlanMeta
201
- * @property {string} [seller_status] - Status of the seller associated with the plan.
202
- * @property {string} [company] - Name of the company offering the plan.
203
- * @property {string} [plan_platform_display_name] - Display name for platform slug.
204
- * @property {string[]} [tags] - Tags associated with the plan for
205
- * categorization or identification.
92
+ * @typedef CreateSubscriptionResponse
93
+ * @property {EntitySubscription} [subscription]
94
+ * @property {string} [confirm_url] - URL to which users are redirected to
95
+ * confirm or complete the payment or subscription process.
206
96
  */
207
97
 
208
98
  /**
209
- * @typedef CountryRes
210
- * @property {string} [name] - Name of the country.
211
- * @property {string} [code] - Country code.
99
+ * @typedef EntityChargePrice
100
+ * @property {number} [amount] - The amount for the price. The minimum value is 1.
101
+ * @property {string} [currency_code] - The currency code for the price
212
102
  */
213
103
 
214
104
  /**
215
- * @typedef Plan
216
- * @property {Object[]} [fee_components] - List of fee components associated
217
- * with the plan. Each component may be represented as a string or an object.
218
- * @property {PlanRecurring} [recurring]
219
- * @property {boolean} [is_trial_plan] - Indicates whether the plan is a trial plan.
220
- * @property {string} [plan_group] - Group or category of the plan.
221
- * @property {string[]} [tag_lines] - List of tag lines or descriptions
222
- * associated with the plan.
223
- * @property {string} [currency] - Currency code used for the plan's pricing.
224
- * @property {string} [approved_by] - Identifier of the user or system that
225
- * approved the plan.
226
- * @property {boolean} [is_active] - Indicates if the plan is currently active.
227
- * @property {boolean} [is_visible] - Indicates if the plan is visible to users.
228
- * @property {number} [trial_period] - Number of days for the trial period, if applicable.
229
- * @property {string[]} [addons] - List of add-ons available for the plan.
230
- * @property {string[]} [tags] - List of tags associated with the plan.
231
- * @property {string} [type] - Type of the plan (e.g., public, private).
232
- * @property {CountryRes} [country]
233
- * @property {string} [_id] - Unique identifier for the plan.
234
- * @property {string} [name] - Name of the plan.
235
- * @property {string} [description] - Description of the plan.
236
- * @property {number} [amount] - Amount to be charged for the plan.
237
- * @property {string} [product_suite_id] - Identifier of the product suite to
238
- * which the plan belongs.
239
- * @property {string} [created_at] - Timestamp when the plan was created.
240
- * @property {string} [modified_at] - Timestamp when the plan was last modified.
241
- * @property {Taxation} [taxation]
242
- * @property {OneTimeFees} [one_time_fees]
243
- * @property {CreditLine} [credit_line]
244
- * @property {string} [current_status] - Current status of the plan (e.g.,
245
- * active, inactive).
246
- * @property {string} [channel_type] - Type of channel where the plan is offered
247
- * (e.g., ecomm, retail).
248
- * @property {string[]} [company_ids] - List of company IDs associated with the
249
- * plan. Can be null.
250
- * @property {string} [platform] - Platform where the plan is available (e.g.,
251
- * web, mobile). Can be null.
252
- * @property {string} [activated_on] - Timestamp when the plan was activated.
253
- * @property {PlanMeta} [meta]
254
- * @property {string} [created_by] - Identifier of the user who created the plan.
105
+ * @typedef ChargeRecurring
106
+ * @property {string} [interval]
107
+ * @property {number} [interval_time]
255
108
  */
256
109
 
257
110
  /**
@@ -261,9 +114,8 @@ const Joi = require("joi");
261
114
  */
262
115
 
263
116
  /**
264
- * @typedef EntityChargePrice
265
- * @property {number} [amount] - The amount for the price. The minimum value is 1.
266
- * @property {string} [currency_code] - The currency code for the price
117
+ * @typedef Charge
118
+ * @property {OneTimeChargeEntity} [final_charge]
267
119
  */
268
120
 
269
121
  /**
@@ -280,49 +132,36 @@ const Joi = require("joi");
280
132
  */
281
133
 
282
134
  /**
283
- * @typedef CreateOneTimeCharge
284
- * @property {string} [name] - The name of the one-time charge to be created.
285
- * @property {OneTimeChargeItem} [charge]
286
- * @property {boolean} [is_test] - Indicates whether the charge creation is for
287
- * testing purposes.
288
- * @property {string} [return_url] - URL to which the user will be redirected
289
- * after creating the charge.
290
- */
291
-
292
- /**
293
- * @typedef ChargeRecurring
294
- * @property {string} [interval]
295
- * @property {number} [interval_time]
135
+ * @typedef ChargeLineItem
136
+ * @property {string} name - Its name of the extension plan.
137
+ * @property {string} term - It indicates how it will be charged.
138
+ * @property {string} pricing_type - It indicates the extension subscription
139
+ * will be auto renewed timely.
140
+ * @property {EntityChargePrice} price
141
+ * @property {EntityChargeRecurring} [recurring]
142
+ * @property {number} [capped_amount]
143
+ * @property {number} [trial_days]
144
+ * @property {boolean} [is_test]
145
+ * @property {Object} [metadata]
296
146
  */
297
147
 
298
148
  /**
299
- * @typedef ChargeDetails
300
- * @property {string} [_id] - Unique identifier for the charge.
301
- * @property {string} [entity_type] - The type of entity associated with the
302
- * charge (e.g., 'extension', 'subscription').
303
- * @property {string} [entity_id] - Unique identifier for the entity associated
304
- * with the charge.
305
- * @property {string} [name] - The name of the charge.
306
- * @property {string} [term] - Description of the charge term.
307
- * @property {string} [charge_type] - The type of charge (e.g., 'standalone',
308
- * 'recurring').
309
- * @property {string} [pricing_type] - The pricing model for the charge (e.g.,
310
- * 'one_time', 'recurring').
311
- * @property {EntityChargePrice} [price]
312
- * @property {ChargeRecurring} [recurring]
313
- * @property {string} [status] - Current status of the charge.
314
- * @property {number} [capped_amount] - Maximum amount that can be charged, if applicable.
315
- * @property {string} [activated_on] - Date and time when the charge was activated.
316
- * @property {string} [cancelled_on] - Date and time when the charge was cancelled.
317
- * @property {string} [billing_date] - Date and time when the charge was billed.
318
- * @property {SubscriptionTrialPeriod} [current_period]
319
- * @property {string} [modified_at] - Date and time when the charge details were
320
- * last modified.
321
- * @property {string} [created_at] - Date and time when the charge was created.
322
- * @property {boolean} [is_test] - Indicates whether the charge is for testing purposes.
323
- * @property {string} [company_id] - Company id.
324
- * @property {Object} [meta] - Additional metadata associated with the charge.
325
- * @property {number} [__v] - Internal version key for the charge record.
149
+ * @typedef EntitySubscription
150
+ * @property {string} [_id] - Unique identifier for the subscription charge
151
+ * @property {string} [product_suit_id] - ID of the product suit associated with
152
+ * the charge
153
+ * @property {string} [entity_id] - Unique identifier for the entity
154
+ * @property {string} [entity_type] - Type of entity (e.g., subscription, extension)
155
+ * @property {string} [name] - Name of the subscription charge
156
+ * @property {string} [status] - Current status of the subscription charge
157
+ * @property {number} [trial_days] - Number of trial days provided
158
+ * @property {boolean} [is_test] - Indicates if the charge is for testing purposes
159
+ * @property {string} [created_at] - Timestamp when the charge was created
160
+ * @property {string} [modified_at] - Timestamp when the charge was last modified
161
+ * @property {string} [subscriber_id] - Unique Identifier of the company
162
+ * @property {EntityChargeDetails[]} [line_items]
163
+ * @property {string} [return_url] - The URL passed in request which extension
164
+ * expects in return.
326
165
  */
327
166
 
328
167
  /**
@@ -361,2463 +200,248 @@ const Joi = require("joi");
361
200
  */
362
201
 
363
202
  /**
364
- * @typedef CreateOneTimeChargeResponse
365
- * @property {Charge} [charge]
366
- * @property {string} [confirm_url] - URL to which users are redirected to
367
- * confirm or complete the payment or subscription process.
368
- */
369
-
370
- /**
371
- * @typedef Charge
372
- * @property {OneTimeChargeEntity} [final_charge]
373
- */
374
-
375
- /**
376
- * @typedef InvoiceDetailsStatusTrail
377
- * @property {string} [_id] - Unique identifier for the status trail entry.
378
- * @property {string} [value] - The status value of the invoice at a particular
379
- * point in time.
380
- * @property {string} [timestamp] - The date and time when this status was recorded.
381
- */
382
-
383
- /**
384
- * @typedef InvoiceItemsPlanRecurring
385
- * @property {string} [interval] - The interval at which the plan recurs (e.g.,
386
- * month, year).
387
- * @property {number} [interval_count] - The number of intervals for the recurring plan.
388
- */
389
-
390
- /**
391
- * @typedef InvoiceItemsPlan
392
- * @property {InvoiceItemsPlanRecurring} [recurring]
393
- * @property {boolean} [is_trial_plan] - Indicates whether the plan is a trial plan.
394
- * @property {string} [plan_group] - Group or category to which the plan belongs.
395
- * @property {string[]} [tag_lines] - List of tag lines or short descriptions
396
- * for the plan.
397
- * @property {string} [currency] - Currency code for the pricing of the plan.
398
- * @property {boolean} [is_active] - Indicates whether the plan is currently active.
399
- * @property {boolean} [is_visible] - Indicates whether the plan is visible to users.
400
- * @property {number} [trial_period] - The number of days for the trial period.
401
- * @property {string[]} [addons] - List of add-ons available with the plan.
402
- * @property {string[]} [tags] - Tags associated with the plan for categorization.
403
- * @property {string} [type] - Type of the plan (e.g., public, private).
404
- * @property {string} [country] - Country for which plan is created
405
- * @property {string} [_id] - Unique identifier for the plan.
406
- * @property {string} [name] - Name of the plan.
407
- * @property {string} [description] - Detailed description of the plan.
408
- * @property {number} [amount] - Price of the plan in the specified currency.
409
- * @property {string} [product_suite_id] - Identifier for the product suite to
410
- * which the plan belongs.
411
- * @property {string} [created_at] - Timestamp when the plan was created.
412
- * @property {string} [modified_at] - Timestamp when the plan was last modified.
413
- */
414
-
415
- /**
416
- * @typedef InvoiceItemsPeriod
417
- * @property {string} [start] - Start date of the invoice period.
418
- * @property {string} [end] - End date of the invoice period.
419
- */
420
-
421
- /**
422
- * @typedef InvoiceItems
423
- * @property {string} [_id] - Unique identifier for the invoice item.
424
- * @property {string} [currency] - Currency for the amount.
425
- * @property {InvoiceItemsPlan} [plan]
426
- * @property {string} [name] - Name of the invoice item.
427
- * @property {number} [quantity] - Number of units of the invoice item.
428
- * @property {string} [description] - Description of the invoice item.
429
- * @property {InvoiceItemsPeriod} [period]
430
- * @property {number} [unit_amount] - Amount per unit of the invoice item.
431
- * @property {number} [amount] - Total amount for the invoice item.
432
- * @property {string} [type] - Type of the invoice item (e.g., subscription, extension).
433
- * @property {string} [invoice_id] - Identifier for the invoice to which the item belongs.
434
- * @property {string} [created_at] - Timestamp when the invoice item was created.
435
- * @property {string} [modified_at] - Timestamp when the invoice item was last modified.
436
- */
437
-
438
- /**
439
- * @typedef InvoicesDataClient
440
- * @property {string} [name] - Name of the client.
441
- * @property {string} [email] - Email address of the client.
442
- * @property {string} [phone] - Phone number of the client.
443
- * @property {string[]} [address_lines] - Array of address lines for the client’s address.
444
- */
445
-
446
- /**
447
- * @typedef InvoicesDataPeriod
448
- * @property {string} [start] - The start date and time of the invoice period.
449
- * @property {string} [end] - The end date and time of the invoice period.
450
- */
451
-
452
- /**
453
- * @typedef InvoicesDataPaymentMethod
454
- * @property {string} [pg_payment_method_id] - Payment gateway-specific payment
455
- * method identifier. Nullable if not applicable.
456
- */
457
-
458
- /**
459
- * @typedef InvoicesData
460
- * @property {string} [_id] - Unique identifier for the invoice.
461
- * @property {Object} [documents] - Associated documents related to the invoice.
462
- * @property {Object} [payment] - Payment details for the invoice.
463
- * @property {number} [old_settlement] - Previous settlement amount, if applicable.
464
- * @property {number} [credit_balance] - Remaining credit balance applied to the
465
- * invoice, if any.
466
- * @property {Object} [discount] - Details of any discounts applied to the invoice.
467
- * @property {Object} [taxation] - Taxation details associated with the invoice.
468
- * @property {number} [credit_note_amount] - Amount covered by credit notes, if any.
469
- * @property {InvoicesDataClient} [client]
470
- * @property {boolean} [auto_advance] - Indicates if the invoice should be
471
- * auto-advanced in the billing process.
472
- * @property {string} [currency] - Currency code used for the invoice amount.
473
- * @property {boolean} [paid] - Indicates if the invoice has been paid.
474
- * @property {number} [attemp] - Number of payment attempts made for the invoice.
475
- * @property {string} [collection_method] - Method used to collect payment for
476
- * the invoice.
477
- * @property {string} [subscriber_id] - Identifier for the subscriber associated
478
- * with the invoice.
479
- * @property {string} [invoice_url] - URL to view or download the invoice.
480
- * "null" if not available.
481
- * @property {string} [number] - Unique invoice number.
482
- * @property {Object} [pg_data] - Payment gateway-related data for the invoice.
483
- * @property {InvoicesDataPeriod} [period]
484
- * @property {string} [receipt_number] - Receipt number for the invoice payment.
485
- * @property {string} [statement_descriptor] - Descriptor that appears on the
486
- * client's statement for the invoice.
487
- * @property {string} [current_status] - Current status of the invoice (e.g.,
488
- * paid, pending).
489
- * @property {InvoiceDetailsStatusTrail[]} [status_trail] - History of status
490
- * changes for the invoice.
491
- * @property {number} [subtotal] - Subtotal amount before taxes and discounts.
492
- * @property {number} [total] - Total amount including taxes and discounts.
493
- * @property {string} [subscription] - Identifier for the subscription
494
- * associated with the invoice.
495
- * @property {string} [next_action_time] - Scheduled time for the next action
496
- * related to the invoice.
497
- * @property {string} [created_at] - Timestamp when the invoice was created.
498
- * @property {string} [modified_at] - Timestamp when the invoice was last modified.
499
- * @property {string} [hash_identifier] - Unique hash identifier for the invoice.
500
- * @property {InvoicesDataPaymentMethod} [payment_method]
501
- * @property {InvoiceItems[]} [invoice_items] - List of items included in the invoice.
502
- * @property {string} [invoice_type] - Type of invoice (e.g., extension, subscription).
503
- */
504
-
505
- /**
506
- * @typedef Invoices
507
- * @property {InvoicesData[]} [data]
508
- * @property {number} [start] - Index of the first item in the results.
509
- * @property {number} [end] - Index of the last item in the results.
510
- * @property {number} [limit] - Number of items per page.
511
- * @property {number} [page] - Page number of the results.
512
- * @property {number} [total] - Total number of items available.
513
- */
514
-
515
- /**
516
- * @typedef Phone
517
- * @property {string} [phone_number] - The phone number of the contact.
518
- * @property {string} [phone_country_code] - The country code of the phone number.
519
- */
520
-
521
- /**
522
- * @typedef SubscriptionBillingAddress
523
- * @property {string} [country] - Name of the country for the billing address.
524
- * @property {string} [country_code] - ISO country code for the billing address.
525
- * @property {string} [state] - State or province for the billing address.
526
- * @property {string} [city] - City for the billing address.
527
- * @property {string} [line1] - First line of the street address.
528
- * @property {string} [line2] - Second line of the street address (optional).
529
- * @property {string} [postal_code] - Postal or ZIP code for the billing address.
203
+ * @typedef EntityChargeRecurring
204
+ * @property {string} interval - The interval of the subscription.
530
205
  */
531
206
 
532
207
  /**
533
- * @typedef SubscriptionCustomer
534
- * @property {Phone} [phone]
535
- * @property {SubscriptionBillingAddress} [billing_address]
536
- * @property {string} [_id] - Unique identifier for the subscriber.
537
- * @property {string} [unique_id] - Identifier specific to the company.
538
- * @property {string} [type] - Type of the customer (e.g., developer, company).
539
- * @property {string} [name] - Name of the customer.
540
- * @property {string} [email] - Email address of the customer.
541
- * @property {string} [created_at] - Timestamp when the customer record was created.
542
- * @property {string} [modified_at] - Timestamp when the customer record was
208
+ * @typedef EntityChargeDetails
209
+ * @property {string} [_id] - Unique identifier for the charge.
210
+ * @property {string} [subscription_id] - Unique identifier of the extension subscription.
211
+ * @property {string} [subscriber_id] - Unique identifier of the
212
+ * subscriber/company who installed extension subscription.
213
+ * @property {string} [entity_type] - The type of entity associated with the
214
+ * charge (e.g., 'extension', 'subscription').
215
+ * @property {string} [entity_id] - Unique identifier for the entity associated
216
+ * with the charge.
217
+ * @property {string} [name] - The name of the charge.
218
+ * @property {string} [term] - Description of the charge term.
219
+ * @property {string} [charge_type] - The type of charge (e.g., 'standalone',
220
+ * 'recurring').
221
+ * @property {string} [pricing_type] - The pricing model for the charge (e.g.,
222
+ * 'one_time', 'recurring').
223
+ * @property {EntityChargePrice} [price]
224
+ * @property {ChargeRecurring} [recurring]
225
+ * @property {string} [status] - Current status of the charge.
226
+ * @property {number} [capped_amount] - Maximum amount that can be charged, if applicable.
227
+ * @property {string} [activated_on] - Date and time when the charge was activated.
228
+ * @property {string} [cancelled_on] - Date and time when the charge was cancelled.
229
+ * @property {string} [billing_date] - Date and time when the charge was billed.
230
+ * @property {SubscriptionTrialPeriod} [current_period]
231
+ * @property {string} [modified_at] - Date and time when the charge details were
543
232
  * last modified.
544
- * @property {Object} [data] - Additional data related to the customer.
545
- * @property {Object} [documents] - Associated documents related to the customer.
546
- * @property {boolean} [consent] - Indicates whether the customer has given consent.
547
- * @property {boolean} [comms] - Indicates whether the customer has opted in for
548
- * communications.
549
- * @property {number} [credit_balance] - Current credit balance for the customer, if any.
550
- * @property {BusinessCountryInfo} [business_country_info]
551
- */
552
-
553
- /**
554
- * @typedef SubscriptionCustomerCreate
555
- * @property {Phone} [phone]
556
- * @property {SubscriptionBillingAddress} [billing_address]
557
- * @property {string} [unique_id] - Company id for the customer, generated by the client.
558
- * @property {string} [type] - Type of company
559
- * @property {string} [name] - Name of the company
560
- * @property {string} [email] - Email address of the company
561
- */
562
-
563
- /**
564
- * @typedef SubscriptionCurrentPeriod
565
- * @property {string} [start] - The start date and time of the current
566
- * subscription period.
567
- * @property {string} [end] - The end date and time of the current subscription period.
568
- */
569
-
570
- /**
571
- * @typedef SubscriptionPauseCollection
572
- * @property {string} [behavior] - Defines the behavior of the subscription when
573
- * it is paused. Possible values could include `keep_as_draft` or `cancel`.
574
- * @property {string} [resume_at] - The date and time when the paused
575
- * subscription is scheduled to resume.
233
+ * @property {string} [created_at] - Date and time when the charge was created.
234
+ * @property {boolean} [is_test] - Indicates whether the charge is for testing purposes.
235
+ * @property {string} [company_id] - Company id.
236
+ * @property {Object} [meta] - Additional metadata associated with the charge.
237
+ * @property {number} [__v] - Internal version key for the charge record.
576
238
  */
577
239
 
578
- /**
579
- * @typedef SubscriptionTrial
580
- * @property {string} [start] - The start date and time of the subscription trial period.
581
- * @property {string} [end] - The end date and time of the subscription trial period.
582
- */
583
-
584
- /**
585
- * @typedef SubscriptionInvoiceSettings
586
- * @property {boolean} [generation] - Indicates whether invoices are
587
- * automatically generated for the subscription.
588
- * @property {boolean} [charging] - Indicates whether charging is enabled for
589
- * the subscription. This setting determines if charges are applied based on
590
- * the invoice settings.
591
- */
592
-
593
- /**
594
- * @typedef Subscription
595
- * @property {Object} [meta] - Additional metadata related to the subscription.
596
- * @property {SubscriptionCurrentPeriod} [current_period]
597
- * @property {SubscriptionPauseCollection} [pause_collection]
598
- * @property {SubscriptionTrial} [trial]
599
- * @property {SubscriptionInvoiceSettings} [invoice_settings]
600
- * @property {boolean} [is_active] - Indicates whether the subscription is
601
- * currently active.
602
- * @property {boolean} [cancel_at_period_end] - Indicates whether the
603
- * subscription will be canceled at the end of the current period.
604
- * @property {string} [_id] - Unique identifier for the subscription.
605
- * @property {string} [subscriber_id] - Unique identifier for the subscriber
606
- * associated with the subscription.
607
- * @property {string} [plan_id] - Unique identifier for the plan associated with
608
- * the subscription.
609
- * @property {string} [product_suite_id] - Unique identifier for the product
610
- * suite associated with the subscription.
611
- * @property {boolean} [is_eligible_for_plan_change] - Indicates whether the
612
- * subscriber is eligible to change their subscription plan.
613
- * @property {Plan} [plan_data]
614
- * @property {string} [current_status] - The current status of the subscription
615
- * (e.g., active, canceled).
616
- * @property {string} [collection_method] - Method used to collect payments for
617
- * the subscription (e.g., charge_automatically, invoice).
618
- * @property {string} [created_at] - The date and time when the subscription was created.
619
- * @property {string} [modified_at] - The date and time when the subscription
620
- * was last modified.
621
- * @property {string} [latest_invoice] - Unique identifier for the most recent
622
- * invoice related to the subscription.
623
- * @property {string} [channel_type] - Ordering channel for which the
624
- * subscription was created (e.g., ecomm, fynd).
625
- * @property {boolean} [freezed] - Indicates whether the subscription is
626
- * currently freezed.
627
- * @property {string} [cancel_at] - The date and time when the subscription is
628
- * scheduled to be canceled, if applicable.
629
- * @property {string} [canceled_at] - The date and time when the subscription
630
- * was actually canceled.
631
- */
632
-
633
- /**
634
- * @typedef SubscriptionStatus
635
- * @property {boolean} [is_enabled] - Indicates whether the subscription status
636
- * is enabled.
637
- * @property {Subscription} [subscription]
638
- * @property {InvoicesData} [latest_invoice]
639
- * @property {Plan} [next_plan]
640
- * @property {Subscription[]} [current_subscriptions] - List of current
641
- * subscriptions associated with the user.
642
- * @property {number} [mandate_amount] - The amount mandated for the
643
- * subscription or service.
644
- * @property {string} [message] - A message providing additional context or
645
- * information about the subscription status.
646
- */
647
-
648
- /**
649
- * @typedef SubscriptionLimitApplication
650
- * @property {boolean} [enabled] - Indicates whether the application limit is enabled.
651
- * @property {number} [hard_limit] - The maximum number of applications allowed.
652
- * @property {number} [soft_limit] - The soft limit of applications allowed,
653
- * typically a warning threshold before reaching the hard limit.
654
- */
655
-
656
- /**
657
- * @typedef SubscriptionLimitMarketplace
658
- * @property {boolean} [enabled] - Indicates whether the marketplace limit is enabled.
659
- */
660
-
661
- /**
662
- * @typedef SubscriptionLimitOtherPlatform
663
- * @property {boolean} [enabled] - Indicates whether the other platform limit is enabled.
664
- */
665
-
666
- /**
667
- * @typedef SubscriptionLimitTeam
668
- * @property {number} [limit] - The limit for team-related features.
669
- */
670
-
671
- /**
672
- * @typedef SubscriptionLimitProducts
673
- * @property {boolean} [bulk] - Indicates whether bulk product limits are enabled.
674
- * @property {number} [limit] - The limit for products.
675
- */
676
-
677
- /**
678
- * @typedef SubscriptionLimitExtensions
679
- * @property {boolean} [enabled] - Indicates whether the extensions limit is enabled.
680
- * @property {number} [limit] - The limit for extensions.
681
- */
682
-
683
- /**
684
- * @typedef SubscriptionLimitIntegrations
685
- * @property {boolean} [enabled] - Indicates whether the integrations limit is enabled.
686
- * @property {number} [limit] - The limit for integrations. A value of `-1`
687
- * usually indicates no limit.
688
- */
689
-
690
- /**
691
- * @typedef SubscriptionLimit
692
- * @property {SubscriptionLimitApplication} [application]
693
- * @property {SubscriptionLimitMarketplace} [marketplace]
694
- * @property {SubscriptionLimitOtherPlatform} [other_platform]
695
- * @property {SubscriptionLimitTeam} [team]
696
- * @property {SubscriptionLimitProducts} [products]
697
- * @property {SubscriptionLimitExtensions} [extensions]
698
- * @property {SubscriptionLimitIntegrations} [integrations]
699
- * @property {boolean} [is_trial_plan] - Indicates whether the subscription is
700
- * for a trial plan.
701
- */
702
-
703
- /**
704
- * @typedef IntentReq
705
- * @property {string} [unique_external_id] - A unique identifier for the
706
- * external resource, used to track and reference the request like company id.
707
- * @property {string} [plan_id] - The identifier for the plan associated with the intent.
708
- */
709
-
710
- /**
711
- * @typedef PutIntentReq
712
- * @property {string} [unique_external_id] - A unique identifier for the
713
- * external resource, used to track and reference the request like company id.
714
- * @property {string} [setup_intent_id] - The ID of the setup intent for payment
715
- * methods, if applicable.
716
- * @property {string} [payment_method_id] - The ID of the payment method to use
717
- * for the intent.
718
- * @property {boolean} [set_default] - Indicates whether the payment method
719
- * should be set as default.
720
- */
721
-
722
- /**
723
- * @typedef SubscriptionActivateReq
724
- * @property {string} [unique_id] - A unique identifier for the subscription
725
- * activation request.
726
- * @property {string} [type] - The type of subscriber account, e.g., company or developer.
727
- * @property {string} [product_suite] - The product suite associated with the
728
- * subscription.
729
- * @property {string} [plan_id] - The ID of the plan to be activated for the subscription.
730
- * @property {string} [payment_method] - The payment method ID to be used for
731
- * this subscription.
732
- * @property {string} [subscription_id] - The ID of the subscription to be
733
- * activated, if applicable.
734
- * @property {string} [coupon] - A coupon code for applying discounts, if applicable.
735
- * @property {Object} [meta] - Additional metadata related to the subscription
736
- * activation request.
737
- */
738
-
739
- /**
740
- * @typedef SubscriptionActivateRes
741
- * @property {boolean} [success] - Indicates whether the subscription activation
742
- * was successful.
743
- * @property {Subscription} [data]
744
- */
745
-
746
- /**
747
- * @typedef CancelSubscriptionReq
748
- * @property {string} [unique_id] - A unique identifier for the subscription
749
- * cancellation request like company id.
750
- * @property {string} [type] - The type of subscription to be canceled, e.g.,
751
- * company or developer.
752
- * @property {string} [product_suite] - The product suite associated with the
753
- * subscription to be canceled.
754
- * @property {string} [subscription_id] - The ID of the subscription to be canceled.
755
- */
756
-
757
- /**
758
- * @typedef CancelSubscriptionRes
759
- * @property {boolean} [success]
760
- * @property {Subscription} [data]
761
- */
762
-
763
- /**
764
- * @typedef PlanStatusUpdateReq
765
- * @property {string} [plan_id] - The identifier of the plan whose status is
766
- * being updated.
767
- * @property {string} [reason] - The reason for updating the plan status.
768
- * @property {string} [seller_status] - The new status of the plan as set by the
769
- * seller (e.g., approved, rejected, pending).
770
- */
771
-
772
- /**
773
- * @typedef SubscribePlan
774
- * @property {string} [entity_type] - The type of entity for which the plan is
775
- * being subscribed (e.g., subscription, extension).
776
- * @property {string} [collection_type] - The method of collection for the
777
- * subscription (e.g., online, offline).
778
- * @property {string} [plan_id] - The identifier of the plan to subscribe to.
779
- * @property {string} [callback_url] - URL to which the payment result will be sent
780
- * @property {Meta} [meta]
781
- */
782
-
783
- /**
784
- * @typedef Meta
785
- * @property {boolean} [subscribe] - Indicates whether the subscription is being
786
- * initiated.
787
- * @property {boolean} [is_custom_plan] - Indicates if the plan is a custom plan
788
- * rather than a standard one.
789
- * @property {boolean} [is_plan_upgrade] - Indicates whether this subscription
790
- * is an upgrade from a previous plan.
791
- */
792
-
793
- /**
794
- * @typedef SubscribePlanRes
795
- * @property {string} [redirect_url] - The URL to which the user should be
796
- * redirected after completion of subscription process.
797
- * @property {string} [transaction_id] - The unique identifier for the
798
- * subscription transaction.
799
- * @property {string} [current_status] - The current status of the subscription
800
- * process (e.g., initiated, success, failed).
801
- * @property {Meta} [meta]
802
- */
803
-
804
- /**
805
- * @typedef EntityDetail
806
- * @property {string} [entity] - Specifies the type of entity (e.g., subscription, user).
807
- * @property {Subscription} [item]
808
- */
809
-
810
- /**
811
- * @typedef PaymentOptions
812
- * @property {string} [_id] - Unique identifier for the payment option.
813
- * @property {string} [name] - Name of the payment option.
814
- * @property {string} [description] - Brief description of the payment option's
815
- * functionality.
816
- * @property {string} [logo] - URL of the payment option's logo like upi logo.
817
- * @property {string} [aggregator_id] - Unique identifier for the payment aggregator.
818
- * @property {string} [aggregator] - Identifier for the payment aggregator system.
819
- * @property {string} [created_at] - Date and time when the payment option was created.
820
- * @property {string} [modified_at] - Date and time when the payment option was
821
- * last modified.
822
- * @property {number} [__v] - Version key for document revision control.
823
- */
824
-
825
- /**
826
- * @typedef VerifyPaymentReq
827
- * @property {string} [razorpay_payment_id] - Unique identifier for the Razorpay payment.
828
- * @property {string} [razorpay_order_id] - Unique identifier for the Razorpay order.
829
- * @property {string} [razorpay_signature] - Signature generated by Razorpay to
830
- * verify the payment.
831
- * @property {number} [status_code] - HTTP status code of the payment
832
- * verification response.
833
- * @property {string} [provider_type] - The payment provider used for the transaction.
834
- */
835
-
836
- /**
837
- * @typedef Documents
838
- * @property {string} [pan] - Permanent Account Number (PAN) used for tax purposes.
839
- * @property {string} [gst] - Goods and Services Tax (GST) number for business taxation.
840
- */
841
-
842
- /**
843
- * @typedef BillingAddress
844
- * @property {string} [country] - The country where the billing address is located.
845
- * @property {string} [state] - The state or region within the country.
846
- * @property {string} [city] - The city of the billing address.
847
- * @property {string} [line1] - The first line of the billing address.
848
- * @property {string} [line2] - The second line of the billing address (if applicable).
849
- * @property {string} [postal_code] - The ZIP code of the billing address.
850
- * @property {string} [country_code] - ISO country code for the country of the
851
- * billing address.
852
- */
853
-
854
- /**
855
- * @typedef Currency
856
- * @property {string} [code] - Currency code as per ISO 4217.
857
- * @property {string} [symbol] - Symbol representing the currency.
858
- * @property {string} [name] - Full name of the currency.
859
- */
860
-
861
- /**
862
- * @typedef BusinessCountryInfo
863
- * @property {string} [country] - The country where the business is registered.
864
- * @property {string} [country_code] - ISO country code for the business's country.
865
- * @property {Currency} [currency]
866
- * @property {string} [timezone] - Timezone in which the business operates.
867
- */
868
-
869
- /**
870
- * @typedef SubscriberData
871
- * @property {boolean} [pg_user_exists] - Indicates if the user exists in the
872
- * payment gateway system.
873
- * @property {string} [id] - Unique identifier for the subscriber.
874
- * @property {string} [pg_customer_id] - Unique customer ID assigned by the
875
- * payment gateway.
876
- * @property {string} [default_payment_method] - Identifier for the default
877
- * payment method used by the subscriber.
878
- */
879
-
880
- /**
881
- * @typedef Subscriber
882
- * @property {Documents} [documents]
883
- * @property {Object} [phone] - Contact information for the subscriber, such as
884
- * phone number.
885
- * @property {BillingAddress} [billing_address]
886
- * @property {boolean} [consent] - Indicates whether the subscriber has given
887
- * consent for processing.
888
- * @property {boolean} [comms] - Indicates whether the subscriber has opted in
889
- * for communications.
890
- * @property {string} [_id] - Unique identifier for the subscriber in the system.
891
- * @property {string} [type] - The type of the subscriber, such as 'individual'
892
- * or 'company'.
893
- * @property {string} [unique_id] - A unique identifier assigned to the subscriber.
894
- * @property {string} [name] - The name of the subscriber.
895
- * @property {string} [email] - Email address of the subscriber.
896
- * @property {BusinessCountryInfo} [business_country_info]
897
- * @property {string} [created_at] - The date and time when the subscriber was created.
898
- * @property {string} [modified_at] - The date and time when the subscriber
899
- * details were last modified.
900
- * @property {number} [credit_balance] - The current credit balance for the
901
- * subscriber, if any.
902
- * @property {SubscriberData} [data]
903
- */
904
-
905
- /**
906
- * @typedef AuthorModifiedDetails
907
- * @property {string} [first_name] - The first name of the author who made modifications.
908
- * @property {string} [last_name] - The last name of the author who made modifications.
909
- * @property {boolean} [is_admin] - Indicates whether the author has
910
- * administrative privileges.
911
- */
912
-
913
- /**
914
- * @typedef Author
915
- * @property {AuthorModifiedDetails} [modified_by_details]
916
- * @property {string} [created_by] - Identifier of the user who created the record.
917
- * @property {string} [modified_by] - Identifier of the user who last modified the record.
918
- */
919
-
920
- /**
921
- * @typedef EndingBalance
922
- * @property {number} [amount] - The ending balance amount.
923
- * @property {string} [old_entry_ref] - Reference to the previous entry if applicable.
924
- */
925
-
926
- /**
927
- * @typedef PaymentData
928
- * @property {string} [transaction_id] - The unique identifier for the transaction.
929
- * @property {string} [aggregator] - The payment aggregator used for the transaction.
930
- * @property {string} [aggregator_order_id] - The order ID generated by the
931
- * payment aggregator.
932
- * @property {string} [receipt_date] - The date and time when the receipt was generated.
933
- * @property {string} [unique_transaction_reference] - A unique reference for
934
- * the transaction.
935
- */
936
-
937
- /**
938
- * @typedef CreditTransaction
939
- * @property {Object} [entity] - The entity associated with the transaction.
940
- * @property {Author} [author]
941
- * @property {string} [_id] - The unique identifier for the credit transaction.
942
- * @property {number} [amount] - The amount credited in the transaction.
943
- * @property {string} [currency] - The currency of the transaction amount.
944
- * @property {string} [subscriber_id] - The unique identifier of the subscriber
945
- * involved in the transaction.
946
- * @property {string} [description] - A brief description of the transaction.
947
- * @property {string} [is_test] - Indicates if the transaction is a test transaction.
948
- * @property {EndingBalance} [ending_balance]
949
- * @property {PaymentData} [payment]
950
- * @property {string} [type] - The type of credit transaction.
951
- * @property {string} [created_at] - The date and time when the transaction was created.
952
- * @property {string} [modified_at] - The date and time when the transaction was
953
- * last modified.
954
- */
955
-
956
- /**
957
- * @typedef VerifyPaymentData
958
- * @property {boolean} [success] - Indicates if the payment verification was successful.
959
- * @property {Subscriber} [subscriber]
960
- * @property {CreditTransaction} [credit_transaction]
961
- */
962
-
963
- /**
964
- * @typedef VerifyPaymentRes
965
- * @property {string} [status] - The status of the payment verification.
966
- * @property {VerifyPaymentData} [data]
967
- */
968
-
969
- /**
970
- * @typedef DefaultMerchants
971
- * @property {string} [stripe] - The default Stripe merchant identifier.
972
- */
973
-
974
- /**
975
- * @typedef GlobalSettingsPayment
976
- * @property {DefaultMerchants} [default_merchants]
977
- */
978
-
979
- /**
980
- * @typedef GlobalSettingsData
981
- * @property {GlobalSettingsPayment} [payment]
982
- * @property {boolean} [freeze_panel] - Indicates if the panel is frozen.
983
- * @property {string} [_id] - Unique identifier for the global settings.
984
- * @property {string} [created_at] - The date and time when the global settings
985
- * were created.
986
- * @property {string} [modified_at] - The date and time when the global settings
987
- * were last modified.
988
- */
989
-
990
- /**
991
- * @typedef GlobalSettings
992
- * @property {string} [status] - The status of the global settings retrieval.
993
- * @property {GlobalSettingsData} [data]
994
- */
995
-
996
- /**
997
- * @typedef MethodChecks
998
- * @property {string} [address_line1_check] - Result of the address line 1 check.
999
- * @property {string} [address_postal_code_check] - Result of the address postal
1000
- * code check.
1001
- * @property {string} [cvc_check] - Result of the CVC check.
1002
- */
1003
-
1004
- /**
1005
- * @typedef MethodNetworks
1006
- * @property {string[]} [available] - List of available networks for the payment method.
1007
- * @property {string} [preferred] - Preferred network for the payment method.
1008
- */
1009
-
1010
- /**
1011
- * @typedef MethodSecureUsage
1012
- * @property {boolean} [supported] - Indicates if 3D Secure is supported for the
1013
- * payment method.
1014
- */
1015
-
1016
- /**
1017
- * @typedef MethodDetails
1018
- * @property {string} [id] - Unique identifier for the payment method.
1019
- * @property {string} [type] - Type of payment method.
1020
- * @property {boolean} [mandate_available] - Indicates if a mandate is available
1021
- * for the payment method.
1022
- * @property {number} [mandate_amount] - Mandate amount for the payment method.
1023
- * @property {string} [pg_payment_method_id] - Payment gateway's payment method
1024
- * identifier.
1025
- * @property {boolean} [is_default] - Indicates if the payment method is the default.
1026
- * @property {SubscriptionMethodData} [data]
1027
- */
1028
-
1029
- /**
1030
- * @typedef SubscriptionMethodData
1031
- * @property {string} [brand] - Brand of the payment method.
1032
- * @property {MethodChecks} [checks]
1033
- * @property {string} [country] - Country of the payment method.
1034
- * @property {number} [exp_month] - Expiration month of the payment method.
1035
- * @property {number} [exp_year] - Expiration year of the payment method.
1036
- * @property {string} [fingerprint] - Fingerprint of the payment method.
1037
- * @property {string} [funding] - Funding type of the payment method.
1038
- * @property {string} [generated_from] - Source from which the payment method
1039
- * was generated.
1040
- * @property {string} [last4] - Last 4 digits of the payment method.
1041
- * @property {MethodNetworks} [networks]
1042
- * @property {MethodSecureUsage} [three_d_secure_usage]
1043
- * @property {string} [wallet] - Wallet associated with the payment method.
1044
- * @property {string} [name] - Name associated with the payment method.
1045
- * @property {boolean} [is_default] - Indicates if the payment method is the default.
1046
- */
1047
-
1048
- /**
1049
- * @typedef SubscriptionMethods
1050
- * @property {boolean} [success] - Indicates if the retrieval of subscription
1051
- * methods was successful.
1052
- * @property {MethodDetails[]} [data] - List of subscription methods.
1053
- */
1054
-
1055
- /**
1056
- * @typedef ConfigPublicKey
1057
- * @property {string} [public_key] - Public key for the payment aggregator.
1058
- */
1059
-
1060
- /**
1061
- * @typedef ConfigRes
1062
- * @property {boolean} [success] - Indicates if the retrieval of configuration
1063
- * was successful.
1064
- * @property {string} [aggregator] - The payment aggregator.
1065
- * @property {ConfigPublicKey} [config]
1066
- */
1067
-
1068
- /**
1069
- * @typedef PlanChangeData
1070
- * @property {number} [total] - The total amount after the plan change.
1071
- * @property {number} [credit_note_amount] - The amount credited due to the plan change.
1072
- * @property {number} [settlement] - The settlement amount for the plan change.
1073
- * @property {number} [taxable_amount] - The taxable amount for the plan change.
1074
- * @property {number} [gst_amount] - The GST amount for the plan change.
1075
- * @property {number} [gross_total] - The gross total amount for the plan change.
1076
- * @property {number} [gst] - The GST for the plan change.
1077
- * @property {number} [discount] - The discount amount applied to the plan change.
1078
- */
1079
-
1080
- /**
1081
- * @typedef PlanChangeDetails
1082
- * @property {string} [status] - Status of the plan change.
1083
- * @property {PlanChangeData} [data]
1084
- */
1085
-
1086
- /**
1087
- * @typedef TransactionMeta
1088
- * @property {string} [invoice_id] - Invoice ID associated with the transaction.
1089
- */
1090
-
1091
- /**
1092
- * @typedef PaymentTransactionDetails
1093
- * @property {Object} [aggregator] - Payment aggregator details.
1094
- * @property {string} [currency] - Currency used in the transaction.
1095
- * @property {string} [current_status] - Current status of the transaction.
1096
- * @property {string} [_id] - Unique identifier for the payment transaction.
1097
- * @property {string} [subscriber_id] - Unique identifier for the subscriber.
1098
- * @property {number} [amount] - Amount involved in the transaction.
1099
- * @property {string} [entity_type] - Type of entity involved in the transaction.
1100
- * @property {string} [collection_type] - Type of collection for the transaction.
1101
- * @property {TransactionMeta} [meta]
1102
- * @property {string} [created_at] - Timestamp when the transaction was created.
1103
- * @property {string} [modified_at] - Timestamp when the transaction was last modified.
1104
- */
1105
-
1106
- /**
1107
- * @typedef PaymentItems
1108
- * @property {string} [name] - Name of the payment option.
1109
- * @property {string} [code] - Code for the payment option
1110
- * @property {string} [aggregator] - Aggregator used for the payment option.
1111
- */
1112
-
1113
- /**
1114
- * @typedef GetPaymentOptions
1115
- * @property {PaymentItems[]} [payment_options] - List of available payment options.
1116
- */
1117
-
1118
- /**
1119
- * @typedef TopupReq
1120
- * @property {number} [amount] - Amount to be topped up.
1121
- * @property {string} [currency] - Currency in which the top-up is made.
1122
- * @property {string} [provider_type] - Provider type for the top-up.
1123
- */
1124
-
1125
- /**
1126
- * @typedef SetupMandateReq
1127
- * @property {string} [intent_id] - ID of the setup intent.
1128
- * @property {string} [payment_method_id] - ID of the payment method.
1129
- */
1130
-
1131
- /**
1132
- * @typedef SetupPaymentReq
1133
- * @property {string} [payment_method] - Payment method to be used.
1134
- * @property {string} [payment_id] - ID of the payment.
1135
- * @property {string} [plan_id] - ID of the plan.
1136
- * @property {string} [invoice_id] - ID of the invoice.
1137
- */
1138
-
1139
- /**
1140
- * @typedef SubscriptionRenewReq
1141
- * @property {string} [invoice_id] - ID of the invoice for renewal.
1142
- * @property {string} [entity_type] - Type of entity for the renewal.
1143
- * @property {string} [collection_type] - Collection type for the renewal.
1144
- * @property {string} [callback_url] - URL to which the payment result will be sent
1145
- * @property {RenewMeta} [meta]
1146
- */
1147
-
1148
- /**
1149
- * @typedef RenewMeta
1150
- * @property {boolean} [invoice_payment] - Indicates whether the invoice payment
1151
- * is involved in the renewal.
1152
- * @property {boolean} [renew] - Indicates whether the subscription is being renewed.
1153
- */
1154
-
1155
- /**
1156
- * @typedef SubscriptionMethodsReq
1157
- * @property {string} [unique_external_id] - The unique external identifier for
1158
- * the subscription method.
1159
- * @property {string} [setup_intent_id] - The setup intent ID for the subscription method.
1160
- * @property {string} [pg_payment_method_id] - The payment gateway payment method ID.
1161
- * @property {boolean} [set_default] - Indicates whether this payment method
1162
- * should be set as the default.
1163
- */
1164
-
1165
- /**
1166
- * @typedef CreditTransactionResponse
1167
- * @property {number} [total] - Total number of transactions.
1168
- * @property {number} [limit] - Maximum number of transactions per page.
1169
- * @property {number} [page] - Current page number.
1170
- * @property {number} [pages] - Total number of pages.
1171
- * @property {CreditTransaction[]} [items] - List of credit transactions.
1172
- */
1173
-
1174
- /**
1175
- * @typedef DowngradePlanReq
1176
- * @property {string} [unique_id] - Unique identifier for the request.
1177
- * @property {string} [type] - Type of entity requesting the downgrade.
1178
- * @property {string} [product_suite] - Product suite for the plan.
1179
- * @property {string} [plan_id] - Plan ID for the downgrade request.
1180
- * @property {string} [reason] - Reason for downgrading the plan.
1181
- * @property {string} [platform] - Platform from which the request is made.
1182
- */
1183
-
1184
- /**
1185
- * @typedef Taxation
1186
- * @property {number} [gst] - GST percentage.
1187
- */
1188
-
1189
- /**
1190
- * @typedef OneTimeFees
1191
- * @property {number} [developement] - One-time development fee.
1192
- * @property {number} [marketing] - One-time marketing fee.
1193
- */
1194
-
1195
- /**
1196
- * @typedef CreditLine
1197
- * @property {boolean} [is_active] - Indicates whether the credit line is active.
1198
- */
1199
-
1200
- /**
1201
- * @typedef StatusMessage
1202
- * @property {string} [status] - Status of the request.
1203
- * @property {string} [message] - Detailed message regarding the status.
1204
- * @property {boolean} [success] - Indicates whether the operation was successful.
1205
- * @property {string} [code] - Status code of the operation.
1206
- */
1207
-
1208
- /**
1209
- * @typedef PaymentCollectReq
1210
- * @property {string} [transaction_id] - ID of the transaction to collect payment for.
1211
- * @property {boolean} [credit_balance] - Indicates whether to use credit
1212
- * balance for the payment.
1213
- * @property {string} [payment_mode] - Mode of payment.
1214
- * @property {string} [payment_method] - Payment method to be used.
1215
- * @property {string} [invoice_id] - ID of the invoice for which the payment is collected.
1216
- */
1217
-
1218
- /**
1219
- * @typedef SubscriptionRenewResMeta
1220
- * @property {boolean} [invoice_payment] - Indicates whether the invoice payment
1221
- * is involved in the renewal.
1222
- * @property {boolean} [renew] - Indicates whether the subscription is being renewed.
1223
- */
1224
-
1225
- /**
1226
- * @typedef SubscriptionRenewRes
1227
- * @property {string} [redirect_url] - URL to redirect the user for completing
1228
- * the renewal.
1229
- * @property {string} [transaction_id] - ID of the renewal transaction.
1230
- * @property {string} [current_status] - Current status of the renewal process.
1231
- * @property {SubscriptionRenewResMeta} [meta]
1232
- */
1233
-
1234
- /**
1235
- * @typedef SetupIntentRes
1236
- * @property {boolean} [success] - Indicates if the setup intent was successful.
1237
- * @property {SetupIntentData} [data]
1238
- */
1239
-
1240
- /**
1241
- * @typedef SetupIntentData
1242
- * @property {string} [id] - The ID of the setup intent.
1243
- * @property {string} [client_secret] - The client secret of the setup intent.
1244
- * @property {string} [customer] - The customer associated with the setup intent.
1245
- * @property {string} [status] - The status of the setup intent.
1246
- */
1247
-
1248
- /**
1249
- * @typedef SetupPayment
1250
- * @property {string} [id] - The ID of the setup payment.
1251
- * @property {string} [status] - The status of the setup payment.
1252
- * @property {string} [customer] - The customer associated with the setup payment.
1253
- * @property {string} [client_secret] - The client secret of the setup payment.
1254
- * @property {string} [payment_method] - The payment method used for the setup payment.
1255
- * @property {string} [mandate] - The mandate ID associated with the setup payment.
1256
- * @property {PaymentMethodOptions} [payment_method_options]
1257
- */
1258
-
1259
- /**
1260
- * @typedef PaymentMethodOptions
1261
- * @property {Card} [card]
1262
- */
1263
-
1264
- /**
1265
- * @typedef Card
1266
- * @property {MandateOptions} [mandate_options]
1267
- */
1268
-
1269
- /**
1270
- * @typedef MandateOptions
1271
- * @property {number} [amount] - The mandate amount.
1272
- */
1273
-
1274
- /**
1275
- * @typedef Message
1276
- * @property {string} [message] - A message providing details about the operation status.
1277
- */
1278
-
1279
- /**
1280
- * @typedef TopupRes
1281
- * @property {string} [status] - The status of the top-up request.
1282
- * @property {string} [aggregator_order_id] - The order ID from the aggregator.
1283
- * @property {number} [amount] - The amount of the top-up.
1284
- * @property {string} [currency] - The currency of the top-up.
1285
- * @property {string} [transaction_id] - The transaction ID for the top-up.
1286
- */
1287
-
1288
- /**
1289
- * @typedef CancelTopupReq
1290
- * @property {string} [order_id] - The order ID of the top-up to cancel.
1291
- */
1292
-
1293
- /**
1294
- * @typedef CancelTopupRes
1295
- * @property {string} [_id] - The ID of the canceled top-up.
1296
- * @property {string} [subscriber_id] - The subscriber ID associated with the top-up.
1297
- * @property {number} [amount] - The amount of the canceled top-up.
1298
- * @property {string} [currency] - The currency of the canceled top-up.
1299
- * @property {string} [aggregator] - The aggregator used for the top-up.
1300
- * @property {string} [aggregator_order_id] - The order ID from the aggregator.
1301
- * @property {string} [created_at] - The date and time when the top-up was created.
1302
- * @property {string} [modified_at] - The date and time when the top-up was modified.
1303
- * @property {number} [__v] - The version key, used for internal purposes.
1304
- * @property {string} [aggregator_status] - The status of the top-up with the aggregator.
1305
- * @property {string} [current_status] - The current status of the top-up.
1306
- */
1307
-
1308
- /**
1309
- * @typedef DefaultReq
1310
- * @property {string} [payment_method_id] - The ID of the payment method to set
1311
- * as default.
1312
- */
1313
-
1314
- /**
1315
- * @typedef EntityChargeRecurring
1316
- * @property {string} interval - The interval of the subscription.
1317
- */
1318
-
1319
- /**
1320
- * @typedef ChargeLineItem
1321
- * @property {string} name - Its name of the extension plan.
1322
- * @property {string} term - It indicates how it will be charged.
1323
- * @property {string} pricing_type - It indicates the extension subscription
1324
- * will be auto renewed timely.
1325
- * @property {EntityChargePrice} price
1326
- * @property {EntityChargeRecurring} [recurring]
1327
- * @property {number} [capped_amount]
1328
- * @property {number} [trial_days]
1329
- * @property {boolean} [is_test]
1330
- * @property {Object} [metadata]
1331
- */
1332
-
1333
- /**
1334
- * @typedef CreateSubscriptionCharge
1335
- * @property {string} name - The name of the charge.
1336
- * @property {number} [trial_days]
1337
- * @property {ChargeLineItem[]} line_items
1338
- * @property {boolean} [is_test] - Indicates whether the charge is for testing purposes.
1339
- * @property {string} return_url - The URL passed in request which extension
1340
- * expects in return.
1341
- */
1342
-
1343
- /**
1344
- * @typedef EntityChargeDetails
1345
- * @property {string} [_id] - Unique identifier for the charge.
1346
- * @property {string} [subscription_id] - Unique identifier of the extension subscription.
1347
- * @property {string} [subscriber_id] - Unique identifier of the
1348
- * subscriber/company who installed extension subscription.
1349
- * @property {string} [entity_type] - The type of entity associated with the
1350
- * charge (e.g., 'extension', 'subscription').
1351
- * @property {string} [entity_id] - Unique identifier for the entity associated
1352
- * with the charge.
1353
- * @property {string} [name] - The name of the charge.
1354
- * @property {string} [term] - Description of the charge term.
1355
- * @property {string} [charge_type] - The type of charge (e.g., 'standalone',
1356
- * 'recurring').
1357
- * @property {string} [pricing_type] - The pricing model for the charge (e.g.,
1358
- * 'one_time', 'recurring').
1359
- * @property {EntityChargePrice} [price]
1360
- * @property {ChargeRecurring} [recurring]
1361
- * @property {string} [status] - Current status of the charge.
1362
- * @property {number} [capped_amount] - Maximum amount that can be charged, if applicable.
1363
- * @property {string} [activated_on] - Date and time when the charge was activated.
1364
- * @property {string} [cancelled_on] - Date and time when the charge was cancelled.
1365
- * @property {string} [billing_date] - Date and time when the charge was billed.
1366
- * @property {SubscriptionTrialPeriod} [current_period]
1367
- * @property {string} [modified_at] - Date and time when the charge details were
1368
- * last modified.
1369
- * @property {string} [created_at] - Date and time when the charge was created.
1370
- * @property {boolean} [is_test] - Indicates whether the charge is for testing purposes.
1371
- * @property {string} [company_id] - Company id.
1372
- * @property {Object} [meta] - Additional metadata associated with the charge.
1373
- * @property {number} [__v] - Internal version key for the charge record.
1374
- */
1375
-
1376
- /**
1377
- * @typedef EntitySubscription
1378
- * @property {string} [_id] - Unique identifier for the subscription charge
1379
- * @property {string} [product_suit_id] - ID of the product suit associated with
1380
- * the charge
1381
- * @property {string} [entity_id] - Unique identifier for the entity
1382
- * @property {string} [entity_type] - Type of entity (e.g., subscription, extension)
1383
- * @property {string} [name] - Name of the subscription charge
1384
- * @property {string} [status] - Current status of the subscription charge
1385
- * @property {number} [trial_days] - Number of trial days provided
1386
- * @property {boolean} [is_test] - Indicates if the charge is for testing purposes
1387
- * @property {string} [created_at] - Timestamp when the charge was created
1388
- * @property {string} [modified_at] - Timestamp when the charge was last modified
1389
- * @property {string} [subscriber_id] - Unique Identifier of the company
1390
- * @property {EntityChargeDetails[]} [line_items]
1391
- * @property {string} [return_url] - The URL passed in request which extension
1392
- * expects in return.
1393
- */
1394
-
1395
- /**
1396
- * @typedef CreateSubscriptionResponse
1397
- * @property {EntitySubscription} [subscription]
1398
- * @property {string} [confirm_url] - URL to which users are redirected to
1399
- * confirm or complete the payment or subscription process.
1400
- */
1401
-
1402
- class BillingPlatformModel {
1403
- /** @returns {CompanyInfo} */
1404
- static CompanyInfo() {
1405
- return Joi.object({
1406
- company_name: Joi.string().allow(""),
1407
- gstin: Joi.string().allow(""),
1408
- address: Joi.string().allow(""),
1409
- address_details: BillingPlatformModel.AddressDetails(),
1410
- pan: Joi.string().allow(""),
1411
- phone: Joi.string().allow(""),
1412
- email: Joi.string().allow(""),
1413
- cin: Joi.string().allow(""),
1414
- });
1415
- }
1416
-
1417
- /** @returns {AddressDetails} */
1418
- static AddressDetails() {
1419
- return Joi.object({
1420
- address_line_1: Joi.string().allow(""),
1421
- address_line_2: Joi.string().allow(""),
1422
- city: Joi.string().allow(""),
1423
- pincode: Joi.string().allow(""),
1424
- state: Joi.string().allow(""),
1425
- country: Joi.string().allow(""),
1426
- });
1427
- }
1428
-
1429
- /** @returns {InvoiceData} */
1430
- static InvoiceData() {
1431
- return Joi.object({
1432
- invoice: BillingPlatformModel.InvoiceDetailsData(),
1433
- invoice_items: Joi.array().items(BillingPlatformModel.InvoiceItems()),
1434
- shopsense_details: BillingPlatformModel.CompanyInfo(),
1435
- });
1436
- }
1437
-
1438
- /** @returns {InvoiceDetailsData} */
1439
- static InvoiceDetailsData() {
1440
- return Joi.object({
1441
- attemp: Joi.number().allow(null),
1442
- documents: Joi.any(),
1443
- payment: Joi.any(),
1444
- period: BillingPlatformModel.Period(),
1445
- client: BillingPlatformModel.Client(),
1446
- discount: Joi.any(),
1447
- taxation: Joi.any(),
1448
- _id: Joi.string().allow(""),
1449
- auto_advance: Joi.boolean(),
1450
- collection_method: Joi.string().allow(""),
1451
- subscriber_id: Joi.string().allow(""),
1452
- currency: Joi.string().allow(""),
1453
- invoice_url: Joi.string().allow(""),
1454
- number: Joi.string().allow(""),
1455
- paid: Joi.boolean(),
1456
- pg_data: Joi.any(),
1457
- receipt_number: Joi.string().allow(""),
1458
- statement_descriptor: Joi.string().allow(""),
1459
- current_status: Joi.string().allow(""),
1460
- status_trail: Joi.array().items(BillingPlatformModel.StatusTrail()),
1461
- subtotal: Joi.number(),
1462
- total: Joi.number(),
1463
- old_settlement: Joi.number().allow(null),
1464
- credit_balance: Joi.number().allow(null),
1465
- subscription: Joi.string().allow(""),
1466
- attempt: Joi.number(),
1467
- next_action_time: Joi.string().allow(""),
1468
- credit_note_amount: Joi.number(),
1469
- created_at: Joi.string().allow(""),
1470
- modified_at: Joi.string().allow(""),
1471
- invoice_type: Joi.string().allow(""),
1472
- });
1473
- }
1474
-
1475
- /** @returns {Client} */
1476
- static Client() {
1477
- return Joi.object({
1478
- name: Joi.string().allow(""),
1479
- email: Joi.string().allow(""),
1480
- phone: Joi.string().allow(""),
1481
- address_lines: Joi.array().items(Joi.string().allow("")),
1482
- });
1483
- }
1484
-
1485
- /** @returns {Period} */
1486
- static Period() {
1487
- return Joi.object({
1488
- start: Joi.string().allow(""),
1489
- end: Joi.string().allow(""),
1490
- });
1491
- }
1492
-
1493
- /** @returns {StatusTrail} */
1494
- static StatusTrail() {
1495
- return Joi.object({
1496
- value: Joi.string().allow(""),
1497
- timestamp: Joi.string().allow(""),
1498
- _id: Joi.string().allow(""),
1499
- });
1500
- }
1501
-
1502
- /** @returns {PaymentCollectRes} */
1503
- static PaymentCollectRes() {
1504
- return Joi.object({
1505
- transaction_id: Joi.string().allow(""),
1506
- current_status: Joi.string().allow(""),
1507
- });
1508
- }
1509
-
1510
- /** @returns {SubscriptionChargeRes} */
1511
- static SubscriptionChargeRes() {
1512
- return Joi.object({
1513
- _id: Joi.string().allow(""),
1514
- product_suit_id: Joi.string().allow(""),
1515
- entity_id: Joi.string().allow(""),
1516
- entity_type: Joi.string().allow(""),
1517
- name: Joi.string().allow(""),
1518
- status: Joi.string().allow(""),
1519
- trial_days: Joi.number(),
1520
- activated_on: Joi.string().allow(""),
1521
- cancelled_on: Joi.string().allow(""),
1522
- is_test: Joi.boolean(),
1523
- created_at: Joi.string().allow(""),
1524
- modified_at: Joi.string().allow(""),
1525
- company_id: Joi.string().allow(""),
1526
- line_items: Joi.array().items(Joi.any()),
1527
- });
1528
- }
1529
-
1530
- /** @returns {PostDowngradeRes} */
1531
- static PostDowngradeRes() {
1532
- return Joi.object({
1533
- success: Joi.boolean(),
1534
- data: BillingPlatformModel.DowngradeRes(),
1535
- });
1536
- }
1537
-
1538
- /** @returns {DowngradeRes} */
1539
- static DowngradeRes() {
1540
- return Joi.object({
1541
- _id: Joi.string().allow(""),
1542
- status: Joi.string().allow(""),
1543
- subscriber_id: Joi.string().allow(""),
1544
- activated: Joi.boolean(),
1545
- created_at: Joi.string().allow(""),
1546
- modified_at: Joi.string().allow(""),
1547
- plan_id: Joi.string().allow(""),
1548
- reason: Joi.string().allow(""),
1549
- request_user_id: Joi.string().allow(""),
1550
- subscription_id: Joi.string().allow(""),
1551
- });
1552
- }
1553
-
1554
- /** @returns {PaymentStatusData} */
1555
- static PaymentStatusData() {
1556
- return Joi.object({
1557
- _id: Joi.string().allow(""),
1558
- journey: Joi.string().allow(""),
1559
- webhook_response: Joi.array().items(Joi.any()),
1560
- aggregator_status: Joi.string().allow(""),
1561
- current_status: Joi.string().allow(""),
1562
- created_at: Joi.string().allow(""),
1563
- modified_at: Joi.string().allow(""),
1564
- __v: Joi.number(),
1565
- aggregator_order_id: Joi.string().allow(""),
1566
- });
1567
- }
1568
-
1569
- /** @returns {PaymentStatusResponse} */
1570
- static PaymentStatusResponse() {
1571
- return Joi.object({
1572
- status: Joi.string().allow(""),
1573
- data: BillingPlatformModel.PaymentStatusData(),
1574
- });
1575
- }
1576
-
1577
- /** @returns {BadRequest} */
1578
- static BadRequest() {
1579
- return Joi.object({
1580
- message: Joi.string().allow(""),
1581
- });
1582
- }
1583
-
1584
- /** @returns {ResourceNotFound} */
1585
- static ResourceNotFound() {
1586
- return Joi.object({
1587
- message: Joi.string().allow(""),
1588
- code: Joi.any(),
1589
- success: Joi.any(),
1590
- });
1591
- }
1592
-
1593
- /** @returns {InternalServerError} */
1594
- static InternalServerError() {
1595
- return Joi.object({
1596
- message: Joi.string().allow(""),
1597
- code: Joi.string().allow(""),
1598
- });
1599
- }
1600
-
1601
- /** @returns {CheckValidityResponse} */
1602
- static CheckValidityResponse() {
1603
- return Joi.object({
1604
- is_valid: Joi.boolean(),
1605
- discount_amount: Joi.number(),
1606
- });
1607
- }
1608
-
1609
- /** @returns {PlanRecurring} */
1610
- static PlanRecurring() {
1611
- return Joi.object({
1612
- interval: Joi.string().allow(""),
1613
- interval_count: Joi.number(),
1614
- });
1615
- }
1616
-
1617
- /** @returns {PlanMeta} */
1618
- static PlanMeta() {
1619
- return Joi.object({
1620
- seller_status: Joi.string().allow(""),
1621
- company: Joi.string().allow(""),
1622
- plan_platform_display_name: Joi.string().allow("").allow(null),
1623
- tags: Joi.array().items(Joi.string().allow("")),
1624
- });
1625
- }
1626
-
1627
- /** @returns {CountryRes} */
1628
- static CountryRes() {
1629
- return Joi.object({
1630
- name: Joi.string().allow(""),
1631
- code: Joi.string().allow(""),
1632
- });
1633
- }
1634
-
1635
- /** @returns {Plan} */
1636
- static Plan() {
1637
- return Joi.object({
1638
- fee_components: Joi.array().items(Joi.any()).allow(null, ""),
1639
- recurring: BillingPlatformModel.PlanRecurring(),
1640
- is_trial_plan: Joi.boolean(),
1641
- plan_group: Joi.string().allow(""),
1642
- tag_lines: Joi.array().items(Joi.string().allow("")),
1643
- currency: Joi.string().allow(""),
1644
- approved_by: Joi.string().allow(""),
1645
- is_active: Joi.boolean(),
1646
- is_visible: Joi.boolean(),
1647
- trial_period: Joi.number(),
1648
- addons: Joi.array().items(Joi.string().allow("")),
1649
- tags: Joi.array().items(Joi.string().allow("")),
1650
- type: Joi.string().allow(""),
1651
- country: BillingPlatformModel.CountryRes(),
1652
- _id: Joi.string().allow(""),
1653
- name: Joi.string().allow(""),
1654
- description: Joi.string().allow(""),
1655
- amount: Joi.number(),
1656
- product_suite_id: Joi.string().allow(""),
1657
- created_at: Joi.string().allow(""),
1658
- modified_at: Joi.string().allow(""),
1659
- taxation: BillingPlatformModel.Taxation(),
1660
- one_time_fees: BillingPlatformModel.OneTimeFees(),
1661
- credit_line: BillingPlatformModel.CreditLine(),
1662
- current_status: Joi.string().allow(""),
1663
- channel_type: Joi.string().allow(""),
1664
- company_ids: Joi.array().items(Joi.string().allow("").allow(null)),
1665
- platform: Joi.string().allow("").allow(null),
1666
- activated_on: Joi.string().allow(""),
1667
- meta: BillingPlatformModel.PlanMeta(),
1668
- created_by: Joi.string().allow(""),
1669
- });
1670
- }
1671
-
1672
- /** @returns {SubscriptionTrialPeriod} */
1673
- static SubscriptionTrialPeriod() {
1674
- return Joi.object({
1675
- start_date: Joi.string().allow(""),
1676
- end_date: Joi.string().allow(""),
1677
- });
1678
- }
1679
-
1680
- /** @returns {EntityChargePrice} */
1681
- static EntityChargePrice() {
1682
- return Joi.object({
1683
- amount: Joi.number(),
1684
- currency_code: Joi.string().allow(""),
1685
- });
1686
- }
1687
-
1688
- /** @returns {OneTimeChargeItem} */
1689
- static OneTimeChargeItem() {
1690
- return Joi.object({
1691
- name: Joi.string().allow(""),
1692
- term: Joi.string().allow(""),
1693
- pricing_type: Joi.string().allow(""),
1694
- price: BillingPlatformModel.EntityChargePrice(),
1695
- capped_amount: Joi.number(),
1696
- is_test: Joi.boolean(),
1697
- metadata: Joi.any(),
1698
- });
1699
- }
1700
-
1701
- /** @returns {CreateOneTimeCharge} */
1702
- static CreateOneTimeCharge() {
1703
- return Joi.object({
1704
- name: Joi.string().allow(""),
1705
- charge: BillingPlatformModel.OneTimeChargeItem(),
1706
- is_test: Joi.boolean(),
1707
- return_url: Joi.string().allow(""),
1708
- });
1709
- }
1710
-
1711
- /** @returns {ChargeRecurring} */
1712
- static ChargeRecurring() {
1713
- return Joi.object({
1714
- interval: Joi.string().allow(""),
1715
- interval_time: Joi.number(),
1716
- });
1717
- }
1718
-
1719
- /** @returns {ChargeDetails} */
1720
- static ChargeDetails() {
1721
- return Joi.object({
1722
- _id: Joi.string().allow(""),
1723
- entity_type: Joi.string().allow(""),
1724
- entity_id: Joi.string().allow(""),
1725
- name: Joi.string().allow(""),
1726
- term: Joi.string().allow(""),
1727
- charge_type: Joi.string().allow(""),
1728
- pricing_type: Joi.string().allow(""),
1729
- price: BillingPlatformModel.EntityChargePrice(),
1730
- recurring: BillingPlatformModel.ChargeRecurring(),
1731
- status: Joi.string().allow(""),
1732
- capped_amount: Joi.number(),
1733
- activated_on: Joi.string().allow(""),
1734
- cancelled_on: Joi.string().allow(""),
1735
- billing_date: Joi.string().allow(""),
1736
- current_period: BillingPlatformModel.SubscriptionTrialPeriod(),
1737
- modified_at: Joi.string().allow(""),
1738
- created_at: Joi.string().allow(""),
1739
- is_test: Joi.boolean(),
1740
- company_id: Joi.string().allow(""),
1741
- meta: Joi.any(),
1742
- __v: Joi.number(),
1743
- });
1744
- }
1745
-
1746
- /** @returns {OneTimeChargeEntity} */
1747
- static OneTimeChargeEntity() {
1748
- return Joi.object({
1749
- term: Joi.string().allow(""),
1750
- charge_type: Joi.string().allow(""),
1751
- capped_amount: Joi.number(),
1752
- billing_date: Joi.string().allow("").allow(null),
1753
- created_at: Joi.string().allow(""),
1754
- modified_at: Joi.string().allow(""),
1755
- __v: Joi.number(),
1756
- _id: Joi.string().allow(""),
1757
- name: Joi.string().allow(""),
1758
- status: Joi.string().allow(""),
1759
- activated_on: Joi.string().allow("").allow(null),
1760
- cancelled_on: Joi.string().allow("").allow(null),
1761
- metadata: Joi.any(),
1762
- return_url: Joi.string().allow(""),
1763
- is_test: Joi.boolean(),
1764
- pricing_type: Joi.string().allow(""),
1765
- subscriber_id: Joi.string().allow(""),
1766
- entity_type: Joi.string().allow(""),
1767
- entity_id: Joi.string().allow(""),
1768
- meta: Joi.any(),
1769
- price: BillingPlatformModel.EntityChargePrice(),
1770
- });
1771
- }
1772
-
1773
- /** @returns {CreateOneTimeChargeResponse} */
1774
- static CreateOneTimeChargeResponse() {
1775
- return Joi.object({
1776
- charge: BillingPlatformModel.Charge(),
1777
- confirm_url: Joi.string().allow(""),
1778
- });
1779
- }
1780
-
1781
- /** @returns {Charge} */
1782
- static Charge() {
1783
- return Joi.object({
1784
- final_charge: BillingPlatformModel.OneTimeChargeEntity(),
1785
- });
1786
- }
1787
-
1788
- /** @returns {InvoiceDetailsStatusTrail} */
1789
- static InvoiceDetailsStatusTrail() {
1790
- return Joi.object({
1791
- _id: Joi.string().allow(""),
1792
- value: Joi.string().allow(""),
1793
- timestamp: Joi.string().allow(""),
1794
- });
1795
- }
1796
-
1797
- /** @returns {InvoiceItemsPlanRecurring} */
1798
- static InvoiceItemsPlanRecurring() {
1799
- return Joi.object({
1800
- interval: Joi.string().allow(""),
1801
- interval_count: Joi.number(),
1802
- });
1803
- }
1804
-
1805
- /** @returns {InvoiceItemsPlan} */
1806
- static InvoiceItemsPlan() {
1807
- return Joi.object({
1808
- recurring: BillingPlatformModel.InvoiceItemsPlanRecurring(),
1809
- is_trial_plan: Joi.boolean(),
1810
- plan_group: Joi.string().allow(""),
1811
- tag_lines: Joi.array().items(Joi.string().allow("")),
1812
- currency: Joi.string().allow(""),
1813
- is_active: Joi.boolean(),
1814
- is_visible: Joi.boolean(),
1815
- trial_period: Joi.number(),
1816
- addons: Joi.array().items(Joi.string().allow("")),
1817
- tags: Joi.array().items(Joi.string().allow("")),
1818
- type: Joi.string().allow(""),
1819
- country: Joi.string().allow(""),
1820
- _id: Joi.string().allow(""),
1821
- name: Joi.string().allow(""),
1822
- description: Joi.string().allow(""),
1823
- amount: Joi.number(),
1824
- product_suite_id: Joi.string().allow(""),
1825
- created_at: Joi.string().allow(""),
1826
- modified_at: Joi.string().allow(""),
1827
- });
1828
- }
1829
-
1830
- /** @returns {InvoiceItemsPeriod} */
1831
- static InvoiceItemsPeriod() {
1832
- return Joi.object({
1833
- start: Joi.string().allow(""),
1834
- end: Joi.string().allow(""),
1835
- });
1836
- }
1837
-
1838
- /** @returns {InvoiceItems} */
1839
- static InvoiceItems() {
1840
- return Joi.object({
1841
- _id: Joi.string().allow(""),
1842
- currency: Joi.string().allow(""),
1843
- plan: BillingPlatformModel.InvoiceItemsPlan(),
1844
- name: Joi.string().allow(""),
1845
- quantity: Joi.number(),
1846
- description: Joi.string().allow(""),
1847
- period: BillingPlatformModel.InvoiceItemsPeriod(),
1848
- unit_amount: Joi.number(),
1849
- amount: Joi.number(),
1850
- type: Joi.string().allow(""),
1851
- invoice_id: Joi.string().allow(""),
1852
- created_at: Joi.string().allow(""),
1853
- modified_at: Joi.string().allow(""),
1854
- });
1855
- }
1856
-
1857
- /** @returns {InvoicesDataClient} */
1858
- static InvoicesDataClient() {
1859
- return Joi.object({
1860
- name: Joi.string().allow(""),
1861
- email: Joi.string().allow(""),
1862
- phone: Joi.string().allow(""),
1863
- address_lines: Joi.array().items(Joi.string().allow("")),
1864
- });
1865
- }
1866
-
1867
- /** @returns {InvoicesDataPeriod} */
1868
- static InvoicesDataPeriod() {
1869
- return Joi.object({
1870
- start: Joi.string().allow(""),
1871
- end: Joi.string().allow(""),
1872
- });
1873
- }
1874
-
1875
- /** @returns {InvoicesDataPaymentMethod} */
1876
- static InvoicesDataPaymentMethod() {
1877
- return Joi.object({
1878
- pg_payment_method_id: Joi.string().allow(""),
1879
- });
1880
- }
1881
-
1882
- /** @returns {InvoicesData} */
1883
- static InvoicesData() {
1884
- return Joi.object({
1885
- _id: Joi.string().allow(""),
1886
- documents: Joi.any(),
1887
- payment: Joi.any(),
1888
- old_settlement: Joi.number().allow(null),
1889
- credit_balance: Joi.number().allow(null),
1890
- discount: Joi.any(),
1891
- taxation: Joi.any(),
1892
- credit_note_amount: Joi.number(),
1893
- client: BillingPlatformModel.InvoicesDataClient(),
1894
- auto_advance: Joi.boolean(),
1895
- currency: Joi.string().allow(""),
1896
- paid: Joi.boolean(),
1897
- attemp: Joi.number(),
1898
- collection_method: Joi.string().allow(""),
1899
- subscriber_id: Joi.string().allow(""),
1900
- invoice_url: Joi.string().allow(""),
1901
- number: Joi.string().allow(""),
1902
- pg_data: Joi.any(),
1903
- period: BillingPlatformModel.InvoicesDataPeriod(),
1904
- receipt_number: Joi.string().allow(""),
1905
- statement_descriptor: Joi.string().allow(""),
1906
- current_status: Joi.string().allow(""),
1907
- status_trail: Joi.array().items(
1908
- BillingPlatformModel.InvoiceDetailsStatusTrail()
1909
- ),
1910
- subtotal: Joi.number(),
1911
- total: Joi.number(),
1912
- subscription: Joi.string().allow(""),
1913
- next_action_time: Joi.string().allow(""),
1914
- created_at: Joi.string().allow(""),
1915
- modified_at: Joi.string().allow(""),
1916
- hash_identifier: Joi.string().allow(""),
1917
- payment_method: BillingPlatformModel.InvoicesDataPaymentMethod(),
1918
- invoice_items: Joi.array().items(BillingPlatformModel.InvoiceItems()),
1919
- invoice_type: Joi.string().allow(""),
1920
- });
1921
- }
1922
-
1923
- /** @returns {Invoices} */
1924
- static Invoices() {
1925
- return Joi.object({
1926
- data: Joi.array().items(BillingPlatformModel.InvoicesData()),
1927
- start: Joi.number(),
1928
- end: Joi.number(),
1929
- limit: Joi.number(),
1930
- page: Joi.number(),
1931
- total: Joi.number(),
1932
- });
1933
- }
1934
-
1935
- /** @returns {Phone} */
1936
- static Phone() {
1937
- return Joi.object({
1938
- phone_number: Joi.string().allow(""),
1939
- phone_country_code: Joi.string().allow(""),
1940
- });
1941
- }
1942
-
1943
- /** @returns {SubscriptionBillingAddress} */
1944
- static SubscriptionBillingAddress() {
1945
- return Joi.object({
1946
- country: Joi.string().allow(""),
1947
- country_code: Joi.string().allow(""),
1948
- state: Joi.string().allow(""),
1949
- city: Joi.string().allow(""),
1950
- line1: Joi.string().allow(""),
1951
- line2: Joi.string().allow(""),
1952
- postal_code: Joi.string().allow(""),
1953
- });
1954
- }
1955
-
1956
- /** @returns {SubscriptionCustomer} */
1957
- static SubscriptionCustomer() {
1958
- return Joi.object({
1959
- phone: BillingPlatformModel.Phone(),
1960
- billing_address: BillingPlatformModel.SubscriptionBillingAddress(),
1961
- _id: Joi.string().allow(""),
1962
- unique_id: Joi.string().allow(""),
1963
- type: Joi.string().allow(""),
1964
- name: Joi.string().allow(""),
1965
- email: Joi.string().allow(""),
1966
- created_at: Joi.string().allow(""),
1967
- modified_at: Joi.string().allow(""),
1968
- data: Joi.any(),
1969
- documents: Joi.any(),
1970
- consent: Joi.boolean(),
1971
- comms: Joi.boolean(),
1972
- credit_balance: Joi.number().allow(null),
1973
- business_country_info: BillingPlatformModel.BusinessCountryInfo(),
1974
- });
1975
- }
1976
-
1977
- /** @returns {SubscriptionCustomerCreate} */
1978
- static SubscriptionCustomerCreate() {
1979
- return Joi.object({
1980
- phone: BillingPlatformModel.Phone(),
1981
- billing_address: BillingPlatformModel.SubscriptionBillingAddress(),
1982
- unique_id: Joi.string().allow(""),
1983
- type: Joi.string().allow(""),
1984
- name: Joi.string().allow(""),
1985
- email: Joi.string().allow(""),
1986
- });
1987
- }
1988
-
1989
- /** @returns {SubscriptionCurrentPeriod} */
1990
- static SubscriptionCurrentPeriod() {
1991
- return Joi.object({
1992
- start: Joi.string().allow(""),
1993
- end: Joi.string().allow(""),
1994
- });
1995
- }
1996
-
1997
- /** @returns {SubscriptionPauseCollection} */
1998
- static SubscriptionPauseCollection() {
1999
- return Joi.object({
2000
- behavior: Joi.string().allow(""),
2001
- resume_at: Joi.string().allow(""),
2002
- });
2003
- }
2004
-
2005
- /** @returns {SubscriptionTrial} */
2006
- static SubscriptionTrial() {
2007
- return Joi.object({
2008
- start: Joi.string().allow(""),
2009
- end: Joi.string().allow(""),
2010
- });
2011
- }
2012
-
2013
- /** @returns {SubscriptionInvoiceSettings} */
2014
- static SubscriptionInvoiceSettings() {
2015
- return Joi.object({
2016
- generation: Joi.boolean(),
2017
- charging: Joi.boolean(),
2018
- });
2019
- }
2020
-
2021
- /** @returns {Subscription} */
2022
- static Subscription() {
2023
- return Joi.object({
2024
- meta: Joi.any(),
2025
- current_period: BillingPlatformModel.SubscriptionCurrentPeriod(),
2026
- pause_collection: BillingPlatformModel.SubscriptionPauseCollection(),
2027
- trial: BillingPlatformModel.SubscriptionTrial(),
2028
- invoice_settings: BillingPlatformModel.SubscriptionInvoiceSettings(),
2029
- is_active: Joi.boolean(),
2030
- cancel_at_period_end: Joi.boolean(),
2031
- _id: Joi.string().allow(""),
2032
- subscriber_id: Joi.string().allow(""),
2033
- plan_id: Joi.string().allow(""),
2034
- product_suite_id: Joi.string().allow(""),
2035
- is_eligible_for_plan_change: Joi.boolean(),
2036
- plan_data: BillingPlatformModel.Plan(),
2037
- current_status: Joi.string().allow(""),
2038
- collection_method: Joi.string().allow(""),
2039
- created_at: Joi.string().allow(""),
2040
- modified_at: Joi.string().allow(""),
2041
- latest_invoice: Joi.string().allow(""),
2042
- channel_type: Joi.string().allow(""),
2043
- freezed: Joi.boolean(),
2044
- cancel_at: Joi.string().allow(""),
2045
- canceled_at: Joi.string().allow(""),
2046
- });
2047
- }
2048
-
2049
- /** @returns {SubscriptionStatus} */
2050
- static SubscriptionStatus() {
2051
- return Joi.object({
2052
- is_enabled: Joi.boolean(),
2053
- subscription: BillingPlatformModel.Subscription(),
2054
- latest_invoice: BillingPlatformModel.InvoicesData(),
2055
- next_plan: BillingPlatformModel.Plan(),
2056
- current_subscriptions: Joi.array().items(
2057
- BillingPlatformModel.Subscription()
2058
- ),
2059
- mandate_amount: Joi.number(),
2060
- message: Joi.string().allow(""),
2061
- });
2062
- }
2063
-
2064
- /** @returns {SubscriptionLimitApplication} */
2065
- static SubscriptionLimitApplication() {
2066
- return Joi.object({
2067
- enabled: Joi.boolean(),
2068
- hard_limit: Joi.number(),
2069
- soft_limit: Joi.number(),
2070
- });
2071
- }
2072
-
2073
- /** @returns {SubscriptionLimitMarketplace} */
2074
- static SubscriptionLimitMarketplace() {
2075
- return Joi.object({
2076
- enabled: Joi.boolean(),
2077
- });
2078
- }
2079
-
2080
- /** @returns {SubscriptionLimitOtherPlatform} */
2081
- static SubscriptionLimitOtherPlatform() {
2082
- return Joi.object({
2083
- enabled: Joi.boolean(),
2084
- });
2085
- }
2086
-
2087
- /** @returns {SubscriptionLimitTeam} */
2088
- static SubscriptionLimitTeam() {
2089
- return Joi.object({
2090
- limit: Joi.number(),
2091
- });
2092
- }
2093
-
2094
- /** @returns {SubscriptionLimitProducts} */
2095
- static SubscriptionLimitProducts() {
2096
- return Joi.object({
2097
- bulk: Joi.boolean(),
2098
- limit: Joi.number(),
2099
- });
2100
- }
2101
-
2102
- /** @returns {SubscriptionLimitExtensions} */
2103
- static SubscriptionLimitExtensions() {
2104
- return Joi.object({
2105
- enabled: Joi.boolean(),
2106
- limit: Joi.number(),
2107
- });
2108
- }
2109
-
2110
- /** @returns {SubscriptionLimitIntegrations} */
2111
- static SubscriptionLimitIntegrations() {
2112
- return Joi.object({
2113
- enabled: Joi.boolean(),
2114
- limit: Joi.number(),
2115
- });
2116
- }
2117
-
2118
- /** @returns {SubscriptionLimit} */
2119
- static SubscriptionLimit() {
2120
- return Joi.object({
2121
- application: BillingPlatformModel.SubscriptionLimitApplication(),
2122
- marketplace: BillingPlatformModel.SubscriptionLimitMarketplace(),
2123
- other_platform: BillingPlatformModel.SubscriptionLimitOtherPlatform(),
2124
- team: BillingPlatformModel.SubscriptionLimitTeam(),
2125
- products: BillingPlatformModel.SubscriptionLimitProducts(),
2126
- extensions: BillingPlatformModel.SubscriptionLimitExtensions(),
2127
- integrations: BillingPlatformModel.SubscriptionLimitIntegrations(),
2128
- is_trial_plan: Joi.boolean(),
2129
- });
2130
- }
2131
-
2132
- /** @returns {IntentReq} */
2133
- static IntentReq() {
2134
- return Joi.object({
2135
- unique_external_id: Joi.string().allow(""),
2136
- plan_id: Joi.string().allow(""),
2137
- });
2138
- }
2139
-
2140
- /** @returns {PutIntentReq} */
2141
- static PutIntentReq() {
2142
- return Joi.object({
2143
- unique_external_id: Joi.string().allow(""),
2144
- setup_intent_id: Joi.string().allow(""),
2145
- payment_method_id: Joi.string().allow(""),
2146
- set_default: Joi.boolean(),
2147
- });
2148
- }
2149
-
2150
- /** @returns {SubscriptionActivateReq} */
2151
- static SubscriptionActivateReq() {
2152
- return Joi.object({
2153
- unique_id: Joi.string().allow(""),
2154
- type: Joi.string().allow(""),
2155
- product_suite: Joi.string().allow(""),
2156
- plan_id: Joi.string().allow(""),
2157
- payment_method: Joi.string().allow(""),
2158
- subscription_id: Joi.string().allow(""),
2159
- coupon: Joi.string().allow(""),
2160
- meta: Joi.any(),
2161
- });
2162
- }
2163
-
2164
- /** @returns {SubscriptionActivateRes} */
2165
- static SubscriptionActivateRes() {
2166
- return Joi.object({
2167
- success: Joi.boolean(),
2168
- data: BillingPlatformModel.Subscription(),
2169
- });
2170
- }
2171
-
2172
- /** @returns {CancelSubscriptionReq} */
2173
- static CancelSubscriptionReq() {
2174
- return Joi.object({
2175
- unique_id: Joi.string().allow(""),
2176
- type: Joi.string().allow(""),
2177
- product_suite: Joi.string().allow(""),
2178
- subscription_id: Joi.string().allow(""),
2179
- });
2180
- }
2181
-
2182
- /** @returns {CancelSubscriptionRes} */
2183
- static CancelSubscriptionRes() {
2184
- return Joi.object({
2185
- success: Joi.boolean(),
2186
- data: BillingPlatformModel.Subscription(),
2187
- });
2188
- }
2189
-
2190
- /** @returns {PlanStatusUpdateReq} */
2191
- static PlanStatusUpdateReq() {
2192
- return Joi.object({
2193
- plan_id: Joi.string().allow(""),
2194
- reason: Joi.string().allow(""),
2195
- seller_status: Joi.string().allow(""),
2196
- });
2197
- }
2198
-
2199
- /** @returns {SubscribePlan} */
2200
- static SubscribePlan() {
2201
- return Joi.object({
2202
- entity_type: Joi.string().allow(""),
2203
- collection_type: Joi.string().allow(""),
2204
- plan_id: Joi.string().allow(""),
2205
- callback_url: Joi.string().allow(""),
2206
- meta: BillingPlatformModel.Meta(),
2207
- });
2208
- }
2209
-
2210
- /** @returns {Meta} */
2211
- static Meta() {
2212
- return Joi.object({
2213
- subscribe: Joi.boolean(),
2214
- is_custom_plan: Joi.boolean(),
2215
- is_plan_upgrade: Joi.boolean(),
2216
- });
2217
- }
2218
-
2219
- /** @returns {SubscribePlanRes} */
2220
- static SubscribePlanRes() {
2221
- return Joi.object({
2222
- redirect_url: Joi.string().allow(""),
2223
- transaction_id: Joi.string().allow(""),
2224
- current_status: Joi.string().allow(""),
2225
- meta: BillingPlatformModel.Meta(),
2226
- });
2227
- }
2228
-
2229
- /** @returns {EntityDetail} */
2230
- static EntityDetail() {
2231
- return Joi.object({
2232
- entity: Joi.string().allow(""),
2233
- item: BillingPlatformModel.Subscription(),
2234
- });
2235
- }
2236
-
2237
- /** @returns {PaymentOptions} */
2238
- static PaymentOptions() {
2239
- return Joi.object({
2240
- _id: Joi.string().allow(""),
2241
- name: Joi.string().allow(""),
2242
- description: Joi.string().allow(""),
2243
- logo: Joi.string().allow(""),
2244
- aggregator_id: Joi.string().allow(""),
2245
- aggregator: Joi.string().allow(""),
2246
- created_at: Joi.string().allow(""),
2247
- modified_at: Joi.string().allow(""),
2248
- __v: Joi.number(),
2249
- });
2250
- }
2251
-
2252
- /** @returns {VerifyPaymentReq} */
2253
- static VerifyPaymentReq() {
2254
- return Joi.object({
2255
- razorpay_payment_id: Joi.string().allow(""),
2256
- razorpay_order_id: Joi.string().allow(""),
2257
- razorpay_signature: Joi.string().allow(""),
2258
- status_code: Joi.number(),
2259
- provider_type: Joi.string().allow(""),
2260
- });
2261
- }
2262
-
2263
- /** @returns {Documents} */
2264
- static Documents() {
2265
- return Joi.object({
2266
- pan: Joi.string().allow(""),
2267
- gst: Joi.string().allow(""),
2268
- });
2269
- }
2270
-
2271
- /** @returns {BillingAddress} */
2272
- static BillingAddress() {
2273
- return Joi.object({
2274
- country: Joi.string().allow(""),
2275
- state: Joi.string().allow(""),
2276
- city: Joi.string().allow(""),
2277
- line1: Joi.string().allow(""),
2278
- line2: Joi.string().allow(""),
2279
- postal_code: Joi.string().allow(""),
2280
- country_code: Joi.string().allow(""),
2281
- });
2282
- }
2283
-
2284
- /** @returns {Currency} */
2285
- static Currency() {
2286
- return Joi.object({
2287
- code: Joi.string().allow(""),
2288
- symbol: Joi.string().allow(""),
2289
- name: Joi.string().allow(""),
2290
- });
2291
- }
2292
-
2293
- /** @returns {BusinessCountryInfo} */
2294
- static BusinessCountryInfo() {
2295
- return Joi.object({
2296
- country: Joi.string().allow(""),
2297
- country_code: Joi.string().allow(""),
2298
- currency: BillingPlatformModel.Currency(),
2299
- timezone: Joi.string().allow(""),
2300
- });
2301
- }
2302
-
2303
- /** @returns {SubscriberData} */
2304
- static SubscriberData() {
2305
- return Joi.object({
2306
- pg_user_exists: Joi.boolean(),
2307
- id: Joi.string().allow(""),
2308
- pg_customer_id: Joi.string().allow(""),
2309
- default_payment_method: Joi.string().allow(""),
2310
- });
2311
- }
2312
-
2313
- /** @returns {Subscriber} */
2314
- static Subscriber() {
2315
- return Joi.object({
2316
- documents: BillingPlatformModel.Documents(),
2317
- phone: Joi.any(),
2318
- billing_address: BillingPlatformModel.BillingAddress(),
2319
- consent: Joi.boolean(),
2320
- comms: Joi.boolean(),
2321
- _id: Joi.string().allow(""),
2322
- type: Joi.string().allow(""),
2323
- unique_id: Joi.string().allow(""),
2324
- name: Joi.string().allow(""),
2325
- email: Joi.string().allow(""),
2326
- business_country_info: BillingPlatformModel.BusinessCountryInfo(),
2327
- created_at: Joi.string().allow(""),
2328
- modified_at: Joi.string().allow(""),
2329
- credit_balance: Joi.number().allow(null),
2330
- data: BillingPlatformModel.SubscriberData(),
2331
- });
2332
- }
2333
-
2334
- /** @returns {AuthorModifiedDetails} */
2335
- static AuthorModifiedDetails() {
2336
- return Joi.object({
2337
- first_name: Joi.string().allow(""),
2338
- last_name: Joi.string().allow(""),
2339
- is_admin: Joi.boolean(),
2340
- });
2341
- }
2342
-
2343
- /** @returns {Author} */
2344
- static Author() {
2345
- return Joi.object({
2346
- modified_by_details: BillingPlatformModel.AuthorModifiedDetails(),
2347
- created_by: Joi.string().allow(""),
2348
- modified_by: Joi.string().allow(""),
2349
- });
2350
- }
2351
-
2352
- /** @returns {EndingBalance} */
2353
- static EndingBalance() {
2354
- return Joi.object({
2355
- amount: Joi.number(),
2356
- old_entry_ref: Joi.string().allow("").allow(null),
2357
- });
2358
- }
2359
-
2360
- /** @returns {PaymentData} */
2361
- static PaymentData() {
2362
- return Joi.object({
2363
- transaction_id: Joi.string().allow(""),
2364
- aggregator: Joi.string().allow(""),
2365
- aggregator_order_id: Joi.string().allow(""),
2366
- receipt_date: Joi.string().allow(""),
2367
- unique_transaction_reference: Joi.string().allow(""),
2368
- });
2369
- }
2370
-
2371
- /** @returns {CreditTransaction} */
2372
- static CreditTransaction() {
2373
- return Joi.object({
2374
- entity: Joi.any(),
2375
- author: BillingPlatformModel.Author(),
2376
- _id: Joi.string().allow(""),
2377
- amount: Joi.number(),
2378
- currency: Joi.string().allow(""),
2379
- subscriber_id: Joi.string().allow(""),
2380
- description: Joi.string().allow(""),
2381
- is_test: Joi.string().allow(""),
2382
- ending_balance: BillingPlatformModel.EndingBalance(),
2383
- payment: BillingPlatformModel.PaymentData(),
2384
- type: Joi.string().allow(""),
2385
- created_at: Joi.string().allow(""),
2386
- modified_at: Joi.string().allow(""),
2387
- });
2388
- }
2389
-
2390
- /** @returns {VerifyPaymentData} */
2391
- static VerifyPaymentData() {
2392
- return Joi.object({
2393
- success: Joi.boolean(),
2394
- subscriber: BillingPlatformModel.Subscriber(),
2395
- credit_transaction: BillingPlatformModel.CreditTransaction(),
2396
- });
2397
- }
2398
-
2399
- /** @returns {VerifyPaymentRes} */
2400
- static VerifyPaymentRes() {
2401
- return Joi.object({
2402
- status: Joi.string().allow(""),
2403
- data: BillingPlatformModel.VerifyPaymentData(),
2404
- });
2405
- }
2406
-
2407
- /** @returns {DefaultMerchants} */
2408
- static DefaultMerchants() {
2409
- return Joi.object({
2410
- stripe: Joi.string().allow(""),
2411
- });
2412
- }
2413
-
2414
- /** @returns {GlobalSettingsPayment} */
2415
- static GlobalSettingsPayment() {
2416
- return Joi.object({
2417
- default_merchants: BillingPlatformModel.DefaultMerchants(),
2418
- });
2419
- }
2420
-
2421
- /** @returns {GlobalSettingsData} */
2422
- static GlobalSettingsData() {
2423
- return Joi.object({
2424
- payment: BillingPlatformModel.GlobalSettingsPayment(),
2425
- freeze_panel: Joi.boolean(),
2426
- _id: Joi.string().allow(""),
2427
- created_at: Joi.string().allow(""),
2428
- modified_at: Joi.string().allow(""),
2429
- });
2430
- }
2431
-
2432
- /** @returns {GlobalSettings} */
2433
- static GlobalSettings() {
2434
- return Joi.object({
2435
- status: Joi.string().allow(""),
2436
- data: BillingPlatformModel.GlobalSettingsData(),
2437
- });
2438
- }
2439
-
2440
- /** @returns {MethodChecks} */
2441
- static MethodChecks() {
2442
- return Joi.object({
2443
- address_line1_check: Joi.string().allow(""),
2444
- address_postal_code_check: Joi.string().allow(""),
2445
- cvc_check: Joi.string().allow(""),
2446
- });
2447
- }
2448
-
2449
- /** @returns {MethodNetworks} */
2450
- static MethodNetworks() {
2451
- return Joi.object({
2452
- available: Joi.array().items(Joi.string().allow("")),
2453
- preferred: Joi.string().allow("").allow(null),
2454
- });
2455
- }
2456
-
2457
- /** @returns {MethodSecureUsage} */
2458
- static MethodSecureUsage() {
2459
- return Joi.object({
2460
- supported: Joi.boolean(),
2461
- });
2462
- }
2463
-
2464
- /** @returns {MethodDetails} */
2465
- static MethodDetails() {
2466
- return Joi.object({
2467
- id: Joi.string().allow(""),
2468
- type: Joi.string().allow(""),
2469
- mandate_available: Joi.boolean(),
2470
- mandate_amount: Joi.number(),
2471
- pg_payment_method_id: Joi.string().allow(""),
2472
- is_default: Joi.boolean(),
2473
- data: BillingPlatformModel.SubscriptionMethodData(),
2474
- });
2475
- }
2476
-
2477
- /** @returns {SubscriptionMethodData} */
2478
- static SubscriptionMethodData() {
2479
- return Joi.object({
2480
- brand: Joi.string().allow(""),
2481
- checks: BillingPlatformModel.MethodChecks(),
2482
- country: Joi.string().allow(""),
2483
- exp_month: Joi.number(),
2484
- exp_year: Joi.number(),
2485
- fingerprint: Joi.string().allow(""),
2486
- funding: Joi.string().allow(""),
2487
- generated_from: Joi.string().allow("").allow(null),
2488
- last4: Joi.string().allow(""),
2489
- networks: BillingPlatformModel.MethodNetworks(),
2490
- three_d_secure_usage: BillingPlatformModel.MethodSecureUsage(),
2491
- wallet: Joi.string().allow("").allow(null),
2492
- name: Joi.string().allow(""),
2493
- is_default: Joi.boolean(),
2494
- });
2495
- }
2496
-
2497
- /** @returns {SubscriptionMethods} */
2498
- static SubscriptionMethods() {
2499
- return Joi.object({
2500
- success: Joi.boolean(),
2501
- data: Joi.array().items(BillingPlatformModel.MethodDetails()),
2502
- });
2503
- }
2504
-
2505
- /** @returns {ConfigPublicKey} */
2506
- static ConfigPublicKey() {
2507
- return Joi.object({
2508
- public_key: Joi.string().allow(""),
2509
- });
2510
- }
2511
-
2512
- /** @returns {ConfigRes} */
2513
- static ConfigRes() {
2514
- return Joi.object({
2515
- success: Joi.boolean(),
2516
- aggregator: Joi.string().allow(""),
2517
- config: BillingPlatformModel.ConfigPublicKey(),
2518
- });
2519
- }
2520
-
2521
- /** @returns {PlanChangeData} */
2522
- static PlanChangeData() {
2523
- return Joi.object({
2524
- total: Joi.number(),
2525
- credit_note_amount: Joi.number(),
2526
- settlement: Joi.number(),
2527
- taxable_amount: Joi.number(),
2528
- gst_amount: Joi.number(),
2529
- gross_total: Joi.number(),
2530
- gst: Joi.number(),
2531
- discount: Joi.number(),
2532
- });
2533
- }
2534
-
2535
- /** @returns {PlanChangeDetails} */
2536
- static PlanChangeDetails() {
2537
- return Joi.object({
2538
- status: Joi.string().allow(""),
2539
- data: BillingPlatformModel.PlanChangeData(),
2540
- });
2541
- }
2542
-
2543
- /** @returns {TransactionMeta} */
2544
- static TransactionMeta() {
2545
- return Joi.object({
2546
- invoice_id: Joi.string().allow(""),
2547
- });
2548
- }
2549
-
2550
- /** @returns {PaymentTransactionDetails} */
2551
- static PaymentTransactionDetails() {
240
+ class BillingPlatformModel {
241
+ /** @returns {SubscriptionChargeRes} */
242
+ static SubscriptionChargeRes() {
2552
243
  return Joi.object({
2553
- aggregator: Joi.any(),
2554
- currency: Joi.string().allow(""),
2555
- current_status: Joi.string().allow(""),
2556
244
  _id: Joi.string().allow(""),
2557
- subscriber_id: Joi.string().allow(""),
2558
- amount: Joi.number(),
245
+ product_suit_id: Joi.string().allow(""),
246
+ entity_id: Joi.string().allow(""),
2559
247
  entity_type: Joi.string().allow(""),
2560
- collection_type: Joi.string().allow(""),
2561
- meta: BillingPlatformModel.TransactionMeta(),
248
+ name: Joi.string().allow(""),
249
+ status: Joi.string().allow(""),
250
+ trial_days: Joi.number(),
251
+ activated_on: Joi.string().allow(""),
252
+ cancelled_on: Joi.string().allow(""),
253
+ is_test: Joi.boolean(),
2562
254
  created_at: Joi.string().allow(""),
2563
255
  modified_at: Joi.string().allow(""),
256
+ company_id: Joi.string().allow(""),
257
+ line_items: Joi.array().items(Joi.any()),
2564
258
  });
2565
259
  }
2566
260
 
2567
- /** @returns {PaymentItems} */
2568
- static PaymentItems() {
2569
- return Joi.object({
2570
- name: Joi.string().allow(""),
2571
- code: Joi.string().allow(""),
2572
- aggregator: Joi.string().allow(""),
2573
- });
2574
- }
2575
-
2576
- /** @returns {GetPaymentOptions} */
2577
- static GetPaymentOptions() {
2578
- return Joi.object({
2579
- payment_options: Joi.array().items(BillingPlatformModel.PaymentItems()),
2580
- });
2581
- }
2582
-
2583
- /** @returns {TopupReq} */
2584
- static TopupReq() {
2585
- return Joi.object({
2586
- amount: Joi.number(),
2587
- currency: Joi.string().allow(""),
2588
- provider_type: Joi.string().allow(""),
2589
- });
2590
- }
2591
-
2592
- /** @returns {SetupMandateReq} */
2593
- static SetupMandateReq() {
2594
- return Joi.object({
2595
- intent_id: Joi.string().allow(""),
2596
- payment_method_id: Joi.string().allow(""),
2597
- });
2598
- }
2599
-
2600
- /** @returns {SetupPaymentReq} */
2601
- static SetupPaymentReq() {
2602
- return Joi.object({
2603
- payment_method: Joi.string().allow(""),
2604
- payment_id: Joi.string().allow(""),
2605
- plan_id: Joi.string().allow(""),
2606
- invoice_id: Joi.string().allow(""),
2607
- });
2608
- }
2609
-
2610
- /** @returns {SubscriptionRenewReq} */
2611
- static SubscriptionRenewReq() {
261
+ /** @returns {ChargeDetails} */
262
+ static ChargeDetails() {
2612
263
  return Joi.object({
2613
- invoice_id: Joi.string().allow(""),
264
+ _id: Joi.string().allow(""),
2614
265
  entity_type: Joi.string().allow(""),
2615
- collection_type: Joi.string().allow(""),
2616
- callback_url: Joi.string().allow(""),
2617
- meta: BillingPlatformModel.RenewMeta(),
2618
- });
2619
- }
2620
-
2621
- /** @returns {RenewMeta} */
2622
- static RenewMeta() {
2623
- return Joi.object({
2624
- invoice_payment: Joi.boolean(),
2625
- renew: Joi.boolean(),
2626
- });
2627
- }
2628
-
2629
- /** @returns {SubscriptionMethodsReq} */
2630
- static SubscriptionMethodsReq() {
2631
- return Joi.object({
2632
- unique_external_id: Joi.string().allow(""),
2633
- setup_intent_id: Joi.string().allow(""),
2634
- pg_payment_method_id: Joi.string().allow(""),
2635
- set_default: Joi.boolean(),
2636
- });
2637
- }
2638
-
2639
- /** @returns {CreditTransactionResponse} */
2640
- static CreditTransactionResponse() {
2641
- return Joi.object({
2642
- total: Joi.number(),
2643
- limit: Joi.number(),
2644
- page: Joi.number(),
2645
- pages: Joi.number(),
2646
- items: Joi.array().items(BillingPlatformModel.CreditTransaction()),
2647
- });
2648
- }
2649
-
2650
- /** @returns {DowngradePlanReq} */
2651
- static DowngradePlanReq() {
2652
- return Joi.object({
2653
- unique_id: Joi.string().allow(""),
2654
- type: Joi.string().allow(""),
2655
- product_suite: Joi.string().allow(""),
2656
- plan_id: Joi.string().allow(""),
2657
- reason: Joi.string().allow(""),
2658
- platform: Joi.string().allow("").allow(null),
266
+ entity_id: Joi.string().allow(""),
267
+ name: Joi.string().allow(""),
268
+ term: Joi.string().allow(""),
269
+ charge_type: Joi.string().allow(""),
270
+ pricing_type: Joi.string().allow(""),
271
+ price: BillingPlatformModel.EntityChargePrice(),
272
+ recurring: BillingPlatformModel.ChargeRecurring(),
273
+ status: Joi.string().allow(""),
274
+ capped_amount: Joi.number(),
275
+ activated_on: Joi.string().allow(""),
276
+ cancelled_on: Joi.string().allow(""),
277
+ billing_date: Joi.string().allow(""),
278
+ current_period: BillingPlatformModel.SubscriptionTrialPeriod(),
279
+ modified_at: Joi.string().allow(""),
280
+ created_at: Joi.string().allow(""),
281
+ is_test: Joi.boolean(),
282
+ company_id: Joi.string().allow(""),
283
+ meta: Joi.any(),
284
+ __v: Joi.number(),
2659
285
  });
2660
286
  }
2661
287
 
2662
- /** @returns {Taxation} */
2663
- static Taxation() {
288
+ /** @returns {ResourceNotFound} */
289
+ static ResourceNotFound() {
2664
290
  return Joi.object({
2665
- gst: Joi.number(),
291
+ message: Joi.string().allow(""),
292
+ code: Joi.any(),
293
+ success: Joi.any(),
2666
294
  });
2667
295
  }
2668
296
 
2669
- /** @returns {OneTimeFees} */
2670
- static OneTimeFees() {
297
+ /** @returns {CreateOneTimeCharge} */
298
+ static CreateOneTimeCharge() {
2671
299
  return Joi.object({
2672
- developement: Joi.number().allow(null),
2673
- marketing: Joi.number().allow(null),
300
+ name: Joi.string().allow(""),
301
+ charge: BillingPlatformModel.OneTimeChargeItem(),
302
+ is_test: Joi.boolean(),
303
+ return_url: Joi.string().allow(""),
2674
304
  });
2675
305
  }
2676
306
 
2677
- /** @returns {CreditLine} */
2678
- static CreditLine() {
307
+ /** @returns {CreateOneTimeChargeResponse} */
308
+ static CreateOneTimeChargeResponse() {
2679
309
  return Joi.object({
2680
- is_active: Joi.boolean(),
310
+ charge: BillingPlatformModel.Charge(),
311
+ confirm_url: Joi.string().allow(""),
2681
312
  });
2682
313
  }
2683
314
 
2684
- /** @returns {StatusMessage} */
2685
- static StatusMessage() {
315
+ /** @returns {BadRequest} */
316
+ static BadRequest() {
2686
317
  return Joi.object({
2687
- status: Joi.string().allow(""),
2688
318
  message: Joi.string().allow(""),
2689
- success: Joi.boolean(),
2690
- code: Joi.string().allow(""),
2691
- });
2692
- }
2693
-
2694
- /** @returns {PaymentCollectReq} */
2695
- static PaymentCollectReq() {
2696
- return Joi.object({
2697
- transaction_id: Joi.string().allow(""),
2698
- credit_balance: Joi.boolean().allow(null),
2699
- payment_mode: Joi.string().allow(""),
2700
- payment_method: Joi.string().allow(""),
2701
- invoice_id: Joi.string().allow(""),
2702
- });
2703
- }
2704
-
2705
- /** @returns {SubscriptionRenewResMeta} */
2706
- static SubscriptionRenewResMeta() {
2707
- return Joi.object({
2708
- invoice_payment: Joi.boolean(),
2709
- renew: Joi.boolean(),
2710
319
  });
2711
320
  }
2712
321
 
2713
- /** @returns {SubscriptionRenewRes} */
2714
- static SubscriptionRenewRes() {
322
+ /** @returns {CreateSubscriptionCharge} */
323
+ static CreateSubscriptionCharge() {
2715
324
  return Joi.object({
2716
- redirect_url: Joi.string().allow(""),
2717
- transaction_id: Joi.string().allow(""),
2718
- current_status: Joi.string().allow(""),
2719
- meta: BillingPlatformModel.SubscriptionRenewResMeta(),
325
+ name: Joi.string().allow("").required(),
326
+ trial_days: Joi.number(),
327
+ line_items: Joi.array()
328
+ .items(BillingPlatformModel.ChargeLineItem())
329
+ .required(),
330
+ is_test: Joi.boolean(),
331
+ return_url: Joi.string().allow("").required(),
2720
332
  });
2721
333
  }
2722
334
 
2723
- /** @returns {SetupIntentRes} */
2724
- static SetupIntentRes() {
335
+ /** @returns {CreateSubscriptionResponse} */
336
+ static CreateSubscriptionResponse() {
2725
337
  return Joi.object({
2726
- success: Joi.boolean(),
2727
- data: BillingPlatformModel.SetupIntentData(),
338
+ subscription: BillingPlatformModel.EntitySubscription(),
339
+ confirm_url: Joi.string().allow(""),
2728
340
  });
2729
341
  }
2730
342
 
2731
- /** @returns {SetupIntentData} */
2732
- static SetupIntentData() {
343
+ /** @returns {EntityChargePrice} */
344
+ static EntityChargePrice() {
2733
345
  return Joi.object({
2734
- id: Joi.string().allow(""),
2735
- client_secret: Joi.string().allow(""),
2736
- customer: Joi.string().allow(""),
2737
- status: Joi.string().allow(""),
346
+ amount: Joi.number(),
347
+ currency_code: Joi.string().allow(""),
2738
348
  });
2739
349
  }
2740
350
 
2741
- /** @returns {SetupPayment} */
2742
- static SetupPayment() {
351
+ /** @returns {ChargeRecurring} */
352
+ static ChargeRecurring() {
2743
353
  return Joi.object({
2744
- id: Joi.string().allow(""),
2745
- status: Joi.string().allow(""),
2746
- customer: Joi.string().allow(""),
2747
- client_secret: Joi.string().allow(""),
2748
- payment_method: Joi.string().allow(""),
2749
- mandate: Joi.string().allow(""),
2750
- payment_method_options: BillingPlatformModel.PaymentMethodOptions(),
354
+ interval: Joi.string().allow(""),
355
+ interval_time: Joi.number(),
2751
356
  });
2752
357
  }
2753
358
 
2754
- /** @returns {PaymentMethodOptions} */
2755
- static PaymentMethodOptions() {
359
+ /** @returns {SubscriptionTrialPeriod} */
360
+ static SubscriptionTrialPeriod() {
2756
361
  return Joi.object({
2757
- card: BillingPlatformModel.Card(),
362
+ start_date: Joi.string().allow(""),
363
+ end_date: Joi.string().allow(""),
2758
364
  });
2759
365
  }
2760
366
 
2761
- /** @returns {Card} */
2762
- static Card() {
367
+ /** @returns {Charge} */
368
+ static Charge() {
2763
369
  return Joi.object({
2764
- mandate_options: BillingPlatformModel.MandateOptions(),
370
+ final_charge: BillingPlatformModel.OneTimeChargeEntity(),
2765
371
  });
2766
372
  }
2767
373
 
2768
- /** @returns {MandateOptions} */
2769
- static MandateOptions() {
374
+ /** @returns {OneTimeChargeItem} */
375
+ static OneTimeChargeItem() {
2770
376
  return Joi.object({
2771
- amount: Joi.number(),
377
+ name: Joi.string().allow(""),
378
+ term: Joi.string().allow(""),
379
+ pricing_type: Joi.string().allow(""),
380
+ price: BillingPlatformModel.EntityChargePrice(),
381
+ capped_amount: Joi.number(),
382
+ is_test: Joi.boolean(),
383
+ metadata: Joi.any(),
2772
384
  });
2773
385
  }
2774
386
 
2775
- /** @returns {Message} */
2776
- static Message() {
387
+ /** @returns {ChargeLineItem} */
388
+ static ChargeLineItem() {
2777
389
  return Joi.object({
2778
- message: Joi.string().allow(""),
390
+ name: Joi.string().allow("").required(),
391
+ term: Joi.string().allow("").required(),
392
+ pricing_type: Joi.string().allow("").required(),
393
+ price: BillingPlatformModel.EntityChargePrice().required(),
394
+ recurring: BillingPlatformModel.EntityChargeRecurring(),
395
+ capped_amount: Joi.number(),
396
+ trial_days: Joi.number(),
397
+ is_test: Joi.boolean(),
398
+ metadata: Joi.any(),
2779
399
  });
2780
400
  }
2781
401
 
2782
- /** @returns {TopupRes} */
2783
- static TopupRes() {
402
+ /** @returns {EntitySubscription} */
403
+ static EntitySubscription() {
2784
404
  return Joi.object({
405
+ _id: Joi.string().allow(""),
406
+ product_suit_id: Joi.string().allow(""),
407
+ entity_id: Joi.string().allow(""),
408
+ entity_type: Joi.string().allow(""),
409
+ name: Joi.string().allow(""),
2785
410
  status: Joi.string().allow(""),
2786
- aggregator_order_id: Joi.string().allow(""),
2787
- amount: Joi.number(),
2788
- currency: Joi.string().allow(""),
2789
- transaction_id: Joi.string().allow(""),
2790
- });
2791
- }
2792
-
2793
- /** @returns {CancelTopupReq} */
2794
- static CancelTopupReq() {
2795
- return Joi.object({
2796
- order_id: Joi.string().allow(""),
411
+ trial_days: Joi.number(),
412
+ is_test: Joi.boolean(),
413
+ created_at: Joi.string().allow(""),
414
+ modified_at: Joi.string().allow(""),
415
+ subscriber_id: Joi.string().allow(""),
416
+ line_items: Joi.array().items(BillingPlatformModel.EntityChargeDetails()),
417
+ return_url: Joi.string().allow(""),
2797
418
  });
2798
419
  }
2799
420
 
2800
- /** @returns {CancelTopupRes} */
2801
- static CancelTopupRes() {
421
+ /** @returns {OneTimeChargeEntity} */
422
+ static OneTimeChargeEntity() {
2802
423
  return Joi.object({
2803
- _id: Joi.string().allow(""),
2804
- subscriber_id: Joi.string().allow(""),
2805
- amount: Joi.number(),
2806
- currency: Joi.string().allow(""),
2807
- aggregator: Joi.string().allow(""),
2808
- aggregator_order_id: Joi.string().allow(""),
424
+ term: Joi.string().allow(""),
425
+ charge_type: Joi.string().allow(""),
426
+ capped_amount: Joi.number(),
427
+ billing_date: Joi.string().allow("").allow(null),
2809
428
  created_at: Joi.string().allow(""),
2810
429
  modified_at: Joi.string().allow(""),
2811
430
  __v: Joi.number(),
2812
- aggregator_status: Joi.string().allow(""),
2813
- current_status: Joi.string().allow(""),
2814
- });
2815
- }
2816
-
2817
- /** @returns {DefaultReq} */
2818
- static DefaultReq() {
2819
- return Joi.object({
2820
- payment_method_id: Joi.string().allow(""),
431
+ _id: Joi.string().allow(""),
432
+ name: Joi.string().allow(""),
433
+ status: Joi.string().allow(""),
434
+ activated_on: Joi.string().allow("").allow(null),
435
+ cancelled_on: Joi.string().allow("").allow(null),
436
+ metadata: Joi.any(),
437
+ return_url: Joi.string().allow(""),
438
+ is_test: Joi.boolean(),
439
+ pricing_type: Joi.string().allow(""),
440
+ subscriber_id: Joi.string().allow(""),
441
+ entity_type: Joi.string().allow(""),
442
+ entity_id: Joi.string().allow(""),
443
+ meta: Joi.any(),
444
+ price: BillingPlatformModel.EntityChargePrice(),
2821
445
  });
2822
446
  }
2823
447
 
@@ -2828,34 +452,6 @@ class BillingPlatformModel {
2828
452
  });
2829
453
  }
2830
454
 
2831
- /** @returns {ChargeLineItem} */
2832
- static ChargeLineItem() {
2833
- return Joi.object({
2834
- name: Joi.string().allow("").required(),
2835
- term: Joi.string().allow("").required(),
2836
- pricing_type: Joi.string().allow("").required(),
2837
- price: BillingPlatformModel.EntityChargePrice().required(),
2838
- recurring: BillingPlatformModel.EntityChargeRecurring(),
2839
- capped_amount: Joi.number(),
2840
- trial_days: Joi.number(),
2841
- is_test: Joi.boolean(),
2842
- metadata: Joi.any(),
2843
- });
2844
- }
2845
-
2846
- /** @returns {CreateSubscriptionCharge} */
2847
- static CreateSubscriptionCharge() {
2848
- return Joi.object({
2849
- name: Joi.string().allow("").required(),
2850
- trial_days: Joi.number(),
2851
- line_items: Joi.array()
2852
- .items(BillingPlatformModel.ChargeLineItem())
2853
- .required(),
2854
- is_test: Joi.boolean(),
2855
- return_url: Joi.string().allow("").required(),
2856
- });
2857
- }
2858
-
2859
455
  /** @returns {EntityChargeDetails} */
2860
456
  static EntityChargeDetails() {
2861
457
  return Joi.object({
@@ -2884,32 +480,5 @@ class BillingPlatformModel {
2884
480
  __v: Joi.number(),
2885
481
  });
2886
482
  }
2887
-
2888
- /** @returns {EntitySubscription} */
2889
- static EntitySubscription() {
2890
- return Joi.object({
2891
- _id: Joi.string().allow(""),
2892
- product_suit_id: Joi.string().allow(""),
2893
- entity_id: Joi.string().allow(""),
2894
- entity_type: Joi.string().allow(""),
2895
- name: Joi.string().allow(""),
2896
- status: Joi.string().allow(""),
2897
- trial_days: Joi.number(),
2898
- is_test: Joi.boolean(),
2899
- created_at: Joi.string().allow(""),
2900
- modified_at: Joi.string().allow(""),
2901
- subscriber_id: Joi.string().allow(""),
2902
- line_items: Joi.array().items(BillingPlatformModel.EntityChargeDetails()),
2903
- return_url: Joi.string().allow(""),
2904
- });
2905
- }
2906
-
2907
- /** @returns {CreateSubscriptionResponse} */
2908
- static CreateSubscriptionResponse() {
2909
- return Joi.object({
2910
- subscription: BillingPlatformModel.EntitySubscription(),
2911
- confirm_url: Joi.string().allow(""),
2912
- });
2913
- }
2914
483
  }
2915
484
  module.exports = BillingPlatformModel;