AddSalesRep

Description

The AddSalesRep method creates a SalesRep object in the EBizCharge platform.

Syntax

SalesRepResponse AddSalesRep(SecurityToken securityToken, SalesRep salesRep)

Arguments

Type

Name

Req

Description

SecurityToken

securityToken

R

A unique token that is used to identify a merchant and authenticate the API request.

SalesRep

salesRep

R

Details of the new SalesRep object.

Required Fields
  • SalesRepId
  • Inactive

If using the objects below, the following fields are required. Unused obects must be removed from the request.

Address:

  • IsDefault

Return Value

TypeDescription
SalesRepResponseIndicates whether the operation was successful.

Example Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ebiz="http://eBizCharge.ServiceModel.SOAP">
   <soapenv:Header />
   <soapenv:Body>
      <ebiz:AddSalesRep>
         <ebiz:securityToken>
            <ebiz:SecurityId>********-23f6-4466-a993***************</ebiz:SecurityId>
            <ebiz:UserId />
            <ebiz:Password />
         </ebiz:securityToken>
         <ebiz:salesRep>
           <ebiz:SalesRepId>Sr-0002</ebiz:SalesRepId>
            <ebiz:SalesRepInternalId></ebiz:SalesRepInternalId>
            <ebiz:SalesRepId></ebiz:SalesRepId>
            <ebiz:SalesRepType></ebiz:SalesRepType>
            <ebiz:LinkedToInternalId></ebiz:LinkedToInternalId>
            <ebiz:FirstName></ebiz:FirstName>
            <ebiz:LastName></ebiz:LastName>
            <ebiz:CompanyName></ebiz:CompanyName>
            <ebiz:Phone></ebiz:Phone>
            <ebiz:CellPhone></ebiz:CellPhone>
            <ebiz:Fax></ebiz:Fax>
            <ebiz:Email></ebiz:Email>
            <ebiz:WebSite></ebiz:WebSite>
            <ebiz:Address>
               <ebiz:FirstName/>
               <ebiz:LastName/>
               <ebiz:CompanyName/>
               <ebiz:Address1/>
               <ebiz:Address2/>
               <ebiz:Address3/>
               <ebiz:Address4/>
               <ebiz:Address5/>
               <ebiz:Address6/>
               <ebiz:City/>
               <ebiz:State/>
               <ebiz:ZipCode/>
               <ebiz:Country/>
               <ebiz:IsDefault/>
               <ebiz:AddressId/>
            </ebiz:Address>
            <ebiz:AccountNumber/>
            <ebiz:IsInactive/>
            <ebiz:ExternalUniqueId/>
            <ebiz:DateTimeCreated/>
            <ebiz:DateTimeModified/>
         </ebiz:salesRep>
      </ebiz:AddSalesRep>
   </soapenv:Body>
</soapenv:Envelope>
public static void AddSalesRep()
{
  //Create EBizCharge SOAP client
  IeBizService apiClient = new IeBizServiceClient();
  //Set up merchant authentication
  SecurityToken securityToken = new SecurityToken
    {
      SecurityId = "********-rtvd-32sx-45fg-************", // Replace with your token
      UserId = "",
      Password = ""
      };
  //Create SalesRep object and set required fields
  SalesRep salesRep = new SalesRep();
  salesRep.SalesRepInternalId = "";
  salesRep.SalesRepId = "Sr-0002";
  salesRep.SalesRepType = "Sales";
  salesRep.FirstName = "John";
  salesRep.LastName = "Doe";
  salesRep.AccountNumber = "000027";
  salesRep.IsInactive = false;
  salesRep.ExternalUniqueId = "Net30";
  salesRep.Address = new Address();
  salesRep.Address.AddressId = "ADDR1001";
  salesRep.CompanyName = "EbizCharge";
  salesRep.Phone = "555-123-4567";
  salesRep.CellPhone = "555-987-6543";
  salesRep.Fax = "555-000-1111";
  salesRep.Email = "[email protected]";
  salesRep.WebSite = "https://ebizcharge.com";
  SalesRepResponse response = apiClient.AddSalesRep(securityToken, salesRep);

  //Display results
  Console.WriteLine($"Status: {response.Status}");
  Console.WriteLine($"Status Code: {response.StatusCode}");
  Console.WriteLine($"Error: {response.Error}");
  Console.WriteLine($"Error Code: {response.ErrorCode}");
}
function addSalesRep()
{
  $client = new SoapClient('End point URL');

  $securityToken = array(
    'SecurityId' => '******-454757-4567********',
    'UserId' => 'merchant1',
    'Password' => 'merchant1'
  );

  $address = array(
    'FirstName' => 'Hello',
    'LastName' => 'There',
    'CompanyName' => 'ABC',
    'Address1' => 'Gulber 3',
    'Address2' => 'Model Town N block',
    'City' => 'Lahore',
    'State' => 'Punjab',
    'ZipCode' => '54000',
    'Country' => 'Pakistan',
    'IsDefault' => true,
    'AddressId' => '101'
  ); 

  $salesRep = array(
    'SalesRepInternalId' => 1,
    'SalesRepId' => 'So107',
    'SalesRepType' => '1',
    'LinkedToInternalId' => 'sr001',
    'FirstName' => 'Hello',
    'LastName' => 'There',
    'CompanyName' =>'Abc',
    'Phone' => '234-232323',
    'Phone' => '2020-05-01',
    'WebSite' => '2020-05-01',
    'Address' => $address
  );

  $addSalesRep = array(
    'SecurityToken' => $securityToken,
    'SalesRep' => $salesRep
  );

  $addSalesRepResponse = $client->AddSalesRep($addSalesRep);
  $addSalesRepResult = $addSalesRepResponse->AddSalesRepResult;
}

Example Response

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <AddSalesRepResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
         <AddSalesRepResult>
            <SalesRepId>Sr-0002</SalesRepId>
            <SalesRepInternalId>********-db6b-424b-8b7c-d38904ae1075</SalesRepInternalId>
            <Status>Success</Status>
            <StatusCode>1</StatusCode>
            <Error />
            <ErrorCode>0</ErrorCode>
         </AddSalesRepResult>
      </AddSalesRepResponse>
   </s:Body>
</s:Envelope>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <AddSalesRepResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
         <AddSalesRepResult>
            <SalesRepId/>
            <SalesRepInternalId/>
            <Status>Failed</Status>
            <StatusCode>0</StatusCode>
            <Error>Record already exists</Error>
            <ErrorCode>2</ErrorCode>
         </AddSalesRepResult>
      </AddSalesRepResponse>
   </s:Body>
</s:Envelope>