diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 15eced64..af7b9ca1 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1 @@ -* @braintree/sdk * @braintree/team-sdk-server diff --git a/CHANGELOG.md b/CHANGELOG.md index 282955dc..1d0a3cb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,23 @@ -# Unreleased -* Add a log message to the `ArgumentError` at `TransactionGateway.find` (thanks @BrianLima) - # Changelog +## 4.3.0 +* Add a log message to the `ArgumentError` at `TransactionGateway.find` (thanks @BrianLima) +* Add `exchange_rate_quote_id` to `Transaction.create` +* Add error code `ExchangeRateQuoteIdTooLong` to `Transaction` +* Add the following fields to `ApplePayCard` and `GooglePayCard`: + * `commercial` + * `debit` + * `durbin_regulated` + * `healthcare` + * `payroll` + * `prepaid` + * `product_id` + * `country_of_issuance` + * `issuing_bank` +* Add the following fields to `PayPalDetails`: + * `tax_id` + * `tax_id_type` + ## 4.2.0 * Add `default?` to `PaymentMethodNonce` (thanks @klouvas) * Add error code `TaxAmountIsRequiredForAibSwedish` for attribute `tax_amount` in `transaction` key for AIB:Domestic Transactions in Sweden diff --git a/Dockerfile b/Dockerfile index 18d546cc..6707aa5e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM debian:buster RUN apt-get update RUN apt-get -y install gnupg curl procps build-essential libxml2-dev -RUN gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB +RUN gpg -vvvv --keyserver keys.openpgp.org --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB RUN curl -sSL https://get.rvm.io | bash RUN bash -l -c "rvm requirements" RUN bash -l -c "rvm install 3.0.1" diff --git a/lib/braintree/apple_pay_card.rb b/lib/braintree/apple_pay_card.rb index 5ac7bb95..15e3b190 100644 --- a/lib/braintree/apple_pay_card.rb +++ b/lib/braintree/apple_pay_card.rb @@ -12,15 +12,24 @@ module CardType attr_reader :bin attr_reader :card_type + attr_reader :commercial + attr_reader :country_of_issuance attr_reader :created_at attr_reader :customer_id + attr_reader :debit attr_reader :default + attr_reader :durbin_regulated attr_reader :expiration_month attr_reader :expiration_year attr_reader :expired + attr_reader :healthcare attr_reader :image_url + attr_reader :issuing_bank attr_reader :last_4 attr_reader :payment_instrument_name + attr_reader :payroll + attr_reader :prepaid + attr_reader :product_id attr_reader :source_description attr_reader :subscriptions attr_reader :token diff --git a/lib/braintree/error_codes.rb b/lib/braintree/error_codes.rb index c056d952..351db41d 100644 --- a/lib/braintree/error_codes.rb +++ b/lib/braintree/error_codes.rb @@ -312,6 +312,7 @@ module Transaction DiscountAmountCannotBeNegative = "915160" DiscountAmountFormatIsInvalid = "915159" DiscountAmountIsTooLarge = "915161" + ExchangeRateQuoteIdTooLong = "915229" FailedAuthAdjustmentAllowRetry = "95603" FailedAuthAdjustmentHardDecline = "95602" FinalAuthSubmitForSettlementForDifferentAmount = "95601" diff --git a/lib/braintree/google_pay_card.rb b/lib/braintree/google_pay_card.rb index 37f9a386..96b3ded1 100644 --- a/lib/braintree/google_pay_card.rb +++ b/lib/braintree/google_pay_card.rb @@ -3,13 +3,22 @@ class GooglePayCard include BaseModule # :nodoc: attr_reader :bin + attr_reader :commercial + attr_reader :country_of_issuance attr_reader :created_at attr_reader :customer_id + attr_reader :debit attr_reader :default + attr_reader :durbin_regulated attr_reader :expiration_month attr_reader :expiration_year attr_reader :google_transaction_id + attr_reader :healthcare attr_reader :image_url + attr_reader :issuing_bank + attr_reader :payroll + attr_reader :prepaid + attr_reader :product_id attr_reader :source_card_last_4 attr_reader :source_card_type attr_reader :source_description diff --git a/lib/braintree/transaction/paypal_details.rb b/lib/braintree/transaction/paypal_details.rb index 39b901c8..7084466a 100644 --- a/lib/braintree/transaction/paypal_details.rb +++ b/lib/braintree/transaction/paypal_details.rb @@ -24,6 +24,8 @@ class PayPalDetails attr_reader :refund_from_transaction_fee_currency_iso_code attr_reader :refund_id attr_reader :seller_protection_status + attr_reader :tax_id + attr_reader :tax_id_type attr_reader :token attr_reader :transaction_fee_amount attr_reader :transaction_fee_currency_iso_code diff --git a/lib/braintree/transaction_gateway.rb b/lib/braintree/transaction_gateway.rb index 629f38ea..6a83944a 100644 --- a/lib/braintree/transaction_gateway.rb +++ b/lib/braintree/transaction_gateway.rb @@ -192,7 +192,7 @@ def self._create_signature # :nodoc: :shared_shipping_address_id, :shipping_address_id, :shipping_amount, :ships_from_postal_code, :tax_amount, :tax_exempt, :three_d_secure_authentication_id, :three_d_secure_token, :transaction_source, :type, :venmo_sdk_payment_method_code, - :sca_exemption, :currency_iso_code, + :sca_exemption, :currency_iso_code, :exchange_rate_quote_id, {:line_items => [:quantity, :name, :description, :kind, :unit_amount, :unit_tax_amount, :total_amount, :discount_amount, :tax_amount, :unit_of_measure, :product_code, :commodity_code, :url]}, {:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]}, {:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number, {:payment_reader_card_details => [:encrypted_card_data, :key_serial_number]}]}, diff --git a/lib/braintree/version.rb b/lib/braintree/version.rb index 63b18678..b1f12801 100644 --- a/lib/braintree/version.rb +++ b/lib/braintree/version.rb @@ -1,7 +1,7 @@ module Braintree module Version Major = 4 - Minor = 2 + Minor = 3 Tiny = 0 String = "#{Major}.#{Minor}.#{Tiny}" diff --git a/spec/integration/braintree/customer_spec.rb b/spec/integration/braintree/customer_spec.rb index c7951739..8d8061d5 100644 --- a/spec/integration/braintree/customer_spec.rb +++ b/spec/integration/braintree/customer_spec.rb @@ -1021,6 +1021,15 @@ apple_pay_card.token.should_not be_nil apple_pay_card.expiration_year.should_not be_nil apple_pay_card.payment_instrument_name.should == "AmEx 41002" + apple_pay_card.commercial.should_not be_nil + apple_pay_card.country_of_issuance.should_not be_nil + apple_pay_card.debit.should_not be_nil + apple_pay_card.durbin_regulated.should_not be_nil + apple_pay_card.healthcare.should_not be_nil + apple_pay_card.issuing_bank.should_not be_nil + apple_pay_card.payroll.should_not be_nil + apple_pay_card.prepaid.should_not be_nil + apple_pay_card.product_id.should_not be_nil end it "returns associated google pay proxy cards" do @@ -1037,6 +1046,15 @@ google_pay_card.token.should_not be_nil google_pay_card.expiration_year.should_not be_nil google_pay_card.is_network_tokenized?.should == false + google_pay_card.commercial.should_not be_nil + google_pay_card.country_of_issuance.should_not be_nil + google_pay_card.debit.should_not be_nil + google_pay_card.durbin_regulated.should_not be_nil + google_pay_card.healthcare.should_not be_nil + google_pay_card.issuing_bank.should_not be_nil + google_pay_card.payroll.should_not be_nil + google_pay_card.prepaid.should_not be_nil + google_pay_card.product_id.should_not be_nil end it "returns associated google pay network tokens" do @@ -1053,6 +1071,15 @@ google_pay_card.token.should_not be_nil google_pay_card.expiration_year.should_not be_nil google_pay_card.is_network_tokenized?.should == true + google_pay_card.commercial.should_not be_nil + google_pay_card.country_of_issuance.should_not be_nil + google_pay_card.debit.should_not be_nil + google_pay_card.durbin_regulated.should_not be_nil + google_pay_card.healthcare.should_not be_nil + google_pay_card.issuing_bank.should_not be_nil + google_pay_card.payroll.should_not be_nil + google_pay_card.prepaid.should_not be_nil + google_pay_card.product_id.should_not be_nil end it "returns associated venmo accounts" do diff --git a/spec/integration/braintree/merchant_account_spec.rb b/spec/integration/braintree/merchant_account_spec.rb index e76a54f4..fa684bd8 100644 --- a/spec/integration/braintree/merchant_account_spec.rb +++ b/spec/integration/braintree/merchant_account_spec.rb @@ -41,7 +41,7 @@ :business => { :legal_name => "Joe's Bloggs", :dba_name => "Joe's Junkyard", - :tax_id => "123456789", + :tax_id => "423456789", :address => { :street_address => "456 Fake St", :postal_code => "48104", @@ -371,7 +371,7 @@ params[:individual][:address][:postal_code] = "60622" params[:business][:dba_name] = "James's Bloggs" params[:business][:legal_name] = "James's Bloggs Inc" - params[:business][:tax_id] = "123456789" + params[:business][:tax_id] = "423456789" params[:business][:address][:street_address] = "999 Fake St" params[:business][:address][:locality] = "Miami" params[:business][:address][:region] = "FL" @@ -397,7 +397,7 @@ result.merchant_account.individual_details.address_details.postal_code.should == "60622" result.merchant_account.business_details.dba_name.should == "James's Bloggs" result.merchant_account.business_details.legal_name.should == "James's Bloggs Inc" - result.merchant_account.business_details.tax_id.should == "123456789" + result.merchant_account.business_details.tax_id.should == "423456789" result.merchant_account.business_details.address_details.street_address.should == "999 Fake St" result.merchant_account.business_details.address_details.locality.should == "Miami" result.merchant_account.business_details.address_details.region.should == "FL" diff --git a/spec/integration/braintree/payment_method_spec.rb b/spec/integration/braintree/payment_method_spec.rb index 76e9009e..9f19c2b0 100644 --- a/spec/integration/braintree/payment_method_spec.rb +++ b/spec/integration/braintree/payment_method_spec.rb @@ -99,6 +99,15 @@ def make_token apple_pay_card.expiration_month.to_i.should > 0 apple_pay_card.expiration_year.to_i.should > 0 apple_pay_card.customer_id.should == customer.id + apple_pay_card.commercial.should_not be_nil + apple_pay_card.country_of_issuance.should_not be_nil + apple_pay_card.debit.should_not be_nil + apple_pay_card.durbin_regulated.should_not be_nil + apple_pay_card.healthcare.should_not be_nil + apple_pay_card.issuing_bank.should_not be_nil + apple_pay_card.payroll.should_not be_nil + apple_pay_card.prepaid.should_not be_nil + apple_pay_card.product_id.should_not be_nil end it "creates a payment method from a fake google pay proxy card nonce" do @@ -127,6 +136,15 @@ def make_token google_pay_card.google_transaction_id.should == "google_transaction_id" google_pay_card.source_description.should == "Discover 1111" google_pay_card.customer_id.should == customer.id + google_pay_card.commercial.should_not be_nil + google_pay_card.country_of_issuance.should_not be_nil + google_pay_card.debit.should_not be_nil + google_pay_card.durbin_regulated.should_not be_nil + google_pay_card.healthcare.should_not be_nil + google_pay_card.issuing_bank.should_not be_nil + google_pay_card.payroll.should_not be_nil + google_pay_card.prepaid.should_not be_nil + google_pay_card.product_id.should_not be_nil end it "creates a payment method from a google pay network token nonce" do @@ -155,6 +173,15 @@ def make_token google_pay_card.google_transaction_id.should == "google_transaction_id" google_pay_card.source_description.should == "MasterCard 4444" google_pay_card.customer_id.should == customer.id + google_pay_card.commercial.should_not be_nil + google_pay_card.country_of_issuance.should_not be_nil + google_pay_card.debit.should_not be_nil + google_pay_card.durbin_regulated.should_not be_nil + google_pay_card.healthcare.should_not be_nil + google_pay_card.issuing_bank.should_not be_nil + google_pay_card.payroll.should_not be_nil + google_pay_card.prepaid.should_not be_nil + google_pay_card.product_id.should_not be_nil end it "creates a payment method from venmo account nonce" do diff --git a/spec/integration/braintree/transaction_spec.rb b/spec/integration/braintree/transaction_spec.rb index 7796fb76..c0198ba7 100644 --- a/spec/integration/braintree/transaction_spec.rb +++ b/spec/integration/braintree/transaction_spec.rb @@ -999,6 +999,34 @@ result.transaction.credit_card_details.expiration_date.should == "05/2011" end + it "accepts exchange_rate_quote_id" do + result = Braintree::Transaction.create( + :type => "sale", + :amount => Braintree::Test::TransactionAmounts::Authorize, + :credit_card => { + :number => Braintree::Test::CreditCardNumbers::Visa, + :expiration_date => "05/2009" + }, + :exchange_rate_quote_id => "dummyExchangeRateQuoteId-Brainree-Ruby", + ) + result.success?.should == true + result.transaction.credit_card_details.expiration_date.should == "05/2009" + end + + it "returns an error if provided invalid exchange_rate_quote_id" do + result = Braintree::Transaction.create( + :type => "sale", + :amount => Braintree::Test::TransactionAmounts::Authorize, + :credit_card => { + :number => Braintree::Test::CreditCardNumbers::Visa, + :expiration_date => "05/2009" + }, + :exchange_rate_quote_id => "a" * 4010, + ) + result.success?.should == false + result.errors.for(:transaction).on(:exchange_rate_quote_id)[0].code.should == Braintree::ErrorCodes::Transaction::ExchangeRateQuoteIdTooLong + end + it "returns some error if customer_id is invalid" do result = Braintree::Transaction.create( :type => "sale", diff --git a/spec/unit/braintree/transaction/paypal_details_spec.rb b/spec/unit/braintree/transaction/paypal_details_spec.rb index 35bd51ee..0f7146f4 100644 --- a/spec/unit/braintree/transaction/paypal_details_spec.rb +++ b/spec/unit/braintree/transaction/paypal_details_spec.rb @@ -25,6 +25,8 @@ :refund_from_transaction_fee_currency_iso_code => "123", :refund_id => "refund-id", :seller_protection_status => "seller-protection-status", + :tax_id => "tax-id", + :tax_id_type => "tax-id-type", :token => "token", :transaction_fee_amount => "2.00", :transaction_fee_currency_iso_code => "123", @@ -51,6 +53,8 @@ expect(details.refund_from_transaction_fee_currency_iso_code).to eq("123") expect(details.refund_id).to eq("refund-id") expect(details.seller_protection_status).to eq("seller-protection-status") + expect(details.tax_id).to eq("tax-id") + expect(details.tax_id_type).to eq("tax-id-type") expect(details.token).to eq("token") expect(details.transaction_fee_amount).to eq("2.00") expect(details.transaction_fee_currency_iso_code).to eq("123")