IPP QBO UK v3 - Trouble adding Journal Entry with EntityId - intuit-partner-platform

Intuit Partner Platform - API v3 QBO United Kingdom.
I am properly setting the entity to an existing customer but the journal entry won't save. Line 2 I am using the Debtor account and setting the EntityId to a valid customer.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<outgoing><?xml version="1.0" encoding="UTF-8"?>
<JournalEntry xmlns:ns2="http://www.intuit.com/sb/cdm/qbo" xmlns="http://schema.intuit.com/finance/v3">
<TxnDate>2014-03-05</TxnDate>
<PrivateNote>Invoice</PrivateNote>
<DocNumber>102</DocNumber>
<Adjustment>false</Adjustment>
<Line>
<Desc>Credit Sales</Desc>
<Amount>150</Amount>
<DetailType>JournalEntryLineDetail</DetailType>
<JournalEntryLineDetail>
<PostingType>Credit</PostingType>
<AccountRef>1</AccountRef>
<ClassRef></ClassRef>
<DepartmentRef></DepartmentRef>
<BillableStatus></BillableStatus>
</JournalEntryLineDetail>
</Line>
<Line>
<Desc>Debit Accounts Receivable</Desc>
<Amount>150.00</Amount>
<DetailType>JournalEntryLineDetail</DetailType>
<JournalEntryLineDetail>
<PostingType>Debit</PostingType>
<AccountRef>52</AccountRef>
<ClassRef></ClassRef>
<DepartmentRef></DepartmentRef>
<BillableStatus></BillableStatus>
<EntityRef>
<EntityRef>21</EntityRef>
<Type>Customer</Type>
</EntityRef>
</JournalEntryLineDetail>
</Line>
</JournalEntry>
</outgoing>
<returns><?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-03-13T09:22:10.585-07:00">
<Fault type="ValidationFault">
<Error code="6000" element="">
<Message>A business validation error has occurred while processing your request</Message>
<Detail>Business Validation Error: When you use Debtors, you must choose a customer in the Name field.</Detail>
</Error>
</Fault>
</IntuitResponse>
</returns>

Can you share the response XML for this issue.
( If you're using devkit, then please set the logger in DEBUG mode, to get the raw request and response XMLs)
PFB one working JE response.
<JournalEntry domain="QBO" sparse="false">
<Id>6</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2014-03-10T21:10:17-07:00</CreateTime>
<LastUpdatedTime>2014-03-10T21:10:17-07:00</LastUpdatedTime>
</MetaData>
<DocNumber>1</DocNumber>
<TxnDate>2014-03-11</TxnDate>
<CurrencyRef name="United States Dollar">USD</CurrencyRef>
<Line>
<Id>0</Id>
<Description>Debit</Description>
<Amount>100.00</Amount>
<DetailType>JournalEntryLineDetail</DetailType>
<JournalEntryLineDetail>
<PostingType>Debit</PostingType>
<Entity>
<Type>Customer</Type>
<EntityRef name="Customer123">2</EntityRef>
</Entity>
<AccountRef name="Accounts Receivable (A/R)">48</AccountRef>
<ClassRef name="CLASS-1">3000000000000199718</ClassRef>
</JournalEntryLineDetail>
</Line>
<Line>
<Id>1</Id>
<Description>Credit</Description>
<Amount>100.00</Amount>
<DetailType>JournalEntryLineDetail</DetailType>
<JournalEntryLineDetail>
<PostingType>Credit</PostingType>
<AccountRef name="Sales">1</AccountRef>
</JournalEntryLineDetail>
</Line>
<Adjustment>false</Adjustment>
</JournalEntry>
QBO UI( US company )
Thanks
Instead of
<EntityRef>
<EntityRef>21</EntityRef>
<Type>Customer</Type>
</EntityRef>
Please try (as you got from the response)
<Entity>
<Type>Customer</Type>
<EntityRef name="Right Way Cleaners">21</EntityRef>
</Entity>
You had used EntityRef twice in the composite tag.

I had the tag wrong. It should be Entity and I had EntityRef. Got it working. Thanks for your help.

Related

How to retrieve Sabre profile using SOAP API

I'm trying to use the Sabre SOAP API to retrieve a profile. I'm using the SOAP template here (https://developer.sabre.com/guides/travel-agency/developer-guides/soap-apis-request-format) with the specifics here (https://developer.sabre.com/sabre_hospitality/apis/soap_apis/hotel/profile/read_profile). I'm able to get a BinarySession token ok using the SessionCreateRQ request ok. It starts with the text "Shared/IDL:IceSess/SessMgr".
My request looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Header>
<eb:MessageHeader SOAP-ENV:mustUnderstand="1" eb:version="1.0">
<eb:From>
<eb:PartyId />
</eb:From>
<eb:To>
<eb:PartyId />
</eb:To>
<eb:CPAId>ipcc</eb:CPAId>
<eb:ConversationId>conversationID</eb:ConversationId>
<eb:Service>OTA_ReadRQ</eb:Service>
<eb:Action>OTA_ReadRQ</eb:Action>
<eb:MessageData>
<eb:MessageId>mid:20001209-133003-2333#clientofsabre.com</eb:MessageId>
<eb:Timestamp>2001-02-15T11:15:12Z</eb:Timestamp>
<eb:TimeToLive>2001-02-15T11:15:12Z</eb:TimeToLive>
</eb:MessageData>
</eb:MessageHeader>
<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext">
<wsse:BinarySecurityToken valueType="String" EncodingType="wsse:Base64Binary">MY SECURITY TOKEN GOES HERE</wsse:BinarySecurityToken>
</wsse:Security>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<eb:SoapAPIServiceActionCode>
<OTA_ReadRQ Version="1" EchoToken="1122" PrimaryLangID="en" xmlns="http://www.opentravel.org/OTA/2003/05">
<ReadRequests>
<ProfileReadRequest>
<UniqueID Type="1" ID="14EF985B2C" ID_Context="crs">
<CompanyName CodeContext="hotel" Code="10001"/>
</UniqueID>
</ProfileReadRequest>
</ReadRequests>
</OTA_ReadRQ>
</eb:SoapAPIServiceActionCode>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
But when I do this I get the error:
<soap-env:Fault>
<faultcode>soap-env:Client.InvalidAction</faultcode>
<faultstring>Action specified in EbxmlMessage does not exist.</faultstring>
<detail>
<StackTrace>com.sabre.universalservices.base.exception.ApplicationException: errors.xml.USG_INVALID_ACTION</StackTrace>
</detail>
</soap-env:Fault>
Can anyone advise where I'm going wrong?
Try to use <eb:Action>OTA_ProfileReadRQ</eb:Action> instead.
Sabre responds with OTA_ProfileReadRS, so I suppose the Action code may contain "ProfileRead" as well.
First of all you must have permission in your iPCC/EPR the authorization to use this service.
The faultstring="Action specified in EbxmlMessage does not exist." error was in <eb:Action>OTA_ReadRQ</eb:Action>.
You can read more details about the hospitallity services in:
https://github.com/SabreDevStudio/get-hotel-avail-v2-sample-nodejs
https://github.com/SabreDevStudio/get-hotel-details-sample-nodejs
https://github.com/SabreDevStudio/hotel-price-check-v2-sample-nodejs

QBO API V3 Sparse update request to reactivate entity in named list

According to the Accounting API docs named lists items are soft deleted, so it is possible to reactivate them with a sparse update where Active is set to true. This is working fine for Term, Account, PaymentMethod, and Department.
However we ran into issues when trying to sparse update Class and TaxCode. Here are the request/response we got in each case:
<?xml version="1.0" encoding="UTF-8"?>
<Class xmlns="http://schema.intuit.com/finance/v3" sparse="true">
<Id>5000000000000020362</Id>
<Name>Consultancy (deleted)</Name>
<SyncToken>1</SyncToken>
<Active>true</Active>
</Class>
Response from request to sparse update to reactivate class:
<?xml version="1.0" encoding="UTF-8"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2016-12-29T10:36:51.732-08:00">
<Fault type="ValidationFault">
<Error code="6000" element="">
<Message>A business validation error has occurred while processing your request</Message>
<Detail>Business Validation Error: You cannot modify a list element that has been deleted.</Detail>
</Error>
</Fault>
</IntuitResponse>
Request to activate a tax code
<?xml version="1.0" encoding="UTF-8"?>
<TaxCode xmlns="http://schema.intuit.com/finance/v3" sparse="true">
<Id>4</Id>
<Name>California - Inactive</Name>
<SyncToken>1</SyncToken>
<Active>true</Active>
</TaxCode>
Response from request to sparse update to reactivate tax code:
<?xml version="1.0" encoding="UTF-8"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2016-12-30T14:20:24.614-08:00">
<Fault type="ValidationFault">
<Error code="500" element="Operation">
<Message>Unsupported Operation</Message>
<Detail>Operation Update is not supported.</Detail>
</Error>
</Fault>
</IntuitResponse>
Any help would be much appreciated.
Thanks,
Fernando

Access a web-service with session-key/token from WSO2 ESB

I'm starting to evaluate WSO2 ESB and try to implement some simple but real life scenarios.
What I'm trying to do, in this specific case is connect to a web-service that uses a session-key in the payload to do the authentication. So there is one web-service call with user and password to get the key and then I need to put this into the payload of the second web-service call to actually retrieve data from a service.
I don't want to log in with every service call, for performance reasons, but log in once, store the key for some time and do a couple of requests.
The service I want to call is a SugarCRM web-service.
The login message would be something like this:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sug="http://www.sugarcrm.com/sugarcrm" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header/>
<soapenv:Body>
<sug:login soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<user_auth xsi:type="sug:user_auth">
<user_name xsi:type="xsd:string">interface</user_name>
<password xsi:type="xsd:string">MD5HASHOFPASSWORD</password>
</user_auth>
<application_name xsd:string">dummy</application_name>
<name_value_list xsi:type="sug:name_value_list" soapenc:arrayType="sug:name_value[]"/>
</sug:login>
</soapenv:Body>
Which returns something like this:
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://www.sugarcrm.com/sugarcrm">
<SOAP-ENV:Body>
<ns1:loginResponse xmlns:ns1="http://www.sugarcrm.com/sugarcrm">
<return xsi:type="tns:entry_value">
<id xsi:type="xsd:string">loggfi0i3j6eeugs7l0a0m2587</id>
</return>
</ns1:loginResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Then I need to use the "id" field as the token for a new request.
Example, to request all the Leads (the "id" is put into the "session" field):
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sug="http://www.sugarcrm.com/sugarcrm" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header/>
<soapenv:Body>
<sug:get_entry_list soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<session xsi:type="xsd:string">loggfi0i3j6eeugs7l0a0m2587</session>
<module_name xsi:type="xsd:string">Leads</module_name>
</sug:get_entry_list>
</soapenv:Body>
</soapenv:Envelope>
This request then returns all the Leads in the database.
Equally this is needed for accessing web-services that use OAuth2, for example the REST-API of MS Dynamics CRM, only then I need to put the token/bearer in the header.
How would I go about realizing the above scenario in WSO2 ESB? I'm sure this is pretty common, but I have not found documentation or examples for it.
Here is the sequence to get the session-id from the CRM:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="sugar_login" trace="enable" xmlns="http://ws.apache.org/ns/synapse">
<payloadFactory media-type="xml">
<format>
<sug:login xmlns:sug="http://www.sugarcrm.com/sugarcrm">
<sug:user_auth>
<user_name>interface</user_name>
<password>MD5HASHOFPASSWORD</password>
<version>1</version>
</sug:user_auth>
<application_name>dummy</application_name>
</sug:login>
</format>
</payloadFactory>
<header name="To" value="http://my.sugarcrm.com:9090/service/v4_1/soap.php"/>
<call>
<endpoint name="templEPTimeout" template="org.wso2.carbon.connector.sugarcrm.timeout">
<axis2ns653:parameter name="timoutDuration" value="6000" xmlns:axis2ns653="http://ws.apache.org/ns/synapse"/>
<axis2ns654:parameter name="maximumDuration" value="3000" xmlns:axis2ns654="http://ws.apache.org/ns/synapse"/>
<axis2ns655:parameter name="progressAFactor" value="2.0" xmlns:axis2ns655="http://ws.apache.org/ns/synapse"/>
<axis2ns656:parameter name="initialDuration" value="2000" xmlns:axis2ns656="http://ws.apache.org/ns/synapse"/>
</endpoint>
</call>
<!-- Remove response custom header information -->
<header action="remove" name="X-SOAP-Server" scope="transport"/>
<header action="remove" name="Cache-control" scope="transport"/>
<header action="remove" name="Vary" scope="transport"/>
<header action="remove" name="Expires" scope="transport"/>
<header action="remove" name="Set-Cookie" scope="transport"/>
<header action="remove" name="path" scope="transport"/>
<property expression="//ns1:loginResponse/return/id"
name="sugarsessionid" scope="default" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
</sequence>
You can use the sugarcrm connector to connect with SugarCRM API. You can find the sugarcrm connector at WSO2 Store. Find more details in the documentation.

How to retrieve the job and customer suffix field using the quickbooks API

We are building an application that gets data from a QuickBooks online account using the QuickBooks Online API V2. According to the API documentation, we can see that the "Suffix" field is supported for both customer and job tables. However we have noticed this field is not being returned in the API response. Below is a sample response for a job which should have a suffix (the suffix is present in the quickbooks UI). Is this a problem with the API, the API documentation, or our API request?
200
14
2013-05-08T10:57:55-07:00
2013-09-17T09:23:39-07:00
Bridget O'Brien276
5165 easy
Line 2
Line 3
Line 4
Line 5
Portland
United States
OR
12620
INVALID
Billing
Primary
555-5837
Fax
555-5838
Mobile
555-556-9176
http://www.customersruscorp.com
QBOrocksTest#yahoo.com
Bridget
Elizabeth
O'Brien276
CustomersRus LLC
This is a note.
Bill With Parent
true
Preferred Delivery Method
PRINT
Bridget O'Brien276
2
1
IS_TAXABLE
2
12
3
Bridget O'Brien
Just now I've created a customer using IDS V2 API.
Req body -
<?xml version="1.0" encoding="utf-8"?>
<Customer xmlns:ns2="http://www.intuit.com/sb/cdm/qbo" xmlns="http://www.intuit.com/sb/cdm/v2">
<TypeOf>Person</TypeOf>
<Name>John Doe</Name>
<Suffix>Sr</Suffix>
</Customer>
Response (GetByID) -
<Customer xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:qbp="http://www.intuit.com/sb/cdm/qbopayroll/v1" xmlns:qbo="http://www.intuit.com/sb/cdm/qbo">
<Id idDomain="QBO">6</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2013-09-19T15:53:47-07:00</CreateTime>
<LastUpdatedTime>2013-09-19T15:53:47-07:00</LastUpdatedTime>
</MetaData>
<Name>John Doe</Name>
<WebSite />
<Email />
<Suffix>Sr</Suffix>
<CustomField xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="StringTypeCustomField">
<DefinitionId>Preferred Delivery Method</DefinitionId>
<Value>DONT</Value>
</CustomField>
<CustomField xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="StringTypeCustomField">
<DefinitionId>Resale Number</DefinitionId>
</CustomField>
<CustomField xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="BooleanTypeCustomField">
<DefinitionId>Bill With Parent</DefinitionId>
<Value>false</Value>
</CustomField>
<ShowAs>John Doe</ShowAs>
<OpenBalance>
<Amount>0</Amount>
</OpenBalance>
</Customer>
It seems, it works in GetByID API call.
Edit
But GetAll query endpoint doesn't populate suffix attribute. Here is the response.
<Customer>
<Id idDomain="QBO">6</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2013-09-19T15:53:47-07:00</CreateTime>
<LastUpdatedTime>2013-09-19T15:53:47-07:00</LastUpdatedTime>
</MetaData>
<Name>John Doe</Name>
<WebSite />
<Email />
<CustomField xsi:type="BooleanTypeCustomField">
<DefinitionId>Bill With Parent</DefinitionId>
<Value>false</Value>
</CustomField>
<CustomField xsi:type="StringTypeCustomField">
<DefinitionId>Preferred Delivery Method</DefinitionId>
<Value>DONT</Value>
</CustomField>
<ShowAs>John Doe</ShowAs>
<OpenBalance>
<Amount>0</Amount>
</OpenBalance>
</Customer>
Thanks

How to read some element name from XML using GData library?

I am making an app in which I am using SOAP web service, I am receiving this data -
<?xml version="1.0" encoding="UTF-8"?>
<User xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.myurl.com/">
<code>200</code>
<profile>
<NewDataSet xmlns="">
<Table diffgr:id="Table1" msdata:rowOrder="0">
<id>1</id>
<country>Afghanistan</country>
<isd_code>93</isd_code>
<timezone>+04:30</timezone>
<visible>false</visible>
</Table>
</NewDataSet>
</profile>
</User>
And I am using GData library to read this data. I am able to read <NewDataSet> element values but don't know how to read value of <code> tag. So please suggest me to do this.