Difference between revisions of "API/Services/PurchaseProduct"

From Emersion
Jump to: navigation, search
(Purchase Product)
Line 18: Line 18:
 
               <!--Optional:-->
 
               <!--Optional:-->
 
               <ser:Tax>9</ser:Tax>
 
               <ser:Tax>9</ser:Tax>
 +
              <!-Optional:->
 +
              <ser:Note_Details>Customer Note</ser:Note_Details>
 +
              <!-Optional:->
 +
              <ser:Note_Customer_Visible>1</ser:Note_Customer_Visible>
 
             </ser:PurchaseItem>
 
             </ser:PurchaseItem>
 
         </ser:ShoppingCart>
 
         </ser:ShoppingCart>

Revision as of 10:07, 26 March 2018

Purchase Product

Purpose This method is used to create a product purchase on behalf of an existing client.

Inputs

 <soapenv:Header/>
  <soapenv:Body>
     <ser:PurchaseProducts>
        <ser:AccountID>9999999</ser:AccountID>
        <ser:ShoppingCart>
           <ser:PurchaseItem>
              <ser:ProductID>9999999</ser:ProductID>
              <ser:Quantity>9</ser:Quantity>
              <ser:ExTaxPrice>99</ser:ExTaxPrice>
              <ser:Tax>9</ser:Tax>
              <!-Optional:->
              <ser:Note_Details>Customer Note</ser:Note_Details>
              <!-Optional:->
              <ser:Note_Customer_Visible>1</ser:Note_Customer_Visible>
           </ser:PurchaseItem>
        </ser:ShoppingCart>
        <ser:DeliveryAddress>
           <ser:PrimaryAddressID></ser:PrimaryAddressID>
           <ser:PrimaryAddressPostCode>9999</ser:PrimaryAddressPostCode>
           <ser:PrimaryAddressSuburb>Dummy</ser:PrimaryAddressSuburb>
           <ser:PrimaryAddressStreetName>Dummy</ser:PrimaryAddressStreetName>
           <ser:PrimaryAddressStreetTypeID>999</ser:PrimaryAddressStreetTypeID>
           <ser:PrimaryAddressLotNumber>999</ser:PrimaryAddressLotNumber>
           <ser:PrimaryAddressUnitNumber>999</ser:PrimaryAddressUnitNumber>
           <ser:PrimaryAddressState>999</ser:PrimaryAddressState>
           <ser:PrimaryAddressLevel>999</ser:PrimaryAddressLevel>
           <ser:PrimaryAddressLevelTypeID>999</ser:PrimaryAddressLevelTypeID>
           <ser:PrimaryAddressUnitTypeID>999</ser:PrimaryAddressUnitTypeID>
           <ser:PrimaryAddressPOBoxNumber>999</ser:PrimaryAddressPOBoxNumber>
           <ser:PrimaryAddressSiteName>Dummy</ser:PrimaryAddressSiteName>
           <ser:PrimaryAddressStreetTypeSuffixID>999</ser:PrimaryAddressStreetTypeSuffixID>
        </ser:DeliveryAddress>
     </ser:PurchaseProducts>
  </soapenv:Body>

Important notes - ProductID needs to be the ID of the Product in the Emersion system - Quantity has to be non-zero and an integer - ExTaxPrice and Tax are floating point numbers however tax is optional – a sale can be tax free.

Example Validation Error

  <SOAP-ENV:Body>
     <SOAP-ENV:Fault>
        <faultcode>SOAP-ENV:Client</faultcode>
        <faultstring>Validation Error</faultstring>
        <faultactor>http://emersion.com.au/Services</faultactor>
        <detail>Invalid or Missing Account ID</detail>
     </SOAP-ENV:Fault>
  </SOAP-ENV:Body>

Output

 <SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://emersion.com.au/ServiceObjects">
            <SOAP-ENV:Body>
                <ns1:PurchaseProductResponse>
                       <ns1:AccountID>399301</ns1:AccountID>
                        <ns1:InvoiceID/>
                         <ns1:Cardlines/>
            </ns1:PurchaseProductResponse>
         </SOAP-ENV:Body>
 </SOAP-ENV:Envelope>


Error Strings

  • Invalid or Missing Account ID
  • Could not find Account ID!
  • You do not have permission to modify this Account!
  • No items have been provided to purchase in transaction.
  • Cart item missing mandatory ProductID
  • Cart item missing mandatory quantity
  • Product purchase failed with an exception: '.$e->getMessage());

The following errors can only occur if a Delivery Address is provided.

  • Provided Primary Address ID does not exist in system
  • Primary Address ID should be Integer
  • Missing Primary Address Post Code from Delivery Address
  • Post Code should consist of 4 digits
  • Post Code should contain digits only
  • Missing Primary Address Suburb from Delivery Address
  • Missing Primary Address Street Name from Delivery Address
  • Missing Primary Address Street Name from Delivery Address
  • Missing Primary Address Street Type ID from Delivery Address
  • Invalid Value for Street Type ID (means that Street Type ID does not exist in the system)
  • Street Type ID should be Integer
  • Missing Primary Address Lot Number from Delivery Address
  • Missing Primary Address Unit Number from Delivery Address
  • Missing Primary Address State from Delivery Address
  • Invalid Value for State (means that State ID does not exist in the system)
  • State should be Integer
  • Missing Primary Address Level from Delivery Address
  • Missing Primary Address Level Type ID from Delivery Address
  • Invalid Value for Level Type ID (means that Level Type ID does not exist in the system)
  • Level Type ID should be Integer
  • Missing Primary Address Unit Type ID from Delivery Address
  • Invalid Value for Unit Type ID (means that Unit Type ID does not exist in the system)
  • Unit Type ID should be Integer
  • Missing Primary Address P.O. Box Number from Delivery Address
  • Missing Primary Address Site Name from Delivery Address
  • Missing Primary Address Street Type Suffix ID from Delivery Address
  • Invalid Value for Street Type Suffix ID (means that Street Type Suffix ID does not exist in the system)
  • Street Type Suffix ID should be Integer