Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Jay Mehta
/
strapi-setup-file
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Registry
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 89f60242
authored
2023-01-06 20:31:38 +0530
by
jay
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
backend referral lead issue fixed
1 parent
3e833938
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
19 deletions
src/api/channel-partner/services/channel-partner.js
src/api/end-user/controllers/end-user.js
src/api/end-user/services/end-user.js
src/api/lead/services/lead.js
src/api/referral/controllers/referral.js
src/api/referral/services/referral.js
src/api/channel-partner/services/channel-partner.js
View file @
89f6024
...
@@ -12,7 +12,7 @@ module.exports = createCoreService(
...
@@ -12,7 +12,7 @@ module.exports = createCoreService(
"api::channel-partner.channel-partner"
,
"api::channel-partner.channel-partner"
,
({
strapi
:
Strapi
})
=>
({
({
strapi
:
Strapi
})
=>
({
async
sendCPToSperto
(
data
)
{
async
sendCPToSperto
(
data
)
{
console
.
log
(
data
);
//
console.log(data);
const
headers
=
{
"Content-Type"
:
"application/json"
};
const
headers
=
{
"Content-Type"
:
"application/json"
};
const
cpData
=
{
const
cpData
=
{
api_key
:
process
.
env
.
SPERTO_API_KEY
,
api_key
:
process
.
env
.
SPERTO_API_KEY
,
...
@@ -39,7 +39,7 @@ module.exports = createCoreService(
...
@@ -39,7 +39,7 @@ module.exports = createCoreService(
cpData
,
cpData
,
{
headers
:
headers
}
{
headers
:
headers
}
);
);
console
.
log
(
"cp response"
,
spertoResponse
);
//
console.log("cp response", spertoResponse);
return
spertoResponse
;
return
spertoResponse
;
},
},
})
})
...
...
src/api/end-user/controllers/end-user.js
View file @
89f6024
...
@@ -58,7 +58,7 @@ module.exports = factories.createCoreController(
...
@@ -58,7 +58,7 @@ module.exports = factories.createCoreController(
}
}
try
{
try
{
console
.
log
(
"inside try"
,
user
.
email
);
//
console.log("inside try", user.email);
const
spretoLeadData
=
await
strapi
const
spretoLeadData
=
await
strapi
.
service
(
"api::end-user.end-user"
)
.
service
(
"api::end-user.end-user"
)
.
sendLeadToSperto
({
...
endUser
,
email
:
user
.
email
},
"Y"
);
.
sendLeadToSperto
({
...
endUser
,
email
:
user
.
email
},
"Y"
);
...
@@ -183,14 +183,14 @@ module.exports = factories.createCoreController(
...
@@ -183,14 +183,14 @@ module.exports = factories.createCoreController(
}
}
);
);
ctx
.
request
.
body
.
data
=
{
...
ctx
.
request
.
body
.
data
,
emailToSend
};
ctx
.
request
.
body
.
data
=
{
...
ctx
.
request
.
body
.
data
,
emailToSend
};
console
.
log
(
"ctx.request.body.data"
,
ctx
.
request
.
body
.
data
);
//
console.log("ctx.request.body.data", ctx.request.body.data);
// Send an email to the user.
// Send an email to the user.
// await strapi.plugin("email").service("email").send(emailToSend).sendOTPToSpreto({...ctx.request.body.data,body: emailToSend });
// await strapi.plugin("email").service("email").send(emailToSend).sendOTPToSpreto({...ctx.request.body.data,body: emailToSend });
try
{
try
{
const
spretoOTP
=
await
strapi
const
spretoOTP
=
await
strapi
.
service
(
"api::end-user.end-user"
)
.
service
(
"api::end-user.end-user"
)
.
sendOTPToSpreto
(
ctx
.
request
.
body
.
data
);
.
sendOTPToSpreto
(
ctx
.
request
.
body
.
data
);
console
.
log
(
"spretoOTP>>>>>>>>"
,
spretoOTP
);
//
console.log("spretoOTP>>>>>>>>", spretoOTP);
ctx
.
request
.
body
.
data
.
httpRequestEmailHeaders
=
JSON
.
stringify
(
ctx
.
request
.
body
.
data
.
httpRequestEmailHeaders
=
JSON
.
stringify
(
spretoOTP
.
spertoEmailResponse
.
headers
spretoOTP
.
spertoEmailResponse
.
headers
);
);
...
@@ -306,7 +306,7 @@ module.exports = factories.createCoreController(
...
@@ -306,7 +306,7 @@ module.exports = factories.createCoreController(
const
finalArray
=
removeDuplicates
(
projectType
);
const
finalArray
=
removeDuplicates
(
projectType
);
// const matchingProjects =
// const matchingProjects =
console
.
log
(
projectsId
);
//
console.log(projectsId);
ctx
.
send
({
ctx
.
send
({
ok
:
true
,
ok
:
true
,
...
@@ -351,7 +351,7 @@ module.exports = factories.createCoreController(
...
@@ -351,7 +351,7 @@ module.exports = factories.createCoreController(
return
arr
.
filter
((
item
,
index
)
=>
arr
.
indexOf
(
item
)
===
index
);
return
arr
.
filter
((
item
,
index
)
=>
arr
.
indexOf
(
item
)
===
index
);
}
}
const
finalArray
=
removeDuplicates
(
porjectConfiguration
).
sort
();
const
finalArray
=
removeDuplicates
(
porjectConfiguration
).
sort
();
console
.
log
(
"matchingProjects"
,
finalArray
);
//
console.log("matchingProjects",finalArray);
// const matchingProjects =
// const matchingProjects =
...
...
src/api/end-user/services/end-user.js
View file @
89f6024
...
@@ -11,7 +11,7 @@ module.exports = createCoreService(
...
@@ -11,7 +11,7 @@ module.exports = createCoreService(
"api::end-user.end-user"
,
"api::end-user.end-user"
,
({
strapi
:
Strapi
})
=>
({
({
strapi
:
Strapi
})
=>
({
async
sendLeadToSperto
(
data
,
isVerified
)
{
async
sendLeadToSperto
(
data
,
isVerified
)
{
console
.
log
(
">>>>>>>"
,
data
);
//
console.log(">>>>>>>",data);
const
headers
=
{
"Content-Type"
:
"application/json"
};
const
headers
=
{
"Content-Type"
:
"application/json"
};
const
leadData
=
{
const
leadData
=
{
api_key
:
process
.
env
.
SPERTO_API_KEY
,
api_key
:
process
.
env
.
SPERTO_API_KEY
,
...
@@ -23,7 +23,7 @@ module.exports = createCoreService(
...
@@ -23,7 +23,7 @@ module.exports = createCoreService(
email_id1
:
data
.
email
,
email_id1
:
data
.
email
,
otp_verified_yn
:
isVerified
,
otp_verified_yn
:
isVerified
,
};
};
console
.
log
(
"lead data"
,
leadData
);
//
console.log("lead data", leadData);
// if (data.comments) {
// if (data.comments) {
// leadData.comments = data.comments;
// leadData.comments = data.comments;
// }
// }
...
@@ -43,7 +43,7 @@ module.exports = createCoreService(
...
@@ -43,7 +43,7 @@ module.exports = createCoreService(
leadData
,
leadData
,
{
headers
:
headers
}
{
headers
:
headers
}
);
);
console
.
log
(
"spertoLeadResponse"
,
spertoLeadResponse
);
//
console.log("spertoLeadResponse", spertoLeadResponse);
return
spertoLeadResponse
;
return
spertoLeadResponse
;
},
},
...
...
src/api/lead/services/lead.js
View file @
89f6024
...
@@ -10,7 +10,7 @@ const { createCoreService } = require("@strapi/strapi").factories;
...
@@ -10,7 +10,7 @@ const { createCoreService } = require("@strapi/strapi").factories;
module
.
exports
=
createCoreService
(
"api::lead.lead"
,
({
strapi
:
Strapi
})
=>
({
module
.
exports
=
createCoreService
(
"api::lead.lead"
,
({
strapi
:
Strapi
})
=>
({
async
sendLeadToSperto
(
data
)
{
async
sendLeadToSperto
(
data
)
{
console
.
log
(
data
);
//
console.log(data);
const
headers
=
{
"Content-Type"
:
"application/json"
};
const
headers
=
{
"Content-Type"
:
"application/json"
};
const
leadData
=
{
const
leadData
=
{
api_key
:
process
.
env
.
SPERTO_API_KEY
,
api_key
:
process
.
env
.
SPERTO_API_KEY
,
...
...
src/api/referral/controllers/referral.js
View file @
89f6024
...
@@ -8,14 +8,14 @@ const { createCoreController } = require("@strapi/strapi").factories;
...
@@ -8,14 +8,14 @@ const { createCoreController } = require("@strapi/strapi").factories;
module
.
exports
=
createCoreController
(
"api::referral.referral"
,
()
=>
({
module
.
exports
=
createCoreController
(
"api::referral.referral"
,
()
=>
({
async
create
(
ctx
)
{
async
create
(
ctx
)
{
console
.
log
(
"create started"
);
//
console.log("create started");
try
{
try
{
const
spertoRefereeData
=
await
strapi
const
spertoRefereeData
=
await
strapi
.
service
(
"api::referral.referral"
)
.
service
(
"api::referral.referral"
)
.
sendReferee
(
ctx
.
request
.
body
.
data
);
.
sendReferee
(
ctx
.
request
.
body
.
data
);
console
.
log
(
"spertoRefereeData"
,
spertoRefereeData
.
data
.
member_id
);
//
console.log("spertoRefereeData", spertoRefereeData.data.member_id);
const
spertoReferralData
=
await
strapi
.
service
(
"api::referral.referral"
).
sendReferral
({...
ctx
.
request
.
body
.
data
,
parent_id
:
spertoRefereeData
.
data
.
member_id
})
const
spertoReferralData
=
await
strapi
.
service
(
"api::referral.referral"
).
sendReferral
({...
ctx
.
request
.
body
.
data
,
parent_id
:
spertoRefereeData
.
data
.
member_id
})
// console.log("spertoReferralData", spertoReferralData)
ctx
.
request
.
body
.
data
.
httpRequestHeaders
=
JSON
.
stringify
(
ctx
.
request
.
body
.
data
.
httpRequestHeaders
=
JSON
.
stringify
(
spertoRefereeData
.
headers
spertoRefereeData
.
headers
);
);
...
...
src/api/referral/services/referral.js
View file @
89f6024
"use strict"
;
"use strict"
;
const
{
default
:
axios
}
=
require
(
"axios"
);
const
axios
=
require
(
"axios"
);
/**
/**
* referral service
* referral service
...
@@ -49,13 +49,13 @@ module.exports = createCoreService(
...
@@ -49,13 +49,13 @@ module.exports = createCoreService(
referralData
.
building
=
projectData
.
projectName
;
referralData
.
building
=
projectData
.
projectName
;
}
}
console
.
log
(
"entered try"
);
//
console.log("entered try");
const
spertoResponse
=
await
axios
.
post
(
const
spertoResponse
=
await
axios
.
post
(
"https://net4hgc.sperto.co.in/_api/api_auth_post_referral_json.php"
,
"https://net4hgc.sperto.co.in/_api/api_auth_post_referral_json.php"
,
referralData
,
referralData
,
{
headers
:
headers
}
{
headers
:
headers
}
);
);
console
.
log
(
"spertoResponse"
,
spertoResponse
);
//
console.log("spertoResponse", spertoResponse);
return
spertoResponse
;
return
spertoResponse
;
},
},
...
@@ -85,13 +85,13 @@ module.exports = createCoreService(
...
@@ -85,13 +85,13 @@ module.exports = createCoreService(
referring_location
:
data
.
projectReferredTo
,
referring_location
:
data
.
projectReferredTo
,
};
};
console
.
log
(
"entered try
"
);
// console.log("entered try2
");
const
spertoResponse
=
await
axios
.
post
(
const
spertoResponse
=
await
axios
.
post
(
"https://net4hgc.sperto.co.in/_api/api_auth_post_referral_json.php"
,
"https://net4hgc.sperto.co.in/_api/api_auth_post_referral_json.php"
,
refereelData
,
refereelData
,
{
headers
:
headers
}
{
headers
:
headers
}
);
);
console
.
log
(
"spertoResponse
"
,
spertoResponse
);
// console.log("spertoResponse2
", spertoResponse);
return
spertoResponse
;
return
spertoResponse
;
},
},
})
})
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment