Skip to content

Commit

Permalink
4.15.0
Browse files Browse the repository at this point in the history
Co-authored-by: Sara Vasquez <saravasquez@paypal.com>
Co-authored-by: Debra Do <debdo@paypal.com>
  • Loading branch information
3 people committed Oct 18, 2023
1 parent c2e1e49 commit 35ec79f
Show file tree
Hide file tree
Showing 111 changed files with 5,043 additions and 4,696 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 4.15.0
- Add `retry_ids`, `retried_transaction_id`, and `debit_network` to `Transaction`
- Add `evidence_submittable` to Dispute
- Add `implicitly_vaulted_payment_method_token` and `implicitly_vaulted_payment_method_global_id` to `LocalPaymentDetails`
- Add `merchant_token_identifier` and `source_card_last4` to ApplePayCard and ApplePayDetails response objects
- Add `debit_network` to `TransactionSearch`
- Add `DebitNetwork` enum to `CreditCard`
- Add `SubscriptionBillingSkipped` webhook notification support
- Deprecate `three_d_secure_token` in favor of `three_d_secure_authentication_id`
- Deprecate `venmo_sdk_session`, `venmo_sdk_payment_method_code`, and `venmo_sdk?`

## 4.14.0

- Add `payment_receipt` object to `Transaction`
Expand Down
13 changes: 13 additions & 0 deletions lib/braintree/credit_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ module CardType
All = constants.map { |c| const_get(c) }
end

module DebitNetwork
Accel = "ACCEL"
Nyce = "NYCE"
Pulse = "PULSE"
Star = "STAR"
Star_Access = "STAR_ACCESS"

All = constants.map { |c| const_get(c) }
end

module CustomerLocation
International = "international"
US = "us"
Expand Down Expand Up @@ -160,7 +170,10 @@ def nonce
end

# Returns true if the card is associated with Venmo SDK
# NEXT_MAJOR_VERSION Remove this method
# The old venmo SDK class has been deprecated
def venmo_sdk?
warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead."
@venmo_sdk
end

Expand Down
18 changes: 15 additions & 3 deletions lib/braintree/credit_card_gateway.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ def create(attributes)
if attributes.has_key?(:expiration_date) && (attributes.has_key?(:expiration_month) || attributes.has_key?(:expiration_year))
raise ArgumentError.new("create with both expiration_month and expiration_year or only expiration_date")
end
# NEXT_MAJOR_VERSION remove this check
if attributes.has_key?(:venmo_sdk_payment_method_code) || attributes.has_key?(:venmo_sdk_session)
warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead."
end
Util.verify_keys(CreditCardGateway._create_signature, attributes)
_do_create("/payment_methods", :credit_card => attributes)
end
Expand Down Expand Up @@ -61,6 +65,10 @@ def from_nonce(nonce)
end

def update(token, attributes)
# NEXT_MAJOR_VERSION remove this check
if attributes.has_key?(:venmo_sdk_payment_method_code) || attributes.has_key?(:venmo_sdk_session)
warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead."
end
Util.verify_keys(CreditCardGateway._update_signature, attributes)
_do_update(:put, "/payment_methods/credit_card/#{token}", :credit_card => attributes)
end
Expand All @@ -79,21 +87,25 @@ def self._update_signature # :nodoc:

def self._signature(type) # :nodoc:
billing_address_params = AddressGateway._shared_signature
# NEXT_MAJOR_VERSION Remove venmo_sdk_session
# The old venmo SDK class has been deprecated
options = [
:fail_on_duplicate_payment_method,
:make_default,
:skip_advanced_fraud_checking,
:venmo_sdk_session,
:venmo_sdk_session, # Deprecated
:verification_account_type,
:verification_amount,
:verification_currency_iso_code,
:verification_merchant_account_id,
:verify_card
]
# NEXT_MAJOR_VERSION Remove venmo_sdk_payment_method_code
# The old venmo SDK class has been deprecated
signature = [
:billing_address_id, :cardholder_name, :cvv, :expiration_date, :expiration_month,
:expiration_year, :number, :token, :venmo_sdk_payment_method_code, :device_data,
:payment_method_nonce,
:expiration_year, :number, :token, :venmo_sdk_payment_method_code, # Deprecated
:device_data, :payment_method_nonce,
{:external_vault => [:network_transaction_id]},
{:options => options},
{:billing_address => billing_address_params}
Expand Down
18 changes: 15 additions & 3 deletions lib/braintree/payment_method_gateway.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ def initialize(gateway)
end

def create(attributes)
# NEXT_MAJOR_VERSION remove this check
if attributes.has_key?(:venmo_sdk_payment_method_code) || attributes.has_key?(:venmo_sdk_session)
warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead."
end
Util.verify_keys(PaymentMethodGateway._create_signature, attributes)
_do_create("/payment_methods", :payment_method => attributes)
end
Expand Down Expand Up @@ -60,6 +64,10 @@ def find(token)
end

def update(token, attributes)
# NEXT_MAJOR_VERSION remove this check
if attributes.has_key?(:venmo_sdk_payment_method_code) || attributes.has_key?(:venmo_sdk_session)
warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead."
end
Util.verify_keys(PaymentMethodGateway._update_signature, attributes)
_do_update(:put, "/payment_methods/any/#{token}", :payment_method => attributes)
end
Expand Down Expand Up @@ -149,11 +157,13 @@ def self._delete_signature # :nodoc:
def self._signature(type) # :nodoc:
billing_address_params = AddressGateway._shared_signature
paypal_options_shipping_signature = AddressGateway._shared_signature
# NEXT_MAJOR_VERSION Remove venmo_sdk_session
# The old venmo SDK class has been deprecated
options = [
:make_default,
:skip_advanced_fraud_checking,
:us_bank_account_verification_method,
:venmo_sdk_session,
:venmo_sdk_session, # Deprecated
:verification_account_type,
:verification_amount,
:verification_currency_iso_code,
Expand All @@ -168,10 +178,12 @@ def self._signature(type) # :nodoc:
{:shipping => paypal_options_shipping_signature}
],
]
# NEXT_MAJOR_VERSION Remove venmo_sdk_payment_method_code
# The old venmo SDK class has been deprecated
signature = [
:billing_address_id, :cardholder_name, :cvv, :expiration_date, :expiration_month,
:expiration_year, :number, :token, :venmo_sdk_payment_method_code, :device_data,
:payment_method_nonce,
:expiration_year, :number, :token, :venmo_sdk_payment_method_code, # Deprecated
:device_data, :payment_method_nonce,
{:options => options},
{:billing_address => billing_address_params}
]
Expand Down
1 change: 1 addition & 0 deletions lib/braintree/test/nonce.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ module Nonce
TransactableCountryOfIssuanceUSA = "fake-valid-country-of-issuance-usa-nonce"
TransactableCountryOfIssuanceCAD = "fake-valid-country-of-issuance-cad-nonce"
TransactableIssuingBankNetworkOnly = "fake-valid-issuing-bank-network-only-nonce"
TransactablePinlessDebitVisa = "fake-pinless-debit-visa-nonce"
ProcessorDeclinedVisa = "fake-processor-declined-visa-nonce"
ProcessorDeclinedMasterCard = "fake-processor-declined-mastercard-nonce"
ProcessorDeclinedAmEx = "fake-processor-declined-amex-nonce"
Expand Down
2 changes: 2 additions & 0 deletions lib/braintree/test/venmo_sdk.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# NEXT_MAJOR_VERSION Remove this class
# The old venmo SDK class has been deprecated
module Braintree
module Test
module VenmoSDK
Expand Down
9 changes: 5 additions & 4 deletions lib/braintree/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ module Status
end
end

attr_reader :acquirer_reference_number
attr_reader :ach_return_code
attr_reader :ach_return_responses
attr_reader :acquirer_reference_number
attr_reader :add_ons
attr_reader :additional_processor_response # The raw response from the processor.
attr_reader :amount
Expand All @@ -111,6 +112,7 @@ module Status
attr_reader :custom_fields
attr_reader :customer_details
attr_reader :cvv_response_code
attr_reader :debit_network
attr_reader :descriptor
attr_reader :disbursement_details
attr_reader :discount_amount
Expand Down Expand Up @@ -150,18 +152,18 @@ module Status
attr_reader :purchase_order_number
attr_reader :recurring
attr_reader :refund_ids
attr_reader :refunded_transaction_id
attr_reader :refunded_installments
attr_reader :refunded_transaction_id
attr_reader :retried
attr_reader :retried_transaction_id # the primary/parent transaction id of any retried transaction
attr_reader :retrieval_reference_number
attr_reader :retry_ids # all retried transactions ids for a primary transaction
attr_reader :risk_data
attr_reader :samsung_pay_card_details
attr_reader :sca_exemption_requested
attr_reader :service_fee_amount
attr_reader :sepa_direct_debit_account_details
attr_reader :sepa_direct_debit_return_code
attr_reader :service_fee_amount
attr_reader :settlement_batch_id
attr_reader :shipping_amount
attr_reader :shipping_details
Expand All @@ -179,7 +181,6 @@ module Status
attr_reader :venmo_account_details
attr_reader :visa_checkout_card_details
attr_reader :voice_referral_number
attr_reader :ach_return_responses

def self.adjust_authorization(*args)
Configuration.gateway.transaction.adjust_authorization(*args)
Expand Down
3 changes: 3 additions & 0 deletions lib/braintree/transaction/credit_card_details.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ def masked_number
"#{bin}******#{last_4}"
end

# NEXT_MAJOR_VERSION Remove this method
# The old venmo SDK class has been deprecated
def venmo_sdk?
warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead."
@venmo_sdk
end

Expand Down
2 changes: 2 additions & 0 deletions lib/braintree/transaction/local_payment_details.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class LocalPaymentDetails
attr_reader :debug_id
attr_reader :description
attr_reader :funding_source
attr_reader :implicitly_vaulted_payment_method_global_id
attr_reader :implicitly_vaulted_payment_method_token
attr_reader :payer_id
attr_reader :payment_id
attr_reader :refund_from_transaction_fee_amount
Expand Down
18 changes: 15 additions & 3 deletions lib/braintree/transaction_gateway.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ def initialize(gateway)
end

def create(attributes)
# NEXT_MAJOR_VERSION remove this check
if attributes.has_key?(:venmo_sdk_payment_method_code) || attributes.has_key?(:venmo_sdk_session)
warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead."
end
# NEXT_MAJOR_VERSION remove this check
if attributes.has_key?(:three_d_secure_token)
warn "[DEPRECATED] Passing :three_d_secure_token to create is deprecated. Please use :three_d_secure_authentication_id"
end
Util.verify_keys(TransactionGateway._create_signature, attributes)
_do_create "/transactions", :transaction => attributes
end
Expand Down Expand Up @@ -183,15 +191,19 @@ def self._clone_signature # :nodoc:
[:amount, :channel, {:options => [:submit_for_settlement]}]
end


# NEXT_MAJOR_VERSION Remove venmo_sdk_payment_method_code, venmo_sdk_session, and three_d_secure_token
# The old venmo SDK class has been deprecated
# three_d_secure_token has been deprecated in favor of three_d_secure_authentication_id
def self._create_signature # :nodoc:
[
:amount, :billing_address_id, :channel, :customer_id, :device_data, :discount_amount,
:merchant_account_id, :order_id, :payment_method_nonce, :payment_method_token,
:product_sku, :purchase_order_number, :service_fee_amount, :shared_billing_address_id,
:shared_customer_id, :shared_payment_method_nonce, :shared_payment_method_token,
: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,
:ships_from_postal_code, :tax_amount, :tax_exempt, :three_d_secure_authentication_id,:three_d_secure_token, #Deprecated
:transaction_source, :type, :venmo_sdk_payment_method_code, # Deprecated
: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]},
Expand Down Expand Up @@ -222,7 +234,7 @@ def self._create_signature # :nodoc:
:submit_for_settlement,
:add_billing_address_to_payment_method,
:store_shipping_address_in_vault,
:venmo_sdk_session,
:venmo_sdk_session, # Deprecated
:payee_id,
:payee_email,
:skip_advanced_fraud_checking,
Expand Down
11 changes: 6 additions & 5 deletions lib/braintree/transaction_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,16 @@ class TransactionSearch < AdvancedSearch # :nodoc:
CreditCard::CustomerLocation::International,
CreditCard::CustomerLocation::US
]
multiple_value_field :debit_network, :allows => CreditCard::DebitNetwork::All
multiple_value_field :ids
multiple_value_field :payment_instrument_type
multiple_value_field :user
multiple_value_field :merchant_account_id
multiple_value_field :status, :allows => Transaction::Status::All
multiple_value_field :payment_instrument_type
multiple_value_field :reason_code
multiple_value_field :source
multiple_value_field :type, :allows => Transaction::Type::All
multiple_value_field :status, :allows => Transaction::Status::All
multiple_value_field :store_ids
multiple_value_field :reason_code
multiple_value_field :type, :allows => Transaction::Type::All
multiple_value_field :user

key_value_fields :refund

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 = 14
Minor = 15
Tiny = 0

String = "#{Major}.#{Minor}.#{Tiny}"
Expand Down
1 change: 1 addition & 0 deletions lib/braintree/webhook_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module Kind

RecipientUpdatedGrantedPaymentMethod = "recipient_updated_granted_payment_method"

SubscriptionBillingSkipped = "subscription_billing_skipped"
SubscriptionCanceled = "subscription_canceled"
SubscriptionChargedSuccessfully = "subscription_charged_successfully"
SubscriptionChargedUnsuccessfully = "subscription_charged_unsuccessfully"
Expand Down
17 changes: 17 additions & 0 deletions lib/braintree/webhook_testing_gateway.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def _subject_sample_xml(kind, id)
_disbursement_exception_sample_xml(id)
when Braintree::WebhookNotification::Kind::Disbursement
_disbursement_sample_xml(id)
when Braintree::WebhookNotification::Kind::SubscriptionBillingSkipped
_subscription_billing_skipped(id)
when Braintree::WebhookNotification::Kind::SubscriptionChargedSuccessfully
_subscription_charged_successfully(id)
when Braintree::WebhookNotification::Kind::SubscriptionChargedUnsuccessfully
Expand Down Expand Up @@ -112,6 +114,21 @@ def _check
XML
end

def _subscription_billing_skipped(id)

<<-XML
<subscription>
<id>#{id}</id>
<transactions type="array">
</transactions>
<add_ons type="array">
</add_ons>
<discounts type="array">
</discounts>
</subscription>
XML
end

def _subscription_charged_successfully(id)

<<-XML
Expand Down
18 changes: 9 additions & 9 deletions spec/integration/braintree/add_on_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
add_ons = Braintree::AddOn.all
add_on = add_ons.select { |add_on| add_on.id == id }.first

add_on.should_not be_nil
add_on.amount.should == BigDecimal(expected[:amount])
add_on.created_at.should_not be_nil
add_on.description.should == expected[:description]
add_on.kind.should == expected[:kind]
add_on.name.should == expected[:name]
add_on.never_expires.should == expected[:never_expires]
add_on.number_of_billing_cycles.should == expected[:number_of_billing_cycles]
add_on.updated_at.should_not be_nil
expect(add_on).not_to be_nil
expect(add_on.amount).to eq(BigDecimal(expected[:amount]))
expect(add_on.created_at).not_to be_nil
expect(add_on.description).to eq(expected[:description])
expect(add_on.kind).to eq(expected[:kind])
expect(add_on.name).to eq(expected[:name])
expect(add_on.never_expires).to eq(expected[:never_expires])
expect(add_on.number_of_billing_cycles).to eq(expected[:number_of_billing_cycles])
expect(add_on.updated_at).not_to be_nil
end

it "raises with a helpful error if public_key and private_key are not set" do
Expand Down
Loading

0 comments on commit 35ec79f

Please sign in to comment.