tango-app-api-payment-subscription 3.0.60-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.
@@ -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
+
@@ -165,4 +165,6 @@ paymentSubscriptionRouter.get( '/notificationList', isAllowedSessionHandler, val
165
165
  paymentSubscriptionRouter.put( '/notification/update/:notificationId', isAllowedSessionHandler, validate( validationDtos.validateId ), paymentController.updateNotification );
166
166
  paymentSubscriptionRouter.put( '/pushNotification/update/:notificationId', isAllowedSessionHandler, validate( validationDtos.validateId ), paymentController.updatePushNotification );
167
167
  paymentSubscriptionRouter.post( '/updateRemind/:notificationId', isAllowedSessionHandler, validate( validationDtos.validateId ), paymentController.updateRemind );
168
+ paymentSubscriptionRouter.post( '/createDefaultbillings', paymentController.createDefaultbillings );
169
+
168
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
+
@@ -0,0 +1,7 @@
1
+
2
+
3
+ import model from 'tango-api-schema';
4
+
5
+ export const findOneAccount = ( query = {}, record = {} ) => {
6
+ return model.paymentAccountModel.findOne( query, record );
7
+ };