tango-app-api-payment-subscription 3.0.30-dev → 3.0.32-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.30-dev",
3
+ "version": "3.0.32-dev",
4
4
  "description": "paymentSubscription",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -62,7 +62,7 @@ export const clientBillingSubscriptionInfo = async ( req, res, next ) => {
62
62
  {
63
63
  $match: {
64
64
  clientId: req.params.clientId,
65
- status: 'active',
65
+ // status: 'active',
66
66
  },
67
67
  },
68
68
  {
@@ -493,7 +493,7 @@ export const trialProductList = async ( req, res ) => {
493
493
  {
494
494
  $match: {
495
495
  clientId: req.query.clientId,
496
- status: 'active',
496
+ // status: 'active',
497
497
  },
498
498
  },
499
499
  { $unwind: '$planDetails.product' },
@@ -717,7 +717,7 @@ export const notificationList = async ( req, res ) => {
717
717
  {
718
718
  $match: {
719
719
  clientId: req.query.clientId,
720
- status: 'active',
720
+ // status: 'active',
721
721
  },
722
722
  },
723
723
  { $unwind: '$planDetails.product' },
@@ -945,7 +945,8 @@ export const productSubscribe = async ( req, res ) => {
945
945
  // let findIndex = product.findIndex( ( product ) => product.productName );
946
946
  // product.splice( findIndex, 1 );
947
947
  // let requestDetails = await clientRequestService.findOne({});
948
- await storeService.addremoveElement( { clientId: clientInfo.clientId, status: 'active', product: { $in: item.name } }, { $pull: { product: item.name } } );
948
+ await storeService.addremoveElement( { clientId: clientInfo.clientId, product: { $in: item.name } }, { $pull: { product: item.name } } );
949
+ // status: 'active',
949
950
  }
950
951
  if ( !productList.includes( item.name ) && [ 'trial', 'subscription' ].includes( item.type ) ) {
951
952
  if ( item.type == 'trial' ) {
@@ -1041,6 +1042,7 @@ export const unsubscribeApproval = async ( req, res ) => {
1041
1042
  clientProducts.status = 'deactive';
1042
1043
  clientProducts.save();
1043
1044
  await storeService.updateMany( { clientId: requestData.clientId }, { status: 'deactive' } );
1045
+ await userService.updateMany( { clientId: requestData.clientId }, { isActive: false } );
1044
1046
  let userDetails= await userService.findOne( { clientId: requestData.clientId, role: 'superadmin' } );
1045
1047
  if ( userDetails ) {
1046
1048
  const templateHtml = fs.readFileSync( path.resolve( path.dirname( '' ) ) + '/src/hbs/trialUnsubscribeEmail.hbs', 'utf8' );
@@ -1081,7 +1083,7 @@ export const productViewList = async ( req, res ) => {
1081
1083
  {
1082
1084
  $match: {
1083
1085
  clientId: req.query.clientId,
1084
- status: 'active',
1086
+ // status: 'active',
1085
1087
  },
1086
1088
  },
1087
1089
  { $unwind: '$product' },
@@ -1155,7 +1157,7 @@ export const storeViewList = async ( req, res ) => {
1155
1157
  {
1156
1158
  $match: {
1157
1159
  clientId: req.body.clientId,
1158
- status: 'active',
1160
+ // status: 'active',
1159
1161
  },
1160
1162
  },
1161
1163
  ];
@@ -1516,7 +1518,7 @@ export const priceList = async ( req, res ) => {
1516
1518
  {
1517
1519
  $match: {
1518
1520
  clientId: req.body.clientId,
1519
- status: 'active',
1521
+ // status: 'active',
1520
1522
  },
1521
1523
  },
1522
1524
  { $unwind: '$product' },
@@ -1922,11 +1924,11 @@ export const getExpiredClients = async ( req, res ) => {
1922
1924
  end = new Date( end.getTime() - userTimezoneOffset );
1923
1925
  end.setUTCHours( 23, 59, 59, 59 );
1924
1926
  let query = [
1925
- {
1926
- $match: {
1927
- status: 'active',
1928
- },
1929
- },
1927
+ // {
1928
+ // $match: {
1929
+ // status: 'active',
1930
+ // },
1931
+ // },
1930
1932
  { $unwind: '$planDetails.product' },
1931
1933
  {
1932
1934
  $match: {
@@ -1987,6 +1989,7 @@ export const invoiceDownload = async ( req, res ) => {
1987
1989
  let invoiceDate= dayjs( invoiceInfo.createdAt ).format( 'DD MMM, YYYY' );
1988
1990
  let days = clientDetails?.paymentInvoice?.extendPaymentPeriodDays || 10;
1989
1991
  let dueDate = invoiceInfo?.dueDate ? dayjs( invoiceInfo?.dueDate ).format( 'DD MMM, YYYY' ) : dayjs().add( days, 'days' ).format( 'DD MMM, YYYY' );
1992
+
1990
1993
  invoiceDetails = {
1991
1994
  ...invoiceInfo._doc,
1992
1995
  clientName: clientDetails.clientName,
@@ -3,3 +3,6 @@ import model from 'tango-api-schema';
3
3
  export const findOne = async ( query = {}, record = {} ) => {
4
4
  return await model.userModel.findOne( query, record );
5
5
  };
6
+ export const updateMany = async ( query = {}, record = {} ) => {
7
+ return await model.userModel.updateMany( query, record );
8
+ };