Skip to content

Commit

Permalink
2.104.0
Browse files Browse the repository at this point in the history
  • Loading branch information
braintreeps committed Oct 2, 2020
1 parent 14da8d8 commit dae568f
Show file tree
Hide file tree
Showing 19 changed files with 330 additions and 141 deletions.
373 changes: 239 additions & 134 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions lib/braintree/amex_express_checkout_card.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
module Braintree
# NEXT_MAJOR_VERSION Remove this class.
# DEPRECATED The American Express Checkout payment method is deprecated.
class AmexExpressCheckoutCard
include BaseModule # :nodoc:

Expand Down
1 change: 1 addition & 0 deletions lib/braintree/android_pay_card.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module Braintree
# NEXT_MAJOR_VERSION rename Android Pay to Google Pay
class AndroidPayCard
include BaseModule # :nodoc:

Expand Down
6 changes: 4 additions & 2 deletions lib/braintree/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ class Customer
include Braintree::Util::IdEquality

attr_reader :addresses
attr_reader :amex_express_checkout_cards
attr_reader :amex_express_checkout_cards # Deprecated
# NEXT_MAJOR_VERSION rename Android Pay to Google Pay
attr_reader :android_pay_cards
attr_reader :apple_pay_cards
attr_reader :coinbase_accounts
Expand All @@ -18,7 +19,7 @@ class Customer
attr_reader :graphql_id
attr_reader :id
attr_reader :last_name
attr_reader :masterpass_cards
attr_reader :masterpass_cards # Deprecated
attr_reader :paypal_accounts
attr_reader :phone
attr_reader :samsung_pay_cards
Expand Down Expand Up @@ -113,6 +114,7 @@ def initialize(gateway, attributes) # :nodoc:
@coinbase_accounts = (@coinbase_accounts || []).map { |pm| CoinbaseAccount._new gateway, pm }
@apple_pay_cards = (@apple_pay_cards || []).map { |pm| ApplePayCard._new gateway, pm }
@europe_bank_accounts = (@europe_bank_Accounts || []).map { |pm| EuropeBankAccount._new gateway, pm }
# NEXT_MAJOR_VERSION rename Android Pay to Google Pay
@android_pay_cards = (@android_pay_cards || []).map { |pm| AndroidPayCard._new gateway, pm }
@amex_express_checkout_cards = (@amex_express_checkout_cards || []).map { |pm| AmexExpressCheckoutCard._new gateway, pm }
@venmo_accounts = (@venmo_accounts || []).map { |pm| VenmoAccount._new gateway, pm }
Expand Down
1 change: 1 addition & 0 deletions lib/braintree/dispute/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class Transaction # :nodoc:
attr_reader :amount
attr_reader :created_at
attr_reader :id
attr_reader :installment_count
attr_reader :order_id
attr_reader :purchase_order_number
attr_reader :payment_instrument_subtype
Expand Down
2 changes: 2 additions & 0 deletions lib/braintree/masterpass_card.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
module Braintree
# NEXT_MAJOR_VERSION Remove this class.
# DEPRECATED The Masterpass Card payment method is deprecated.
class MasterpassCard
include BaseModule # :nodoc:
include Braintree::Util::TokenEquality
Expand Down
3 changes: 2 additions & 1 deletion lib/braintree/payment_instrument_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ module PaymentInstrumentType
CreditCard = 'credit_card'
CoinbaseAccount = 'coinbase_account'
ApplePayCard = 'apple_pay_card'
# NEXT_MAJOR_VERSION rename Android Pay to Google Pay
AndroidPayCard = 'android_pay_card'
VenmoAccount = 'venmo_account'
UsBankAccount = 'us_bank_account'
VisaCheckoutCard = 'visa_checkout_card'
MasterpassCard = 'masterpass_card'
MasterpassCard = 'masterpass_card' # Deprecated
SamsungPayCard = 'samsung_pay_card'
LocalPayment = 'local_payment'
PayPalHere = 'paypal_here'
Expand Down
1 change: 1 addition & 0 deletions lib/braintree/payment_method_gateway.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def find(token)
elsif response.has_key?(:apple_pay_card)
ApplePayCard._new(@gateway, response[:apple_pay_card])
elsif response.has_key?(:android_pay_card)
# NEXT_MAJOR_VERSION rename Android Pay to Google Pay
AndroidPayCard._new(@gateway, response[:android_pay_card])
elsif response.has_key?(:venmo_account)
VenmoAccount._new(@gateway, response[:venmo_account])
Expand Down
1 change: 1 addition & 0 deletions lib/braintree/payment_method_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def self.parse_payment_method(gateway, attributes)
elsif attributes[:apple_pay_card]
ApplePayCard._new(gateway, attributes[:apple_pay_card])
elsif attributes[:android_pay_card]
# NEXT_MAJOR_VERSION rename Android Pay to Google Pay
AndroidPayCard._new(gateway, attributes[:android_pay_card])
elsif attributes[:amex_express_checkout_card]
AmexExpressCheckoutCard._new(gateway, attributes[:amex_express_checkout_card])
Expand Down
3 changes: 3 additions & 0 deletions lib/braintree/test/nonce.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ module Nonce
AbstractTransactable = "fake-abstract-transactable-nonce"
Europe = "fake-europe-bank-account-nonce"
Coinbase = "fake-coinbase-nonce"
# NEXT_MAJOR_VERSION rename Android Pay to Google Pay
AndroidPayDiscover = "fake-android-pay-discover-nonce"
AndroidPayVisa = "fake-android-pay-visa-nonce"
AndroidPayMasterCard = "fake-android-pay-mastercard-nonce"
AndroidPayAmEx = "fake-android-pay-amex-nonce"
# NEXT_MAJOR_VERSION Remove AmexExpressCheckout test nonces
AmexExpressCheckout = "fake-amex-express-checkout-nonce"
VenmoAccount = "fake-venmo-account-nonce"
VenmoAccountTokenIssuanceError = "fake-token-issuance-error-venmo-account-nonce"
Expand Down Expand Up @@ -63,6 +65,7 @@ module Nonce
SEPA = "fake-sepa-bank-account-nonce"
GatewayRejectedFraud = "fake-gateway-rejected-fraud-nonce"
GatewayRejectedRiskThresholds = "fake-gateway-rejected-risk-thresholds-nonce"
# NEXT_MAJOR_VERSION Remove Masterpass test nonces
MasterpassAmEx = "fake-masterpass-amex-nonce"
MasterpassDiscover = "fake-masterpass-discover-nonce"
MasterpassMasterCard = "fake-masterpass-mastercard-nonce"
Expand Down
6 changes: 6 additions & 0 deletions lib/braintree/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,11 @@ module Status

attr_reader :add_ons
attr_reader :additional_processor_response # The raw response from the processor.
# NEXT_MAJOR_VERSION Remove this class.
# DEPRECATED The American Express Checkout payment method is deprecated.
attr_reader :amex_express_checkout_details
attr_reader :amount
# NEXT_MAJOR_VERSION rename Android Pay to Google Pay
attr_reader :android_pay_details
attr_reader :apple_pay_details
attr_reader :authorization_adjustments
Expand Down Expand Up @@ -126,6 +129,8 @@ module Status
# DEPRECATED If you're looking to accept iDEAL as a payment method contact accounts@braintreepayments.com for a solution.
attr_reader :ideal_payment_details
attr_reader :local_payment_details
# NEXT_MAJOR_VERSION Remove this class.
# DEPRECATED The Masterpass Card payment method is deprecated.
attr_reader :masterpass_card_details
attr_reader :merchant_account_id
attr_reader :network_response_code # Response code from the card network
Expand Down Expand Up @@ -308,6 +313,7 @@ def initialize(gateway, attributes) # :nodoc:
@paypal_details = PayPalDetails.new(@paypal)
@paypal_here_details = PayPalHereDetails.new(@paypal_here)
@apple_pay_details = ApplePayDetails.new(@apple_pay)
# NEXT_MAJOR_VERSION rename Android Pay to Google Pay
@android_pay_details = AndroidPayDetails.new(@android_pay_card)
@amex_express_checkout_details = AmexExpressCheckoutDetails.new(@amex_express_checkout_card)
@venmo_account_details = VenmoAccountDetails.new(@venmo_account)
Expand Down
2 changes: 2 additions & 0 deletions lib/braintree/transaction/masterpass_card_details.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Braintree
class Transaction
# NEXT_MAJOR_VERSION Remove this class.
# DEPRECATED The Masterpass Card payment method is deprecated.
class MasterpassCardDetails # :nodoc:
include BaseModule

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 @@ -9,6 +9,8 @@ class PayPalDetails
attr_reader :debug_id
attr_reader :description
attr_reader :image_url
attr_reader :implicitly_vaulted_payment_method_global_id
attr_reader :implicitly_vaulted_payment_method_token
attr_reader :payee_email
attr_reader :payee_id
attr_reader :payer_email
Expand Down
1 change: 1 addition & 0 deletions lib/braintree/transaction_gateway.rb
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ def self._create_signature # :nodoc:
]},
]},
{:apple_pay_card => [:number, :cardholder_name, :cryptogram, :expiration_month, :expiration_year, :eci_indicator]},
# NEXT_MAJOR_VERSION rename Android Pay to Google Pay
{:android_pay_card => [:number, :cryptogram, :google_transaction_id, :expiration_month, :expiration_year, :source_card_type, :source_card_last_four, :eci_indicator]}
]
end
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 = 2
Minor = 103
Minor = 104
Tiny = 0

String = "#{Major}.#{Minor}.#{Tiny}"
Expand Down
4 changes: 2 additions & 2 deletions spec/integration/braintree/merchant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,15 @@
it "succeeds" do
result = Braintree::Merchant.provision_raw_apple_pay
result.should be_success
result.supported_networks.should == ["visa", "mastercard", "amex", "discover"]
result.supported_networks.should == ["visa", "mastercard", "amex", "discover", "maestro"]
end

it "is repeatable" do
result = Braintree::Merchant.provision_raw_apple_pay
result.should be_success
result = Braintree::Merchant.provision_raw_apple_pay
result.should be_success
result.supported_networks.should == ["visa", "mastercard", "amex", "discover"]
result.supported_networks.should == ["visa", "mastercard", "amex", "discover", "maestro"]
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/integration/braintree/paypal_account_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
)

result.success?.should == false
result.errors.first.code.should == "82902"
result.errors.map(&:code).should include("82902")
end
end

Expand Down
2 changes: 2 additions & 0 deletions spec/unit/braintree/dispute_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
:amount => "31.00",
:id => "open_disputed_transaction",
:created_at => Time.utc(2009, 2, 9, 12, 59, 59),
:installment_count => nil,
:order_id => nil,
:purchase_order_number => "po",
:payment_instrument_subtype => "Visa",
Expand Down Expand Up @@ -320,6 +321,7 @@
dispute.transaction.amount.should == 31.00
dispute.transaction.id.should == "open_disputed_transaction"
dispute.transaction.created_at.should == Time.utc(2009, 2, 9, 12, 59, 59)
dispute.transaction.installment_count.should == nil
dispute.transaction.order_id.should == nil
dispute.transaction.purchase_order_number.should == "po"
dispute.transaction.payment_instrument_subtype.should == "Visa"
Expand Down
57 changes: 57 additions & 0 deletions spec/unit/braintree/transaction/paypal_details_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")

describe Braintree::Transaction::PayPalDetails do
describe "initialize" do
it "sets all fields" do
details = Braintree::Transaction::PayPalDetails.new(
:authorization_id => "id",
:capture_id => "capture-id",
:custom_field => "custom-field",
:debug_id => "debug-id",
:description => "description",
:image_url => "www.image.com",
:implicitly_vaulted_payment_method_global_id => "global-id",
:implicitly_vaulted_payment_method_token => "payment-method-token",
:payee_email => "payee@example.com",
:payee_id => "payee-id",
:payer_email => "payer@example.com",
:payer_first_name => "Grace",
:payer_id => "payer-id",
:payer_last_name => "Hopper",
:payer_status =>"status",
:payment_id => "payment-id",
:refund_from_transaction_fee_amount => "1.00",
:refund_from_transaction_fee_currency_iso_code => "123",
:refund_id => "refund-id",
:seller_protection_status => "seller-protection-status",
:token => "token",
:transaction_fee_amount => "2.00",
:transaction_fee_currency_iso_code => "123"
)

expect(details.authorization_id).to eq("id")
expect(details.capture_id).to eq("capture-id")
expect(details.custom_field).to eq("custom-field")
expect(details.debug_id).to eq("debug-id")
expect(details.description).to eq("description")
expect(details.image_url).to eq("www.image.com")
expect(details.implicitly_vaulted_payment_method_global_id).to eq("global-id")
expect(details.implicitly_vaulted_payment_method_token).to eq("payment-method-token")
expect(details.payee_email).to eq("payee@example.com")
expect(details.payee_id).to eq("payee-id")
expect(details.payer_email).to eq("payer@example.com")
expect(details.payer_first_name).to eq("Grace")
expect(details.payer_id).to eq("payer-id")
expect(details.payer_last_name).to eq("Hopper")
expect(details.payer_status).to eq("status")
expect(details.payment_id).to eq("payment-id")
expect(details.refund_from_transaction_fee_amount).to eq("1.00")
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.token).to eq("token")
expect(details.transaction_fee_amount).to eq("2.00")
expect(details.transaction_fee_currency_iso_code).to eq("123")
end
end
end

0 comments on commit dae568f

Please sign in to comment.