tango-app-api-payment-subscription 3.4.1 → 3.4.2

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.4.1",
3
+ "version": "3.4.2",
4
4
  "description": "paymentSubscription",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  "nodemon": "^3.1.0",
27
27
  "swagger-ui-express": "^5.0.0",
28
28
  "tango-api-schema": "^2.5.73",
29
- "tango-app-api-middleware": "^3.1.90",
29
+ "tango-app-api-middleware": "^3.6.18",
30
30
  "winston": "^3.12.0",
31
31
  "winston-daily-rotate-file": "^5.0.0"
32
32
  },
@@ -147,6 +147,10 @@ export async function createInvoice( req, res ) {
147
147
  dueDate: dueDate,
148
148
  advanceInvoice: group.advanceInvoice || false,
149
149
  };
150
+
151
+ if ( req.body.invoiceId ) {
152
+ await invoiceService.deleteRecord( { invoice: req.body.invoiceId } );
153
+ }
150
154
  if ( req.body.invoiceId ) {
151
155
  let logObj = {
152
156
  userName: req.user?.userName,
@@ -1688,7 +1692,11 @@ export async function updateInvoice( req, res ) {
1688
1692
 
1689
1693
  allowedFields.forEach( ( field ) => {
1690
1694
  if ( req.body[field] !== undefined ) {
1691
- updateData[field] = req.body[field];
1695
+ if ( field === 'billingDate' || field === 'dueDate' ) {
1696
+ updateData[field] = new Date( req.body[field] );
1697
+ } else {
1698
+ updateData[field] = req.body[field];
1699
+ }
1692
1700
  }
1693
1701
  } );
1694
1702