Hey Marcus,
I’m wondering if the @ symbol is being tripped up on the php to .net serialization. Can you try removing that from your payload and see if it goes through ok?
/* Get Cust / Pass "CustNum" */
function createCust($data){
$service = "Erp.BO.CustomerSvc/Customers";
return $this->call_epicor($service, $data);
}
function submitCustPerConForm() {
$action = ee()->input->get('action', true);
$actions = array('create_cust', 'create_percon', 'create_link');
$return_data['success'] = 0;
$return_data['message'] = "";
if($action && in_array($action, $actions)) {
switch ($action) {
case "create_cust":
$Name = ee()->input->post('Name', true);
$Address1 = ee()->input->post('Address1', true);
$Address2 = ee()->input->post('Address2', true);
$Address3 = ee()->input->post('Address3', true);
$City = ee()->input->post('City', true);
$State = ee()->input->post('State', true);
$Zip = ee()->input->post('Zip', true);
$EMailAddress = ee()->input->post('EMailAddress', true);
$PhoneNum = ee()->input->post('PhoneNum', true);
$FaxNum = ee()->input->post('FaxNum', true);
$custID = ee()->input->post('custID', true);
$BTName = ee()->input->post('BTName', true);
$BTPhoneNum = ee()->input->post('BTPhoneNum', true);
$BTFaxNum = ee()->input->post('BTFaxNum', true);
$BTAddress1 = ee()->input->post('BTAddress1', true);
$BTAddress2 = ee()->input->post('BTAddress2', true);
$BTAddress3 = ee()->input->post('BTAddress3', true);
$BTCity = ee()->input->post('BTCity', true);
$BTState = ee()->input->post('BTState', true);
$BTZip = ee()->input->post('BTZip', true);
if($Name){
$data = array(
"Company" => "JRF",
"Name" => "$Name",
"Address1" => "$Address1",
"Address2" => "$Address2",
"Address3" => "$Address3",
"City" => "$City",
"State" => "$State",
"Zip" => "$Zip",
"EMailAddress" => "$EMailAddress",
"PhoneNum" => "$PhoneNum",
"FaxNum" => "$FaxNum",
"BTName" => "$BTName",
"BTPhoneNum" => "$BTPhoneNum",
"BTFaxNum" => "$BTFaxNum",
"BTAddress1" => "$BTAddress1",
"BTAddress2" => "$BTAddress2",
"BTAddress3" => "$BTAddress3",
"BTCity" => "$BTCity",
"BTState" => "$BTState",
"BTZip" => "$BTZip",
"GroupCode" => "DR",
"CustomerType" => "CUS",
);
if($custID != ""){
$data["CustID"] = "$custID";
$data["GroupCode"] = "FAC";
}
$result = $this->api->createCust($data);
if(!$result['success']){
$return_data['message'] .= isset($result['error_msg']) && $result['error_msg'] != "" ? $result['error_msg'] : "Epicor Connection Error";
}
function call_epicor($service, $post_data = null, $method = null) {
if(!$service){
return false;
}
if($this->hlp_fn->_is_asc()){
$conn_timeout = 30;
}else{
$conn_timeout = 9;
}
$url = $this->creds['url'] . $this->encode_url_epi($service);
$user = $this->creds['user'];
$pass = $this->creds['pass'];
$headers = array(
'Content-Type: application/json',
);
if($post_data){
$data_string = json_encode($post_data);
$headers[] = 'Content-Length: ' . strlen($data_string);
}
if($this->session_id != "" && $this->session_id !== false && $this->skip_session == false){
$sess_arr = array('SessionID' => $this->session_id);
$headers[] = 'SessionInfo: ' . json_encode($sess_arr);
}
/* Curl Init */
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERPWD, "$user:$pass");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $conn_timeout);
curl_setopt($ch, CURLOPT_TIMEOUT, 80);
if($post_data){
if($method){
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
}else{
curl_setopt($ch, CURLOPT_POST, 1);
}
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
}elseif($method == "POST0"){
$headers[] = 'Content-Length: 0';
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$return_data = array(
'data' => $result,
'code' => $http_code,
);
$check = $this->checkResponse($return_data, $service);
$return_data['success'] = $check['success'];
$return_data['error_msg'] = isset($check['ErrorMessage']) ? $check['ErrorMessage'] : false;
return $return_data;
}