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,50 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
export const billingRouter = express.Router();
|
|
3
|
+
import { authorize, isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
|
|
4
|
+
import { createBillingGroup, deleteBillingGroup, getAllBillingGroups, getBillingGroups, getInvoices, subscribedStoreList, updateBillingGroup } from '../controllers/billing.controllers.js';
|
|
5
|
+
import { billingGroupSchema, createBillingGroupsSchema, deleteBillingGroupsSchema, getBillingGroupsSchema, getInvoiceSchema, subscribedStoreListSchema, updateBillingGroupsSchema } from '../dtos/validation.dtos.js';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
billingRouter.post( '/get-subscribed-store-list', isAllowedSessionHandler, authorize( {
|
|
9
|
+
userType: [ 'tango' ], access: [
|
|
10
|
+
{ featureName: 'settings', name: 'paymentSubscriptions', permissions: [ 'isView' ] },
|
|
11
|
+
],
|
|
12
|
+
} ), validate( subscribedStoreListSchema ), subscribedStoreList );
|
|
13
|
+
|
|
14
|
+
billingRouter.get( '/get-all-billing-groups', isAllowedSessionHandler, authorize( {
|
|
15
|
+
userType: [ 'tango' ], access: [
|
|
16
|
+
{ featureName: 'settings', name: 'paymentSubscriptions', permissions: [ 'isView' ] },
|
|
17
|
+
],
|
|
18
|
+
} ), validate( getBillingGroupsSchema ), getAllBillingGroups );
|
|
19
|
+
|
|
20
|
+
billingRouter.post( '/create-group', isAllowedSessionHandler, authorize( {
|
|
21
|
+
userType: [ 'tango' ], access: [
|
|
22
|
+
{ featureName: 'settings', name: 'paymentSubscriptions', permissions: [ 'isView' ] },
|
|
23
|
+
],
|
|
24
|
+
} ), validate( createBillingGroupsSchema ), createBillingGroup );
|
|
25
|
+
|
|
26
|
+
billingRouter.put( '/update-group', isAllowedSessionHandler, authorize( {
|
|
27
|
+
userType: [ 'tango' ], access: [
|
|
28
|
+
{ featureName: 'settings', name: 'paymentSubscriptions', permissions: [ 'isView' ] },
|
|
29
|
+
],
|
|
30
|
+
} ), validate( updateBillingGroupsSchema ), updateBillingGroup );
|
|
31
|
+
|
|
32
|
+
billingRouter.delete( '/delete-group', isAllowedSessionHandler, authorize( {
|
|
33
|
+
userType: [ 'tango' ], access: [
|
|
34
|
+
{ featureName: 'settings', name: 'paymentSubscriptions', permissions: [ 'isView' ] },
|
|
35
|
+
],
|
|
36
|
+
} ), validate( deleteBillingGroupsSchema ), deleteBillingGroup );
|
|
37
|
+
|
|
38
|
+
billingRouter.post( '/get-billing-groups', isAllowedSessionHandler, authorize( {
|
|
39
|
+
userType: [ 'tango' ], access: [
|
|
40
|
+
{ featureName: 'settings', name: 'paymentSubscriptions', permissions: [ 'isView' ] },
|
|
41
|
+
],
|
|
42
|
+
} ), validate( billingGroupSchema ), getBillingGroups );
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
billingRouter.post( '/get-invoices', isAllowedSessionHandler, authorize( {
|
|
46
|
+
userType: [ 'tango' ], access: [
|
|
47
|
+
{ featureName: 'settings', name: 'paymentSubscriptions', permissions: [ 'isView' ] },
|
|
48
|
+
],
|
|
49
|
+
} ), validate( getInvoiceSchema ), getInvoices );
|
|
50
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { createInvoice, invoiceDownload, clientInvoiceList } from '../controllers/invoice.controller.js';
|
|
3
|
+
// import { isAllowedSessionHandler } from 'tango-app-api-middleware';
|
|
4
|
+
export const invoiceRouter = express.Router();
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
invoiceRouter.post( '/createInvoice', createInvoice );
|
|
8
|
+
invoiceRouter.post( '/invoiceDownload/:invoiceId', invoiceDownload );
|
|
9
|
+
invoiceRouter.post( '/clientInvoiceList', clientInvoiceList );
|
|
10
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
export const paymentRouter = express.Router();
|
|
3
|
+
import { authorize, isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
|
|
4
|
+
import { generateOrder, payUsingVallet } from '../controllers/payment.controller.js';
|
|
5
|
+
import { getVirtualAccount } from '../controllers/payment.controller.js';
|
|
6
|
+
import { getVirtualAccountSchema, valletPayValid } from '../dtos/validation.dtos.js';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
paymentRouter.get( '/get-virtual-account', isAllowedSessionHandler, authorize( {
|
|
10
|
+
userType: [ 'tango' ], access: [
|
|
11
|
+
{ featureName: 'settings', name: 'paymentSubscriptions', permissions: [ 'isView' ] },
|
|
12
|
+
],
|
|
13
|
+
} ), validate( getVirtualAccountSchema ), getVirtualAccount );
|
|
14
|
+
|
|
15
|
+
paymentRouter.post( '/generate-order', isAllowedSessionHandler, authorize( {
|
|
16
|
+
userType: [ 'tango' ], access: [
|
|
17
|
+
{ featureName: 'settings', name: 'paymentSubscriptions', permissions: [ 'isEdit' ] },
|
|
18
|
+
],
|
|
19
|
+
} ), generateOrder );
|
|
20
|
+
|
|
21
|
+
paymentRouter.get( '/wallet-pay/:invoice', isAllowedSessionHandler, authorize( {
|
|
22
|
+
userType: [ 'tango' ], access: [
|
|
23
|
+
{ featureName: 'settings', name: 'paymentSubscriptions', permissions: [ 'isEdit' ] },
|
|
24
|
+
],
|
|
25
|
+
} ), validate( valletPayValid ), payUsingVallet );
|
|
26
|
+
|
|
@@ -159,9 +159,12 @@ paymentSubscriptionRouter.post( '/invoiceStatusUpdate/:invoiceId', validate( val
|
|
|
159
159
|
paymentSubscriptionRouter.post( '/invoice/create', validateClient, paymentController.invoiceCreate );
|
|
160
160
|
paymentSubscriptionRouter.post( '/invoiceGenerate', paymentController.invoiceGenerate );
|
|
161
161
|
paymentSubscriptionRouter.post( '/dailyPricing/insert', validate( validationDtos.dailyPricingParams ), paymentController.dailyPricingInsert );
|
|
162
|
+
paymentSubscriptionRouter.post( '/dailyPricing/insertOld', paymentController.dailyPricingInsertV1 );
|
|
162
163
|
paymentSubscriptionRouter.get( '/invoiceRevised/:invoiceId', validate( validationDtos.invoiceRevisedParams ), paymentController.invoiceRevised );
|
|
163
164
|
paymentSubscriptionRouter.get( '/notificationList', isAllowedSessionHandler, validate( validationDtos.notificationParams ), paymentController.clientNotificationList );
|
|
164
165
|
paymentSubscriptionRouter.put( '/notification/update/:notificationId', isAllowedSessionHandler, validate( validationDtos.validateId ), paymentController.updateNotification );
|
|
165
166
|
paymentSubscriptionRouter.put( '/pushNotification/update/:notificationId', isAllowedSessionHandler, validate( validationDtos.validateId ), paymentController.updatePushNotification );
|
|
166
167
|
paymentSubscriptionRouter.post( '/updateRemind/:notificationId', isAllowedSessionHandler, validate( validationDtos.validateId ), paymentController.updateRemind );
|
|
168
|
+
paymentSubscriptionRouter.post( '/createDefaultbillings', paymentController.createDefaultbillings );
|
|
169
|
+
|
|
167
170
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import model from 'tango-api-schema';
|
|
2
|
+
|
|
3
|
+
export const aggregatebilling = ( query = {} ) => {
|
|
4
|
+
return model.billingModel.aggregate( query );
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export const find = ( query = {}, record = {} ) => {
|
|
8
|
+
return model.billingModel.find( query, record );
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const findOne = ( query = {}, record = {} ) => {
|
|
12
|
+
return model.billingModel.findOne( query, record );
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const create = ( record ) => {
|
|
16
|
+
return model.billingModel.create( record );
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const updateOne = ( query, record ) => {
|
|
20
|
+
return model.billingModel.updateOne( query, record );
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const deleteOne = ( record ) => {
|
|
24
|
+
return model.billingModel.deleteOne( record );
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const updateMany = ( query, record ) => {
|
|
28
|
+
return model.billingModel.updateMany( query, record );
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const countDocuments = ( query = {}, options = {} ) => {
|
|
32
|
+
return model.billingModel.countDocuments( query, options );
|
|
33
|
+
};
|
|
34
|
+
|