Skip to content

Commit

Permalink
Fixed merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
braintreeps committed Jul 15, 2021
1 parent cba87ff commit 87cc755
Show file tree
Hide file tree
Showing 14 changed files with 131 additions and 10 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
* @braintree/sdk
* @braintree/team-sdk-server
21 changes: 18 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 9 additions & 0 deletions lib/braintree/apple_pay_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/braintree/error_codes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ module Transaction
DiscountAmountCannotBeNegative = "915160"
DiscountAmountFormatIsInvalid = "915159"
DiscountAmountIsTooLarge = "915161"
ExchangeRateQuoteIdTooLong = "915229"
FailedAuthAdjustmentAllowRetry = "95603"
FailedAuthAdjustmentHardDecline = "95602"
FinalAuthSubmitForSettlementForDifferentAmount = "95601"
Expand Down
9 changes: 9 additions & 0 deletions lib/braintree/google_pay_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lib/braintree/transaction/paypal_details.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/braintree/transaction_gateway.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]}]},
Expand Down
2 changes: 1 addition & 1 deletion lib/braintree/version.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Braintree
module Version
Major = 4
Minor = 2
Minor = 3
Tiny = 0

String = "#{Major}.#{Minor}.#{Tiny}"
Expand Down
27 changes: 27 additions & 0 deletions spec/integration/braintree/customer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions spec/integration/braintree/merchant_account_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down
27 changes: 27 additions & 0 deletions spec/integration/braintree/payment_method_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
28 changes: 28 additions & 0 deletions spec/integration/braintree/transaction_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions spec/unit/braintree/transaction/paypal_details_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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")
Expand Down

0 comments on commit 87cc755

Please sign in to comment.