<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,6 @@
 = ActiveMerchant CHANGELOG
 
+* Provide a C_STATE value of &quot;Outside United States&quot; for SageGateway when processing international customers [cody]
 * PayPal Website Payments Pro Canada supports Amex [cody]
 * Add line item support for LinkpointGateway. [Tony Primerano]
 * Add support for SallieMae gateway [iamjwc]</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -55,7 +55,13 @@ module ActiveMerchant #:nodoc:
         
         post[:C_address]    = billing_address[:address1]
         post[:C_city]       = billing_address[:city]
-        post[:C_state]      = billing_address[:state]
+        
+        if ['US', 'CA'].include?(billing_address[:country])
+          post[:C_state]    = billing_address[:state]
+        else
+          post[:C_state]    = &quot;Outside of United States&quot;
+        end
+        
         post[:C_zip]        = billing_address[:zip]
         post[:C_country]    = billing_address[:country] 
         post[:C_telephone]  = billing_address[:phone]</diff>
      <filename>lib/active_merchant/billing/gateways/sage/sage_core.rb</filename>
    </modified>
    <modified>
      <diff>@@ -138,7 +138,41 @@ class SageBankcardGatewayTest &lt; Test::Unit::TestCase
     response = @gateway.purchase(@amount, @credit_card, @options)
     assert_equal 'M', response.cvv_result['code']
   end
-
+  
+  def test_us_address_with_state
+    post = {}
+    options = {
+      :billing_address =&gt; { :country =&gt; &quot;US&quot;, :state =&gt; &quot;CA&quot;}
+    }
+    @gateway.send(:add_addresses, post, options)
+    
+    assert_equal &quot;US&quot;, post[:C_country]
+    assert_equal &quot;CA&quot;, post[:C_state]
+  end
+  
+  def test_us_address_without_state
+    post = {}
+    options = {
+      :billing_address =&gt; { :country =&gt; &quot;US&quot;, :state =&gt; &quot;&quot;}
+    }
+    @gateway.send(:add_addresses, post, options)
+    
+    assert_equal &quot;US&quot;, post[:C_country]
+    assert_equal &quot;&quot;, post[:C_state]
+  end
+  
+  
+  def test_international_address_without_state
+    post = {}
+    options = {
+      :billing_address =&gt; { :country =&gt; &quot;JP&quot;, :state =&gt; &quot;&quot;}
+    }
+    @gateway.send(:add_addresses, post, options)
+    
+    assert_equal &quot;JP&quot;, post[:C_country]
+    assert_equal &quot;Outside of United States&quot;, post[:C_state]
+  end
+  
   private
   def successful_authorization_response
     &quot;\002A911911APPROVED                        00MX001234567890\0341000\0340\034\003&quot;</diff>
      <filename>test/unit/gateways/sage_bankcard_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>411046a884091995444ec9666e8771a586903166</id>
    </parent>
  </parents>
  <author>
    <name>Cody Fauser</name>
    <email>codyfauser@gmail.com</email>
  </author>
  <url>http://github.com/Shopify/active_merchant/commit/39e6eb07865c03745e75fb53ea3d851fec81d5aa</url>
  <id>39e6eb07865c03745e75fb53ea3d851fec81d5aa</id>
  <committed-date>2009-10-06T06:41:51-07:00</committed-date>
  <authored-date>2009-10-06T06:41:51-07:00</authored-date>
  <message>Provide a C_STATE value of 'Outside United States' for SageGateway when processing international customers</message>
  <tree>e0ad4df2b30e6b64b6a4d7c13b89506d2f3fb8da</tree>
  <committer>
    <name>Cody Fauser</name>
    <email>codyfauser@gmail.com</email>
  </committer>
</commit>
