Difference between revisions of "API/Services/PurchaseProduct"

From Emersion
Jump to: navigation, search
(Purchase Product)
m (added createimmediateinvoice notes)
 
(8 intermediate revisions by 4 users not shown)
Line 2: Line 2:
  
 
'''Purpose'''
 
'''Purpose'''
This method is used to create a product purchase on behalf of an existing client.
+
This method is used to create a product purchase on behalf of an existing client. This call supports creating pending cardline items for charging to next invoice.
 +
For Products of type Credit, please enter a negative quantity.
  
 
'''Inputs'''
 
'''Inputs'''
 
+
<nowiki>
  <xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://emersion.com.au/ServiceObjects">
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:emersion:api" xmlns:urn1="urn:emersion:types">
    <soapenv:Header/>
+
  <soapenv:Header/>
    <soapenv:Body>
+
  <soapenv:Body>
  <ser:PurchaseProducts>
+
      <urn:PurchaseProducts>
  <ser:AccountID>?</ser:AccountID>
+
        <urn:AccountID>?</urn:AccountID>
  <ser:ShoppingCart>
+
        <urn:ShoppingCart>
    <!--1 to 999 repetitions:-->
+
            <!--1 to 999 repetitions:-->
    <ser:PurchaseItem>
+
            <urn1:PurchaseItem>
    <ser:ProductID>?</ser:ProductID>
+
              <urn1:ProductID>?</urn1:ProductID>
      <ser:Quantity>?</ser:Quantity>
+
              <urn1:Quantity>?</urn1:Quantity>
<!--Optional:-->
+
              <urn1:ExTaxPrice>?</urn1:ExTaxPrice>
<ser:ExTaxPrice>?</ser:ExTaxPrice>
+
              <urn1:Tax>?</urn1:Tax>
<!--Optional:-->
+
              <urn1:Note_Details>?</urn1:Note_Details>
  <ser:Tax>?</ser:Tax>
+
              <urn1:Note_Customer_Visible>?</urn1:Note_Customer_Visible>
</ser:PurchaseItem>
+
            </urn1:PurchaseItem>
      </ser:ShoppingCart>
+
        </urn:ShoppingCart>
    </ser:PurchaseProducts>
+
        <urn:DeliveryAddress>
 +
            <urn1:PrimaryAddressID>?</urn1:PrimaryAddressID>
 +
            <urn1:Address ID="?">
 +
              <urn1:IsPrimary>?</urn1:IsPrimary>
 +
              <urn1:Details/>
 +
              <urn1:NearestCrossStreet>?</urn1:NearestCrossStreet>
 +
              <urn1:Country>?</urn1:Country>
 +
              <urn1:FormattedAddress>?</urn1:FormattedAddress>
 +
              <urn1:IsValidated>?</urn1:IsValidated>
 +
              <urn1:Type>?</urn1:Type>
 +
              <urn1:DateFrom>?</urn1:DateFrom>
 +
              <urn1:DateTo>?</urn1:DateTo>
 +
              <urn1:GnafPid ID="?">?</urn1:GnafPid>
 +
              <urn1:DPID>?</urn1:DPID>
 +
              <urn1:Barcode>?</urn1:Barcode>
 +
              <urn1:ExternalReferences>
 +
                  <!--Zero or more repetitions:-->
 +
                  <urn1:ExternalReference Type="?">?</urn1:ExternalReference>
 +
              </urn1:ExternalReferences>
 +
              <urn1:UploadSource>?</urn1:UploadSource>
 +
              <urn1:UploadSourceRef>?</urn1:UploadSourceRef>
 +
              <urn1:ImportIdentifier>?</urn1:ImportIdentifier>
 +
              <urn1:LastUpdated>?</urn1:LastUpdated>
 +
            </urn1:Address>
 +
        </urn:DeliveryAddress>
 +
        <urn:CreateImmediateInvoice>?</urn:CreateImmediateInvoice>
 +
      </urn:PurchaseProducts>
 
   </soapenv:Body>
 
   </soapenv:Body>
 +
</soapenv:Envelope>
 +
</nowiki>
  
 
'''Important notes'''
 
'''Important notes'''
- ProductID needs to be the ID of the Product in the Emersion system
+
* ''ProductID'' needs to be the ID of the Product in the Emersion system
- Quantity has to be non-zero and an integer
+
* ''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.
+
* ''ExTaxPrice'' and Tax are floating point numbers however tax is optional – a sale can be tax free.
 +
* ''CreateImmediateInvoice'' defaults to 1 (and therefore attempts to create an immediate invoice if no Pending invoices exist).
  
 
'''Example Validation Error'''
 
'''Example Validation Error'''
Line 54: Line 84:
  
  
'''Error String'''
+
'''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
  
75. Invalid or Missing Account ID
+
* Invalid Value for Unit Type ID (means that Unit Type ID does not exist in the system)
  
76. Could not find Account ID!
+
* Unit Type ID should be Integer
  
77. You do not have permission to modify this Account!
+
* Missing Primary Address P.O. Box Number from Delivery Address
  
78. No items have been provided to purchase in transaction.
+
* Missing Primary Address Site Name from Delivery Address
  
79. Cart item missing mandatory ProductID
+
* Missing Primary Address Street Type Suffix ID from Delivery Address
  
80. Cart item missing mandatory quantity
+
* Invalid Value for Street Type Suffix ID (means that Street Type Suffix ID does not exist in the system)
  
81. Product purchase failed with an exception: '.$e->getMessage());
+
* Street Type Suffix ID should be Integer

Latest revision as of 17:32, 2 May 2019

Purchase Product

Purpose This method is used to create a product purchase on behalf of an existing client. This call supports creating pending cardline items for charging to next invoice. For Products of type Credit, please enter a negative quantity.

Inputs

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:emersion:api" xmlns:urn1="urn:emersion:types">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:PurchaseProducts>
         <urn:AccountID>?</urn:AccountID>
         <urn:ShoppingCart>
            <!--1 to 999 repetitions:-->
            <urn1:PurchaseItem>
               <urn1:ProductID>?</urn1:ProductID>
               <urn1:Quantity>?</urn1:Quantity>
               <urn1:ExTaxPrice>?</urn1:ExTaxPrice>
               <urn1:Tax>?</urn1:Tax>
               <urn1:Note_Details>?</urn1:Note_Details>
               <urn1:Note_Customer_Visible>?</urn1:Note_Customer_Visible>
            </urn1:PurchaseItem>
         </urn:ShoppingCart>
         <urn:DeliveryAddress>
            <urn1:PrimaryAddressID>?</urn1:PrimaryAddressID>
            <urn1:Address ID="?">
               <urn1:IsPrimary>?</urn1:IsPrimary>
               <urn1:Details/>
               <urn1:NearestCrossStreet>?</urn1:NearestCrossStreet>
               <urn1:Country>?</urn1:Country>
               <urn1:FormattedAddress>?</urn1:FormattedAddress>
               <urn1:IsValidated>?</urn1:IsValidated>
               <urn1:Type>?</urn1:Type>
               <urn1:DateFrom>?</urn1:DateFrom>
               <urn1:DateTo>?</urn1:DateTo>
               <urn1:GnafPid ID="?">?</urn1:GnafPid>
               <urn1:DPID>?</urn1:DPID>
               <urn1:Barcode>?</urn1:Barcode>
               <urn1:ExternalReferences>
                  <!--Zero or more repetitions:-->
                  <urn1:ExternalReference Type="?">?</urn1:ExternalReference>
               </urn1:ExternalReferences>
               <urn1:UploadSource>?</urn1:UploadSource>
               <urn1:UploadSourceRef>?</urn1:UploadSourceRef>
               <urn1:ImportIdentifier>?</urn1:ImportIdentifier>
               <urn1:LastUpdated>?</urn1:LastUpdated>
            </urn1:Address>
         </urn:DeliveryAddress>
         <urn:CreateImmediateInvoice>?</urn:CreateImmediateInvoice>
      </urn:PurchaseProducts>
   </soapenv:Body>
</soapenv:Envelope>

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.
  • CreateImmediateInvoice defaults to 1 (and therefore attempts to create an immediate invoice if no Pending invoices exist).

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