From 4883afb265bd5d1fd41ed1ca2e5ff5120c8defc1 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 10 Nov 2011 17:27:44 +0000 Subject: [PATCH] paypal: Add hack to accept paypal from US and Germany... we had to make the State mandantory for US customers using Paypal, but now for EU members we don't get a state and fail to save the order. Move it down as we might overwrite it --- app/controllers/spree/checkout_controller_decorator.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/controllers/spree/checkout_controller_decorator.rb b/app/controllers/spree/checkout_controller_decorator.rb index 46ee3bc..e1444d4 100644 --- a/app/controllers/spree/checkout_controller_decorator.rb +++ b/app/controllers/spree/checkout_controller_decorator.rb @@ -94,6 +94,12 @@ module Spree else order_ship_address.state_name = ship_address["state"] end + + # Paypal requires us to have a state for US and on some states it is empty + if order_ship_address.state_name.nil? && order_ship_address.state.nil? + order_ship_address.state_name = "N/A" + end + order_ship_address.save! @order.sysmocom_paypal_ship_address = order_ship_address