Multiple concurrent rides for Guests not working - uber-api

When attempting multiple ride request, "request_id" of first ride is returned in the second request which means new ride is not booked for the second ride request. Please see the request/response below,
Ride Request 1 :
https://sandbox-api.uber.com/v1.2/requests
{
"start_latitude": "37.713706",
"start_longitude": "-122.403708",
"end_latitude": "37.744186",
"end_longitude": "-122.466388",
"fare_id" :"48ba6200227450d3965081024657275f9d1ff5cbb719aaa0bf30be234325f300",
"guest_id" : "5b357e78-c495-4614-afa1-e2a0b0f3dffc",
"product_id": "a1111c8c-c720-46c3-8534-2fcdd730040d",
}
**Response :**
{
"status": "processing",
"product_id": "a1111c8c-c720-46c3-8534-2fcdd730040d",
"destination": {
"latitude": 37.744186,
"longitude": -122.466388
},
"driver": null,
"pickup": {
"latitude": 37.713706,
"longitude": -122.403708
},
"request_id": "2be01f1e-6687-4393-9fcf-e3b840803849",
"eta": null,
"location": null,
"vehicle": null,
"shared": false,
"guest": {
"guest_id": "5b357e78-c495-4614-afa1-e2a0b0f3dffc",
"phone_number": "+14150001234",
"first_name": "Jane",
"last_name": "Smith",
"email": "jane.smith#email.com"
}
}
Ride Request 2 :
https://sandbox-api.uber.com/v1.2/requests
{
"start_latitude": "37.743033",
"start_longitude": "-122.389675",
"end_latitude": "37.7759073",
"end_longitude": "-122.4245247",
"fare_id" :"502eed0ccbb906363df23cf9e81ecb6ceb35b8af46a25194775ac9560871da12",
"guest_id" : "ecc5adeb-fa20-4580-ac24-1ae184bffce9",
"product_id" : "26546650-e557-4a7b-86e7-6a3942445247"
}
Response:
{
"status": "processing",
"product_id": "26546650-e557-4a7b-86e7-6a3942445247",
"destination": {
"latitude": 37.744186,
"longitude": -122.466388
},
"driver": null,
"pickup": {
"latitude": 37.713706,
"longitude": -122.403708
},
"request_id": "2be01f1e-6687-4393-9fcf-e3b840803849",
"eta": null,
"location": null,
"vehicle": null,
"shared": false,
"guest": {
"guest_id": "ecc5adeb-fa20-4580-ac24-1ae184bffce9",
"phone_number": "+14150001234",
"first_name": "Jane",
"last_name": "Smith",
"email": "jane.smith#email.com"
}
}

You can only have one concurrent ride per user/token so it is expected. In your case you just made a ride request in the sandbox and did not progress the state to completed or cancel the ride.

Related

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
}
}

MongoDB sort does not work

since this morning (I think) I can't sort my collection. The collection has 26944 objects inside (it is currently my biggest - but that cant be the reason right?).
So what i'm doing:
myCollection.find().sort({ _id: 1 })
this works great and without any problem!
but:
myCollection.find().sort({ xxx: 1 })
each other case don't work, xxx means any other key on my object it does not matter which I take...
for example:
myCollection.find({modified: { $exists : true } })
Returns an result with 26944 Objects,
myCollection.find({modified: { $exists : true } }).sort({"modified":-1})
will return 0 Objects.
Did I something wrong?
Maybe I had crashed my collection? Did somebody know what could do in this case? (excepts dropping the collection)
Example Object:
{
"_id": ObjectId("55071e25760e250d050ed8d5"),
"sysModified": new Date("2015-03-15T21:10:12+0100"),
"created": new Date(1426529829922),
"modified": new Date(1426528563945),
"payments": [
],
"orderItems": [
{
"orderId": 'xxxxx',
"itemId": 'xxxxx',
"ean": "XXXXX"
"quantity": 1,
"name": "xxxxxxx",
"vat": 19,
"price": 29.989999999999998437,
"currency": "EUR",
"_id": ObjectId("5507365c89866d820dcef7e0"),
},
{
"orderId": 'xxxxx',
"itemId": 'xxxxx',
"ean": "XXXXX"
"quantity": 1,
"name": "xxxxxxx",
"vat": 19,
"price": 29.989999999999998437,
"currency": "EUR",
"_id": ObjectId("5507365c89866d820dcef7e1"),
}
],
"orderData": {
"orderId": XXXXXXXXX,
"type": "order",
"status": "XXXXXXXXX",
"timestamp_php": XXXXXXXXX,
"customer": XXXXXXXXX,
...
},
"orderDeliveryAddress": {
"customer": xxxxxxxxxxx,
"company": "",
"additional": "",
"firstName": "xxxxxxxxxxx",
"surname": "xxxxxxxxxxx",
"street": "xxxxxxxxxxx",
"houseNumber": "xxxxxxxxxxx",
"zip": "xxxxxxxxxxx",
"city": "xxxxxxxxxxx",
"iso2": "xxxxxxxxxxx",
"phone": "xxxxxxxxxxx",
"fax": "xxxxxxxxxx",
"email": "xxxxxxxxxxx",
},
"orderCustomerAddress": {
"customer": xxxxxxxxxxx,
"company": "",
"additional": "",
"firstName": "xxxxxxxxxxx",
"surname": "xxxxxxxxxxx",
"street": "xxxxxxxxxxx",
"houseNumber": "xxxxxxxxxxx",
"zip": "xxxxxxxxxxx",
"city": "xxxxxxxxxxx",
"iso2": "xxxxxxxxxxx",
"phone": "xxxxxxxxxxx",
"fax": "xxxxxxxxxx",
"email": "xxxxxxxxxxx",
},
"__v": 1
}
It is possible that your collection is to big. If you try so sort on a key, that has no index this can result in an error if the resultset is to big. The error should look like this:
error: {
"$err" : "too much data for sort() with no index.
add an index or specify a smaller limit",
"code" : 10128
}
What you can do is add an index to your key you want to sort by:
db.myCollection.ensureIndex({"modified":-1})
Or you reduce the resultset before sorting:
myCollection.find({modified: { $exists : true } }).limit(10).sort({"modified":-1})

How JSON format for calling Checking out REST Api of Broadleaf commerce looks like

I have followed setting up Broadleaf to make it running by following its documentation (http://docs.broadleafcommerce.org/current/REST-Tutorials.html). I wanted to do checking out the cart using REST Api; that's, /cart/checkout. Therefore, I looked inside the code in order to understand how the JSON format being sent will look alike. By looking through the code, I found that it is required to pass the JSON data as shown following:
{
"paymentInfo": {
"id": ,
"orderId": ,
"type": ,
"address": {
"id":
"firstname":
"lastname":
"addressLine1":
"addressLine2":
"city":
"state":
"country":
"postalCode":
},
"phone": "",
"additionalFields": "",
"amount": "",
"amountItems": "",
"customerIpAddress": "",
"referenceNumber": ""
},
"referenced": {
"id": "",
"referenceNumber": "",
"type": "",
"pan": "",
"cvvCode:" "",
"expirationMonth": "",
"expirationYear": "",
"accountNumber": "",
"routingNumber": "",
"pin": ""
}
}
However, I have no idea such the JSON data looks like. Therefore, if anyone who has ever used the api, please help me by showing an example of data in order to make the request. Looking forward to the answers.
Thanks in advance.
All of our REST APIs are exposed through a 'wrapper' concept. For instance, there is a CustomerWrapper, OrderWrapper, etc. These wrappers define which properties are serialized back and forth with the REST APIs.
For your specific case, you should look at PaymentReferenceMapWrapper.
{
"id": 1751,
"status": "IN_PROCESS",
"totalTax": {
"amount": "0.00",
"currency": "INR"
},
"totalShipping": {
"amount": "0.00",
"currency": "INR"
},
"subTotal": {
"amount": "860.00",
"currency": "INR"
},
"total": {
"amount": "860.00",
"currency": "INR"
},
"customer": {
"id": 2600
},
"orderItems": [
{
"id": 1752,
"name": "abc",
"quantity": 2,
"retailPrice": {
"amount": "430.00",
"currency": "INR"
},
"salePrice": {
"amount": "430.00",
"currency": "INR"
},
"orderId": 1751,
"categoryId": 10300,
"skuId": 10212,
"productId": 10212,
"isBundle": false,
"orderItemPriceDetails": [
{
"id": 1752,
"totalAdjustmentValue": {
"amount": "0.00",
"currency": "INR"
},
"totalAdjustedPrice": {
"amount": "860.00",
"currency": "INR"
},
"quantity": 2,
"adjustments": []
}
],
"isDiscountingAllowed": true
}
],
"fulfillmentGroups": [
{
"id": 1502,
"orderId": 1751,
"total": {
"amount": "860.00",
"currency": "INR"
},
"fulfillmentGroupItems": [
{
"id": 1752,
"fulfillmentGroupId": 1502,
"orderItemId": 1752,
"totalTax": {
"amount": "0.00",
"currency": "INR"
},
"quantity": 2,
"totalItemAmount": {
"amount": "860.00",
"currency": "INR"
}
}
]
}
],
"payments": [
{
"id": 601,
"orderId": 1751,
"type": "COD",
"amount": "860.00",
"currency": "INR",
"gatewayType": "Passthrough",
"transactions": [
{
"id": 601,
"orderPaymentId": 601,
"type": "AUTHORIZE_AND_CAPTURE",
"success": true,
"amount": "860.00",
"currency": "INR"
}
]
}
]
}
This is the same json you will get from /cart?customerId="" with method GET after successfully executing /cart/checkout/payment