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(
"api::channel-partner.channel-partner"
,
({
strapi
:
Strapi
})
=>
({
async
sendCPToSperto
(
data
)
{
console
.
log
(
data
);
//
console.log(data);
const
headers
=
{
"Content-Type"
:
"application/json"
};
const
cpData
=
{
api_key
:
process
.
env
.
SPERTO_API_KEY
,
...
...
@@ -39,7 +39,7 @@ module.exports = createCoreService(
cpData
,
{
headers
:
headers
}
);
console
.
log
(
"cp response"
,
spertoResponse
);
//
console.log("cp response", spertoResponse);
return
spertoResponse
;
},
})
...
...
src/api/end-user/controllers/end-user.js
View file @
89f6024
...
...
@@ -58,7 +58,7 @@ module.exports = factories.createCoreController(
}
try
{
console
.
log
(
"inside try"
,
user
.
email
);
//
console.log("inside try", user.email);
const
spretoLeadData
=
await
strapi
.
service
(
"api::end-user.end-user"
)
.
sendLeadToSperto
({
...
endUser
,
email
:
user
.
email
},
"Y"
);
...
...
@@ -183,14 +183,14 @@ module.exports = factories.createCoreController(
}
);
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.
// await strapi.plugin("email").service("email").send(emailToSend).sendOTPToSpreto({...ctx.request.body.data,body: emailToSend });
try
{
const
spretoOTP
=
await
strapi
.
service
(
"api::end-user.end-user"
)
.
sendOTPToSpreto
(
ctx
.
request
.
body
.
data
);
console
.
log
(
"spretoOTP>>>>>>>>"
,
spretoOTP
);
//
console.log("spretoOTP>>>>>>>>", spretoOTP);
ctx
.
request
.
body
.
data
.
httpRequestEmailHeaders
=
JSON
.
stringify
(
spretoOTP
.
spertoEmailResponse
.
headers
);
...
...
@@ -306,7 +306,7 @@ module.exports = factories.createCoreController(
const
finalArray
=
removeDuplicates
(
projectType
);
// const matchingProjects =
console
.
log
(
projectsId
);
//
console.log(projectsId);
ctx
.
send
({
ok
:
true
,
...
...
@@ -351,7 +351,7 @@ module.exports = factories.createCoreController(
return
arr
.
filter
((
item
,
index
)
=>
arr
.
indexOf
(
item
)
===
index
);
}
const
finalArray
=
removeDuplicates
(
porjectConfiguration
).
sort
();
console
.
log
(
"matchingProjects"
,
finalArray
);
//
console.log("matchingProjects",finalArray);
// const matchingProjects =
...
...
src/api/end-user/services/end-user.js
View file @
89f6024
...
...
@@ -11,7 +11,7 @@ module.exports = createCoreService(
"api::end-user.end-user"
,
({
strapi
:
Strapi
})
=>
({
async
sendLeadToSperto
(
data
,
isVerified
)
{
console
.
log
(
">>>>>>>"
,
data
);
//
console.log(">>>>>>>",data);
const
headers
=
{
"Content-Type"
:
"application/json"
};
const
leadData
=
{
api_key
:
process
.
env
.
SPERTO_API_KEY
,
...
...
@@ -23,7 +23,7 @@ module.exports = createCoreService(
email_id1
:
data
.
email
,
otp_verified_yn
:
isVerified
,
};
console
.
log
(
"lead data"
,
leadData
);
//
console.log("lead data", leadData);
// if (data.comments) {
// leadData.comments = data.comments;
// }
...
...
@@ -43,7 +43,7 @@ module.exports = createCoreService(
leadData
,
{
headers
:
headers
}
);
console
.
log
(
"spertoLeadResponse"
,
spertoLeadResponse
);
//
console.log("spertoLeadResponse", spertoLeadResponse);
return
spertoLeadResponse
;
},
...
...
src/api/lead/services/lead.js
View file @
89f6024
...
...
@@ -10,7 +10,7 @@ const { createCoreService } = require("@strapi/strapi").factories;
module
.
exports
=
createCoreService
(
"api::lead.lead"
,
({
strapi
:
Strapi
})
=>
({
async
sendLeadToSperto
(
data
)
{
console
.
log
(
data
);
//
console.log(data);
const
headers
=
{
"Content-Type"
:
"application/json"
};
const
leadData
=
{
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;
module
.
exports
=
createCoreController
(
"api::referral.referral"
,
()
=>
({
async
create
(
ctx
)
{
console
.
log
(
"create started"
);
//
console.log("create started");
try
{
const
spertoRefereeData
=
await
strapi
.
service
(
"api::referral.referral"
)
.
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
})
// console.log("spertoReferralData", spertoReferralData)
ctx
.
request
.
body
.
data
.
httpRequestHeaders
=
JSON
.
stringify
(
spertoRefereeData
.
headers
);
...
...
src/api/referral/services/referral.js
View file @
89f6024
"use strict"
;
const
{
default
:
axios
}
=
require
(
"axios"
);
const
axios
=
require
(
"axios"
);
/**
* referral service
...
...
@@ -49,13 +49,13 @@ module.exports = createCoreService(
referralData
.
building
=
projectData
.
projectName
;
}
console
.
log
(
"entered try"
);
//
console.log("entered try");
const
spertoResponse
=
await
axios
.
post
(
"https://net4hgc.sperto.co.in/_api/api_auth_post_referral_json.php"
,
referralData
,
{
headers
:
headers
}
);
console
.
log
(
"spertoResponse"
,
spertoResponse
);
//
console.log("spertoResponse", spertoResponse);
return
spertoResponse
;
},
...
...
@@ -85,13 +85,13 @@ module.exports = createCoreService(
referring_location
:
data
.
projectReferredTo
,
};
console
.
log
(
"entered try
"
);
// console.log("entered try2
");
const
spertoResponse
=
await
axios
.
post
(
"https://net4hgc.sperto.co.in/_api/api_auth_post_referral_json.php"
,
refereelData
,
{
headers
:
headers
}
);
console
.
log
(
"spertoResponse
"
,
spertoResponse
);
// console.log("spertoResponse2
", 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