Commit 89f60242 by jay

backend referral lead issue fixed

1 parent 3e833938
......@@ -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;
},
})
......
......@@ -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 =
......
......@@ -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;
},
......
......@@ -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,
......
......@@ -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
);
......
"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;
},
})
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!