carviaso / google-checkout-dotnet-sample-code

Automatically exported from code.google.com/p/google-checkout-dotnet-sample-code
0 stars 0 forks source link

Order of method calls significant for merchant-calculated shipping #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This code generates an error:

CheckoutShoppingCartRequest Req = GCheckoutButton1.CreateRequest();
Req.AddItem("Mars bar", "Packed with peanuts", 0.75m, 2);
Req.AddItem("OMGWTF BBQ", "50,000 BTU", 295.95m, 1);
Req.AddMerchantCalculatedShippingMethod("UPS", 20);
Req.MerchantCalculatedTax = true;
Req.MerchantCalculationsUrl = "callback.aspx";
Req.AddFlatRateShippingMethod("SuperSaver", 2.50m);
Req.AddFlatRateShippingMethod("Standard Ground", 5.00m);
Req.AddStateTaxRule("FL", 0.065, true);
Req.AddStateTaxRule("AR", 0.07, true);
GCheckoutResponse Resp = Req.Send();
Response.Redirect(Resp.RedirectUrl, true);

This code, where a few of the calls are in a different order, does not:

CheckoutShoppingCartRequest Req = GCheckoutButton1.CreateRequest();
Req.AddItem("Mars bar", "Packed with peanuts", 0.75m, 2);
Req.AddItem("OMGWTF BBQ", "50,000 BTU", 295.95m, 1);
Req.MerchantCalculationsUrl = "callback.aspx";
Req.AddMerchantCalculatedShippingMethod("UPS", 20);
Req.MerchantCalculatedTax = true;
Req.AddStateTaxRule("FL", 0.065, true);
Req.AddStateTaxRule("AR", 0.07, true);
GCheckoutResponse Resp = Req.Send();

Either the order in which you make the calls should not matter, or you
should get a more descriptive error message if you get the order wrong.

Original issue reported on code.google.com by martin.o...@gmail.com on 16 Jun 2007 at 9:53

GoogleCodeExporter commented 9 years ago

Original comment by martin.o...@gmail.com on 16 Jun 2007 at 9:55

GoogleCodeExporter commented 9 years ago
Original report is here:
http://groups.google.com/group/google-checkout-api-dotnet/browse_thread/thread/3
c26142e17079bad/2d47ef0f57f4f0a3#2d47ef0f57f4f0a3

Original comment by martin.o...@gmail.com on 16 Jun 2007 at 9:57

GoogleCodeExporter commented 9 years ago
I was getting an HTTP 400, which is a strange error to return when there is an 
error 
on the server end. I would have expected an Http 500. 

There were two things wrong with the message. 

The first issue was the url was not well formed. Google Returned the 
following message in the response. 

Error parsing XML; message from parser is: Invalid value for body of 
merchant-calculations-url in checkout-shopping-cart/checkout-flow- 
support/merchant-checkout-flow-support/merchant-calculations: URL 
contains illegal characters 

Once I changed the url to something like 
http://www.mycooldomain.com/callback.aspx, 
the error was: 

You can't mix Merchant-calculated shipping methods with other shipping 
methods. 

So we could say that the GCheckout code should be proactive about now 
allowing people to mix shipping calculation methods. 

Martin, should we add this code to now allow this to happen? 

Also should we "try" to determine if the callback url is correct? 

Joe 

Original comment by joseph.f...@gmail.com on 17 Jun 2007 at 3:14

GoogleCodeExporter commented 9 years ago
Thanks for looking into this. Here are my two cents:

1. Should GCheckout.dll stop merchants from mixing shipping methods?
I think so. It would be fairly easy to add that code, and the sooner the error 
is
caught, the less time developers have to spend on troubleshooting.

2. Should GCheckout.dll stop merchants from setting invalid callback URLs?
I don't think so, as we don't know exactly what the Checkout system considers a 
valid
URL... and it may change.

Original comment by martin.o...@gmail.com on 25 Jun 2007 at 10:47

GoogleCodeExporter commented 9 years ago
Updated code to verify if shipping methods were being mixed.

Update unit tests to verify shipping methods

Revision 116

Original comment by joseph.f...@gmail.com on 8 Jul 2007 at 2:20