tango-app-api-payment-subscription 3.0.10-dev → 3.0.11-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -173,7 +173,7 @@ export const clientBillingSubscriptionInfo = async ( req, res, next ) => {
|
|
|
173
173
|
currentPlanInfo.storeCount = storeCount || '--';
|
|
174
174
|
currentPlanInfo.totalCamera = clientInfo[0].planDetails.totalCamera || '--';
|
|
175
175
|
currentPlanInfo.totalStores = clientInfo[0].planDetails.totalStores || '--';
|
|
176
|
-
currentPlanInfo.storeSize = clientInfo[0].planDetails.
|
|
176
|
+
currentPlanInfo.storeSize = clientInfo[0].planDetails.storeSize || '--';
|
|
177
177
|
currentPlanInfo.liveProducts = liveProducts || '--';
|
|
178
178
|
currentPlanInfo.trialProducts = trialProducts || '--';
|
|
179
179
|
currentPlanInfo.expiredProducts = expiredProducts || '--';
|
|
@@ -199,6 +199,13 @@ export const clientBillingSubscriptionInfo = async ( req, res, next ) => {
|
|
|
199
199
|
|
|
200
200
|
export const pricingInfo = async ( req, res ) => {
|
|
201
201
|
try {
|
|
202
|
+
let input = req.body;
|
|
203
|
+
let finalPrice = 0;
|
|
204
|
+
let dummy = [];
|
|
205
|
+
let camaraArray = [];
|
|
206
|
+
let OriginalPrice = 0;
|
|
207
|
+
let productDiscounts = [];
|
|
208
|
+
let dollerpriceOriginal = 0;
|
|
202
209
|
let query = [
|
|
203
210
|
{ $unwind: '$basePricing' },
|
|
204
211
|
{
|
|
@@ -207,23 +214,92 @@ export const pricingInfo = async ( req, res ) => {
|
|
|
207
214
|
'basePricing.productName': { $in: req.body.products },
|
|
208
215
|
},
|
|
209
216
|
},
|
|
210
|
-
{
|
|
211
|
-
$group: {
|
|
212
|
-
_id: '',
|
|
213
|
-
price: {
|
|
214
|
-
$sum: '$basePricing.basePrice' },
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
217
|
{
|
|
218
218
|
$project: {
|
|
219
219
|
_id: 0,
|
|
220
|
-
|
|
220
|
+
basePricing: 1,
|
|
221
221
|
},
|
|
222
222
|
},
|
|
223
223
|
];
|
|
224
224
|
let pricingDetails = await basePricingService.aggregate( query );
|
|
225
|
-
|
|
226
|
-
|
|
225
|
+
if ( !pricingDetails.length ) {
|
|
226
|
+
return res.sendError( 'no data found', 204 );
|
|
227
|
+
}
|
|
228
|
+
let productList = pricingDetails.map( ( item ) => {
|
|
229
|
+
return { ...item.basePricing };
|
|
230
|
+
} );
|
|
231
|
+
input.products.forEach( async ( element, index ) => {
|
|
232
|
+
let getProduct = productList.find( ( item ) => item.productName == element );
|
|
233
|
+
let camaraPerSqft = getProduct.camaraPerStores.filter( ( data ) => data.sqft == input.camaraPerSqft );
|
|
234
|
+
console.log( camaraPerSqft, 'rest' );
|
|
235
|
+
let basicprice = Math.round( getProduct.basePrice * ( camaraPerSqft[0].camaraCount ) );
|
|
236
|
+
productDiscounts.push( getProduct.discoutPercentage );
|
|
237
|
+
let stage = 0;
|
|
238
|
+
if ( input.storesCount == '1-25' ) {
|
|
239
|
+
stage = 0;
|
|
240
|
+
} else if ( input.storesCount == '26-50' ) {
|
|
241
|
+
stage = 1;
|
|
242
|
+
} else if ( input.storesCount == '51-75' ) {
|
|
243
|
+
stage = 2;
|
|
244
|
+
} else if ( input.storesCount == '76-100' ) {
|
|
245
|
+
stage = 2;
|
|
246
|
+
} else if ( input.storesCount == '51-100' ) {
|
|
247
|
+
stage = 2;
|
|
248
|
+
} else if ( input.storesCount == '101-150' || input.storesCount == '101+' ) {
|
|
249
|
+
stage = 3;
|
|
250
|
+
} else if ( input.storesCount == '151-200' ) {
|
|
251
|
+
stage = 4;
|
|
252
|
+
} else if ( input.storesCount == '201-250' ) {
|
|
253
|
+
stage = 5;
|
|
254
|
+
} else if ( input.storesCount == '251-500' ) {
|
|
255
|
+
stage = 6;
|
|
256
|
+
} else if ( input.storesCount == '501-1000' ) {
|
|
257
|
+
stage = 7;
|
|
258
|
+
} else if ( input.storesCount == '1001-2000' ) {
|
|
259
|
+
stage = 8;
|
|
260
|
+
} else if ( input.storesCount == '2000+' ) {
|
|
261
|
+
stage = 9;
|
|
262
|
+
}
|
|
263
|
+
let discountprice = Math.round( basicprice * Math.pow( 0.9, stage ) );
|
|
264
|
+
dummy.push( discountprice );
|
|
265
|
+
OriginalPrice = OriginalPrice + discountprice;
|
|
266
|
+
// console.log("====>", OriginalPrice);
|
|
267
|
+
finalPrice = finalPrice + discountprice;
|
|
268
|
+
camaraArray.push( Number( Math.ceil( camaraPerSqft[0].camaraCount ) ) );
|
|
269
|
+
if ( dummy.length == input.products.length ) {
|
|
270
|
+
if ( input.products.length > 1 ) {
|
|
271
|
+
// for extra product to add maximum discount
|
|
272
|
+
let maxProductDiscounts = Math.max( ...productDiscounts );
|
|
273
|
+
let addtionalDiscount = ( finalPrice * maxProductDiscounts ) / 100;
|
|
274
|
+
console.log( 'addtional product discount', addtionalDiscount );
|
|
275
|
+
finalPrice = finalPrice - addtionalDiscount;
|
|
276
|
+
console.log( finalPrice, 'test' );
|
|
277
|
+
// OriginalPrice = OriginalPrice + addtionalDiscount
|
|
278
|
+
}
|
|
279
|
+
if ( input.planName == 'quarterly' ) {
|
|
280
|
+
let extraDiscount = ( finalPrice * 10 ) / 100;
|
|
281
|
+
console.log( 'halfyearly extraDiscount', extraDiscount );
|
|
282
|
+
finalPrice = finalPrice - extraDiscount;
|
|
283
|
+
console.log( finalPrice, 'rtyu' );
|
|
284
|
+
// OriginalPrice = OriginalPrice + extra_discount
|
|
285
|
+
}
|
|
286
|
+
if ( input.planName == 'annual' ) {
|
|
287
|
+
let extraDiscount = ( finalPrice * 20 ) / 100;
|
|
288
|
+
console.log( 'yearly extraDiscount', extraDiscount );
|
|
289
|
+
finalPrice = finalPrice - extraDiscount;
|
|
290
|
+
console.log( finalPrice, 'fgvbh' );
|
|
291
|
+
// OriginalPrice = OriginalPrice + extra_discount
|
|
292
|
+
}
|
|
293
|
+
finalPrice = Math.ceil( finalPrice / 10 ) * 10; // for round off to 10 position
|
|
294
|
+
if ( input.currencyType && input.currencyType == 'dollar' ) {
|
|
295
|
+
dollerprice = ( ( finalPrice * 50 ) / 100 );
|
|
296
|
+
finalPrice = ( dollerprice + finalPrice ) / 84;
|
|
297
|
+
dollerpriceOriginal = ( ( OriginalPrice * 50 ) / 100 );
|
|
298
|
+
OriginalPrice = ( dollerpriceOriginal + OriginalPrice ) / 84;
|
|
299
|
+
}
|
|
300
|
+
res.sendSuccess( { OriginalPrice: Math.round( OriginalPrice ), price: Math.round( finalPrice ) } );
|
|
301
|
+
}
|
|
302
|
+
} );
|
|
227
303
|
} catch ( e ) {
|
|
228
304
|
console.log( 'pricingInfo=>', e );
|
|
229
305
|
logger.error( { error: e, function: 'pricingInfo' } );
|
|
@@ -389,7 +465,16 @@ export const trialProductList = async ( req, res ) => {
|
|
|
389
465
|
if ( !getClientInfo.length ) {
|
|
390
466
|
return res.sendError( 'no data found', 204 );
|
|
391
467
|
}
|
|
392
|
-
let products =
|
|
468
|
+
let products = [];
|
|
469
|
+
getClientInfo.forEach( ( item ) => {
|
|
470
|
+
let [ firstWord, secondWord ] = item.product.replace( /([a-z])([A-Z])/g, '$1 $2' ).split( ' ' );
|
|
471
|
+
firstWord = firstWord.charAt( 0 ).toUpperCase() + firstWord.slice( 1 );
|
|
472
|
+
products.push( {
|
|
473
|
+
name: `${firstWord} ${secondWord}`,
|
|
474
|
+
value: item.product,
|
|
475
|
+
},
|
|
476
|
+
);
|
|
477
|
+
} );
|
|
393
478
|
return res.sendSuccess( products );
|
|
394
479
|
} catch ( e ) {
|
|
395
480
|
console.log( 'trialRequest =>', e );
|
|
@@ -614,40 +699,58 @@ export const trialExtendRequestApproval = async ( req, res ) => {
|
|
|
614
699
|
|
|
615
700
|
export const productSubscribe = async ( req, res ) => {
|
|
616
701
|
try {
|
|
702
|
+
let data = req.body.product;
|
|
703
|
+
req.body.product = [];
|
|
704
|
+
data.forEach( ( item ) => {
|
|
705
|
+
if ( item.type != 'cancel' ) {
|
|
706
|
+
let arr = item.name.split( ',' );
|
|
707
|
+
arr.forEach( ( product ) => {
|
|
708
|
+
req.body.product.push( {
|
|
709
|
+
name: product,
|
|
710
|
+
type: item.type,
|
|
711
|
+
} );
|
|
712
|
+
} );
|
|
713
|
+
}
|
|
714
|
+
} );
|
|
715
|
+
console.log( req.body.product, 'product' );
|
|
617
716
|
let clientInfo = await paymentService.findOne( { clientId: req.body.clientId, status: 'active' }, { clientId: 1, planDetails: 1 } );
|
|
618
717
|
if ( !clientInfo ) {
|
|
619
718
|
return res.sendError( 'no data found', 204 );
|
|
620
719
|
}
|
|
621
720
|
let product = clientInfo.planDetails.product;
|
|
721
|
+
let removeProducts = req.body.product.filter( ( item ) => item.type == 'unsubscribe' ).map( ( item ) => item.name );
|
|
622
722
|
let productList = product.map( ( item ) => item.productName );
|
|
623
723
|
for ( let item of req.body.product ) {
|
|
624
724
|
if ( productList.includes( item.name ) && item.type =='unsubscribe' ) {
|
|
625
|
-
let findIndex = product.findIndex( ( product ) => product.productName );
|
|
626
|
-
product.splice( findIndex, 1 );
|
|
627
|
-
console.log( clientInfo.clientId );
|
|
725
|
+
// let findIndex = product.findIndex( ( product ) => product.productName );
|
|
726
|
+
// product.splice( findIndex, 1 );
|
|
727
|
+
// console.log( clientInfo.clientId );
|
|
628
728
|
await storeService.addremoveElement( { clientId: clientInfo.clientId, status: 'active', product: { $in: item.name } }, { $pull: { product: item.name } } );
|
|
629
729
|
}
|
|
630
|
-
if ( !productList.includes( item.name ) &&
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
730
|
+
if ( !productList.includes( item.name ) && [ 'trial', 'subscription' ].includes( item.type ) ) {
|
|
731
|
+
if ( item.type == 'trial' ) {
|
|
732
|
+
product.push( {
|
|
733
|
+
productName: item.name,
|
|
734
|
+
trialStartDate: new Date(),
|
|
735
|
+
trialEndDate: new Date( dayjs().add( 13, 'days' ).format( 'YYYY-MM-DD' ) ),
|
|
736
|
+
status: 'trial',
|
|
737
|
+
} );
|
|
738
|
+
} else {
|
|
739
|
+
product.push( {
|
|
740
|
+
productName: item.name,
|
|
741
|
+
subscribedDate: new Date(),
|
|
742
|
+
status: 'live',
|
|
743
|
+
} );
|
|
744
|
+
}
|
|
644
745
|
await storeService.addremoveElement( { clientId: clientInfo.clientId, status: 'active' }, { $push: { product: item.name } } );
|
|
645
746
|
}
|
|
646
747
|
}
|
|
748
|
+
product = product.filter( ( item ) => !removeProducts.includes( item.productName ) );
|
|
749
|
+
console.log( product, 'product' );
|
|
647
750
|
clientInfo.planDetails.product = product;
|
|
648
751
|
clientInfo.save().then( async () => {
|
|
649
|
-
return res.sendSuccess( 'Product Subscribed Successfully' );
|
|
650
752
|
} );
|
|
753
|
+
return res.sendSuccess( 'Product Subscribed Successfully' );
|
|
651
754
|
} catch ( e ) {
|
|
652
755
|
console.log( 'updateProductSubscribe =>', e );
|
|
653
756
|
logger.error( { error: e, function: 'updateProductSubscribe' } );
|
|
@@ -706,18 +809,42 @@ export const productViewList = async ( req, res ) => {
|
|
|
706
809
|
},
|
|
707
810
|
];
|
|
708
811
|
let storeProductCount = await storeService.aggregate( query );
|
|
709
|
-
|
|
812
|
+
let clientProduct = await paymentService.findOne( { clientId: req.query.clientId }, { 'planDetails.product': 1 } );
|
|
813
|
+
|
|
814
|
+
if ( !clientProduct ) {
|
|
710
815
|
return res.sendError( 'no data found', 204 );
|
|
711
816
|
}
|
|
817
|
+
console.log( clientProduct.planDetails.product );
|
|
712
818
|
let productPrice = await basePricingService.findOne( { clientId: { $exists: false } }, { basePricing: 1 } );
|
|
713
|
-
console.log(
|
|
714
|
-
|
|
715
|
-
|
|
819
|
+
console.log( storeProductCount, 'price' );
|
|
820
|
+
let products = [];
|
|
821
|
+
clientProduct.planDetails.product.forEach( ( item ) => {
|
|
822
|
+
let price;
|
|
823
|
+
let count;
|
|
824
|
+
let productBasePrice = productPrice.basePricing.find( ( product ) => product.productName == item.productName );
|
|
825
|
+
let productCount = storeProductCount.find( ( product ) => product.product == item.productName );
|
|
716
826
|
if ( productBasePrice ) {
|
|
717
|
-
|
|
827
|
+
price = productBasePrice.basePrice;
|
|
828
|
+
}
|
|
829
|
+
if ( productCount ) {
|
|
830
|
+
count = productCount.storeCount;
|
|
718
831
|
}
|
|
832
|
+
products.push(
|
|
833
|
+
{
|
|
834
|
+
product: item.productName,
|
|
835
|
+
basePrice: price,
|
|
836
|
+
storeCount: count,
|
|
837
|
+
status: item.status,
|
|
838
|
+
},
|
|
839
|
+
);
|
|
719
840
|
} );
|
|
720
|
-
|
|
841
|
+
// storeProductCount.forEach( ( item ) => {
|
|
842
|
+
// let productBasePrice = productPrice.basePricing.find( ( product ) => product.productName == item.product );
|
|
843
|
+
// if ( productBasePrice ) {
|
|
844
|
+
// item.basePrice = productBasePrice.basePrice;
|
|
845
|
+
// }
|
|
846
|
+
// } );
|
|
847
|
+
return res.sendSuccess( products );
|
|
721
848
|
} catch ( e ) {
|
|
722
849
|
console.log( 'productViewList =>', e );
|
|
723
850
|
logger.error( { error: e, function: 'productViewList' } );
|
|
@@ -798,7 +925,10 @@ export const storeViewList = async ( req, res ) => {
|
|
|
798
925
|
},
|
|
799
926
|
);
|
|
800
927
|
|
|
928
|
+
console.log( JSON.stringify( query ), 'query' );
|
|
929
|
+
|
|
801
930
|
let storeDetails = await storeService.aggregate( query );
|
|
931
|
+
console.log( storeDetails );
|
|
802
932
|
|
|
803
933
|
if ( !storeDetails[0].data.length ) {
|
|
804
934
|
return res.sendError( 'no data found', 204 );
|
|
@@ -962,12 +1092,12 @@ export const invoiceList = async ( req, res ) => {
|
|
|
962
1092
|
|
|
963
1093
|
export const priceList = async ( req, res ) => {
|
|
964
1094
|
try {
|
|
965
|
-
let pricingDetails = await basePricingService.findOne( { clientId: { $exists: true }, clientId: req.
|
|
1095
|
+
let pricingDetails = await basePricingService.findOne( { clientId: { $exists: true }, clientId: req.body.clientId }, { standard: 1, step: 1 } );
|
|
966
1096
|
if ( !pricingDetails ) {
|
|
967
1097
|
return res.sendError( 'no data found', 204 );
|
|
968
1098
|
}
|
|
969
1099
|
let data = [];
|
|
970
|
-
if (
|
|
1100
|
+
if ( req.body.priceType == 'standard' ) {
|
|
971
1101
|
data = pricingDetails.standard;
|
|
972
1102
|
} else {
|
|
973
1103
|
data = pricingDetails.step;
|
|
@@ -975,7 +1105,7 @@ export const priceList = async ( req, res ) => {
|
|
|
975
1105
|
let query = [
|
|
976
1106
|
{
|
|
977
1107
|
$match: {
|
|
978
|
-
clientId: req.
|
|
1108
|
+
clientId: req.body.clientId,
|
|
979
1109
|
status: 'active',
|
|
980
1110
|
},
|
|
981
1111
|
},
|
|
@@ -997,21 +1127,29 @@ export const priceList = async ( req, res ) => {
|
|
|
997
1127
|
let storeProduct = await storeService.aggregate( query );
|
|
998
1128
|
let originalTotalPrice = 0;
|
|
999
1129
|
let discountTotalPrice = 0;
|
|
1130
|
+
let totalProductPrice = 0;
|
|
1131
|
+
let totalnegotiatePrice = 0;
|
|
1000
1132
|
let temp = [];
|
|
1001
|
-
console.log( data );
|
|
1002
|
-
console.log( storeProduct );
|
|
1003
1133
|
storeProduct.forEach( ( item ) => {
|
|
1004
1134
|
let productDetails = data.filter( ( ele ) => ele.productName == item.product );
|
|
1005
1135
|
productDetails.forEach( ( product, index ) => {
|
|
1006
|
-
if ( req.body.
|
|
1136
|
+
if ( req.body.priceType == 'standard' ) {
|
|
1007
1137
|
product.storeCount = item.storeCount;
|
|
1008
1138
|
} else {
|
|
1139
|
+
product.showImg = false;
|
|
1140
|
+
product.showEditDelete = false;
|
|
1009
1141
|
if ( index == productDetails.length-1 ) {
|
|
1142
|
+
if ( index != 0 ) {
|
|
1143
|
+
product.showImg = true;
|
|
1144
|
+
product.showEditDelete = true;
|
|
1145
|
+
}
|
|
1010
1146
|
product.storeCount = item.storeCount;
|
|
1147
|
+
product.lastIndex = true;
|
|
1011
1148
|
} else if ( index == 0 ) {
|
|
1012
1149
|
product.storeCount = 100;
|
|
1013
1150
|
item.storeCount = item.storeCount - 100;
|
|
1014
1151
|
} else {
|
|
1152
|
+
product.showImg = true;
|
|
1015
1153
|
let rangeArray = product.storeRange.split( '-' );
|
|
1016
1154
|
let startNumber = parseInt( rangeArray[0] );
|
|
1017
1155
|
let endNumber = parseInt( rangeArray[1] );
|
|
@@ -1022,19 +1160,29 @@ export const priceList = async ( req, res ) => {
|
|
|
1022
1160
|
}
|
|
1023
1161
|
let discountPrice = product.basePrice * ( product.discountPercentage / 100 );
|
|
1024
1162
|
let price = product.basePrice - discountPrice;
|
|
1163
|
+
totalProductPrice = totalProductPrice + product.basePrice;
|
|
1164
|
+
totalnegotiatePrice = totalnegotiatePrice + product.negotiatePrice;
|
|
1025
1165
|
product.price = price * product.storeCount;
|
|
1026
1166
|
temp.push( product );
|
|
1027
1167
|
let originalPrice = product.basePrice * product.storeCount;
|
|
1168
|
+
product.originalPrice = originalPrice;
|
|
1028
1169
|
originalTotalPrice = originalTotalPrice + originalPrice;
|
|
1029
1170
|
discountTotalPrice = discountTotalPrice + product.price;
|
|
1030
1171
|
} );
|
|
1031
1172
|
} );
|
|
1032
1173
|
data = temp;
|
|
1033
|
-
|
|
1174
|
+
let discountPrice = originalTotalPrice - discountTotalPrice;
|
|
1175
|
+
let discountPercentage = ( discountTotalPrice / originalTotalPrice ) * 100;
|
|
1176
|
+
let finalValue = discountTotalPrice * ( 18 / 100 );
|
|
1034
1177
|
let result = {
|
|
1035
1178
|
product: data,
|
|
1036
1179
|
totalActualPrice: originalTotalPrice,
|
|
1037
|
-
|
|
1180
|
+
totalNegotiatePrice: discountTotalPrice,
|
|
1181
|
+
actualPrice: totalProductPrice,
|
|
1182
|
+
negotiatePrice: totalnegotiatePrice,
|
|
1183
|
+
discountPrice: discountPrice,
|
|
1184
|
+
discountPercentage: discountPercentage.toFixed(),
|
|
1185
|
+
finalValue: finalValue.toFixed( 2 ),
|
|
1038
1186
|
};
|
|
1039
1187
|
return res.sendSuccess( result );
|
|
1040
1188
|
} catch ( e ) {
|
|
@@ -1047,6 +1195,19 @@ export const priceList = async ( req, res ) => {
|
|
|
1047
1195
|
|
|
1048
1196
|
export const pricingListUpdate = async ( req, res ) => {
|
|
1049
1197
|
try {
|
|
1198
|
+
req.body.products.forEach( ( item ) => {
|
|
1199
|
+
delete item.originalPrice;
|
|
1200
|
+
delete item.oldPrice;
|
|
1201
|
+
delete item.oldStoreCount;
|
|
1202
|
+
delete item.storeCount;
|
|
1203
|
+
delete item.price;
|
|
1204
|
+
if ( req.body.type == 'step' ) {
|
|
1205
|
+
delete item.showImg;
|
|
1206
|
+
delete item.showEditDelete;
|
|
1207
|
+
delete item.lastIndex;
|
|
1208
|
+
}
|
|
1209
|
+
} );
|
|
1210
|
+
console.log( req.body.products, 'products' );
|
|
1050
1211
|
let getPriceInfo = await basePricingService.findOne( { clientId: { $exists: true }, clientId: req.body.clientId }, { standard: 1, step: 1 } );
|
|
1051
1212
|
let data = {
|
|
1052
1213
|
...( req.body.type == 'standard' ) ? { standard: req.body.products } : { step: req.body.products },
|
|
@@ -22,11 +22,11 @@ export const validateStoreParams = {
|
|
|
22
22
|
|
|
23
23
|
export const validateProducts = {
|
|
24
24
|
body: joi.object( {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
camaraPerSqft: joi.string().required(),
|
|
26
|
+
currencyType: joi.string().required(),
|
|
27
|
+
planName: joi.string().required(),
|
|
28
28
|
products: joi.array().required(),
|
|
29
|
-
|
|
29
|
+
storesCount: joi.string().required(),
|
|
30
30
|
} ),
|
|
31
31
|
};
|
|
32
32
|
|
|
@@ -74,12 +74,12 @@ export const validateStoreViewParams = {
|
|
|
74
74
|
limit: joi.number().required(),
|
|
75
75
|
offset: joi.number().required(),
|
|
76
76
|
clientId: joi.string().required(),
|
|
77
|
-
sortColumn: joi.string().optional(),
|
|
78
|
-
sortBy: joi.number().optional(),
|
|
79
|
-
searchValue: joi.string().optional(),
|
|
80
|
-
product: joi.array().optional(),
|
|
81
|
-
store: joi.array().optional(),
|
|
82
|
-
location: joi.array().optional(),
|
|
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
83
|
} ),
|
|
84
84
|
};
|
|
85
85
|
|
|
@@ -120,3 +120,10 @@ export const revisedParams = {
|
|
|
120
120
|
} ),
|
|
121
121
|
};
|
|
122
122
|
|
|
123
|
+
|
|
124
|
+
export const validatePriceListParams = {
|
|
125
|
+
body: joi.object( {
|
|
126
|
+
priceType: joi.string().required(),
|
|
127
|
+
clientId: joi.string().required(),
|
|
128
|
+
} ),
|
|
129
|
+
};
|
|
@@ -46,9 +46,9 @@ paymentSubscriptionRouter.post( '/admin/addStoreProduct', isAllowedSessionHandle
|
|
|
46
46
|
|
|
47
47
|
paymentSubscriptionRouter.post( '/invoiceList', isAllowedSessionHandler, validate( validationDtos.validateInvoiceParams ), validateClient, paymentController.invoiceList );
|
|
48
48
|
|
|
49
|
-
paymentSubscriptionRouter.
|
|
49
|
+
paymentSubscriptionRouter.post( '/admin/priceList', isAllowedSessionHandler, validate( validationDtos.validatePriceListParams ), validateClient, paymentController.priceList );
|
|
50
50
|
|
|
51
|
-
paymentSubscriptionRouter.post( '/pricing', isAllowedSessionHandler, validate( validationDtos.validatePriceParams ), validateClient, paymentController.pricingListUpdate );
|
|
51
|
+
paymentSubscriptionRouter.post( '/admin/pricing', isAllowedSessionHandler, validate( validationDtos.validatePriceParams ), validateClient, paymentController.pricingListUpdate );
|
|
52
52
|
|
|
53
53
|
paymentSubscriptionRouter.post( '/creditNotes', isAllowedSessionHandler, validate( validationDtos.revisedParams ), paymentController.updatedRevisedPrice );
|
|
54
54
|
|