tango-app-api-payment-subscription 3.0.38-dev → 3.0.39-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.38-dev",
3
+ "version": "3.0.39-dev",
4
4
  "description": "paymentSubscription",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  "pdfmake": "^0.2.10",
27
27
  "swagger-ui-express": "^5.0.0",
28
28
  "tango-api-schema": "^2.0.83",
29
- "tango-app-api-middleware": "^1.0.54-dev",
29
+ "tango-app-api-middleware": "^1.0.2-test",
30
30
  "winston": "^3.12.0",
31
31
  "winston-daily-rotate-file": "^5.0.0"
32
32
  },
@@ -16,6 +16,7 @@ import path from 'path';
16
16
  import { JSDOM } from 'jsdom';
17
17
  import pdfMake from 'pdfmake';
18
18
  import htmlToPdfmake from 'html-to-pdfmake';
19
+ import axios from 'axios';
19
20
 
20
21
  export const addBilling = async ( req, res ) => {
21
22
  try {
@@ -1053,6 +1054,15 @@ export const productSubscribe = async ( req, res ) => {
1053
1054
  }
1054
1055
  clientInfo.planDetails.product = product;
1055
1056
  clientInfo.save().then( async () => {
1057
+ let storeProduct = await storeService.find( { clientId: clientInfo.clientId }, { _id: 0, storeId: 1, product: 1 } );
1058
+ storeProduct = storeProduct.map( ( item ) => {
1059
+ return { id: item.storeId, product: item.product };
1060
+ } );
1061
+ await axios.post( `${appConfig.url.oldapidomain}/oldBulkStoreUpdate`, storeProduct, { headers: { Authorization: 'Bearer d47433f8-9a33-47c7-ba43-1a0fbac28f66' } } ).then( ( response ) => {
1062
+ logger.info( 'store Updated Successfully' );
1063
+ } ).catch( ( error ) => {
1064
+ logger.error( { error: error, function: 'oldBulkStoreUpdate' } );
1065
+ } );
1056
1066
  updatePricing( req, res, true );
1057
1067
  } );
1058
1068
  const logObj = {
@@ -1819,7 +1829,7 @@ async function updatePricing( req, res, update ) {
1819
1829
  let clientDetails = await paymentService.findOne( { clientId: req.body.clientId } );
1820
1830
  if ( clientDetails ) {
1821
1831
  let products = clientDetails.planDetails.product.map( ( item ) => item.productName );
1822
- let subscriptionCount = clientDetails.planDetails.product.map( ( item ) => item.status == 'live' );
1832
+ let subscriptionProduct = clientDetails.planDetails.product.filter( ( item ) => item.status == 'live' );
1823
1833
  let standardList = [];
1824
1834
  let stepList = [];
1825
1835
  products.forEach( ( product ) => {
@@ -1877,7 +1887,7 @@ async function updatePricing( req, res, update ) {
1877
1887
  };
1878
1888
  let pricingDetails = await calculatePricing( req, res );
1879
1889
  let paymentStatus = clientDetails?.subscriptionType == 'free' ? 'free' : 'trial';
1880
- if ( subscriptionCount ) {
1890
+ if ( subscriptionProduct.length ) {
1881
1891
  let invoiceCount = await invoiceService.count( { clientId: req.params.clientId, status: 'pending' } );
1882
1892
  if ( invoiceCount ) {
1883
1893
  paymentStatus ='due';
@@ -147,7 +147,7 @@
147
147
  <tr>
148
148
  <td align="left" bgcolor="#ffffff"
149
149
  style="padding-left: 26px;padding-right: 24px;padding-top:25px; font-size: 16px; line-height: 24px;font-weight:400;color:#384860">
150
- <p style="margin: 0;">Best, <br>Team Tango,
150
+ <p style="margin: 0;">Best, <br>Team Tango
151
151
  </p>
152
152
  </td>
153
153
  </tr>