tango-app-api-payment-subscription 3.0.51-dev → 3.0.53-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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-payment-subscription",
3
- "version": "3.0.51-dev",
3
+ "version": "3.0.53-dev",
4
4
  "description": "paymentSubscription",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  "nodemon": "^3.1.0",
27
27
  "swagger-ui-express": "^5.0.0",
28
28
  "tango-api-schema": "^2.0.104",
29
- "tango-app-api-middleware": "^1.0.72-test",
29
+ "tango-app-api-middleware": "^1.0.73-test",
30
30
  "winston": "^3.12.0",
31
31
  "winston-daily-rotate-file": "^5.0.0"
32
32
  },
@@ -46,6 +46,7 @@ export const addBilling = async ( req, res ) => {
46
46
  logSubType: 'billingInfoUpdated',
47
47
  changes: [ 'Billing Address', 'Gst Number' ],
48
48
  eventType: 'update',
49
+ showTo: [ 'client', 'tango' ],
49
50
  };
50
51
  insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
51
52
  return res.sendSuccess( { message: 'Billing Details Added Successfully', data: resultData } );
@@ -430,6 +431,7 @@ export const updateSubscription = async ( req, res ) => {
430
431
  changes: [ `${convertTitleCase( item.name )} Trial Request` ],
431
432
  eventType: 'create',
432
433
  timestamp: new Date(),
434
+ showTo: [ 'client', 'tango' ],
433
435
  };
434
436
  insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
435
437
  }
@@ -457,6 +459,7 @@ export const updateSubscription = async ( req, res ) => {
457
459
  changes: [ `${convertTitleCase( item.name )} subscribed` ],
458
460
  eventType: '',
459
461
  date: new Date(),
462
+ showTo: [ 'client', 'tango' ],
460
463
  };
461
464
  insertOpenSearchData( appConfig.opensearch.activityLog, productObj );
462
465
  } else {
@@ -478,6 +481,7 @@ export const updateSubscription = async ( req, res ) => {
478
481
  changes: [ `${convertTitleCase( item.name )} subscribed` ],
479
482
  eventType: '',
480
483
  date: new Date(),
484
+ showTo: [ 'client', 'tango' ],
481
485
  };
482
486
  insertOpenSearchData( appConfig.opensearch.activityLog, productObj );
483
487
  }
@@ -659,6 +663,7 @@ export const unsubscribeProduct = async ( req, res ) => {
659
663
  logSubType: 'unsubscribedRequest',
660
664
  changes: [ `${req.body.clientId} Unsubscribed Request ` ],
661
665
  eventType: 'create',
666
+ showTo: [ 'client', 'tango' ],
662
667
  };
663
668
  insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
664
669
 
@@ -693,6 +698,7 @@ export const trialExtendRequest = async ( req, res ) => {
693
698
  logSubType: 'trialExtendRequest',
694
699
  changes: [ `${convertTitleCase( req.body.product )} trial Extend Request` ],
695
700
  eventType: 'create',
701
+ showTo: [ 'client', 'tango' ],
696
702
  };
697
703
  insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
698
704
 
@@ -729,6 +735,7 @@ export const trialRequest = async ( req, res ) => {
729
735
  logSubType: 'trialRequest',
730
736
  changes: [ `${convertTitleCase( req.body.product )} trial Request` ],
731
737
  eventType: 'create',
738
+ showTo: [ 'client', 'tango' ],
732
739
  };
733
740
  insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
734
741
 
@@ -800,6 +807,7 @@ export const updateInvoiceDetails = async ( req, res ) => {
800
807
  logSubType: 'updatePaymentInvoice',
801
808
  changes: [ 'Pro Rate', 'Payment Type', 'Payment Cycle', 'Currency Type', 'Invoice To', 'Payment Agreement To', 'Invoice On', 'Extend Payment PeriodDays' ],
802
809
  eventType: 'update',
810
+ showTo: [ 'client', 'tango' ],
803
811
  };
804
812
  insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
805
813
  return res.sendSuccess( 'Invoice Updated Successfully' );
@@ -917,6 +925,7 @@ export const trialApproval = async ( req, res ) => {
917
925
  date: new Date(),
918
926
  changes: [ `${convertTitleCase( requestData.name )} trial started` ],
919
927
  eventType: '',
928
+ showTo: [ 'client', 'tango' ],
920
929
  };
921
930
  insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
922
931
  let clientProducts = await paymentService.findOne( { clientId: requestData.clientId }, { planDetails: 1 } );
@@ -1080,6 +1089,7 @@ export const trialExtendRequestApproval = async ( req, res ) => {
1080
1089
  date: new Date(),
1081
1090
  changes: [ `${firstWord + ' ' + secondWord} trial Extended` ],
1082
1091
  eventType: '',
1092
+ showTo: [ 'client', 'tango' ],
1083
1093
  };
1084
1094
  insertOpenSearchData( appConfig.opensearch.activityLog, notifyObj );
1085
1095
  // const logObj = {
@@ -1140,6 +1150,7 @@ export const productSubscribe = async ( req, res ) => {
1140
1150
  changes: [ `${convertTitleCase( item.name )} product unsubscribed` ],
1141
1151
  eventType: '',
1142
1152
  timestamp: new Date(),
1153
+ showTo: [ 'client', 'tango' ],
1143
1154
  };
1144
1155
  insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
1145
1156
  await storeService.addremoveElement( { clientId: clientInfo.clientId, product: { $in: item.name } }, { $pull: { product: item.name } } );
@@ -1166,6 +1177,7 @@ export const productSubscribe = async ( req, res ) => {
1166
1177
  changes: [ `${convertTitleCase( item.name )} trial started` ],
1167
1178
  eventType: '',
1168
1179
  timestamp: new Date(),
1180
+ showTo: [ 'client', 'tango' ],
1169
1181
  };
1170
1182
  insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
1171
1183
  product.push( {
@@ -1197,6 +1209,7 @@ export const productSubscribe = async ( req, res ) => {
1197
1209
  date: new Date(),
1198
1210
  changes: [ `${convertTitleCase( item.name )} prodcut Subscribed` ],
1199
1211
  eventType: '',
1212
+ showTo: [ 'client', 'tango' ],
1200
1213
  };
1201
1214
  insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
1202
1215
  product.push( {
@@ -1211,6 +1224,27 @@ export const productSubscribe = async ( req, res ) => {
1211
1224
  let productIndex = product.findIndex( ( ele ) => ele.productName == item.name );
1212
1225
  if ( productIndex != -1 ) {
1213
1226
  if ( item.type == 'subscription' ) {
1227
+ let logObj = {
1228
+ userName: req.user?.userName,
1229
+ email: req.user?.email,
1230
+ clientId: clientInfo.clientId,
1231
+ clientNotification: false,
1232
+ adminNotification: true,
1233
+ logSubType: 'productSubscribed',
1234
+ description: 'Your subscription is now active! Get ready to maximize your instore sales potential with the Tangoeye suite',
1235
+ // category: 'Brand Activity Log',
1236
+ // features: 'Subscription',
1237
+ title: 'Subscription',
1238
+ alertCta: [],
1239
+ markasRead: false,
1240
+ logType: 'subscription',
1241
+ showPushNotification: true,
1242
+ date: new Date(),
1243
+ changes: [ `${convertTitleCase( item.name )} prodcut Subscribed` ],
1244
+ eventType: '',
1245
+ showTo: [ 'client', 'tango' ],
1246
+ };
1247
+ insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
1214
1248
  product[productIndex].subscribedDate = new Date();
1215
1249
  product[productIndex].status = 'live';
1216
1250
  subscriptionCount = subscriptionCount + 1;
@@ -1361,6 +1395,7 @@ export const unsubscribeApproval = async ( req, res ) => {
1361
1395
  logSubType: 'unsubscribedApproved',
1362
1396
  changes: [ `${requestData.clientId} unsubscribed` ],
1363
1397
  eventType: '',
1398
+ showTo: [ 'client', 'tango' ],
1364
1399
  };
1365
1400
  insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
1366
1401
  return res.sendSuccess( 'updated Successfully' );
@@ -1597,6 +1632,7 @@ export const addStoreProduct = async ( req, res ) => {
1597
1632
  date: new Date(),
1598
1633
  changes: [ ` ${req.body.store.toString()} ${convertTitleCase( item.name )} product unsubscribed` ],
1599
1634
  eventType: '',
1635
+ showTo: [ 'client', 'tango' ],
1600
1636
 
1601
1637
  };
1602
1638
  insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
@@ -1654,6 +1690,7 @@ export const addStoreProduct = async ( req, res ) => {
1654
1690
  date: new Date(),
1655
1691
  changes: [ `${convertTitleCase( item.name )} trial started` ],
1656
1692
  eventType: '',
1693
+ showTo: [ 'client', 'tango' ],
1657
1694
 
1658
1695
  };
1659
1696
  insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
@@ -1681,6 +1718,7 @@ export const addStoreProduct = async ( req, res ) => {
1681
1718
  date: new Date(),
1682
1719
  changes: [ `${convertTitleCase( item.name )} product subscribed` ],
1683
1720
  eventType: '',
1721
+ showTo: [ 'client', 'tango' ],
1684
1722
  };
1685
1723
  insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
1686
1724
  }
@@ -2158,6 +2196,7 @@ export const pricingListUpdate = async ( req, res ) => {
2158
2196
  logSubType: 'updateProductPricing',
2159
2197
  changes: keys,
2160
2198
  eventType: 'update',
2199
+ showTo: [ 'client', 'tango' ],
2161
2200
  };
2162
2201
  insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
2163
2202
  return res.sendSuccess( 'Pricig Updated Successfully' );
@@ -2332,6 +2371,7 @@ export const updatedRevisedPrice = async ( req, res ) => {
2332
2371
  logSubType: 'revisedPriceUpdation',
2333
2372
  changes: [ 'amount', 'revisedAmount', 'discount' ],
2334
2373
  eventType: 'update',
2374
+ showTo: [ 'client', 'tango' ],
2335
2375
  };
2336
2376
  insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
2337
2377
  return res.sendSuccess( 'Credit notes Updated Successfully' );
@@ -2419,6 +2459,8 @@ export const getRemindClients = async ( req, res ) => {
2419
2459
  userName: userDetails?.userName,
2420
2460
  email: userDetails?.email,
2421
2461
  changes: [ `${data.product} trial is going to expired.` ],
2462
+ eventType: '',
2463
+ showTo: [ 'client', 'tango' ],
2422
2464
  };
2423
2465
  insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
2424
2466
  const templateHtml = fs.readFileSync( path.resolve( path.dirname( '' ) ) + '/src/hbs/trialReminderEmail.hbs', 'utf8' );
@@ -2729,6 +2771,7 @@ export const updateInvoiceStatus = async ( req, res ) => {
2729
2771
  logSubType: 'InvoiceStatus',
2730
2772
  changes: [ 'amount', 'paymentType', 'status' ],
2731
2773
  eventType: 'update',
2774
+ showTo: [ 'client', 'tango' ],
2732
2775
  };
2733
2776
  insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
2734
2777
  return res.sendSuccess( 'Invoice updated Successfully' );
@@ -3194,7 +3237,7 @@ export const updatePushNotification = async ( req, res ) => {
3194
3237
  },
3195
3238
  };
3196
3239
  let updateResult = await updateOpenSearchData( appConfig.opensearch.activityLog, req.params.notificationId, document );
3197
- if ( updateResult?.statusCode == 200 && updateResult?.body?.result == 'updated' ) {
3240
+ if ( updateResult?.statusCode == 200 ) {
3198
3241
  return res.sendSuccess( 'Notification Updated Successfully' );
3199
3242
  }
3200
3243
  return res.sendError( 'Something went wrong', 500 );