lib/active_merchant/billing/gateways/blue_snap.rb in activemerchant-1.95.0 vs lib/active_merchant/billing/gateways/blue_snap.rb in activemerchant-1.96.0
- old
+ new
@@ -64,10 +64,12 @@
'personal_savings' => 'CONSUMER_SAVINGS',
'business_checking' => 'CORPORATE_CHECKING',
'business_savings' => 'CORPORATE_SAVINGS'
}
+ STATE_CODE_COUNTRIES = %w(US CA)
+
def initialize(options={})
requires!(options, :api_username, :api_password)
super
end
@@ -91,10 +93,11 @@
def capture(money, authorization, options={})
commit(:capture, :put) do |doc|
add_authorization(doc, authorization)
add_order(doc, options)
+ add_amount(doc, money, options) if options[:include_capture_amount] == true
end
end
def refund(money, authorization, options={})
commit(:refund, :put) do |doc|
@@ -226,10 +229,10 @@
def add_address(doc, options)
address = options[:billing_address]
return unless address
doc.country(address[:country]) if address[:country]
- doc.state(address[:state]) if address[:state]
+ doc.state(address[:state]) if address[:state] && STATE_CODE_COUNTRIES.include?(address[:country])
doc.address(address[:address]) if address[:address]
doc.city(address[:city]) if address[:city]
doc.zip(address[:zip]) if address[:zip]
end