tango-app-api-payment-subscription 3.0.13-dev → 3.0.14-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,11 +1,10 @@
|
|
|
1
|
-
import { logger, download, sendEmailWithSES } from 'tango-app-api-middleware';
|
|
1
|
+
import { logger, download, sendEmailWithSES, appConfig } from 'tango-app-api-middleware';
|
|
2
2
|
import * as paymentService from '../services/clientPayment.services.js';
|
|
3
3
|
import * as storeService from '../services/store.service.js';
|
|
4
4
|
import * as basePricingService from '../services/basePrice.service.js';
|
|
5
5
|
import * as clientRequestService from '../services/clientRequest.service.js';
|
|
6
6
|
import * as invoiceService from '../services/invoice.service.js';
|
|
7
7
|
import dayjs from 'dayjs';
|
|
8
|
-
import appConfig from '../../config/env/env.js';
|
|
9
8
|
import Handlebars from 'handlebars';
|
|
10
9
|
import fs from 'fs';
|
|
11
10
|
import path from 'path';
|
|
@@ -622,11 +621,12 @@ export const notificationList = async ( req, res ) => {
|
|
|
622
621
|
let days = date.diff( startDate, 'day' );
|
|
623
622
|
let totalDays = endDate.diff( startDate, 'day' );
|
|
624
623
|
let percentage = Math.round( ( days / totalDays )* 100 );
|
|
624
|
+
let leftDays = endDate.diff( date, 'day' ) + 1;
|
|
625
625
|
notificationList.push( {
|
|
626
626
|
product: item.product.productName,
|
|
627
627
|
name: `${firstWord} ${secondWord}`,
|
|
628
|
-
day:
|
|
629
|
-
percentage: percentage,
|
|
628
|
+
day: leftDays < 0 ? 0 : leftDays,
|
|
629
|
+
percentage: percentage > 100 ? 100 : percentage,
|
|
630
630
|
category: 'trial product',
|
|
631
631
|
} );
|
|
632
632
|
} );
|
|
@@ -691,7 +691,7 @@ export const trialApproval = async ( req, res ) => {
|
|
|
691
691
|
mailSubject: 'test',
|
|
692
692
|
htmlBody: html,
|
|
693
693
|
attachment: '',
|
|
694
|
-
sourceEmail: appConfig.cloud.aws.ses.
|
|
694
|
+
sourceEmail: appConfig.cloud.aws.ses.adminEmail,
|
|
695
695
|
};
|
|
696
696
|
sendEmailWithSES( params.toEmail, params.mailSubject, params.htmlBody, params.attachment, params.sourceEmail );
|
|
697
697
|
}
|
|
@@ -848,7 +848,7 @@ export const productViewList = async ( req, res ) => {
|
|
|
848
848
|
let storeProductCount = await storeService.aggregate( query );
|
|
849
849
|
let clientProduct = await paymentService.findOne( { clientId: req.query.clientId }, { 'planDetails.product': 1 } );
|
|
850
850
|
|
|
851
|
-
if ( !clientProduct ) {
|
|
851
|
+
if ( !clientProduct.planDetails.product.length ) {
|
|
852
852
|
return res.sendError( 'no data found', 204 );
|
|
853
853
|
}
|
|
854
854
|
let productPrice = await basePricingService.findOne( { clientId: { $exists: false } }, { basePricing: 1 } );
|