Permalink
Browse files

2.20.0

  • Loading branch information...
braintreeps committed Nov 9, 2012
1 parent af18111 commit babca7dcbd56f1a4f574207897945c2e732a67f7
View
@@ -1,3 +1,8 @@
+== 2.20.0
+* Add params for Venmo SDK
+* Add additional card types for card type indicators
+* Added ability to allow TR query parameters with no value (thanks @dmathieu!)

This comment has been minimized.

Show comment Hide comment
@dmathieu

dmathieu Nov 12, 2012

🤘

+
== 2.19.0
* Adds verification search
View
@@ -53,7 +53,7 @@
require "braintree/subscription_gateway"
require "braintree/subscription_search"
require "braintree/successful_result"
-require "braintree/test/credit_card_numbers"
+require "braintree/test/credit_card"
require "braintree/test/transaction_amounts"
require "braintree/transaction"
require "braintree/transaction/address_details"
@@ -26,45 +26,18 @@ module CustomerLocation
US = "us"
end
- module Commercial
+ module CardTypeIndicator
Yes = "Yes"
No = "No"
Unknown = "Unknown"
end
- module Debit
- Yes = "Yes"
- No = "No"
- Unknown = "Unknown"
- end
-
- module DurbinRegulated
- Yes = "Yes"
- No = "No"
- Unknown = "Unknown"
- end
-
- module Healthcare
- Yes = "Yes"
- No = "No"
- Unknown = "Unknown"
- end
-
- module Payroll
- Yes = "Yes"
- No = "No"
- Unknown = "Unknown"
- end
-
- module Prepaid
- Yes = "Yes"
- No = "No"
- Unknown = "Unknown"
- end
+ Commercial = Debit = DurbinRegulated = Healthcare = Payroll = Prepaid =
+ IssuingBank = CountryOfIssuance = CardTypeIndicator
- attr_reader :billing_address, :bin, :card_type, :cardholder_name, :commercial, :created_at,
- :customer_id, :debit, :durbin_regulated, :expiration_month, :expiration_year, :healthcare,
- :last_4, :payroll, :prepaid, :subscriptions, :token, :unique_number_identifier, :updated_at
+ attr_reader :billing_address, :bin, :card_type, :cardholder_name, :commercial, :country_of_issuance,
+ :created_at, :customer_id, :debit, :durbin_regulated, :expiration_month, :expiration_year, :healthcare,
+ :issuing_bank, :last_4, :payroll, :prepaid, :subscriptions, :token, :unique_number_identifier, :updated_at
# See http://www.braintreepayments.com/docs/ruby/credit_cards/create
def self.create(attributes)
@@ -265,7 +238,7 @@ def self._attributes # :nodoc:
[
:billing_address, :bin, :card_type, :cardholder_name, :created_at, :customer_id, :expiration_month,
:expiration_year, :last_4, :token, :updated_at, :prepaid, :payroll, :commercial, :debit, :durbin_regulated,
- :healthcare
+ :healthcare, :country_of_issuance, :issuing_bank
]
end
@@ -76,10 +76,10 @@ def self._update_signature # :nodoc:
def self._signature(type) # :nodoc:
billing_address_params = AddressGateway._shared_signature
- options = [:make_default, :verification_merchant_account_id, :verify_card]
+ options = [:make_default, :verification_merchant_account_id, :verify_card, :venmo_sdk_session]
signature = [
:billing_address_id, :cardholder_name, :cvv, :expiration_date,
- :expiration_month, :expiration_year, :number, :token,
+ :expiration_month, :expiration_year, :number, :token, :venmo_sdk_payment_method_code,
{:options => options},
{:billing_address => billing_address_params}
]
@@ -7,14 +7,16 @@ module Test # :nodoc:
# See http://www.braintreepayments.com/docs/ruby/reference/sandbox
module CreditCardNumbers
module CardTypeIndicators
- Prepaid = "4111111111111210"
- Commercial = "4111111111131010"
- Payroll = "4111111114101010"
- Healthcare = "4111111510101010"
- DurbinRegulated = "4111161010101010"
- Debit = "4117101010101010"
- Unknown = "4111111111112101"
- No = "4111111111310101"
+ Prepaid = "4111111111111210"
+ Commercial = "4111111111131010"
+ Payroll = "4111111114101010"
+ Healthcare = "4111111510101010"
+ DurbinRegulated = "4111161010101010"
+ Debit = "4117101010101010"
+ Unknown = "4111111111112101"
+ No = "4111111111310101"
+ IssuingBank = "4111111141010101"
+ CountryOfIssuance = "4111111111121102"
end
AmExes = %w[378282246310005 371449635398431 378734493671000]
@@ -47,5 +49,10 @@ module FailsSandboxVerification
All = AmExes + Discovers + MasterCards + Visas
end
+
+ module CreditCardDefaults
+ CountryOfIssuance = "USA"
+ IssuingBank = "NETWORK ONLY"
+ end
end
end
@@ -100,7 +100,7 @@ def self._clone_signature # :nodoc:
def self._create_signature # :nodoc:
[
:amount, :customer_id, :merchant_account_id, :order_id, :payment_method_token,
- :purchase_order_number, :recurring, :shipping_address_id, :type, :tax_amount, :tax_exempt,
+ :purchase_order_number, :recurring, :shipping_address_id, :type, :tax_amount, :tax_exempt, :venmo_sdk_payment_method_code,
{:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number]},
{:customer => [:id, :company, :email, :fax, :first_name, :last_name, :phone, :website]},
{
@@ -109,7 +109,7 @@ def self._create_signature # :nodoc:
{
:shipping => AddressGateway._shared_signature
},
- {:options => [:store_in_vault, :store_in_vault_on_success, :submit_for_settlement, :add_billing_address_to_payment_method, :store_shipping_address_in_vault]},
+ {:options => [:store_in_vault, :store_in_vault_on_success, :submit_for_settlement, :add_billing_address_to_payment_method, :store_shipping_address_in_vault, :venmo_sdk_session]},
{:custom_fields => :_any_key_},
{:descriptor => [:name, :phone]}
]
View
@@ -20,7 +20,7 @@ def self.hash_to_query_string(hash, namespace = nil)
def self.parse_query_string(qs)
qs.split('&').inject({}) do |result, couplet|
pair = couplet.split('=')
- result[CGI.unescape(pair[0]).to_sym] = CGI.unescape(pair[1])
+ result[CGI.unescape(pair[0]).to_sym] = CGI.unescape(pair[1] || '')
result
end
end
View
@@ -1,7 +1,7 @@
module Braintree
module Version
Major = 2
- Minor = 19
+ Minor = 20
Tiny = 0
String = "#{Major}.#{Minor}.#{Tiny}"
@@ -281,6 +281,30 @@
credit_card.durbin_regulated.should == Braintree::CreditCard::DurbinRegulated::Yes
end
+ it "sets the country of issuance field" do
+ customer = Braintree::Customer.create!
+ result = Braintree::CreditCard.create(
+ :customer_id => customer.id,
+ :number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::CountryOfIssuance,
+ :expiration_date => "05/2014",
+ :options => {:verify_card => true}
+ )
+ credit_card = result.credit_card
+ credit_card.country_of_issuance.should == Braintree::Test::CreditCardDefaults::CountryOfIssuance
+ end
+
+ it "sets the issuing bank field" do
+ customer = Braintree::Customer.create!
+ result = Braintree::CreditCard.create(
+ :customer_id => customer.id,
+ :number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::IssuingBank,
+ :expiration_date => "05/2014",
+ :options => {:verify_card => true}
+ )
+ credit_card = result.credit_card
+ credit_card.issuing_bank.should == Braintree::Test::CreditCardDefaults::IssuingBank
+ end
+
it "sets the payroll field if the card is payroll" do
customer = Braintree::Customer.create!
result = Braintree::CreditCard.create(
@@ -349,6 +373,8 @@
credit_card.debit.should == Braintree::CreditCard::Prepaid::Unknown
credit_card.durbin_regulated.should == Braintree::CreditCard::Prepaid::Unknown
credit_card.healthcare.should == Braintree::CreditCard::Prepaid::Unknown
+ credit_card.country_of_issuance == Braintree::CreditCard::CountryOfIssuance::Unknown
+ credit_card.issuing_bank == Braintree::CreditCard::IssuingBank::Unknown
end
end
@@ -20,7 +20,8 @@
:expiration_year,
:number,
:token,
- {:options => [:make_default, :verification_merchant_account_id, :verify_card, :fail_on_duplicate_payment_method]},
+ :venmo_sdk_payment_method_code,
+ {:options => [:make_default, :verification_merchant_account_id, :verify_card, :venmo_sdk_session, :fail_on_duplicate_payment_method]},
{:billing_address => [
:company,
:country_code_alpha2,
@@ -51,7 +52,8 @@
:expiration_year,
:number,
:token,
- {:options => [:make_default, :verification_merchant_account_id, :verify_card]},
+ :venmo_sdk_payment_method_code,
+ {:options => [:make_default, :verification_merchant_account_id, :verify_card, :venmo_sdk_session]},
{:billing_address => [
:company,
:country_code_alpha2,
@@ -90,7 +90,8 @@
:expiration_year,
:number,
:token,
- {:options => [:make_default, :verification_merchant_account_id, :verify_card, :fail_on_duplicate_payment_method]},
+ :venmo_sdk_payment_method_code,
+ {:options => [:make_default, :verification_merchant_account_id, :verify_card, :venmo_sdk_session, :fail_on_duplicate_payment_method]},
{:billing_address => [
:company,
:country_code_alpha2,
@@ -131,10 +132,12 @@
:expiration_year,
:number,
:token,
+ :venmo_sdk_payment_method_code,
{:options => [
:make_default,
:verification_merchant_account_id,
:verify_card,
+ :venmo_sdk_session,
:update_existing_token
]},
{:billing_address => [
@@ -192,6 +192,11 @@
query_string = "foo=bar%20baz&hash=a1b2c3"
Braintree::Util.parse_query_string(query_string).should == {:foo => "bar baz", :hash => "a1b2c3"}
end
+
+ it "parses the query string when a key has an empty value" do
+ query_string = "foo=bar%20baz&hash=a1b2c3&vat_number="
+ Braintree::Util.parse_query_string(query_string).should == {:foo => "bar baz", :hash => "a1b2c3", :vat_number => ""}
+ end
end
describe "self.raise_exception_for_status_code" do

0 comments on commit babca7d

Please sign in to comment.