tango-app-api-payment-subscription 3.0.59-dev → 3.0.61-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/index.js +5 -1
- package/package.json +3 -3
- package/src/controllers/billing.controllers.js +672 -0
- package/src/controllers/invoice.controller.js +867 -0
- package/src/controllers/payment.controller.js +47 -0
- package/src/controllers/paymentSubscription.controllers.js +413 -141
- package/src/dtos/validation.dtos.js +151 -7
- package/src/hbs/invoicePdf.hbs +134 -44
- package/src/hbs/invoicePdf1.hbs +1577 -0
- package/src/routes/billing.routes.js +50 -0
- package/src/routes/invoice.routes.js +10 -0
- package/src/routes/payment.routes.js +26 -0
- package/src/routes/paymentSubscription.routes.js +3 -0
- package/src/services/billing.service.js +34 -0
- package/src/services/paymentAccount.service.js +7 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
import { createOrder } from 'tango-app-api-middleware';
|
|
3
|
+
import { findOneAccount } from '../services/paymentAccount.service.js';
|
|
4
|
+
import * as invoiceService from '../services/invoice.service.js';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export const generateOrder = async ( req, res ) => {
|
|
8
|
+
try {
|
|
9
|
+
const order = await createOrder( { amount: req.body.amount, currency: req.body.currency } );
|
|
10
|
+
|
|
11
|
+
if ( !order ) {
|
|
12
|
+
return res.sendError( 'Failed to generate order id', 500 );
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return res.sendSuccess( order );
|
|
16
|
+
} catch ( error ) {
|
|
17
|
+
logger.error( { error: error, function: 'generateOrder' } );
|
|
18
|
+
return res.sendError( error, 500 );
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const getVirtualAccount = async ( req, res ) => {
|
|
23
|
+
try {
|
|
24
|
+
const account = await findOneAccount( { clientId: req.query.clientId }, { accountNumber: 1, ifsc: 1, branch: 1, paymentType: 1, credit: 1, _id: 0 } );
|
|
25
|
+
|
|
26
|
+
if ( !account ) {
|
|
27
|
+
return res.sendError( 'No data found', 204 );
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return res.sendSuccess( account );
|
|
31
|
+
} catch ( error ) {
|
|
32
|
+
logger.error( { error: error, function: 'getVirtualAccount' } );
|
|
33
|
+
return res.sendError( error, 500 );
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const payUsingVallet = async ( req, res ) => {
|
|
38
|
+
try {
|
|
39
|
+
const invoice = await invoiceService.findOne( { ivoice: req.params.invoice } );
|
|
40
|
+
if ( !invoice ) {
|
|
41
|
+
return res.sendError( 'No data found', 204 );
|
|
42
|
+
}
|
|
43
|
+
} catch ( error ) {
|
|
44
|
+
logger.error( { error: error, function: 'payUsingVallet' } );
|
|
45
|
+
return res.sendError( error, 500 );
|
|
46
|
+
}
|
|
47
|
+
};
|