tango-app-api-client 3.1.18 → 3.1.19-beta.0
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-client",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.19-beta.0",
|
|
4
4
|
"description": "client",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"mongodb": "^6.3.0",
|
|
26
26
|
"nodemon": "^3.0.3",
|
|
27
27
|
"swagger-ui-express": "^5.0.0",
|
|
28
|
-
"tango-api-schema": "^2.0.
|
|
29
|
-
"tango-app-api-middleware": "^3.1.
|
|
28
|
+
"tango-api-schema": "^2.0.155",
|
|
29
|
+
"tango-app-api-middleware": "^3.1.30",
|
|
30
30
|
"winston": "^3.11.0",
|
|
31
31
|
"winston-daily-rotate-file": "^5.0.0"
|
|
32
32
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { billingDetailsUpdate, brandInfoUpdate, domainDetailsConfigurationUpdate, featureConfigurationUpdate, getClientData, signatoryDetailsUpdate, ticketConfigurationUpdate, documentsUpdate, getUserData, auditConfigurationUpdate, auditConfigurationGet, CsmUsersGet, OpsUsersGet, userConfigurationUpdate, findClient, aggregateClient, createAuditQueue, findOne, insert, update, findOneClient, updateOneClient } from '../service/client.service.js';
|
|
2
|
-
import { checkFileExist, fileUpload, signedUrl, chunkArray, download, logger, getOpenSearchData, insertOpenSearchData, sendEmailWithSES } from 'tango-app-api-middleware';
|
|
2
|
+
import { checkFileExist, fileUpload, signedUrl, chunkArray, download, logger, getOpenSearchData, insertOpenSearchData, sendEmailWithSES, createCustomer, createVirtualAccount } from 'tango-app-api-middleware';
|
|
3
3
|
import { countDocumentsUser, findOneAndUpdateUser, findOneUser, getUserNameEmailById, updateManyUser } from '../service/user.service.js';
|
|
4
4
|
import { aggregateStore, countDocumentsStore, findStore, findOneStore, updateManyStore } from '../service/store.service.js';
|
|
5
5
|
import { aggregateCamera, countDocumentsCamera } from '../service/camera.service.js';
|
|
@@ -11,7 +11,9 @@ import { join } from 'path';
|
|
|
11
11
|
import { readFileSync } from 'fs';
|
|
12
12
|
import handlebars from 'handlebars';
|
|
13
13
|
import { countDocumentsGroup, createGroupModel, findOneGroup } from '../service/group.service.js';
|
|
14
|
-
import { deleteOneAuthentication } from '../service/authentication.service.js';
|
|
14
|
+
// import { deleteOneAuthentication } from '../service/authentication.service.js';
|
|
15
|
+
import { createBilling } from '../service/billing.service.js';
|
|
16
|
+
import { createPaymentAccount } from '../service/paymentAccount.service.js';
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
export async function create( req, res ) {
|
|
@@ -66,6 +68,7 @@ export async function create( req, res ) {
|
|
|
66
68
|
'planDetails.subscriptionType': leadRecord?.planDetails?.subscriptionType,
|
|
67
69
|
'planDetails.paymentStatus': leadRecord?.planDetails?.subscriptionType === 'free' ? 'free' : 'trial',
|
|
68
70
|
'planDetails.product': product,
|
|
71
|
+
'profileDetails.website': leadRecord?.websiteUrl,
|
|
69
72
|
'reportConfigs.reportName': generatedName,
|
|
70
73
|
'auditConfigs.queueName': generatedName,
|
|
71
74
|
|
|
@@ -75,6 +78,32 @@ export async function create( req, res ) {
|
|
|
75
78
|
|
|
76
79
|
const insertedClientRecord = await findOneClient( { clientId: record.clientId }, {} );
|
|
77
80
|
|
|
81
|
+
const customer = await createCustomer( { name: user.userName, email: user.email, clientId: insertedClientRecord.clientId } );
|
|
82
|
+
|
|
83
|
+
const virtualAccount = await createVirtualAccount( { receiverTypes: [ 'bank_account' ], description: `Virtual Account for ${insertedClientRecord.clientId}`,
|
|
84
|
+
customerId: customer.id, notes: { createdAt: new Date(), createdBy: req.user?.email } } );
|
|
85
|
+
|
|
86
|
+
const paymentAccount = {
|
|
87
|
+
clientId: insertedClientRecord.clientId,
|
|
88
|
+
virtualAccId: virtualAccount?.id,
|
|
89
|
+
bankAccId: virtualAccount?.receivers[0]?.id,
|
|
90
|
+
accountNumber: virtualAccount?.receivers[0]?.account_number,
|
|
91
|
+
ifsc: virtualAccount?.receivers[0]?.ifsc,
|
|
92
|
+
customerId: virtualAccount?.customer_id,
|
|
93
|
+
status: virtualAccount?.status,
|
|
94
|
+
paymentType: virtualAccount?.entity,
|
|
95
|
+
branch: 'RS Puram, Coimbatore',
|
|
96
|
+
currency: 'dollar',
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
if ( leadRecord.countryCode === '91' ) {
|
|
100
|
+
paymentAccount.currency = 'inr';
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
await createPaymentAccount( paymentAccount );
|
|
105
|
+
|
|
106
|
+
|
|
78
107
|
const defaultGroup = {
|
|
79
108
|
'groupName': 'All stores',
|
|
80
109
|
'description': 'Contains all the onboarded stores',
|
|
@@ -85,6 +114,13 @@ export async function create( req, res ) {
|
|
|
85
114
|
|
|
86
115
|
await createGroupModel( defaultGroup );
|
|
87
116
|
|
|
117
|
+
const primaryBillingGroup = {
|
|
118
|
+
clientId: insertedClientRecord.clientId,
|
|
119
|
+
isPrimary: true,
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
await createBilling( primaryBillingGroup );
|
|
123
|
+
|
|
88
124
|
const createdGroup = await findOneGroup( { clientId: insertedClientRecord.clientId, isDefault: true }, {} );
|
|
89
125
|
|
|
90
126
|
let oldGroup = {
|
|
@@ -251,7 +287,7 @@ export async function create( req, res ) {
|
|
|
251
287
|
permission: getPermission?.permission,
|
|
252
288
|
clientId: String( tangoId ),
|
|
253
289
|
};
|
|
254
|
-
await deleteOneAuthentication( { user: user?._id, type: 'retail' } );
|
|
290
|
+
// await deleteOneAuthentication( { user: user?._id, type: 'retail' } );
|
|
255
291
|
await findOneAndUpdateUser( userQuery, userRecord );
|
|
256
292
|
await createAuditQueue( generatedName );
|
|
257
293
|
return res.sendSuccess( { result: { clientId: String( tangoId ) } } );
|