tango-app-api-payment-subscription 3.1.4 → 3.1.6

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.4",
3
+ "version": "3.1.6",
4
4
  "description": "paymentSubscription",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -25,7 +25,7 @@
25
25
  "mongodb": "^6.4.0",
26
26
  "nodemon": "^3.1.0",
27
27
  "swagger-ui-express": "^5.0.0",
28
- "tango-api-schema": "^2.0.91",
28
+ "tango-api-schema": "^2.0.92",
29
29
  "tango-app-api-middleware": "^3.1.7",
30
30
  "winston": "^3.12.0",
31
31
  "winston-daily-rotate-file": "^5.0.0"
@@ -1054,6 +1054,7 @@ export const productSubscribe = async ( req, res ) => {
1054
1054
  for ( let item of req.body.product ) {
1055
1055
  if ( productList.includes( item.name ) && item.type == 'unsubscribe' ) {
1056
1056
  await storeService.addremoveElement( { clientId: clientInfo.clientId, product: { $in: item.name } }, { $pull: { product: item.name } } );
1057
+ await clientRequestService.deleteOne( { clientId: clientInfo.clientId, status: 'pending', name: item.name } );
1057
1058
  }
1058
1059
  if ( !productList.includes( item.name ) && [ 'trial', 'subscription' ].includes( item.type ) ) {
1059
1060
  if ( item.type == 'trial' ) {
@@ -1205,6 +1206,7 @@ export const unsubscribeApproval = async ( req, res ) => {
1205
1206
  clientProducts.save();
1206
1207
  await storeService.updateMany( { clientId: requestData.clientId }, { status: 'deactive' } );
1207
1208
  await userService.updateMany( { clientId: requestData.clientId }, { isActive: false } );
1209
+ await clientRequestService.deleteMany( { clientId: requestData.clientId } );
1208
1210
  let userDetails = await userService.findOne( { clientId: requestData.clientId, role: 'superadmin' } );
1209
1211
  if ( userDetails ) {
1210
1212
  const templateHtml = fs.readFileSync( path.resolve( path.dirname( '' ) ) + '/src/hbs/trialUnsubscribeEmail.hbs', 'utf8' );
@@ -2413,7 +2415,6 @@ export const invoiceDownload = async ( req, res ) => {
2413
2415
  content: html,
2414
2416
  };
2415
2417
  let options = {
2416
- path: `../../invoice/test.pdf}`,
2417
2418
  format: 'A4', margin: {
2418
2419
  top: '0.5in',
2419
2420
  right: '0.5in',
@@ -16,3 +16,11 @@ export const find = async ( query ={}, record={} ) => {
16
16
  export const updateone = async ( query = {}, record ={} ) => {
17
17
  return await model.clientRequestModel.updateOne( query, { $set: record } );
18
18
  };
19
+
20
+ export const deleteMany = async ( query = {} ) => {
21
+ return await model.clientRequestModel.deleteMany( query );
22
+ };
23
+
24
+ export const deleteOne = async ( query = {} ) => {
25
+ return await model.clientRequestModel.deleteOne( query );
26
+ };