tango-app-api-payment-subscription 3.1.12 → 3.1.14-alpha.1

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.
@@ -1,8 +1,8 @@
1
1
  import express from 'express';
2
2
  export const billingRouter = express.Router();
3
3
  import { authorize, isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
4
- import { createBillingGroup, deleteBillingGroup, getAllBillingGroups, getBillingGroups, subscribedStoreList, updateBillingGroup } from '../controllers/billing.controllers.js';
5
- import { billingGroupSchema, createBillingGroupsSchema, deleteBillingGroupsSchema, getBillingGroupsSchema, subscribedStoreListSchema, updateBillingGroupsSchema } from '../dtos/validation.dtos.js';
4
+ import { createBillingGroup, deleteBillingGroup, getAllBillingGroups, getBillingGroups, getInvoices, onetimePayment, subscribedStoreList, updateBillingGroup } from '../controllers/billing.controllers.js';
5
+ import { billingGroupSchema, createBillingGroupsSchema, deleteBillingGroupsSchema, getBillingGroupsSchema, getInvoiceSchema, onetimeFeeValid, subscribedStoreListSchema, updateBillingGroupsSchema } from '../dtos/validation.dtos.js';
6
6
 
7
7
 
8
8
  billingRouter.post( '/get-subscribed-store-list', isAllowedSessionHandler, authorize( {
@@ -41,3 +41,16 @@ billingRouter.post( '/get-billing-groups', isAllowedSessionHandler, authorize( {
41
41
  ],
42
42
  } ), validate( billingGroupSchema ), getBillingGroups );
43
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
+
51
+ billingRouter.post( '/onetime-payment/:invoice', isAllowedSessionHandler, authorize( {
52
+ userType: [ 'tango' ], access: [
53
+ { featureName: 'settings', name: 'paymentSubscriptions', permissions: [ 'isEdit' ] },
54
+ ],
55
+ } ), validate( onetimeFeeValid ), onetimePayment );
56
+
@@ -1,8 +1,14 @@
1
1
  import express from 'express';
2
- import { createInvoice, invoiceDownload } from '../controllers/invoice.controller.js';
3
- // import { isAllowedSessionHandler } from 'tango-app-api-middleware';
2
+ import { createInvoice, invoiceDownload, clientInvoiceList, creditTransactionlist, pendingInvoices, applyDiscount } from '../controllers/invoice.controller.js';
3
+ import { isAllowedSessionHandler } from 'tango-app-api-middleware';
4
4
  export const invoiceRouter = express.Router();
5
5
 
6
6
 
7
7
  invoiceRouter.post( '/createInvoice', createInvoice );
8
- invoiceRouter.post( '/invoiceDownload/:invoiceId', invoiceDownload );
8
+ invoiceRouter.post( '/invoiceDownload/:invoiceId', isAllowedSessionHandler, invoiceDownload );
9
+ invoiceRouter.post( '/clientInvoiceList', isAllowedSessionHandler, clientInvoiceList );
10
+ invoiceRouter.post( '/creditTransactionlist', isAllowedSessionHandler, creditTransactionlist );
11
+ invoiceRouter.post( '/pendingInvoices', isAllowedSessionHandler, pendingInvoices );
12
+ invoiceRouter.post( '/applyDiscount', isAllowedSessionHandler, applyDiscount );
13
+
14
+
@@ -0,0 +1,41 @@
1
+ import express from 'express';
2
+ export const paymentRouter = express.Router();
3
+ import { authorize, isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
4
+ import { generateOrder, paymentHook, payUsingVallet, transactionList, verifyPayment } from '../controllers/payment.controller.js';
5
+ import { getVirtualAccount } from '../controllers/payment.controller.js';
6
+ import { getInvoiceSchema, getVirtualAccountSchema, valletPayValid, verifyPaymentValid } from '../dtos/validation.dtos.js';
7
+ import { checkDuplicateEvent } from '../dtos/isUniqueEvent.js';
8
+
9
+
10
+ paymentRouter.get( '/get-virtual-account', isAllowedSessionHandler, authorize( {
11
+ userType: [ 'tango' ], access: [
12
+ { featureName: 'settings', name: 'paymentSubscriptions', permissions: [ 'isView' ] },
13
+ ],
14
+ } ), validate( getVirtualAccountSchema ), getVirtualAccount );
15
+
16
+ paymentRouter.get( '/wallet-pay/:invoice', isAllowedSessionHandler, authorize( {
17
+ userType: [ 'tango' ], access: [
18
+ { featureName: 'settings', name: 'paymentSubscriptions', permissions: [ 'isEdit' ] },
19
+ ],
20
+ } ), validate( valletPayValid ), payUsingVallet );
21
+
22
+ paymentRouter.get( '/generate-order/:invoice', isAllowedSessionHandler, authorize( {
23
+ userType: [ 'tango' ], access: [
24
+ { featureName: 'settings', name: 'paymentSubscriptions', permissions: [ 'isEdit' ] },
25
+ ],
26
+ } ), validate( valletPayValid ), generateOrder );
27
+
28
+ paymentRouter.post( '/verify-payment/:invoice', isAllowedSessionHandler, authorize( {
29
+ userType: [ 'tango' ], access: [
30
+ { featureName: 'settings', name: 'paymentSubscriptions', permissions: [ 'isEdit' ] },
31
+ ],
32
+ } ), validate( verifyPaymentValid ), verifyPayment );
33
+
34
+ paymentRouter.post( '/get-transactions', isAllowedSessionHandler, authorize( {
35
+ userType: [ 'tango' ], access: [
36
+ { featureName: 'settings', name: 'paymentSubscriptions', permissions: [ 'isView' ] },
37
+ ],
38
+ } ), validate( getInvoiceSchema ), transactionList );
39
+
40
+ paymentRouter.post( '/payment-hook', checkDuplicateEvent, paymentHook );
41
+
@@ -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
 
@@ -28,3 +28,7 @@ export const updateMany = ( query, record ) => {
28
28
  return model.billingModel.updateMany( query, record );
29
29
  };
30
30
 
31
+ export const countDocuments = ( query = {}, options = {} ) => {
32
+ return model.billingModel.countDocuments( query, options );
33
+ };
34
+
@@ -25,3 +25,11 @@ export const create = async ( data ) => {
25
25
  export const count = async ( query ) => {
26
26
  return await model.invoiceModel.count( query );
27
27
  };
28
+
29
+ export const invoiceUpdateOne = async ( query ={}, record={} ) => {
30
+ return await model.invoiceModel.updateOne( query, record );
31
+ };
32
+
33
+ export const deleteRecord = async ( query ) => {
34
+ return await model.invoiceModel.deleteOne( query );
35
+ };
@@ -0,0 +1,14 @@
1
+
2
+
3
+ import model from 'tango-api-schema';
4
+
5
+ export const findOneAccount = ( query = {}, record = {} ) => {
6
+ return model.paymentAccountModel.findOne( query, record );
7
+ };
8
+
9
+ export const updateOneAccount = async ( query ={}, record={} ) => {
10
+ return await model.paymentAccountModel.updateOne( query, { $set: record } );
11
+ };
12
+ export const aggregate = ( query = [] ) => {
13
+ return model.paymentAccountModel.aggregate( query );
14
+ };
@@ -0,0 +1,10 @@
1
+ import model from 'tango-api-schema';
2
+
3
+
4
+ export const createTransaction = async ( data ) => {
5
+ return await model.transactionModel.create( data );
6
+ };
7
+
8
+ export const aggregateTransaction = async ( query ={} ) => {
9
+ return await model.transactionModel.aggregate( query );
10
+ };