tango-app-api-analysis-traffic 3.0.0-alpha.13 → 3.0.0-alpha.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-analysis-traffic",
3
- "version": "3.0.0-alpha.13",
3
+ "version": "3.0.0-alpha.14",
4
4
  "description": "Traffic Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1258,13 +1258,46 @@ export const getMySubscription = async ( req, res ) => {
1258
1258
  if ( getClientData ) {
1259
1259
  if ( getClientData.planDetails && getClientData.planDetails.product && getClientData.planDetails.product.length>0 ) {
1260
1260
  let clientSubscription = {};
1261
+ let clientProducts = {
1262
+ tangoTraffic: false,
1263
+ tangoZone: false,
1264
+ tangoTrax: false,
1265
+ };
1261
1266
  clientSubscription.subscriptionType = getClientData.planDetails.subscriptionType;
1262
- clientSubscription.product = getClientData.planDetails.product;
1267
+ let actualProduct = getClientData.planDetails.product;
1268
+ for ( let clientIndex = 0; clientIndex < actualProduct.length; clientIndex++ ) {
1269
+ if ( actualProduct[clientIndex].productName == 'tangoTraffic' ) {
1270
+ clientProducts.tangoTraffic = true;
1271
+ }
1272
+ if ( actualProduct[clientIndex].productName == 'tangoZone' ) {
1273
+ clientProducts.tangoZone = true;
1274
+ }
1275
+ if ( actualProduct[clientIndex].tangoTrax == 'tangoTrax' ) {
1276
+ clientProducts.tangoTrax = true;
1277
+ }
1278
+ }
1279
+ clientSubscription.product = clientProducts;
1263
1280
  let storeSubscription = {};
1281
+ let storeProducts = {
1282
+ tangoTraffic: false,
1283
+ tangoZone: false,
1284
+ tangoTrax: false,
1285
+ };
1264
1286
  if ( reqestData.storeId && reqestData.storeId.length>0 ) {
1265
1287
  let getStoreData = await findOneStore( { clientId: reqestData.clientId, storeId: { $in: reqestData.storeId[0] } }, { product: 1 } );
1266
1288
  if ( getStoreData ) {
1267
- storeSubscription.product = getStoreData.product;
1289
+ for ( let storeIndex = 0; storeIndex < getStoreData.product.length; storeIndex++ ) {
1290
+ if ( getStoreData.product[storeIndex] == 'tangoTraffic' ) {
1291
+ storeProducts.tangoTraffic = true;
1292
+ }
1293
+ if ( getStoreData.product[storeIndex] == 'tangoZone' ) {
1294
+ storeProducts.tangoZone = true;
1295
+ }
1296
+ if ( getStoreData.product[storeIndex] == 'tangoTrax' ) {
1297
+ storeProducts.tangoTrax = true;
1298
+ }
1299
+ }
1300
+ storeSubscription.product = storeProducts;
1268
1301
  } else {
1269
1302
  storeSubscription.product = [];
1270
1303
  }