tango-app-api-payment-subscription 3.0.14-dev → 3.0.14

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,153 +1,250 @@
1
1
  import joi from 'joi';
2
2
 
3
+ export const validateBillingSchema = joi.object( {
4
+ clientId: joi.string().required(),
5
+ gstNo: joi.string().required(),
6
+ billingAddress: joi.string().required(),
7
+ companyName: joi.string().required(),
8
+ PlaceOfSupply: joi.string().required(),
9
+
10
+ } );
11
+
3
12
  export const validateBillingParams = {
4
- body: joi.object( {
5
- clientId: joi.string().required(),
6
- gstNo: joi.string().required(),
7
- billingAddress: joi.string().required(),
8
- } ),
13
+ body: validateBillingSchema,
9
14
  };
10
15
 
16
+ export const validateBrandSchema = joi.object( {
17
+ clientId: joi.string().required(),
18
+ } );
19
+
11
20
  export const validateBrandParams = {
12
- params: joi.object( {
13
- clientId: joi.string().required(),
14
- } ),
21
+ params: validateBrandSchema,
15
22
  };
16
23
 
24
+ export const validateStoreSchema = joi.object( {
25
+ clientId: joi.string().required(),
26
+ } );
27
+
17
28
  export const validateStoreParams = {
18
- query: joi.object( {
19
- clientId: joi.string().required(),
20
- } ),
29
+ query: validateStoreSchema,
21
30
  };
22
31
 
32
+ export const validateProductListSchema = joi.object( {
33
+ clientId: joi.string().required(),
34
+ sortColumn: joi.string().required(),
35
+ sortBy: joi.number().required(),
36
+ } );
37
+
38
+ export const validateProductListParams = {
39
+ query: validateProductListSchema,
40
+ };
41
+
42
+ export const validateProductsSchema = joi.object( {
43
+ camaraPerSqft: joi.string().required(),
44
+ currencyType: joi.string().required(),
45
+ planName: joi.string().required(),
46
+ products: joi.array().required(),
47
+ storesCount: joi.string().required(),
48
+ } );
49
+
23
50
  export const validateProducts = {
24
- body: joi.object( {
25
- camaraPerSqft: joi.string().required(),
26
- currencyType: joi.string().required(),
27
- planName: joi.string().required(),
28
- products: joi.array().required(),
29
- storesCount: joi.string().required(),
30
- } ),
51
+ body: validateProductsSchema,
31
52
  };
32
53
 
54
+ export const validateunsubscribeSchema = joi.object( {
55
+ reason: joi.string().required(),
56
+ description: joi.string().optional().empty( '' ),
57
+ clientId: joi.string().required(),
58
+ } );
59
+
33
60
  export const validateunsubscribeParams = {
34
- body: joi.object( {
35
- reason: joi.string().required(),
36
- description: joi.string().required(),
37
- clientId: joi.string().required(),
38
- } ),
61
+ body: validateunsubscribeSchema,
39
62
  };
40
63
 
64
+ export const validateTrialExtendandSubscibeSchema = joi.object( {
65
+ product: joi.string().required(),
66
+ clientId: joi.string().required(),
67
+ } );
68
+
41
69
  export const validateTrialExtendandSubscibeParams = {
42
- body: joi.object( {
43
- product: joi.string().required(),
44
- clientId: joi.string().required(),
45
- } ),
70
+ body: validateTrialExtendandSubscibeSchema,
46
71
  };
47
72
 
73
+ export const validateSubscibeSchema = joi.object( {
74
+ product: joi.array().required(),
75
+ clientId: joi.string().required(),
76
+ } );
77
+
48
78
  export const validateSubscibeParams = {
49
- body: joi.object( {
50
- product: joi.array().required(),
51
- clientId: joi.string().required(),
52
- } ),
79
+ body: validateSubscibeSchema,
53
80
  };
54
81
 
82
+ export const validateTrialandUnsubscribeSchema = joi.object( {
83
+ id: joi.string().required(),
84
+ type: joi.string().required(),
85
+ } );
86
+
55
87
  export const validateTrialandUnsubscribeParams = {
56
- body: joi.object( {
57
- id: joi.string().required(),
58
- type: joi.string().required(),
59
- } ),
88
+ body: validateTrialandUnsubscribeSchema,
60
89
  };
61
90
 
91
+ export const validateTrialExtendRequestSchema = joi.object( {
92
+ clientId: joi.string().required(),
93
+ days: joi.number().required(),
94
+ product: joi.string().required(),
95
+ } );
62
96
 
63
97
  export const validateTrialExtendRequestParams = {
64
- body: joi.object( {
65
- clientId: joi.string().required(),
66
- days: joi.number().required(),
67
- product: joi.string().required(),
68
- } ),
98
+ body: validateTrialExtendRequestSchema,
69
99
  };
70
100
 
101
+ export const validateStoreViewSchema = joi.object( {
102
+ limit: joi.number().required(),
103
+ offset: joi.number().required(),
104
+ clientId: joi.string().required(),
105
+ sortColumn: joi.string().optional().empty( '' ),
106
+ sortBy: joi.number().optional().empty( '' ),
107
+ searchValue: joi.string().optional().empty( '' ),
108
+ product: joi.array().optional().empty(),
109
+ store: joi.array().optional().empty(),
110
+ location: joi.array().optional().empty(),
111
+ } );
71
112
 
72
113
  export const validateStoreViewParams = {
73
- body: joi.object( {
74
- limit: joi.number().required(),
75
- offset: joi.number().required(),
76
- clientId: joi.string().required(),
77
- sortColumn: joi.string().optional().empty( '' ),
78
- sortBy: joi.number().optional().empty( '' ),
79
- searchValue: joi.string().optional().empty( '' ),
80
- product: joi.array().optional().empty(),
81
- store: joi.array().optional().empty(),
82
- location: joi.array().optional().empty(),
83
- } ),
114
+ body: validateStoreViewSchema,
84
115
  };
85
116
 
117
+ export const validateAddStoreProductSchema = joi.object( {
118
+ clientId: joi.string().required(),
119
+ store: joi.array().required().empty(),
120
+ product: joi.array().required(),
121
+ selectAll: joi.boolean().optional(),
122
+ } );
123
+
86
124
  export const validateAddStoreProductParams = {
87
- body: joi.object( {
88
- clientId: joi.string().required(),
89
- store: joi.array().required().empty(),
90
- product: joi.array().required(),
91
- selectAll: joi.boolean().optional(),
92
- } ),
125
+ body: validateAddStoreProductSchema,
93
126
  };
94
127
 
128
+ export const validateInvoiceSchema = joi.object( {
129
+ limit: joi.number().required(),
130
+ offset: joi.number().required(),
131
+ searchValue: joi.string().optional().empty( '' ),
132
+ filter: joi.string().optional(),
133
+ sortColumn: joi.string().optional(),
134
+ sortBy: joi.number().optional(),
135
+ clientId: joi.string().required(),
136
+ export: joi.boolean().optional(),
137
+ } );
95
138
 
96
139
  export const validateInvoiceParams = {
97
- body: joi.object( {
98
- limit: joi.number().required(),
99
- offset: joi.number().required(),
100
- searchValue: joi.string().optional(),
101
- filter: joi.string().optional(),
102
- sortColumn: joi.string().optional(),
103
- sortBy: joi.number().optional(),
104
- clientId: joi.string().required(),
105
- export: joi.boolean().optional(),
106
- } ),
140
+ body: validateInvoiceSchema,
107
141
  };
108
142
 
143
+ export const validatePriceSchema = joi.object( {
144
+ type: joi.string().optional(),
145
+ clientId: joi.string().required(),
146
+ products: joi.array().optional(),
147
+ } );
148
+
109
149
  export const validatePriceParams = {
110
- body: joi.object( {
111
- type: joi.string().required(),
112
- clientId: joi.string().required(),
113
- products: joi.array().required(),
114
- } ),
150
+ body: validatePriceSchema,
115
151
  };
116
152
 
153
+ export const revisedSchema = joi.object( {
154
+ invoice: joi.string().required(),
155
+ revisedAmount: joi.number().required(),
156
+ discount: joi.number().required(),
157
+ } );
158
+
117
159
  export const revisedParams = {
118
- body: joi.object( {
119
- invoice: joi.string().required(),
120
- revisedAmount: joi.number().required(),
121
- discount: joi.number().required(),
122
- } ),
160
+ body: revisedSchema,
123
161
  };
124
162
 
125
163
 
164
+ export const validatePriceListSchema = joi.object( {
165
+ priceType: joi.string().required(),
166
+ clientId: joi.string().required(),
167
+ } );
168
+
126
169
  export const validatePriceListParams = {
127
- body: joi.object( {
128
- priceType: joi.string().required(),
129
- clientId: joi.string().required(),
130
- } ),
170
+ body: validatePriceListSchema,
131
171
  };
132
172
 
173
+ export const validateStoreProductsSchema = joi.object( {
174
+ clientId: joi.string().required(),
175
+ store: joi.array().required().empty(),
176
+ } );
177
+
133
178
  export const validateStoreProductsParams = {
134
- body: joi.object( {
135
- clientId: joi.string().required(),
136
- store: joi.array().required().empty(),
137
- } ),
138
- };
139
-
140
- export const validateUpdateSubscriptionSchema = {
141
- body: joi.object( {
142
- clientId: joi.string().required(),
143
- price: joi.number().required(),
144
- priceType: joi.string().required(),
145
- subscriptionType: joi.string().required(),
146
- subscriptionPeriod: joi.string().required(),
147
- storeCount: joi.number().required(),
148
- totalCamera: joi.number().required(),
149
- totalStores: joi.string().required(),
150
- storeSize: joi.string().required(),
151
- products: joi.array().required(),
152
- } ),
179
+ body: validateStoreProductsSchema,
180
+ };
181
+
182
+ export const validateUpdateSubscriptionSchema =joi.object( {
183
+ clientId: joi.string().required(),
184
+ price: joi.number().required(),
185
+ priceType: joi.string().required(),
186
+ subscriptionType: joi.string().required(),
187
+ subscriptionPeriod: joi.string().required(),
188
+ totalCamera: joi.number().required(),
189
+ totalStores: joi.string().required(),
190
+ storeSize: joi.string().required(),
191
+ products: joi.array().required(),
192
+ } );
193
+
194
+ export const validateUpdateSubscriptionParams = {
195
+ body: validateUpdateSubscriptionSchema,
196
+ };
197
+
198
+ export const dailyPricingSchema = joi.object( {
199
+ clientId: joi.array().required(),
200
+ date: joi.string().required(),
201
+ } );
202
+
203
+ export const dailyPricingParams = {
204
+ body: dailyPricingSchema,
205
+ };
206
+
207
+ export const invoiceGenerateSchema = joi.object( {
208
+ clientId: joi.array().required(),
209
+ fromDate: joi.string().required(),
210
+ toDate: joi.string().required(),
211
+ } );
212
+
213
+ export const invoiceGenerateParams = {
214
+ body: invoiceGenerateSchema,
215
+ };
216
+
217
+ export const invoiceUpdateSchema = joi.object( {
218
+ amount: joi.number().required(),
219
+ paymentType: joi.string().required(),
220
+ paymentReferenceId: joi.string().required(),
221
+ } );
222
+
223
+ export const invoiceUpdateParams = {
224
+ body: invoiceUpdateSchema,
225
+ };
226
+
227
+
228
+ export const invoiceRevisedSchema = joi.object( {
229
+ invoiceId: joi.string().required(),
230
+ } );
231
+
232
+ export const invoiceRevisedParams = {
233
+ params: invoiceRevisedSchema,
234
+ };
235
+
236
+ export const validateInvoiceUpdateSchema = joi.object( {
237
+ proRate: joi.string().required(),
238
+ paymenttype: joi.string().required(),
239
+ paymentCycle: joi.string().required(),
240
+ currencyType: joi.string().required(),
241
+ invoiceTo: joi.array().items( joi.string().email().message( 'Enter valid Email' ) ).required(),
242
+ invoiceCC: joi.array().items( joi.string().email().message( 'Enter valid Email' ) ),
243
+ paymentAgreementTo: joi.array().items( joi.string().email().message( 'Enter valid Email' ) ).required(),
244
+ invoiceOn: joi.string().required(),
245
+ extendPaymentPeriodDays: joi.number().required(),
246
+ } );
247
+
248
+ export const validateInvoiceUpdateParams = {
249
+ body: validateInvoiceUpdateSchema,
153
250
  };