UpdateSalesRep

Description

The UpdateSalesRep method modifies an existing SalesRep object in the EBizCharge platform.

Syntax

SalesRepResponse UpdateSalesRep(SecurityToken securityToken, SalesRep salesRep, string salesRepId, string salesRepInternalId)

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

The updated SalesRep object that replaces the existing object.

Warning: Omitting a field clears its value.

Recommended Fields
  • Inactive

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

Address:

  • IsDefault

string

salesRepId

D

Identifies the SalesRep object to update.

Note: Required if salesRepInternalId is not sent.

string

salesRepInternalId

D

Identifies the SalesRep object to update.

Note: Required if salesRepID is not sent.

Return Value

TypeDescription
SalesRepResponseIndicates whether the SalesRep object was successfully updated.

Example Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ebiz="http://eBizCharge.ServiceModel.SOAP">
   <soapenv:Header/>
   <soapenv:Body>
      <ebiz:UpdateSalesRep>
         <ebiz:securityToken>
            <ebiz:SecurityId>********************-b2f6-2b5affcb252e</ebiz:SecurityId>
            <ebiz:UserId/>
            <ebiz:Password/>
         </ebiz:securityToken>
         <ebiz:salesRep>
            <ebiz:SalesRepInternalId/>    
            <ebiz:SalesRepId/>      
            <ebiz:SalesRepType/>
            <ebiz:LinkedToInternalId/>
            <ebiz:FirstName/>          
            <ebiz:LastName/>       
            <ebiz:CompanyName/>      
            <ebiz:Phone/>     
            <ebiz:CellPhone/>
            <ebiz:Fax/>
            <ebiz:Email/>
            <ebiz:WebSite/>
            <ebiz:Address>
               <ebiz:FirstName/>
               <ebiz:LastName/>
               <ebiz:CompanyName/>
               <ebiz:Address1/>
               <ebiz:City/>
               <ebiz:State/>
               <ebiz:ZipCode/>
               <ebiz:Country/>
               <ebiz:IsDefault>true</ebiz:IsDefault>
               <ebiz:AddressId/>
            </ebiz:Address>
            <ebiz:AccountNumber/>
            <ebiz:IsInactive>true</ebiz:IsInactive>
            <ebiz:ExternalUniqueId/>
            <ebiz:DateTimeCreated/>
            <ebiz:DateTimeModified/>
         </ebiz:salesRep>
         <ebiz:salesRepId/>
         <ebiz:salesRepInternalId>********************-b2f6-2b5affcb252e</ebiz:salesRepInternalId>
      </ebiz:UpdateSalesRep>
   </soapenv:Body>
</soapenv:Envelope>
public static void UpdateSalesRep()
{
  //Create EBizCharge SOAP client
  IeBizService apiClient = new IeBizServiceClient();

  //Set up merchant authentication
  SecurityToken securityToken = new SecurityToken
  {
    SecurityId = "********-1b21-421b-86ce-***********",
    UserId = "****",
    Password = "****"
    };

  //either the salesRepId OR salesRepInternalId is required
  string salesRepId = "Sr-0002";
  string salesRepInternalId = "********-97cf-4aa4-a1c7-************";

  //Create the SalesRep object with updated information
  SalesRep salesRep = new SalesRep();
  salesRep.SalesRepInternalId = salesRepInternalId;
  salesRep.SalesRepId = salesRepId;
  salesRep.SalesRepType = "Sales";
  salesRep.LinkedToInternalId = "";
  salesRep.FirstName = "Tim";
  salesRep.LastName = "Litton";
  salesRep.CompanyName = "A.Datum";
  salesRep.Phone = "949-444-4333";
  salesRep.AccountNumber = "000027";
  salesRep.IsInactive = false;
  salesRep.ExternalUniqueId = "";

  //Add or update the address
  salesRep.Address = new Address();
  salesRep.Address.FirstName = "Tim";
  salesRep.Address.LastName = "Litton";
  salesRep.Address.CompanyName = "EbizCHarge";
  salesRep.Address.Address1 = "20 Pacifica";
  salesRep.Address.City = "Irvine";
  salesRep.Address.State = "CA";
  salesRep.Address.ZipCode = "92644";
  salesRep.Address.Country = "US";
  salesRep.Address.IsDefault = true;

  //Call UpdateSalesRep API
  SalesRepResponse response = apiClient.UpdateSalesRep(securityToken, salesRep, salesRepId, salesRepInternalId);

  //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 updateSalesRep()
{
  $client = new SoapClient('End point URL');
  $securityToken = array(
    'SecurityId' => '*******-454757-4567457-777',
    '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(
    'SalesRepType' => '1',
    'LinkedToInternalId' => 'sr001',
    'FirstName' => 'Hello',
    'LastName' => 'ThereNow',
    'CompanyName' =>'Abc',
    'Phone' => '234-232323',
    'Phone' => '2020-05-01',
    'WebSite' => '2020-05-01',
    'Address' => $address
  );
  $updateSalesRep = array(
    'SecurityToken' => $securityToken,
    'SalesRep' => $salesRep,
    'salesRepId' => 'So107',
    'salesRepInternalId' => 1
  );
  $updateSalesRepResponse = $client->UpdateSalesRep($updateSalesRep);
  $updateSalesRepResult = $updateSalesRepResponse->UpdateSalesRepResult;
}

Example Response

<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">
      <UpdateSalesRepResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
         <UpdateSalesRepResult>
            <Status>Success</Status>
            <StatusCode>1</StatusCode>
            <Error/>
            <ErrorCode>0</ErrorCode>
         </UpdateSalesRepResult>
      </UpdateSalesRepResponse>
   </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">
      <UpdateSalesRepResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
         <UpdateSalesRepResult>
            <Status>Error</Status>
            <StatusCode>0</StatusCode>
            <Error>Update Record error</Error>
            <ErrorCode>3</ErrorCode>
         </UpdateSalesRepResult>
      </UpdateSalesRepResponse>
   </s:Body>
</s:Envelope>