apply payments to specific quickbooks invoice using Ruby Gem - quickbooks-online

Our ruby gem creates invoices in quickbooks, and then creates payments for the same amount and date. How do we have the payment apply to the invoice? (quickbooks online)

Please refer Payment doc.
https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/030_entity_services_reference/payment
It will be through Line( and linkedTran ) attribute.
https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/020_key_concepts/0700_other_topics#Line
Ex -
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-07-18T09:52:33.800-07:00">
<QueryResponse startPosition="1" maxResults="1">
<Payment domain="QBO" sparse="false">
<Id>6</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2014-07-18T09:51:59-07:00</CreateTime>
<LastUpdatedTime>2014-07-18T09:51:59-07:00</LastUpdatedTime>
</MetaData>
<TxnDate>2014-07-18</TxnDate>
<CurrencyRef name="United States Dollar">USD</CurrencyRef>
<Line>
<Amount>300.00</Amount>
<LinkedTxn>
<TxnId>1</TxnId>
<TxnType>Invoice</TxnType>
</LinkedTxn>
</Line>
<CustomerRef name="Anna Ellixson">2</CustomerRef>
<DepositToAccountRef>4</DepositToAccountRef>
<TotalAmt>300.00</TotalAmt>
<UnappliedAmt>0</UnappliedAmt>
<ProcessPayment>false</ProcessPayment>
</Payment>
</QueryResponse>
</IntuitResponse>
To get the correct object structure, create an invoice in QB UI and corresponding Payment and then retrieve the Payment Object using getById(Payment) endpoint.
You can try this from ApiExplorer.
https://developer.intuit.com/apiexplorer?apiname=V3QBO
Thanks

Related

Implementing Sage Intacct API via Postman

I would like to get the invoice link from the purchase order implementing Sage Intacct API via Postman.
I suppose it can be done by following sequences(or by only one api request? not sure about this).
Order a purchase
Create a purchase receipt
Get an invoice link from it
Please refer to this API document (https://developer.intacct.com/api).
i.e. This is the body of a request to create a purchase transaction.
<?xml version="1.0" encoding="UTF-8"?>
<request>
<control>
<senderid>{{sender_id}}</senderid>
<password>{{sender_password}}</password>
<controlid>{{$timestamp}}</controlid>
<uniqueid>false</uniqueid>
<dtdversion>3.0</dtdversion>
<includewhitespace>false</includewhitespace>
</control>
<operation>
<authentication>
<sessionid>{{temp_session_id}}</sessionid>
</authentication>
<content>
<function controlid="{{$guid}}">
<create_potransaction>
<transactiontype>Purchase Requisition</transactiontype>
<datecreated>
<year>2013</year>
<month>6</month>
<day>19</day>
</datecreated>
<vendorid>1001</vendorid>
<referenceno>1234</referenceno>
<vendordocno>vendordocno001</vendordocno>
<datedue>
<year>2013</year>
<month>6</month>
<day>20</day>
</datedue>
<payto>
<contactname>Jameson Company</contactname>
</payto>
<exchratetype>Intacct Daily Rate</exchratetype>
<customfields/>
<potransitems>
<potransitem>
<itemid>75300GL</itemid>
<quantity>100</quantity>
<unit>Each</unit>
<price>1</price>
<locationid>MGMT-US</locationid>
<departmentid>IT</departmentid>
</potransitem>
</potransitems>
</create_potransaction>
</function>
</content>
</operation>
</request>
Thank you in advance.
You can download the Postman collection file (API) from the developer docs.
And then just refer to Purchasing/Purchasing Transactions/Create Transaction (Legacy).
You can change the body (SOAP) content.
I'm sure you can manage it.

IBM Watson Dialog API: detailed <entityRules> documentation

The IBM Watson Dialog API documentation on the following page refers to an entityRules node for expert dialog designers to extract the system-programmed entities but does not say anything else about the node:
http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/dialog/reference_nodes.shtml#reference_entityRules
Is there more detailed documentation on how this node can be used?
You can use entities to create your own data type. So in the doc, we see the example
<entities>
<entity name="currency" entityExample="dollar" entityType="GENERIC">
<value name="USD" value="USD">
<grammar>
<item>dollar </item>
<item>buck</item>
</grammar>
</value>
<value name="EUR" value="EUR">
<grammar>
<item>euro</item>
<item>eur</item>
<item>european buck</item>
</grammar>
</value>
<entityRules></entityRules>
</entity>
</entities>
This "currency" entity has a couple of value types (USD and EUR) but it could be extended to have more rows with more examples of each value. We could also add more values (say YEN, AUD etc or Japanese Yen, Australia Dollar etc).
The next thing would be to utilize the entity in a variation. So you could add a variation in an Input node, example:
I want to convert (currency) to (currency) tomorrow!
You can use any entities in a variation by simply including brackets around it.
You can also assign entity info into a profile variable so you can later access it and utilize it in your Dialog logic. Example variation:
I want to convert (currency)={CURRENCY1} to (currency)={CURRENCY2} tomorrow!
In this example, CURRENCY1 and CURRENCY2 are profile variables, that at run time, contain the entity match info.
Hope this helps.

Quickbooks API Explorer - How To Link Transactions To Invoices?

Using the QuickBooks Online v3 API (https://developer.intuit.com/apiexplorer?apiname=V3QBO)
How do I create a payment and then link that payment to an existing invoice using the API Explorer? I'm using sandbox for all my testing.
For example, I created a payment under a client and here is the response.
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2015-04-23T04:27:18.490-07:00">
<Payment domain="QBO" sparse="false">
<Id>162</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2015-04-23T04:28:55-07:00</CreateTime>
<LastUpdatedTime>2015-04-23T04:28:55-07:00</LastUpdatedTime>
</MetaData>
<TxnDate>2013-07-11</TxnDate>
<PrivateNote>Payment smoke test</PrivateNote>
<CustomerRef name="ZeanabArafat">61</CustomerRef>
<DepositToAccountRef>4</DepositToAccountRef>
<TotalAmt>200.00</TotalAmt>
<UnappliedAmt>200.00</UnappliedAmt>
<ProcessPayment>false</ProcessPayment>
</Payment>
</IntuitResponse>
My payment was for $200. I then created an invoice, here is the response from that...
I then created an invoice the response I got from API below.
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2015-04-23T05:25:26.668-07:00">
<Invoice domain="QBO" sparse="false">
<Id>163</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2015-04-23T05:26:58-07:00</CreateTime>
<LastUpdatedTime>2015-04-23T05:26:58-07:00</LastUpdatedTime>
</MetaData>
<CustomField>
<DefinitionId>1</DefinitionId>
<Name>Crew #</Name>
<Type>StringType</Type>
</CustomField>
<DocNumber>1049</DocNumber>
<TxnDate>2015-04-23</TxnDate>
<Line>
<Id>1</Id>
<LineNum>1</LineNum>
<Amount>2000.00</Amount>
<DetailType>SalesItemLineDetail</DetailType>
<SalesItemLineDetail>
<ItemRef name="Concrete">3</ItemRef>
<TaxCodeRef>NON</TaxCodeRef>
</SalesItemLineDetail>
</Line>
<Line>
<Amount>2000.00</Amount>
<DetailType>SubTotalLineDetail</DetailType>
<SubTotalLineDetail />
</Line>
<TxnTaxDetail>
<TotalTax>0</TotalTax>
</TxnTaxDetail>
<CustomerRef name="ZeanabArafat">61</CustomerRef>
<BillAddr>
<Id>98</Id>
<Line1>2007 Sailborough Ct Winter Garden, FL 34787</Line1>
<Lat>28.522938</Lat>
<Long>-81.605711</Long>
</BillAddr>
<ShipAddr>
<Id>98</Id>
<Line1>2007 Sailborough Ct Winter Garden, FL 34787</Line1>
<Lat>28.522938</Lat>
<Long>-81.605711</Long>
</ShipAddr>
<DueDate>2015-05-23</DueDate>
<TotalAmt>2000.00</TotalAmt>
<ApplyTaxAfterDiscount>false</ApplyTaxAfterDiscount>
<PrintStatus>NeedToPrint</PrintStatus>
<EmailStatus>NotSet</EmailStatus>
<Balance>2000.00</Balance>
<Deposit>0</Deposit>
<AllowIPNPayment>false</AllowIPNPayment>
<AllowOnlinePayment>false</AllowOnlinePayment>
<AllowOnlineCreditCardPayment>false</AllowOnlineCreditCardPayment>
<AllowOnlineACHPayment>false</AllowOnlineACHPayment>
</Invoice>
</IntuitResponse>
I then run the following xml in API explorer for the update command on the invoice just to test and be sure it works and then I double checked and it did update the private comments for the invoice in the UI of sandbox... so ...so far so good.
<Invoice xmlns="http://schema.intuit.com/finance/v3" domain="QBO" sparse="true">
<Id>163</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2014-10-15T14:13:24-07:00</CreateTime>
<LastUpdatedTime>2014-10-15T14:13:24-07:00</LastUpdatedTime>
</MetaData>
<PrivateNote>Invoice update Test</PrivateNote>
</Invoice>
So this worked. I got the response...
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2015-04-23T05:30:04.336-07:00">
<Invoice domain="QBO" sparse="false"> <Id>163</Id> <SyncToken>1</SyncToken> <MetaData> <CreateTime>2015-04-23T05:26:58-07:00</CreateTime> <LastUpdatedTime>2015-04-23T05:31:36-07:00</LastUpdatedTime> </MetaData> <CustomField> <DefinitionId>1</DefinitionId> <Name>Crew #</Name> <Type>StringType</Type> </CustomField> <DocNumber>1049</DocNumber> <TxnDate>2015-04-23</TxnDate> <PrivateNote>Invoice update Test</PrivateNote> <Line> <Id>1</Id> <LineNum>1</LineNum> <Amount>2000.00</Amount> <DetailType>SalesItemLineDetail</DetailType> <SalesItemLineDetail> <ItemRef name="Concrete">3</ItemRef> <TaxCodeRef>NON</TaxCodeRef> </SalesItemLineDetail> </Line> <Line> <Amount>2000.00</Amount> <DetailType>SubTotalLineDetail</DetailType> <SubTotalLineDetail /> </Line> <TxnTaxDetail> <TotalTax>0</TotalTax> </TxnTaxDetail> <CustomerRef name="ZeanabArafat">61</CustomerRef> <BillAddr> <Id>98</Id> <Line1>2007 Sailborough Ct Winter Garden, FL 34787</Line1> <Lat>28.522938</Lat> <Long>-81.605711</Long> </BillAddr> <ShipAddr> <Id>98</Id> <Line1>2007 Sailborough Ct Winter Garden, FL 34787</Line1> <Lat>28.522938</Lat> <Long>-81.605711</Long> </ShipAddr> <DueDate>2015-05-23</DueDate> <TotalAmt>2000.00</TotalAmt> <ApplyTaxAfterDiscount>false</ApplyTaxAfterDiscount> <PrintStatus>NeedToPrint</PrintStatus> <EmailStatus>NotSet</EmailStatus> <Balance>2000.00</Balance> <Deposit>0</Deposit> <AllowIPNPayment>false</AllowIPNPayment> <AllowOnlinePayment>false</AllowOnlinePayment> <AllowOnlineCreditCardPayment>false</AllowOnlineCreditCardPayment> <AllowOnlineACHPayment>false</AllowOnlineACHPayment> </Invoice> </IntuitResponse>
as I said looking in the sandbox UI I did see the results. I see in the private comments my text that I put. (or statement memo area)
Now for my problem: Trying to link the payment to the transaction.
According to the documentation and some guess work on my part I assume I got to go to UPDATE for the invoice and I need to supply my customerRef for the client, update the SyncToken by '1', and supply the linkedtransaction xml I will post what I tried to do so you can tell me what I did wrong. Keep in mind my payment ID was 162, I assume this is what is meant by TxnId?
So my new XML command to try and link the transaction this time is...
<Invoice xmlns="http://schema.intuit.com/finance/v3" domain="QBO" sparse="true">
<Id>163</Id>
<SyncToken>1</SyncToken>
<MetaData>
<CreateTime>2014-10-15T14:13:24-07:00</CreateTime>
<LastUpdatedTime>2014-10-15T14:13:24-07:00</LastUpdatedTime>
</MetaData>
<PrivateNote>Invoice update Test</PrivateNote>
<LinkedTxn>
<TxnId>162</TxnId>
<TxnType>Payment</TxnType>
</LinkedTxn>
</Invoice>
This returned the following response...
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2015-04-23T05:40:03.383-07:00">
<Invoice domain="QBO" sparse="false">
<Id>163</Id>
<SyncToken>1</SyncToken>
<MetaData>
<CreateTime>2015-04-23T05:26:58-07:00</CreateTime>
<LastUpdatedTime>2015-04-23T05:31:36-07:00</LastUpdatedTime>
</MetaData>
<CustomField>
<DefinitionId>1</DefinitionId>
<Name>Crew #</Name>
<Type>StringType</Type>
</CustomField>
<DocNumber>1049</DocNumber>
<TxnDate>2015-04-23</TxnDate>
<PrivateNote>Invoice update Test</PrivateNote>
<Line>
<Id>1</Id>
<LineNum>1</LineNum>
<Amount>2000.00</Amount>
<DetailType>SalesItemLineDetail</DetailType>
<SalesItemLineDetail>
<ItemRef name="Concrete">3</ItemRef>
<TaxCodeRef>NON</TaxCodeRef>
</SalesItemLineDetail>
</Line>
<Line>
<Amount>2000.00</Amount>
<DetailType>SubTotalLineDetail</DetailType>
<SubTotalLineDetail />
</Line>
<TxnTaxDetail>
<TotalTax>0</TotalTax>
</TxnTaxDetail>
<CustomerRef name="ZeanabArafat">61</CustomerRef>
<BillAddr>
<Id>98</Id>
<Line1>2007 Sailborough Ct Winter Garden, FL 34787</Line1>
<Lat>28.522938</Lat>
<Long>-81.605711</Long>
</BillAddr>
<ShipAddr>
<Id>98</Id>
<Line1>2007 Sailborough Ct Winter Garden, FL 34787</Line1>
<Lat>28.522938</Lat>
<Long>-81.605711</Long>
</ShipAddr>
<DueDate>2015-05-23</DueDate>
<TotalAmt>2000.00</TotalAmt>
<ApplyTaxAfterDiscount>false</ApplyTaxAfterDiscount>
<PrintStatus>NeedToPrint</PrintStatus>
<EmailStatus>NotSet</EmailStatus>
<Balance>2000.00</Balance>
<Deposit>0</Deposit>
<AllowIPNPayment>false</AllowIPNPayment>
<AllowOnlinePayment>false</AllowOnlinePayment>
<AllowOnlineCreditCardPayment>false</AllowOnlineCreditCardPayment>
<AllowOnlineACHPayment>false</AllowOnlineACHPayment>
</Invoice>
</IntuitResponse>
So looks like it worked no errors... but when I go to check the sandbox UI to see if its connected? I don't see anything, no status for the transaction and no change on the invoice?
What did I do wrong? Am I missing a step?
I found the answer, trick is to create invoices first then reference the invoice via payments. I was doing in the incorrect order, and after talking to the moderators of intuit I confirmed it was a bug.
Use something like this to link the payment to the invoice
<Payment xmlns="http://schema.intuit.com/finance/v3">
<CustomerRef name="Customer Name Here">61</CustomerRef>
<TotalAmt>500</TotalAmt>
<Line>
<Amount>500</Amount>
<LinkedTxn>
<TxnId>164</TxnId>
<TxnType>Invoice</TxnType>
</LinkedTxn>
</Line>
</Payment>
TxnID is the invoice ID, make sure the amount and total amount line up!

How to get orders in NetSuite when status is changed from Pending Approval to Pending Fulfilment

Basically am integrating Salesfore with NetSuite
Usecase: Create a MuleFlow to create a Case in Salesforce when orders status in NetSuite is changed from Pending Approval to Pending Fulfilment.
Question:
How to retrieve orders whose status is changed from Pending Approval to Pending Fulfilment.
How to create a case only when orders status in NetSuite is
changed from Pending Approval to Pending Fulfilment.
Here is the configuration XML am using for creating a Case in Saleforce:
<flow name="case-creation" doc:name="case-creation">
<vm:inbound-endpoint exchange-pattern="one-way" path="vmQ" doc:name="VM"/>
<!-- Prepares-Collection Of Cases -->
<component class=""
doc:name="Prepares-CollectionOfCases" />
<data-mapper:transform doc:name="PF To ListCase"
config-ref="pf-to-listcase" />
<logger message="Payload sent to SFO is:::#[payload]:::" level="INFO"
doc:name="Logs- Payload sent to SFO" />
<!-- Creating CASE -->
<sfdc:create config-ref="salesforce-default" doc:name="Create Case"
type="Case">
</sfdc:create>
<object-to-string-transformer doc:name="Object to String" />
<logger level="INFO" doc:name="Logs- Resultset of Case Creation"
message="Resultset of Case Creation is :::#[payload]:::" />
</flow>
On each record there is a "system notes" subrecord. You can do search to show all sales orders with joint system notes: field = order status, old value= pending approval, new status= pendign fulfillment. I recommend adding adate restriction to relative x minutes ago, depending on the size of the build.
I'm not exactly sure how you do that in XML, I normally just use a suitescript, its easier to find errors.

Amazon MWS: getting error 99019 for XML productFeeds (SubmitFeed of type _POST_PRODUCT_DATA_)

When I try to add a product (via a SubmitFeed of type "_POST_PRODUCT_DATA_") to the Amazon Market via the Amazon MWS API I get the following error:
[Marketplace : Amazon.de] A valid value is required in either the
"quantity" or "fulfillment_center_id" field.
But there is no "quantity" or "fulfillment_center_id" field in my Product.xsd nor in the official documentation. Also the exact same feed does work without an error on my Amazon MWS sandbox account. What am I missing?
Complete XML:
<?xml version="1.0" encoding="UTF-8"?>
<AmazonEnvelope>
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>XXX</MerchantIdentifier>
</Header>
<MessageType>Product</MessageType>
<Message>
<MessageID>1</MessageID>
<OperationType>Update</OperationType>
<Product>
<SKU>123456</SKU>
<StandardProductID>
<Type>EAN</Type>
<Value>767715012826</Value>
</StandardProductID>
<ProductTaxCode>A_GEN_TAX</ProductTaxCode>
<Condition>
<ConditionType>New</ConditionType>
<ConditionNote>Zustand/condition: neu OVP</ConditionNote>
</Condition>
<DescriptionData>
<Title>Bellydance for Fitness and Fun</Title>
<Manufacturer>New World 2011</Manufacturer>
</DescriptionData>
<ProductData>
<Music>
<ProductType>
<MusicPopular>
<MediaType>audioCD</MediaType>
<NumberOfDiscs>1</NumberOfDiscs>
<Genre>New Age</Genre>
</MusicPopular>
</ProductType>
</Music>
</ProductData>
</Product>
</Message>
</AmazonEnvelope>
Make sure that you use the correct "Merchant Token" (NOT merchant id) in the tag "MerchantIdentifier" inside your feed (this isn't well documented).
<MerchantIdentifier>YOUR_MERCHANT_TOKEN</MerchantIdentifier>
You should see your Merchant Token by navigating to Sellercentral > Settings > Account Info and clicking on Your Merchant Token inside the box Business Information. If the Merchant Token isn't there (which was a common error in the past), contact the Seller Support and ask for the correct Merchant Token: Please send me my Merchant Token (NOT merchant id) for use with 3rd party software.
Try to omit additional tags describing the product, especially the whole <ProductData> section inside the <Product> element. Whenever i specified the <ProductData> section I got error 99019.
The field names in MWS error messages do not match the XML structure. I'm assuming they match the flat file (CSV) columns, but haven't actually checked.
You stated "I try to add a product", while I'm guessing that above error happened when subitting an inventory feed, which is why you won't find the anything of that sort in Product.xsd.
The corresponding XML elements are Quantity and FulfillmentCenterID, both defined in Inventory.xsd.

Resources