Why can't I remove the Shipping address from this IPP QBO v3 API Customer object - rest

I'm using the Intuit Partner Platform v3 QBO API to try to update a Customer object. The sole objective for the purpose of this post is to remove the shipping address.
Here's the original object, queried before the change:
{
"domain": "QBO",
"FamilyName": "last",
"DisplayName": "my display name",
"Title": "mr.",
"PreferredDeliveryMethod": "Print",
"GivenName": "first",
"FullyQualifiedName": "my display name",
"BillWithParent": false,
"Job": false,
"BalanceWithJobs": 0,
"Taxable": true,
"MetaData": {
"CreateTime": "2014-09-22T18:49:43-07:00",
"LastUpdatedTime": "2014-09-22T18:49:44-07:00"
},
"BillAddr": {
"City": "city 1",
"Country": "USA",
"Line1": "billing address line 1\nbilling address line 2",
"PostalCode": "98765",
"CountrySubDivisionCode": "ST",
"Id": "130"
},
"MiddleName": "mid",
"Active": true,
"Balance": 0,
"SyncToken": "0",
"Suffix": "suf",
"CompanyName": "my company name",
"ShipAddr": {
"City": "city 2",
"Country": "USA",
"Line1": "shipping address line 1\nshipping address line 2",
"PostalCode": "54321",
"CountrySubDivisionCode": "TS",
"Id": "131"
},
"PrintOnCheckName": "my display name",
"sparse": false,
"Id": "212"
}
Here's the request body when I do the update (SyncToken matches, sparse is false...):
{
"domain": "QBO",
"DisplayName": "my display name",
"Title": "mr.",
"PreferredDeliveryMethod": "Print",
"GivenName": "first",
"FullyQualifiedName": "my display name",
"BillWithParent": false,
"Job": false,
"BalanceWithJobs": 0.0,
"Taxable": true,
"MetaData": {
"CreateTime": "2014-09-22T18:49:43-07:00",
"LastUpdatedTime": "2014-09-22T18:49:43-07:00"
},
"sparse": false,
"MiddleName": "mid",
"Active": true,
"Balance": 0.0,
"SyncToken": 0,
"Suffix": "suf",
"CompanyName": "my company name",
"FamilyName": "last",
"PrintOnCheckName": "my display name",
"BillAddr": {
"CountrySubDivisionCode": "ST",
"City": "city 1",
"PostalCode": "98765",
"Line1": "billing address line 1\nbilling address line 2",
"Country": "USA"
},
"Id": "212"
}
And then when I read it again afterwards, it still has the shipping address (though note the SyncToken has incremented, so the API 'got the message':
{
"domain": "QBO",
"FamilyName": "last",
"DisplayName": "my display name",
"Title": "mr.",
"PreferredDeliveryMethod": "Print",
"GivenName": "first",
"FullyQualifiedName": "my display name",
"BillWithParent": false,
"Job": false,
"BalanceWithJobs": 0,
"Taxable": true,
"MetaData": {
"CreateTime": "2014-09-22T18:49:43-07:00",
"LastUpdatedTime": "2014-09-22T18:51:20-07:00"
},
"BillAddr": {
"City": "city 1",
"Country": "USA",
"Line1": "billing address line 1\nbilling address line 2",
"PostalCode": "98765",
"CountrySubDivisionCode": "ST",
"Id": "130"
},
"MiddleName": "mid",
"Active": true,
"Balance": 0,
"SyncToken": "1",
"Suffix": "suf",
"CompanyName": "my company name",
"ShipAddr": {
"City": "city 1",
"Country": "USA",
"Line1": "billing address line 1\nbilling address line 2",
"PostalCode": "98765",
"CountrySubDivisionCode": "ST",
"Id": "130"
},
"PrintOnCheckName": "my display name",
"sparse": false,
"Id": "212"
}
I've found that if I just set a SINGLE line of the shipping address (to 'x', for example, then the change goes through, but what I'm trying above (which is what I really want—to DELETE the shipping address), has failed. I don't see it on the known issues list, but I know that when a friend of mine recently migrated from QuickBooks Desktop to QuickBooks Online, shipping addresses were populated where previously there was just a billing address.
Anyone know how to achieve this?
Thanks!

UPDATE Adding working JSON example.
{
"Customer": {
"Taxable": false,
"BillAddr": {
"Id": "9",
"Line1": "100 Street",
"City": "Bangalore",
"Country": "India",
"CountrySubDivisionCode": "Karnataka",
"PostalCode": "560103"
},
"ShipAddr": {
"Id": "9",
"Line1": "100 Street",
"City": "Bangalore",
"Country": "India",
"CountrySubDivisionCode": "Karnataka",
"PostalCode": "560103"
},
"Job": false,
"BillWithParent": false,
"Balance": 0,
"BalanceWithJobs": 0,
"PreferredDeliveryMethod": "Email",
"domain": "QBO",
"sparse": false,
"Id": "16",
"SyncToken": "0",
"MetaData": {
"CreateTime": "2014-09-22T21:54:13-07:00",
"LastUpdatedTime": "2014-09-22T21:54:13-07:00"
},
"GivenName": "AA",
"FullyQualifiedName": "AA",
"DisplayName": "AA",
"PrintOnCheckName": "AA",
"Active": true
},
"time": "2014-09-22T21:55:17.28-07:00"
}
Update Request
{
"Taxable": false,
"BillAddr": {
"Id": "9",
"Line1": "100 Street",
"City": "Bangalore",
"Country": "India",
"CountrySubDivisionCode": "Karnataka",
"PostalCode": "560103"
},
"Job": false,
"BillWithParent": false,
"Balance": 0,
"BalanceWithJobs": 0,
"PreferredDeliveryMethod": "Email",
"domain": "QBO",
"sparse": false,
"Id": "16",
"SyncToken": "0",
"MetaData": {
"CreateTime": "2014-09-22T21:54:13-07:00",
"LastUpdatedTime": "2014-09-22T21:54:13-07:00"
},
"GivenName": "AA",
"FullyQualifiedName": "AA",
"DisplayName": "AA",
"PrintOnCheckName": "AA",
"Active": true
}
Get By Id
{
"Customer": {
"Taxable": false,
"BillAddr": {
"Id": "9",
"Line1": "100 Street",
"City": "Bangalore",
"Country": "India",
"CountrySubDivisionCode": "Karnataka",
"PostalCode": "560103"
},
"Job": false,
"BillWithParent": false,
"Balance": 0,
"BalanceWithJobs": 0,
"PreferredDeliveryMethod": "Email",
"domain": "QBO",
"sparse": false,
"Id": "16",
"SyncToken": "1",
"MetaData": {
"CreateTime": "2014-09-22T21:54:13-07:00",
"LastUpdatedTime": "2014-09-22T21:56:21-07:00"
},
"GivenName": "AA",
"FullyQualifiedName": "AA",
"DisplayName": "AA",
"PrintOnCheckName": "AA",
"Active": true
},
"time": "2014-09-22T21:56:49.814-07:00"
}
Did you try XML payload. It worked fine for me. PFB below request/response.
I'll verify the JSON way and update this post.
<Customer xmlns="http://schema.intuit.com/finance/v3" domain="QBO" sparse="false">
<Id>14</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2014-09-22T21:04:02-07:00</CreateTime>
<LastUpdatedTime>2014-09-22T21:04:02-07:00</LastUpdatedTime>
</MetaData>
<GivenName>Neo</GivenName>
<FamilyName>Light</FamilyName>
<FullyQualifiedName>Neo Light</FullyQualifiedName>
<CompanyName>ABC</CompanyName>
<DisplayName>Neo Light</DisplayName>
<PrintOnCheckName>Neo Light</PrintOnCheckName>
<Active>true</Active>
<PrimaryEmailAddr>
<Address>abc#abc.co.in</Address>
</PrimaryEmailAddr>
<Taxable>false</Taxable>
<BillAddr>
<Id>7</Id>
<Line1>ABC Street</Line1>
<City>Bangalore</City>
<Country>India</Country>
<CountrySubDivisionCode>Karnataka</CountrySubDivisionCode>
<PostalCode>560103</PostalCode>
</BillAddr>
<ShipAddr>
<Id>7</Id>
<Line1>ABC Street</Line1>
<City>Bangalore</City>
<Country>India</Country>
<CountrySubDivisionCode>Karnataka</CountrySubDivisionCode>
<PostalCode>560103</PostalCode>
</ShipAddr>
<Job>false</Job>
<BillWithParent>false</BillWithParent>
<Balance>0</Balance>
<BalanceWithJobs>0</BalanceWithJobs>
<PreferredDeliveryMethod>Email</PreferredDeliveryMethod>
</Customer>
Update request
<Customer xmlns="http://schema.intuit.com/finance/v3" domain="QBO" sparse="false">
<Id>14</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2014-09-22T21:04:02-07:00</CreateTime>
<LastUpdatedTime>2014-09-22T21:04:02-07:00</LastUpdatedTime>
</MetaData>
<GivenName>Neo</GivenName>
<FamilyName>Light</FamilyName>
<FullyQualifiedName>Neo Light</FullyQualifiedName>
<CompanyName>ABC</CompanyName>
<DisplayName>Neo Light</DisplayName>
<PrintOnCheckName>Neo Light1</PrintOnCheckName>
<Active>true</Active>
<PrimaryEmailAddr>
<Address>abc#abc.co.in</Address>
</PrimaryEmailAddr>
<Taxable>false</Taxable>
<BillAddr>
<Id>7</Id>
<Line1>ABC Street</Line1>
<City>Bangalore</City>
<Country>India</Country>
<CountrySubDivisionCode>Karnataka</CountrySubDivisionCode>
<PostalCode>560103</PostalCode>
</BillAddr>
<Job>false</Job>
<BillWithParent>false</BillWithParent>
<Balance>0</Balance>
<BalanceWithJobs>0</BalanceWithJobs>
<PreferredDeliveryMethod>Email</PreferredDeliveryMethod>
</Customer>
Verified that 'shipAddr' is not present anymore
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-09-22T21:07:31.919-07:00">
<Customer domain="QBO" sparse="false">
<Id>14</Id>
<SyncToken>1</SyncToken>
<MetaData>
<CreateTime>2014-09-22T21:04:02-07:00</CreateTime>
<LastUpdatedTime>2014-09-22T21:06:58-07:00</LastUpdatedTime>
</MetaData>
<GivenName>Neo</GivenName>
<FamilyName>Light</FamilyName>
<FullyQualifiedName>Neo Light</FullyQualifiedName>
<CompanyName>ABC</CompanyName>
<DisplayName>Neo Light</DisplayName>
<PrintOnCheckName>Neo Light1</PrintOnCheckName>
<Active>true</Active>
<PrimaryEmailAddr>
<Address>abc#abc.co.in</Address>
</PrimaryEmailAddr>
<Taxable>false</Taxable>
<BillAddr>
<Id>7</Id>
<Line1>ABC Street</Line1>
<City>Bangalore</City>
<Country>India</Country>
<CountrySubDivisionCode>Karnataka</CountrySubDivisionCode>
<PostalCode>560103</PostalCode>
</BillAddr>
<Job>false</Job>
<BillWithParent>false</BillWithParent>
<Balance>0</Balance>
<BalanceWithJobs>0</BalanceWithJobs>
<PreferredDeliveryMethod>Email</PreferredDeliveryMethod>
</Customer>
</IntuitResponse>
Thanks

Related

How to query api with filter options

I am trying filter the response city wise. I am not able to understand how to query filter parameters.
I have tried different ways but with no success. This is the response without applying filter. But I want filter it for a particular city.
{
"index_name": "3b01bcb8-0b14-4abf-b6f2-c1bfd384ba69",
"title": "Real time Air Quality Index from various location",
"desc": "Real time Air Quality Index from various location",
"org_type": "Central",
"org": [
"Ministry of Environment and Forests",
"Central Pollution Control Board"
],
"sector": [
"Industrial Air Pollution"
],
"source": "data.gov.in",
"catalog_uuid": "a3e7afc6-b799-4ede-b143-8e074b27e0621",
"visualizable": "1",
"active": "1",
"created": 1543320551,
"updated": 1559683085,
"created_date": "2018-11-27T17:39:11Z",
"updated_date": "2019-06-05T02:48:05Z",
"target_bucket": {
"index": "air_quality",
"type": "a3e7afc6-b799-4ede-b143-8e074b27e0621",
"field": "3b01bcb8-0b14-4abf-b6f2-c1bfd384ba69"
},
"field": [
{
"id": "id",
"name": "id",
"type": "double"
},
{
"id": "country",
"name": "country",
"type": "keyword"
},
{
"id": "state",
"name": "state",
"type": "keyword"
},
{
"id": "city",
"name": "city",
"type": "keyword"
},
{
"id": "station",
"name": "station",
"type": "keyword"
},
{
"id": "last_update",
"name": "last_update",
"type": "date"
},
{
"id": "pollutant_id",
"name": "pollutant_id",
"type": "keyword"
},
{
"id": "pollutant_min",
"name": "pollutant_min",
"type": "double"
},
{
"id": "pollutant_max",
"name": "pollutant_max",
"type": "double"
},
{
"id": "pollutant_avg",
"name": "pollutant_avg",
"type": "double"
},
{
"id": "pollutant_unit",
"name": "pollutant_unit",
"type": "keyword"
}
],
"status": "ok",
"message": "Resource detail",
"total": 1000,
"count": 10,
"limit": "10",
"offset": "8",
"records": [
{
"id": "13",
"country": "India",
"state": "Andhra_Pradesh",
"city": "Rajamahendravaram",
"station": "Anand Kala Kshetram, Rajamahendravaram - APPCB",
"last_update": "05-06-2019 02:00:00",
"pollutant_id": "CO",
"pollutant_min": "2",
"pollutant_max": "50",
"pollutant_avg": "28",
"pollutant_unit": "NA"
},
{
"id": "14",
"country": "India",
"state": "Andhra_Pradesh",
"city": "Rajamahendravaram",
"station": "Anand Kala Kshetram, Rajamahendravaram - APPCB",
"last_update": "05-06-2019 02:00:00",
"pollutant_id": "OZONE",
"pollutant_min": "37",
"pollutant_max": "132",
"pollutant_avg": "71",
"pollutant_unit": "NA"
}
{
"id": "16",
"country": "India",
"state": "Andhra_Pradesh",
"city": "Tirupati",
"station": "Tirumala, Tirupati - APPCB",
"last_update": "05-06-2019 02:00:00",
"pollutant_id": "PM10",
"pollutant_min": "33",
"pollutant_max": "72",
"pollutant_avg": "55",
"pollutant_unit": "NA"
}
],
"version": "2.1.0"
}
This is only documentation on how to do filtering.
properties: OrderedMap { "id": OrderedMap { "type": "integer" }, "date": OrderedMap { "type": "integer" } }
How to form request url for filtering the response?
yes the documentation is very poor, but still out of many trials I got it work like
this
https://api.data.gov.in/resource/3b01bcb8-0b14-4abf-b6f2-c1bfd384ba69?api-key=<your key>&format=json&offset=0&limit=10
&filters[pollutant_id]=NO2

Checkout.js + Server-Side -> country_code and phone issues using REST API /v1/payments/payment

Without avail, I cannot get the country_code (CA) or phone to fill up after successfully calling create payment.
Country always show up as "United States" and Phone is "+1".
With or without shipping_address, shipping_preference: NO_SHIPPING. Using so-called examples (which might be outdated or not correctly documented), and the API documentation, which would be great to have examples included...
This is the create-payment query in json. I'm getting the same structure back with the following additions:
id:PAY-xxx
state:created
phone in payer_info (but no country_code as expected from the API)
created_time
...and...
PayPal's links in links.
Which indicate that the call was successful.
Either I should ditch "/v1/payments/payment" for something else I'm not aware of, or Paypal API is not up-to-date.
----- json create-payment query -----
{
"intent": "sale",
"payer": {
"payment_method": "paypal",
"payer_info": {
"email": "<snip>",
"first_name": "Bob",
"last_name": "Smith",
"billing_address": {
"line1": "1 notre dame",
"line2": "",
"city": "Montreal",
"country_code": "CA",
"postal_code": "H1H 1H1",
"phone": "011862212345678",
"state": "QC"
}
}
},
"application_context": {
"brand_name": "Server-side Test",
"locale": "fr_CA",
"landing_page": "Billing"
},
"transactions": [
{
"description": "The payment transaction description.",
"invoice_number": "5b5a38cb35bb7",
"custom": "merchant custom data",
"payment_options": {
"allowed_payment_method": "INSTANT_FUNDING_SOURCE"
},
"amount": {
"total": "5.75",
"currency": "CAD",
"details": {
"subtotal": "5",
"tax": "0.75"
}
},
"item_list": {
"items": [
{
"name": "item 1",
"description": "item 1 description",
"quantity": "1",
"price": "1",
"tax": "0.15",
"currency": "CAD"
},
{
"name": "item 2",
"description": "item 2 description",
"quantity": "2",
"price": "2",
"tax": "0.6",
"currency": "CAD"
}
],
"shipping_address": {
"recipient_name": "Bob Smith",
"line1": "1 notre dame",
"line2": "",
"city": "Montreal",
"country_code": "CA",
"postal_code": "H1H 1H1",
"phone": "011862212345678",
"state": "QC"
}
}
}
],
"redirect_urls": {
"return_url": "http:\/\/<snip>\/return.php",
"cancel_url": "http:\/\/<snip>\/cancel.php"
}
}

uber RUSH API sandbox deliveries is_fragile value incorrect, bug?

While experimenting with the uber deliveries API sandbox I noticed that when I POST to https://sandbox-api.uber.com/v1/deliveries to create delivery of a new item with item[]."is fragile": true, that the response from the sandbox incorrectly shows item[]."is fragile": false. At least I think this is incorrect, I didn't see it listed as a known limitation of the sandbox. Is this a bug?
More information:
OS: Ubuntu 16.04.1 LTS
Client: Postman 4.9.0
POST request to URL https://sandbox-api.uber.com/v1/deliveries
POST /v1/deliveries HTTP/1.1
Host: sandbox-api.uber.com
Authorization: [redacted]
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: [redacted]
{
"items": [
{
"title": "Fragile Item",
"quantity": 1,
"price": 30,
"is_fragile": true,
"currency_code": "USD",
}
],
"dropoff": {
"location": {
"address": "530 W 113th Street",
"address_2": "Floor 2",
"city": "New York",
"country": "US",
"postal_code": "10025",
"state": "NY"
},
"contact": {
"first_name": "Alice",
"last_name": "Dropoff",
"email": "tomb#cryptocracy.net",
"phone": {
"number": "+19177447934",
"sms_enabled": "true",
},
}
},
"pickup": {
"location": {
"address": "636 W 28th Street",
"address_2": "Floor 2",
"city": "New York",
"country": "US",
"postal_code": "10001",
"state": "NY"
},
"contact": {
"first_name": "Bob",
"last_name": "Pickup",
"email": "tomb#cryptocracy.net",
"phone": {
"number": "+19177447934",
"sms_enabled": "true",
},
},
},
}
Response from the sandbox:
{
"status": "processing",
"dropoff": {
"eta": 12,
"signature_required": false,
"contact": {
"first_name": "Alice",
"last_name": "Dropoff",
"send_sms_notifications": true,
"send_email_notifications": true,
"phone": {
"sms_enabled": true,
"number": "+19177447934"
},
"email": "tomb#cryptocracy.net"
},
"special_instructions": "",
"location": {
"city": "New York",
"country": "US",
"longitude": -73.963863,
"state": "NY",
"postal_code": "10025",
"address_2": "Floor 2",
"address": "530 W 113th Street",
"latitude": 40.805264
},
"signature_image": {
"url": "",
"expires_at": "-62135596800"
},
"courier_notes": {}
},
"fee": 5,
"quote_id": "c7e135da-957e-40b7-a2c5-5d468dc1d686",
"courier": null,
"items": [
{
"weight": 0,
"title": "Bottle 3",
"price": 30,
"is_fragile": false,
"height": 0,
"width": 0,
"length": 0,
"currency_code": "USD",
"quantity": 1
}
],
"created_at": 1480961485,
"delivery_id": "21b1b8de-2cea-4bc4-a316-2fd7598787c7",
"pickup": {
"eta": 7,
"signature_required": false,
"contact": {
"first_name": "Bob",
"last_name": "Pickup",
"send_sms_notifications": true,
"send_email_notifications": true,
"phone": {
"sms_enabled": true,
"number": "+19177447934"
},
"email": "tomb#cryptocracy.net"
},
"special_instructions": "",
"location": {
"city": "New York",
"country": "US",
"longitude": -74.0064109,
"state": "NY",
"postal_code": "10001",
"address_2": "Floor 2",
"address": "636 W 28th Street",
"latitude": 40.7527293
},
"signature_image": {
"url": "",
"expires_at": "-62135596800"
},
"courier_notes": {}
},
"order_reference_id": "",
"tracking_url": "https://api.uber.com/v1/sandbox/map",
"currency_code": "USD"
}
This seems to be a bug in the Uber sandbox environment for the Deliveries API.

Tax lines won't automatically generate in Shopify API order

I am posting the following to the Shopify API order endpoint:
{
"order": {
"email": "some#email.com",
"financial_status": "paid",
"fulfillment_status": null,
"send_receipt": true,
"send_fulfillment_receipt": true,
"note": "Created by somename",
"line_items": [
{
"variant_id": 21718275463,
"quantity": 1,
"price": 99,
"requires_shipping": true,
"product_id": 6820646151
},
{
"variant_id": 21717700871,
"quantity": 1,
"price": 1000,
"requires_shipping": true,
"product_id": 6820646151
},
{
"variant_id": 21717690055,
"quantity": 1,
"price": 555,
"requires_shipping": true,
"product_id": 6821668807
}
],
"processing_method": "offsite",
"shipping_address": {
"first_name": "Chris",
"address1": "10101 Musick Road",
"phone": "9999999999",
"city": "St. Louis",
"zip": "63123",
"province": "MO",
"country": "United States",
"last_name": "Becker",
"name": "Chris Becker",
"country_code": "US",
"province_code": "MO"
},
"source_name": "somename",
"taxes_included": false,
"shipping_lines": [
{
"title": "standard",
"price": 0.00,
"code": null,
"source": "brand owner on shopify",
"carrier_identifier": null,
"tax_lines": null
}
],
"tags": "some Order"
}
}
and receiving a response without tax lines that are filled. I have seen on the shopify forum that the taxlines are supposed to then be automatically
calculated and filled by shopify. I tried doing it with a customer as well but that didn't work either.
The Orders API will not auto-calculate the taxes but if your app knows how much they are then you can include this data using tax_lines and total_tax:
{
"order": {
"line_items": [{
"title": "Big Brown Bear Boots",
"price": 74.99,
"quantity": 3,
"tax_lines": [{
"price": 13.50,
"rate": 0.06,
"title": "State tax"
}]
}],
"total_tax": 13.50
}
}

Search in mongodb nested arrays

Here i have this database
{
"products": [
[
{
"title": "CS:GO:0",
"description": "500 x 6MM CARBON STEEL BALL BEARINGS",
"moreInfo": "SMK.",
"oldPrice": "269.99",
"newPrice": "109.99",
"offPrice": "59%",
"image": "",
"z-index": 0,
"shown": true,
"type": "product",
"category": "0",
"id": "0"
},
{
"title": "Grid autosport",
"description": "G&P G&P Tokyo Marui M870 Gas Charging...",
"moreInfo": "",
"oldPrice": "",
"newPrice": "129.99",
"offPrice": "",
"image": "",
"z-index": 1,
"shown": true,
"type": "product",
"category": "0",
"id": "1"
}
],
[
{
"title": "CS:GO:0",
"description": "500 x 6MM CARBON STEEL BALL BEARINGS",
"moreInfo": "SMK.",
"oldPrice": "269.99",
"newPrice": "109.99",
"offPrice": "59%",
"image": "",
"z-index": 0,
"shown": true,
"type": "product",
"category": "1",
"id": "0"
},
{
"title": "Grid autosport",
"description": "G&P G&P Tokyo Marui M870 Gas Charging...",
"moreInfo": "",
"oldPrice": "",
"newPrice": "129.99",
"offPrice": "",
"image": "",
"z-index": 1,
"shown": true,
"type": "product",
"category": "1",
"id": "1"
}
].........
I use this as a query to get the object i want
var query = {
"products": {
"$elemMatch": {
"category": '0',
"id": '0'
}
}
};
var secondaryQuery = {
'products.$': 1
};
collection.find(query, secondaryQuery)
The database returns null array [].
Does someone have idea why and how to get the object I want from it?