channel-partner.js
1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"use strict";
const { default: axios } = require("axios");
/**
* channel-partner service
*/
const { createCoreService } = require("@strapi/strapi").factories;
module.exports = createCoreService(
"api::channel-partner.channel-partner",
({ strapi: Strapi }) => ({
async sendCPToSperto(data) {
// console.log(data);
const headers = { "Content-Type": "application/json" };
const cpData = {
api_key: process.env.SPERTO_API_KEY,
name: data.contactPersonName,
firm_type: data.firm_type, // --
address: null,
mobile_number: data.mobileNo,
email: data.email,
city: data.city,
state: data.state,
rera_reg_no: data.reraNumber,
region_of_operation: data.regionOfOperation,
pancard: data.pan,
member_of: data.memberOf,
// scanned_cancelled_cheque_url: data.
// scanned_pan_url: data.panFile,
// rera_certificate_url:
firm_name: data.companyName,
// sourcing_manager_id
// gst_certificate_path: data.
};
const spertoResponse = await axios.post(
"https://net4hgc.sperto.co.in/_api/api_auth_cp_register.php",
cpData,
{ headers: headers }
);
// console.log("cp response", spertoResponse);
return spertoResponse;
},
})
);