tango-app-api-payment-subscription 3.0.33-dev → 3.0.34-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.33-dev",
3
+ "version": "3.0.34-dev",
4
4
  "description": "paymentSubscription",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1632,6 +1632,10 @@ export const pricingListUpdate = async ( req, res ) => {
1632
1632
  productList = JSON.parse( JSON.stringify( req.body ) );
1633
1633
  let amount =0;
1634
1634
  productList.products.forEach( ( item ) => {
1635
+ if ( req.body.client.paymentInvoice.currencyType == 'dollar' ) {
1636
+ item.basePrice = convertINRtoUSD( item.basePrice );
1637
+ item.price = convertINRtoUSD( item.price );
1638
+ }
1635
1639
  if ( req.body.client.priceType == 'step' ) {
1636
1640
  item.storeCount = item.storeRange;
1637
1641
  }
@@ -1640,6 +1644,7 @@ export const pricingListUpdate = async ( req, res ) => {
1640
1644
  productList = {
1641
1645
  ...productList,
1642
1646
  amount: amount,
1647
+ currencyType: req.body.client.paymentInvoice.currencyType == 'dollar' ? '$' : '₹',
1643
1648
  total: amount.toFixed( 2 ),
1644
1649
  discount: 0,
1645
1650
  };
@@ -1953,7 +1958,7 @@ export const getExpiredClients = async ( req, res ) => {
1953
1958
  {
1954
1959
  $match: {
1955
1960
  'planDetails.product.status': 'trial',
1956
- 'planDetails.product.trialEndDate': { $gte: start, $lte: end },
1961
+ 'planDetails.product.trialEndDate': { $gt: end },
1957
1962
  },
1958
1963
  },
1959
1964
  ];
@@ -2001,6 +2006,10 @@ export const invoiceDownload = async ( req, res ) => {
2001
2006
  let clientDetails = await paymentService.findOne( { clientId: invoiceInfo.clientId } );
2002
2007
  let amount = 0;
2003
2008
  invoiceInfo.products.forEach( ( item ) => {
2009
+ if ( clientDetails.paymentInvoice.currencyType == 'dollar' ) {
2010
+ item.basePrice = convertINRtoUSD( item.basePrice );
2011
+ item.price = convertINRtoUSD( item.price );
2012
+ }
2004
2013
  if ( clientDetails.priceType == 'step' ) {
2005
2014
  item.count = item.product.storeRange;
2006
2015
  }
@@ -2016,6 +2025,7 @@ export const invoiceDownload = async ( req, res ) => {
2016
2025
  extendDays: clientDetails.paymentInvoice.extendPaymentPeriodDays,
2017
2026
  address: clientDetails.billingDetails.billingAddress,
2018
2027
  amount: amount,
2028
+ currencyType: clientDetails?.paymentInvoice?.currencyType == 'dollar' ? '$' : '₹',
2019
2029
  // total: ( amount + ( parseFloat( amount ) * 0.19 ) ).toFixed( 2 ),
2020
2030
  total: amount.toFixed( 2 ),
2021
2031
  invoiceDate,
@@ -2291,14 +2301,21 @@ export const invoiceGenerate = async ( req, res ) => {
2291
2301
  invoiceDetails.forEach( ( item ) => {
2292
2302
  amount = item.price + amount;
2293
2303
  } );
2304
+ let storeQuery = {
2305
+ clientId: requestClient[clientIndex],
2306
+ status: 'active',
2307
+ };
2308
+ let storeCount = await storeService.count( storeQuery );
2294
2309
  let data = {
2295
2310
  invoice: `invoice#${requestClient[clientIndex]}-${dayjs().format( 'MMM YYYY' )}`,
2296
2311
  products: invoiceDetails,
2297
2312
  status: 'pending',
2298
2313
  amount: amount,
2314
+ totalAmount: amount,
2299
2315
  clientId: requestClient[clientIndex],
2300
2316
  paymentMethod: getClient?.paymentInvoice?.paymentType || 'online',
2301
2317
  billingDate: new Date(),
2318
+ stores: storeCount,
2302
2319
  };
2303
2320
 
2304
2321
  await invoiceService.create( data );
@@ -2336,6 +2353,10 @@ export const invoiceRevised = async ( req, res ) => {
2336
2353
  let days = clientDetails?.paymentInvoice?.extendPaymentPeriodDays || 10;
2337
2354
  let dueDate = invoiceDetails?.dueDate ? dayjs( invoiceDetails?.dueDate ).format( 'DD MMM, YYYY' ) : dayjs().add( days, 'days' ).format( 'DD MMM, YYYY' );
2338
2355
  invoiceDetails.products.forEach( ( item ) => {
2356
+ if ( clientDetails?.paymentInvoice?.currencyType == 'dollar' ) {
2357
+ item.basePrice = convertINRtoUSD( item.basePrice );
2358
+ item.price = convertINRtoUSD( item.price );
2359
+ }
2339
2360
  if ( clientDetails.priceType == 'step' ) {
2340
2361
  item.count = item.product.storeRange;
2341
2362
  }
@@ -2345,6 +2366,7 @@ export const invoiceRevised = async ( req, res ) => {
2345
2366
  ...invoiceDetails._doc,
2346
2367
  amount: amount,
2347
2368
  discount: invoiceDetails.discount,
2369
+ currencyType: clientDetails?.paymentInvoice?.currencyType == 'dollar' ? '$' : '₹',
2348
2370
  total: amount.toFixed( 2 ),
2349
2371
  invoiceDate,
2350
2372
  dueDate,
@@ -93,9 +93,9 @@
93
93
  {{#each data.products}}
94
94
  <tr style="border:none;margin-top:10px;">
95
95
  <td>{{product.product}}</td>
96
- <td>${{basePrice}}</td>
96
+ <td><span style="font-size:15px">{{../data.currencyType}} &nbsp;</span>{{basePrice}}</td>
97
97
  <td>{{count}}</td>
98
- <td>${{price}}</td>
98
+ <td><span style="font-size:15px">{{../data.currencyType}} &nbsp;</span> {{price}}</td>
99
99
  </tr>
100
100
  {{/each}}
101
101
  <tr style="border:none;">
@@ -108,7 +108,7 @@
108
108
  <td>Sub Total</td>
109
109
  <td></td>
110
110
  <td></td>
111
- <td>${{data.amount}}</td>
111
+ <td><span style="font-size:15px">{{data.currencyType}} &nbsp;</span> {{data.amount}}</td>
112
112
  </tr>
113
113
  <tr style="border:none;margin-top:10px;">
114
114
  <td>IGST</td>
@@ -120,7 +120,7 @@
120
120
  <td>Total</td>
121
121
  <td></td>
122
122
  <td></td>
123
- <td>${{data.total}}</td>
123
+ <td><span style="font-size:15px">{{data.currencyType}} &nbsp;</span> {{data.total}}</td>
124
124
  </tr>
125
125
  <tr style="border:none;margin-top:10px;">
126
126
  <td>Discount</td>
@@ -138,7 +138,7 @@
138
138
  <td>Final Value</td>
139
139
  <td></td>
140
140
  <td></td>
141
- <td>${{data.total}}</td>
141
+ <td><span style="font-size:15px">{{data.currencyType}} &nbsp;</span> {{data.total}}</td>
142
142
  </tr>
143
143
  </table>
144
144
  <br/>
@@ -559,9 +559,9 @@
559
559
  {{#each data.products}}
560
560
  <tr style="border:none;margin-top:10px;">
561
561
  <td>{{product.product}}</td>
562
- <td>${{basePrice}}</td>
562
+ <td>{{../data.currencyType}} {{basePrice}}</td>
563
563
  <td>{{count}}</td>
564
- <td>${{price}}</td>
564
+ <td>{{../data.currencyType}} {{price}}</td>
565
565
  </tr>
566
566
  {{/each}}
567
567
  <tr style="border:1px solid grey;">
@@ -574,7 +574,7 @@
574
574
  <td>Sub Total</td>
575
575
  <td></td>
576
576
  <td></td>
577
- <td>${{data.amount}}</td>
577
+ <td>{{data.currencyType}} {{data.amount}}</td>
578
578
  </tr>
579
579
  <tr style="border:none;margin-top:10px;">
580
580
  <td>IGST</td>
@@ -586,7 +586,7 @@
586
586
  <td>Total</td>
587
587
  <td></td>
588
588
  <td></td>
589
- <td>${{data.total}}</td>
589
+ <td>{{data.currencyType}} {{data.total}}</td>
590
590
  </tr>
591
591
  <tr style="border:none;margin-top:10px;">
592
592
  <td>Discount</td>
@@ -604,7 +604,7 @@
604
604
  <td>Final Value</td>
605
605
  <td></td>
606
606
  <td></td>
607
- <td>${{data.total}}</td>
607
+ <td>{{data.currencyType}} {{data.total}}</td>
608
608
  </tr>
609
609
  </table>
610
610
  </div>
@@ -158,9 +158,9 @@
158
158
  {{#each data.products}}
159
159
  <tr bgcolor="#ffffff" style="border:none;margin-top:10px;">
160
160
  <td style="padding-left:30px;">{{productName}}</td>
161
- <td>${{basePrice}}</td>
161
+ <td>{{../data.currencyType}} {{basePrice}}</td>
162
162
  <td>{{storeCount}}</td>
163
- <td>${{price}}</td>
163
+ <td>{{../data.currencyType}} {{price}}</td>
164
164
  </tr>
165
165
  {{/each}}
166
166
  <tr>
@@ -176,7 +176,7 @@
176
176
  <td style="padding-left:30px;">Sub Total</td>
177
177
  <td></td>
178
178
  <td></td>
179
- <td>${{data.amount}}</td>
179
+ <td>{{data.currencyType}} {{data.amount}}</td>
180
180
  </tr>
181
181
  <tr bgcolor="#ffffff" style="border:none;margin-top:0px;">
182
182
  <td style="padding-left:30px;">IGST</td>
@@ -188,7 +188,7 @@
188
188
  <td style="padding-left:30px;">Total</td>
189
189
  <td></td>
190
190
  <td></td>
191
- <td>${{data.total}}</td>
191
+ <td>{{data.currencyType}} {{data.total}}</td>
192
192
  </tr>
193
193
  <tr bgcolor="#ffffff" style="border:none;margin-top:0px;">
194
194
  <td style="padding-left:30px;">Discount</td>
@@ -209,7 +209,7 @@
209
209
  <td style="padding-left:30px;">Final Value</td>
210
210
  <td></td>
211
211
  <td></td>
212
- <td>${{data.total}}</td>
212
+ <td>{{data.currencyType}} {{data.total}}</td>
213
213
  </tr>
214
214
  </table>
215
215
  </td>