From d2db33ad1dc7ec5cd10c4ab88046934bf8a3f436 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 2 Jan 2012 09:54:15 +0100 Subject: [PATCH] address: Set a dummy zipcode if none was returned from paypal This is an attempt to fix a case where paypal does not provide any zipcode back to us and then validation is failing. It is difficult to test misconduct of paypal. --- app/controllers/spree/checkout_controller_decorator.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/controllers/spree/checkout_controller_decorator.rb b/app/controllers/spree/checkout_controller_decorator.rb index e1444d4..85b8048 100644 --- a/app/controllers/spree/checkout_controller_decorator.rb +++ b/app/controllers/spree/checkout_controller_decorator.rb @@ -100,6 +100,11 @@ module Spree order_ship_address.state_name = "N/A" end + # Paypal returned an address without zipcode + if order_ship_address.zipcode.nil? + order_ship_address.zipcode = "N/A" + end + order_ship_address.save! @order.sysmocom_paypal_ship_address = order_ship_address