Difference between revisions of "API/Services/PurchaseProduct"

From Emersion
Jump to: navigation, search
(Created page with "===Purchase Product=== '''Purpose''' This method is used to create a product purchase on behalf of an existing client. '''Inputs''' <soapenv:Envelope xmlns:soapenv="http://...")
 
Line 6: Line 6:
 
'''Inputs'''
 
'''Inputs'''
  
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://emersion.com.au/ServiceObjects">
+
  <xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://emersion.com.au/ServiceObjects">
 
<soapenv:Header/>
 
<soapenv:Header/>
 
<soapenv:Body>
 
<soapenv:Body>
Line 24: Line 24:
 
</ser:PurchaseProducts>
 
</ser:PurchaseProducts>
 
</soapenv:Body>
 
</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.
 +
 
 +
'''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 String'''
 +
 
 +
75. Invalid or Missing Account ID
 +
 
 +
76. Could not find Account ID!
 +
 
 +
77. You do not have permission to modify this Account!
 +
 
 +
78. No items have been provided to purchase in transaction.
 +
 
 +
79. Cart item missing mandatory ProductID
 +
 
 +
80. Cart item missing mandatory quantity
 +
 
 +
81. Product purchase failed with an exception: '.$e->getMessage());

Revision as of 16:44, 10 September 2014

Purchase Product

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

Inputs

 <xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://emersion.com.au/ServiceObjects">

<soapenv:Header/> <soapenv:Body> <ser:PurchaseProducts> <ser:AccountID>?</ser:AccountID> <ser:ShoppingCart> <ser:PurchaseItem> <ser:ProductID>?</ser:ProductID> <ser:Quantity>?</ser:Quantity> <ser:ExTaxPrice>?</ser:ExTaxPrice> <ser:Tax>?</ser:Tax> </ser:PurchaseItem> </ser:ShoppingCart> </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 String

75. Invalid or Missing Account ID

76. Could not find Account ID!

77. You do not have permission to modify this Account!

78. No items have been provided to purchase in transaction.

79. Cart item missing mandatory ProductID

80. Cart item missing mandatory quantity

81. Product purchase failed with an exception: '.$e->getMessage());