Postback error from google checkout

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
15 years ago
Hi, Im getting the error below when a purchase is made with google checkout, the shipping rate method is set to Shipping By Order Total.  The order is not being created in my store and when returning the products are still in the cart, the payment is being processed at the google end.  Has anyone else come accross this?  Can you suggest a solution - this is a new problem since upgrading to 1.2

Thanks

Rick

Log type:  OrderError  
Severity:  11  
Message:  Error while placing order. Shipping total couldn't be calculated  
Exception:  System.Exception: NopSolutions.NopCommerce.Common.NopException: Shipping total couldn't be calculated at NopSolutions.NopCommerce.Common.Orders.OrderManager.PlaceOrder(PaymentInfo paymentInfo, Customer customer, Guid OrderGuid, Int32& OrderID)  
Customer:  [email protected]  
Page URL:  http://tietie.co.uk/GooglePostHandler.aspx  
Created on:  8/3/2009 8:59:42 PM
15 years ago
Yea I m getting the same error. If you set the shipping to free you don't get this error though. I am looking into the code to see whats wrong. I captured the google postback xml data and that seems fine to me. The shipping rate and name comes with that, its only when placing the order you get this error.
If I menage to fix this I'll post the code here.

Atiq
15 years ago
Hi Atiq,

Thanks for the update, I'd be grateful to hear how you get on.  Can you tell me if you also have the same issue as described in the following post with the google checkout button?
http://nopcommerce.com/Boards/Topic.aspx?TopicID=890

Thanks

Rick
15 years ago
I am not sure about that problem though. I have changed a lot of things on my checkout, if you want to have a look you can see at www.just4laptops.co.uk, the website is still on google sandbox checkout so you can purchase using sandbox credit card number if you want to see how it works.
15 years ago
Oh right, you are set up slightly differently then.

Very nice looking site, really like the theme making full use of the browser width!
15 years ago
Thanks,

Here I have found a solution for google problem. I had to do a lot of work to find out the problem, still I have managed to fudge it. The problem is in GoogleCheckoutPaymentProcessor.cs line 235, where its trying to get customer.LastShippingOption, but its coming back as null, although google XML is posting everything is right.
What you need to do it after this line just add the same line again so it goes like this;

customer.LastShippingOption = shippingOption;
customer.LastShippingOption = shippingOption;

its strange to call the same thing but it works, I didn't have any idea why its not doing in the first go.

Anyway let me know if you need any more help on this.

Cheers
Atiq
15 years ago
Great, thank you, I'll give it a go and let you know.

Rick
15 years ago
Also I thought I'll share another google bug with you. It's not really a bug but when you get an order from google, the shipping address has lastname lastname format in it instead of firstname lastname, which you can fix if you open the same GoogleCheckoutPaymentProcessor.cs file and go to line 206 & 213, here is a function customer.ShippingAddresses.FindAddress which takes all the customer arguments, the first one should be shippingFirstName instead of shippingLastName and the same goes for CustomerManager.InsertAddress on line 213 which inserts shippingLastName twice for first and last name. so you might wana change this as well.

cheers
15 years ago
Thanks! These bugs will be fixed in the next release.

P.S. You don't need to add the same line again (customer.LastShippingOption = shippingOption;).
Replace set{} accessor of Customer.LastShippingOption property with the following one:

set
            {
                CustomerAttribute lastShippingOptionAttr = this.CustomerAttributes.FindAttribute("LastShippingOption", this.CustomerID);
                if (value != null)
                {
                    StringBuilder sb = new StringBuilder();
                    using (TextWriter tw = new StringWriter(sb))
                    {
                        XmlSerializer xmlS = new XmlSerializer(typeof(ShippingOption));
                        xmlS.Serialize(tw, value);
                        string serialized = sb.ToString();
                        if (lastShippingOptionAttr != null)
                            lastShippingOptionAttr = CustomerManager.UpdateCustomerAttribute(lastShippingOptionAttr.CustomerAttributeID, this.CustomerID, "LastShippingOption", serialized);
                        else
                            lastShippingOptionAttr = CustomerManager.InsertCustomerAttribute(this.CustomerID, "LastShippingOption", serialized);
                    }
                }
                else
                {
                    if (lastShippingOptionAttr != null)
                        CustomerManager.DeleteCustomerAttribute(lastShippingOptionAttr.CustomerAttributeID);
                }

                resetCachedValues();
            }
15 years ago
atiqi36  
Since you moved your google check out to the end of the check out process does this mean that your google check out purchases show up in your administration panel as a purchase ?
Thanks
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.