Closed vcardillo closed 9 years ago
I discovered this while building the price by main feature. It's fixed now. I was setting it to total price before
Moreover, the totals don't make sense.
"total_cents": "3517", "delivery_price": "2.75", "tip_cents": "431", "tax_cents": "251",
35.17-2.75-4.31-2.51 = 25.6, which doesn't make sense. 25.6 / 2 = $12.80. The Bento was priced at $13.
Ok I gotta double check on that
Spreadsheet: https://docs.google.com/spreadsheets/d/1NRV8i4X0_ZHXa0NcRbF1vXZQlx3BQVYyKAxWKzvMjIU/edit#gid=1073682431
Here's one clue. The floating point of the tax_cents is a penny off. With 5 significant digits, it comes to 2.51563. So it looks like a rounding issue. (Should have been 2.52)
I'm not sure how the tip_cents went to 4.31 though. When I Play with the spreadsheet, I don't arrive at that value.
One thing that we should do, which Jose is already just doing, is send back tip_percent in the JSON, so we can inspect/save the state of the order more thoroughly.
Fixed: http://recordit.co/x8K5qBs7ro
{
"Stripe":{
"stripeToken":"NULL"
},
"CouponCode":"",
"OrderDetails":{
"coords":{
"lat":"37.790927",
"long":"-122.411379"
},
"tax_cents":"219",
"address":{
"number":"930",
"state":"CA",
"street":"Pine Street",
"city":"San Francisco",
"zip":"94108"
},
"total_cents":"3079",
"tip_cents":"360",
"delivery_price":"1.00",
"tip_percentage":"15",
"coupon_discount_cents":"0"
},
"Platform":"iOS",
"IdempotentToken":"33DD93A0-BF92-4550-AB1E-A760D8A18284",
"OrderItems":[
{
"items":[
{
"id":"53",
"type":"main",
"name":"Golden Curry Chicken"
},
{
"id":"4",
"type":"side1",
"name":"Rice"
},
{
"id":"31",
"type":"side2",
"name":"Roasted Brussel Sprouts"
},
{
"id":"22",
"type":"side3",
"name":"Snow Peas Wasabi"
},
{
"id":"67",
"type":"side4",
"name":"Soba Noodles"
}
],
"unit_price":"12.00",
"item_type":"CustomerBentoBox"
},
{
"items":[
{
"id":"53",
"type":"main",
"name":"Golden Curry Chicken"
},
{
"id":"16",
"type":"side1",
"name":"Salmon Roll"
},
{
"id":"4",
"type":"side2",
"name":"Rice"
},
{
"id":"22",
"type":"side3",
"name":"Snow Peas Wasabi"
},
{
"id":"67",
"type":"side4",
"name":"Soba Noodles"
}
],
"unit_price":"12.00",
"item_type":"CustomerBentoBox"
}
]
}
Did you try doing it with items that were priced differently, to make sure that you don't have some sort of bug where it's just reading the $12 from the prior item?
On Sun, Nov 1, 2015 at 11:40 PM, Joseph Lau notifications@github.com wrote:
Fixed: http://recordit.co/x8K5qBs7ro
{ "Stripe":{ "stripeToken":"NULL" }, "CouponCode":"", "OrderDetails":{ "coords":{ "lat":"37.790927", "long":"-122.411379" }, "tax_cents":"219", "address":{ "number":"930", "state":"CA", "street":"Pine Street", "city":"San Francisco", "zip":"94108" }, "total_cents":"3079", "tip_cents":"360", "delivery_price":"1.00", "tip_percentage":"15", "coupon_discount_cents":"0" }, "Platform":"iOS", "IdempotentToken":"33DD93A0-BF92-4550-AB1E-A760D8A18284", "OrderItems":[ { "items":[ { "id":"53", "type":"main", "name":"Golden Curry Chicken" }, { "id":"4", "type":"side1", "name":"Rice" }, { "id":"31", "type":"side2", "name":"Roasted Brussel Sprouts" }, { "id":"22", "type":"side3", "name":"Snow Peas Wasabi" }, { "id":"67", "type":"side4", "name":"Soba Noodles" } ], "unit_price":"12.00", "item_type":"CustomerBentoBox" }, { "items":[ { "id":"53", "type":"main", "name":"Golden Curry Chicken" }, { "id":"16", "type":"side1", "name":"Salmon Roll" }, { "id":"4", "type":"side2", "name":"Rice" }, { "id":"22", "type":"side3", "name":"Snow Peas Wasabi" }, { "id":"67", "type":"side4", "name":"Soba Noodles" } ], "unit_price":"12.00", "item_type":"CustomerBentoBox" } ] }
— Reply to this email directly or view it on GitHub https://github.com/bentocorp/ios/issues/346#issuecomment-152943939.
Bentos with difference prices:
Bentos Total:
5 + 9 + 12 = $26
Delivery Fee:
= $1
Tip(15%):
26 * .15 = $3.9
Tax(8.75%):
(26 + 1) * 0.0875 = 2.3625 = $2.36
Total:
26 + 1 + 3.9 + 2.36 = $33.26
{
"Stripe":{
"stripeToken":"NULL"
},
"CouponCode":"",
"OrderDetails":{
"coords":{
"lat":"37.790927",
"long":"-122.411379"
},
"tax_cents":"236",
"address":{
"number":"930",
"state":"CA",
"street":"Pine Street",
"city":"San Francisco",
"zip":"94108"
},
"total_cents":"3326",
"tip_cents":"390",
"delivery_price":"1.00",
"tip_percentage":"15",
"coupon_discount_cents":"0"
},
"Platform":"iOS",
"IdempotentToken":"CF557C73-3967-498F-8DB8-4B06E9021B27",
"OrderItems":[
{
"items":[
{
"id":"58",
"type":"main",
"name":"Hawaiian Shrimp Poke"
},
{
"id":"63",
"type":"side1",
"name":"Alaska Roll"
},
{
"id":"71",
"type":"side2",
"name":"Asian Chopped Salad"
},
{
"id":"33",
"type":"side3",
"name":"Avocado Roll"
},
{
"id":"6",
"type":"side4",
"name":"Broccoli"
}
],
"unit_price":"5.00",
"item_type":"CustomerBentoBox"
},
{
"items":[
{
"id":"55",
"type":"main",
"name":"Market Veg Stir Fry"
},
{
"id":"63",
"type":"side1",
"name":"Alaska Roll"
},
{
"id":"71",
"type":"side2",
"name":"Asian Chopped Salad"
},
{
"id":"33",
"type":"side3",
"name":"Avocado Roll"
},
{
"id":"6",
"type":"side4",
"name":"Broccoli"
}
],
"unit_price":"9.00",
"item_type":"CustomerBentoBox"
},
{
"items":[
{
"id":"19",
"type":"main",
"name":"Mongolian Beef"
},
{
"id":"33",
"type":"side1",
"name":"Avocado Roll"
},
{
"id":"33",
"type":"side2",
"name":"Avocado Roll"
},
{
"id":"14",
"type":"side3",
"name":"California Roll"
},
{
"id":"6",
"type":"side4",
"name":"Broccoli"
}
],
"unit_price":"12.00",
"item_type":"CustomerBentoBox"
}
]
}
Same, but with $5 promo discount:
Bentos Total:
5 + 9 + 12 = $26
Discounted Price, subtract from bentos total:
25 - 5 = $21
Delivery Fee:
= $1
Tip(15%), based on total of unit prices:
26 * .15 = $3.9
Tax(8.75%), tax on discounted unit total plus delivery fee:
(21 + 1) * 0.0875 = 1.925 = $1.93
Total:
21 + 1 + 3.9 + 1.93 = $27.83
{
Stripe = {
stripeToken = NULL;
};
CouponCode = ridev;
IdempotentToken = "E7FF135E-C0F5-4D5C-B972-0E5555E48537";
OrderDetails = {
address = {
city = "San Francisco";
number = 930;
state = CA;
street = "Pine Street";
zip = 94108;
};
coords = {
lat = "37.790927";
long = "-122.411379";
};
"coupon_discount_cents" = 500;
"delivery_price" = "1.00";
"tax_cents" = 193;
"tip_cents" = 390;
"tip_percentage" = 15;
"total_cents" = 2783;
};
OrderItems = (
{
"item_type" = CustomerBentoBox;
items = (
{
id = 58;
name = "Hawaiian Shrimp Poke";
type = main;
},
{
id = 63;
name = "Alaska Roll";
type = side1;
},
{
id = 71;
name = "Asian Chopped Salad";
type = side2;
},
{
id = 33;
name = "Avocado Roll";
type = side3;
},
{
id = 6;
name = Broccoli;
type = side4;
}
);
"unit_price" = "5.00";
},
{
"item_type" = CustomerBentoBox;
items = (
{
id = 55;
name = "Market Veg Stir Fry";
type = main;
},
{
id = 63;
name = "Alaska Roll";
type = side1;
},
{
id = 6;
name = Broccoli;
type = side2;
},
{
id = 33;
name = "Avocado Roll";
type = side3;
},
{
id = 6;
name = Broccoli;
type = side4;
}
);
"unit_price" = "9.00";
},
{
"item_type" = CustomerBentoBox;
items = (
{
id = 19;
name = "Mongolian Beef";
type = main;
},
{
id = 63;
name = "Alaska Roll";
type = side1;
},
{
id = 71;
name = "Asian Chopped Salad";
type = side2;
},
{
id = 33;
name = "Avocado Roll";
type = side3;
},
{
id = 6;
name = Broccoli;
type = side4;
}
);
"unit_price" = "12.00";
}
);
Platform = iOS;
}
Nice. Great.
On Mon, Nov 2, 2015 at 12:59 PM, Joseph Lau notifications@github.com wrote:
Same, but with $5 promo discount:
[image: simulator screen shot nov 2 2015 12 46 45 pm] https://cloud.githubusercontent.com/assets/7451830/10893966/8e09af90-8160-11e5-8ffa-0c047f475210.png
Bentos Total: 5 + 9 + 12 = $26
Discounted Price, subtract from bentos total: 25 - 5 = $21
Delivery Fee: = $1
Tip(15%), based on total of unit prices: 26 * .15 = $3.9
Tax(8.75%), tax on discounted unit total plus delivery fee: (21 + 1) * 0.0875 = 1.925 = $1.93
Total: 21 + 1 + 3.9 + 1.93 = $27.83
{ Stripe = { stripeToken = NULL; }; CouponCode = ridev; IdempotentToken = "E7FF135E-C0F5-4D5C-B972-0E5555E48537"; OrderDetails = { address = { city = "San Francisco"; number = 930; state = CA; street = "Pine Street"; zip = 94108; }; coords = { lat = "37.790927"; long = "-122.411379"; }; "coupon_discount_cents" = 500; "delivery_price" = "1.00"; "tax_cents" = 193; "tip_cents" = 390; "tip_percentage" = 15; "total_cents" = 2783; }; OrderItems = ( { "item_type" = CustomerBentoBox; items = ( { id = 58; name = "Hawaiian Shrimp Poke"; type = main; }, { id = 63; name = "Alaska Roll"; type = side1; }, { id = 71; name = "Asian Chopped Salad"; type = side2; }, { id = 33; name = "Avocado Roll"; type = side3; }, { id = 6; name = Broccoli; type = side4; } ); "unit_price" = "5.00"; }, { "item_type" = CustomerBentoBox; items = ( { id = 55; name = "Market Veg Stir Fry"; type = main; }, { id = 63; name = "Alaska Roll"; type = side1; }, { id = 6; name = Broccoli; type = side2; }, { id = 33; name = "Avocado Roll"; type = side3; }, { id = 6; name = Broccoli; type = side4; } ); "unit_price" = "9.00"; }, { "item_type" = CustomerBentoBox; items = ( { id = 19; name = "Mongolian Beef"; type = main; }, { id = 63; name = "Alaska Roll"; type = side1; }, { id = 71; name = "Asian Chopped Salad"; type = side2; }, { id = 33; name = "Avocado Roll"; type = side3; }, { id = 6; name = Broccoli; type = side4; } ); "unit_price" = "12.00"; } ); Platform = iOS;
}
— Reply to this email directly or view it on GitHub https://github.com/bentocorp/ios/issues/346#issuecomment-153154870.
Someone ordered two Bentos, when the price was set to $13. But the
unit_price
on each one said "28".I'm not sure where that came from, but it's not correct.