tango-app-api-payment-subscription 3.1.15 → 3.1.16

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.1.15",
3
+ "version": "3.1.16",
4
4
  "description": "paymentSubscription",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -108,7 +108,7 @@ export async function createInvoice( req, res ) {
108
108
  $filter: {
109
109
  input: '$stores',
110
110
  as: 'item',
111
- cond: { $gt: [ '$$item.daysDifference', 0 ] },
111
+ cond: { $and: [ { $gt: [ '$$item.daysDifference', 0 ] }, { $in: [ '$$item.storeId', group.stores ] } ] },
112
112
  },
113
113
  },
114
114
  },
@@ -210,9 +210,10 @@ export async function invoiceDownload( req, res ) {
210
210
  discountPercentage: invoiceInfo.discountPercentage ? invoiceInfo.discountPercentage : 0,
211
211
  discountAmount: invoiceInfo.discountAmount ? invoiceInfo.discountAmount : 0,
212
212
  logo: `${JSON.parse( process.env.URL ).apiDomain}/logo.png`,
213
+ uidomain: `${JSON.parse( process.env.URL ).domain}`,
213
214
  attachAnnexure: getgroup.attachAnnexure,
214
- virtualaccountNumber: virtualAccount.accountNumber,
215
- virtualifsc: virtualAccount.ifsc,
215
+ virtualaccountNumber: virtualAccount?virtualAccount?.accountNumber:'',
216
+ virtualifsc: virtualAccount?virtualAccount?.ifsc:'',
216
217
  };
217
218
  const currentMonthDays = dayjs().daysInMonth();
218
219
 
@@ -1113,13 +1113,13 @@ export const trialApproval = async ( req, res ) => {
1113
1113
  attachment: '',
1114
1114
  sourceEmail: JSON.parse( process.env.SES ).adminEmail,
1115
1115
  };
1116
- await sendEmailWithSES( params.toEmail, params.mailSubject, params.htmlBody, params.attachment, params.sourceEmail );
1116
+ sendEmailWithSES( params.toEmail, params.mailSubject, params.htmlBody, params.attachment, params.sourceEmail );
1117
1117
  }
1118
1118
  let products = clientProducts.planDetails.product.map( ( item ) => {
1119
1119
  let [ firstWord, secondWord ] = item.productName.replace( /([a-z])([A-Z])/g, '$1 $2' ).split( ' ' );
1120
1120
  return firstWord.toLowerCase() + '_' + secondWord.toLowerCase();
1121
1121
  } );
1122
- await axios.get( `${JSON.parse( process.env.URL ).oldapidomain}/oldBrandGet/${requestData.clientId}`, { headers: { Authorization: 'Bearer d47433f8-9a33-47c7-ba43-1a0fbac28f66' } } ).then( async ( response ) => {
1122
+ axios.get( `${JSON.parse( process.env.URL ).oldapidomain}/oldBrandGet/${requestData.clientId}`, { headers: { Authorization: 'Bearer d47433f8-9a33-47c7-ba43-1a0fbac28f66' } } ).then( async ( response ) => {
1123
1123
  let existsProducts = Object.keys( response.data.data.subscribed_features );
1124
1124
  existsProducts.forEach( ( item ) => {
1125
1125
  if ( products.includes( item ) ) {
@@ -1133,7 +1133,7 @@ export const trialApproval = async ( req, res ) => {
1133
1133
  response.data.data.subscribed_features[item] = true;
1134
1134
  }
1135
1135
  } );
1136
- await axios.post( `${JSON.parse( process.env.URL ).oldapidomain}/oldBrandUpdate/${response.data.data._id}`, response.data.data, { headers: { Authorization: 'Bearer d47433f8-9a33-47c7-ba43-1a0fbac28f66' } } ).then( ( result ) => {
1136
+ axios.post( `${JSON.parse( process.env.URL ).oldapidomain}/oldBrandUpdate/${response.data.data._id}`, response.data.data, { headers: { Authorization: 'Bearer d47433f8-9a33-47c7-ba43-1a0fbac28f66' } } ).then( ( result ) => {
1137
1137
  logger.info( result.data );
1138
1138
  } ).catch( ( error ) => {
1139
1139
  logger.error( { error: error, function: 'old Product update' } );
@@ -1145,7 +1145,7 @@ export const trialApproval = async ( req, res ) => {
1145
1145
  storeProductDetails = storeProductDetails.map( ( item ) => {
1146
1146
  return { id: item.storeId, product: item.product };
1147
1147
  } );
1148
- await axios.post( `${JSON.parse( process.env.URL ).oldapidomain}/oldBulkStoreUpdate`, storeProductDetails, { headers: { Authorization: 'Bearer d47433f8-9a33-47c7-ba43-1a0fbac28f66' } } ).then( ( response ) => {
1148
+ axios.post( `${JSON.parse( process.env.URL ).oldapidomain}/oldBulkStoreUpdate`, storeProductDetails, { headers: { Authorization: 'Bearer d47433f8-9a33-47c7-ba43-1a0fbac28f66' } } ).then( ( response ) => {
1149
1149
  logger.info( 'store Updated Successfully' );
1150
1150
  } ).catch( ( error ) => {
1151
1151
  logger.error( { error: error, function: 'oldBulkStoreUpdate' } );
@@ -1588,8 +1588,9 @@ export const productViewList = async ( req, res ) => {
1588
1588
  let query = [
1589
1589
  {
1590
1590
  $match: {
1591
- clientId: req.query.clientId,
1592
- status: 'active',
1591
+ 'clientId': req.query.clientId,
1592
+ 'status': 'active',
1593
+ 'edge.firstFile': true,
1593
1594
  },
1594
1595
  },
1595
1596
  { $unwind: '$product' },
@@ -1653,8 +1654,9 @@ export const productViewList = async ( req, res ) => {
1653
1654
  // }
1654
1655
  // } );
1655
1656
  let storecount = await storeService.count( {
1656
- clientId: req.query.clientId,
1657
- status: 'active',
1657
+ 'clientId': req.query.clientId,
1658
+ 'status': 'active',
1659
+ 'edge.firstFile': true,
1658
1660
  } );
1659
1661
  let totalSum = products.reduce( ( sum, product ) => sum + product.totalCost, 0 );
1660
1662
  let transaction = await paymentAccountService.findOneAccount( { clientId: req.query.clientId } );
@@ -1804,6 +1806,7 @@ export const addStoreProduct = async ( req, res ) => {
1804
1806
  } );
1805
1807
  }
1806
1808
  } );
1809
+
1807
1810
  let clientInfo = await paymentService.findOne( { clientId: req.body.clientId }, { 'planDetails.product': 1, 'clientName': 1 } );
1808
1811
  let getClientCount = await paymentService.getClientCount( { status: 'active' } );
1809
1812
  let productList = clientInfo.planDetails.product.map( ( product ) => product.productName );
@@ -2221,8 +2224,9 @@ export const priceList = async ( req, res ) => {
2221
2224
  let query = [
2222
2225
  {
2223
2226
  $match: {
2224
- clientId: req.body.clientId,
2225
- status: 'active',
2227
+ 'clientId': req.body.clientId,
2228
+ 'status': 'active',
2229
+ 'edge.firstFile': true,
2226
2230
  },
2227
2231
  },
2228
2232
  { $unwind: '$product' },
@@ -421,6 +421,7 @@ export const verifyPaymentBody = joi.object().keys( {
421
421
  razorpay_payment_id: joi.string().required(),
422
422
  razorpay_order_id: joi.string().required(),
423
423
  razorpay_signature: joi.string().required(),
424
+ status_code: joi.number().optional(),
424
425
  } );
425
426
 
426
427
  export const verifyPaymentValid = {