braintree 4.5.0 → 4.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/braintree.gemspec +1 -1
  3. data/lib/braintree/enriched_customer_data.rb +21 -0
  4. data/lib/braintree/exchange_rate.rb +13 -0
  5. data/lib/braintree/exchange_rate_quote.rb +24 -0
  6. data/lib/braintree/exchange_rate_quote_gateway.rb +35 -0
  7. data/lib/braintree/exchange_rate_quote_input.rb +21 -0
  8. data/lib/braintree/exchange_rate_quote_request.rb +18 -0
  9. data/lib/braintree/exchange_rate_quote_response.rb +18 -0
  10. data/lib/braintree/gateway.rb +4 -0
  11. data/lib/braintree/payment_method_customer_data_updated_metadata.rb +24 -0
  12. data/lib/braintree/plan_gateway.rb +3 -3
  13. data/lib/braintree/risk_data/liability_shift.rb +22 -0
  14. data/lib/braintree/risk_data.rb +3 -1
  15. data/lib/braintree/successful_result.rb +2 -1
  16. data/lib/braintree/transaction.rb +24 -19
  17. data/lib/braintree/transaction_search.rb +2 -1
  18. data/lib/braintree/venmo_profile_data.rb +23 -0
  19. data/lib/braintree/version.rb +1 -1
  20. data/lib/braintree/webhook_notification.rb +5 -0
  21. data/lib/braintree/webhook_testing_gateway.rb +45 -15
  22. data/lib/braintree.rb +18 -8
  23. data/spec/integration/braintree/exchange_rate_quote_spec.rb +97 -0
  24. data/spec/integration/braintree/graphql_client_spec.rb +0 -2
  25. data/spec/integration/braintree/payment_method_nonce_spec.rb +2 -1
  26. data/spec/integration/braintree/payment_method_spec.rb +2 -2
  27. data/spec/integration/braintree/transaction_search_spec.rb +79 -0
  28. data/spec/integration/braintree/transaction_spec.rb +59 -6
  29. data/spec/integration/spec_helper.rb +6 -0
  30. data/spec/unit/braintree/enriched_customer_data_spec.rb +32 -0
  31. data/spec/unit/braintree/exchange_rate_quote_input_spec.rb +42 -0
  32. data/spec/unit/braintree/exchange_rate_quote_request_spec.rb +82 -0
  33. data/spec/unit/braintree/exchange_rate_quote_response_spec.rb +52 -0
  34. data/spec/unit/braintree/exchange_rate_quote_spec.rb +42 -0
  35. data/spec/unit/braintree/exchange_rate_spec.rb +23 -0
  36. data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +45 -0
  37. data/spec/unit/braintree/risk_data/liability_shift.rb +26 -0
  38. data/spec/unit/braintree/risk_data_spec.rb +33 -7
  39. data/spec/unit/braintree/transaction_spec.rb +8 -0
  40. data/spec/unit/braintree/venmo_profile_data_spec.rb +32 -0
  41. data/spec/unit/braintree/webhook_notification_spec.rb +26 -0
  42. metadata +24 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34698c59add2b3613d0c75e58d2d9d8ee5f3aecdd6ef85c79e303211199b4fa8
4
- data.tar.gz: 933cf9e7d93aec94ba227fef1f03e4f245b7e0e4512b57ebf96ddd9ffef89cab
3
+ metadata.gz: 67348684ea4b3f86ef0063df5559298bf7563901010c0d68ee5fce5a64710c4c
4
+ data.tar.gz: 3b32cd4ccfe99e604a42a871003e38fa1679afd62bd8a44ffca6e7524dc30e85
5
5
  SHA512:
6
- metadata.gz: d44a8addd727ea6efe503a33c275956bf0a359abe402ee42fff43785b48e30a84a29ecf6e6cbf8aacb080e8562e553f6c9c2424878575815f08cd563647e6762
7
- data.tar.gz: 4b631596ff355ee26deceac5c37b61e66b0c5cf5336392120df61802be53b276cf2ebf9d93c6fb64dae3bea06d3dcb925644620aa829afaf7d2382328e7b2152
6
+ metadata.gz: 8f7f99a0d53c1e98faf5e0ef34fd47bee88be1a366412d267ada59d309b93d9119fcef2f2c0c535305a7de9340a044ddaf73550f72b69e0ab1e5ff403debf20e
7
+ data.tar.gz: ede1ae81a11c86079c8a7cd2f62673c4bbfefe5ef273bfb899d81583a302e39cb289fd9c1fdd5dfe83e573c55db6ff1ebf041a460f9a0089850b59468979b75a
data/braintree.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  "bug_tracker_uri" => "https://github.com/braintree/braintree_ruby/issues",
19
19
  "changelog_uri" => "https://github.com/braintree/braintree_ruby/blob/master/CHANGELOG.md",
20
20
  "source_code_uri" => "https://github.com/braintree/braintree_ruby",
21
- "documentation_uri" => "https://developers.braintreepayments.com/"
21
+ "documentation_uri" => "https://developer.paypal.com/braintree/docs"
22
22
  }
23
23
  end
24
24
 
@@ -0,0 +1,21 @@
1
+ module Braintree
2
+ class EnrichedCustomerData
3
+ include BaseModule
4
+
5
+ attr_reader :fields_updated
6
+ attr_reader :profile_data
7
+
8
+ def initialize(attributes) # :nodoc:
9
+ set_instance_variables_from_hash(attributes)
10
+ @profile_data = VenmoProfileData._new(attributes[:profile_data])
11
+ end
12
+
13
+ class << self
14
+ protected :new
15
+ end
16
+
17
+ def self._new(*args) # :nodoc:
18
+ self.new(*args)
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,13 @@
1
+ module Braintree
2
+ class ExchangeRate
3
+ include BaseModule # :nodoc:
4
+
5
+ def initialize(gateway, attributes) # :nodoc:
6
+ set_instance_variables_from_hash(attributes)
7
+ end
8
+
9
+ def self.generate(exchange_rate_quote_request)
10
+ Configuration.gateway.exchange_rate_quote.generate(exchange_rate_quote_request)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,24 @@
1
+ module Braintree
2
+ class ExchangeRateQuote
3
+ include BaseModule # :nodoc:
4
+
5
+ attr_reader :attrs
6
+ attr_reader :base_amount
7
+ attr_reader :exchange_rate
8
+ attr_reader :expires_at
9
+ attr_reader :id
10
+ attr_reader :quote_amount
11
+ attr_reader :refreshes_at
12
+ attr_reader :trade_rate
13
+
14
+ def initialize(attributes) # :nodoc:
15
+ @attrs = attributes.keys
16
+ set_instance_variables_from_hash(attributes)
17
+ end
18
+
19
+ def inspect # :nodoc:
20
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
21
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,35 @@
1
+ module Braintree
2
+ class ExchangeRateQuoteGateway # :nodoc
3
+ def initialize(gateway)
4
+ @gateway = gateway
5
+ end
6
+
7
+ DEFINITION = <<-GRAPHQL
8
+ mutation GenerateExchangeRateQuoteInput($input: GenerateExchangeRateQuoteInput!) {
9
+ generateExchangeRateQuote(input: $input) {
10
+ quotes {
11
+ id
12
+ baseAmount {value, currencyCode}
13
+ quoteAmount {value, currencyCode}
14
+ exchangeRate
15
+ tradeRate
16
+ expiresAt
17
+ refreshesAt
18
+ }
19
+ }
20
+ }
21
+ GRAPHQL
22
+
23
+ def generate(params)
24
+ response = @gateway.config.graphql_client.query(DEFINITION, {input: params})
25
+
26
+ if response.has_key?(:data) && response[:data][:generateExchangeRateQuote]
27
+ response[:data][:generateExchangeRateQuote]
28
+ elsif response[:errors]
29
+ ErrorResult.new(@gateway, response[:errors])
30
+ else
31
+ raise UnexpectedError, "expected :generateExchangeRateQuote or :api_error_response in GraphQL response"
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,21 @@
1
+ module Braintree
2
+ class ExchangeRateQuoteInput
3
+ include BaseModule # :nodoc:
4
+
5
+ attr_reader :attrs
6
+ attr_reader :base_currency
7
+ attr_reader :base_amount
8
+ attr_reader :markup
9
+ attr_reader :quote_currency
10
+
11
+ def initialize(attributes) # :nodoc:
12
+ @attrs = attributes.keys
13
+ set_instance_variables_from_hash(attributes)
14
+ end
15
+
16
+ def inspect # :nodoc:
17
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
18
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ module Braintree
2
+ class ExchangeRateQuoteRequest
3
+ include BaseModule # :nodoc:
4
+
5
+ attr_reader :quotes
6
+
7
+ def initialize(attributes) # :nodoc:
8
+ @attrs = attributes.keys
9
+ set_instance_variables_from_hash(attributes)
10
+ @quotes = (@quotes || []).map { |quote_hash| ExchangeRateQuoteInput.new(quote_hash) }
11
+ end
12
+
13
+ def inspect # :nodoc:
14
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
15
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module Braintree
2
+ class ExchangeRateQuoteResponse
3
+ include BaseModule # :nodoc:
4
+
5
+ attr_reader :quotes
6
+
7
+ def initialize(attributes) # :nodoc:
8
+ @attrs = attributes.keys
9
+ set_instance_variables_from_hash(attributes)
10
+ @quotes = (@quotes || []).map { |quote_hash| ExchangeRateQuote.new(quote_hash) }
11
+ end
12
+
13
+ def inspect # :nodoc:
14
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
15
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
16
+ end
17
+ end
18
+ end
@@ -50,6 +50,10 @@ module Braintree
50
50
  DocumentUploadGateway.new(self)
51
51
  end
52
52
 
53
+ def exchange_rate_quote
54
+ ExchangeRateQuoteGateway.new(self)
55
+ end
56
+
53
57
  def oauth
54
58
  OAuthGateway.new(self)
55
59
  end
@@ -0,0 +1,24 @@
1
+ module Braintree
2
+ class PaymentMethodCustomerDataUpdatedMetadata
3
+ include BaseModule
4
+
5
+ attr_reader :token
6
+ attr_reader :payment_method
7
+ attr_reader :datetime_updated
8
+ attr_reader :enriched_customer_data
9
+
10
+ def initialize(gateway, attributes) # :nodoc:
11
+ set_instance_variables_from_hash(attributes)
12
+ @payment_method = PaymentMethodParser.parse_payment_method(gateway, attributes[:payment_method])
13
+ @enriched_customer_data = EnrichedCustomerData._new(enriched_customer_data) if enriched_customer_data
14
+ end
15
+
16
+ class << self
17
+ protected :new
18
+ end
19
+
20
+ def self._new(*args) # :nodoc:
21
+ self.new(*args)
22
+ end
23
+ end
24
+ end
@@ -106,10 +106,10 @@ module Braintree
106
106
  response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
107
107
  if response[:plan]
108
108
  SuccessfulResult.new(:plan => Plan._new(@gateway, response[:plan]))
109
- elsif response[:errors]
110
- ErrorResult.new(@gateway, response[:errors])
109
+ elsif response[:api_error_response]
110
+ ErrorResult.new(@gateway, response[:api_error_response])
111
111
  else
112
- raise UnexpectedError, "expected :plan or :errors"
112
+ raise UnexpectedError, "expected :plan or :api_error_response"
113
113
  end
114
114
  end
115
115
  end
@@ -0,0 +1,22 @@
1
+ module Braintree
2
+ class RiskData
3
+ class LiabilityShift
4
+ include BaseModule
5
+
6
+ attr_reader :responsible_party
7
+ attr_reader :conditions
8
+
9
+ def initialize(attributes)
10
+ set_instance_variables_from_hash attributes unless attributes.nil?
11
+ end
12
+
13
+ def inspect
14
+ attr_order = [:responsible_party, :conditions]
15
+ formatted_attrs = attr_order.map do |attr|
16
+ "#{attr}: #{send(attr).inspect}"
17
+ end
18
+ "#<LiabilityShift #{formatted_attrs.join(", ")}>"
19
+ end
20
+ end
21
+ end
22
+ end
@@ -10,14 +10,16 @@ module Braintree
10
10
  attr_reader :device_data_captured
11
11
  attr_reader :fraud_service_provider
12
12
  attr_reader :id
13
+ attr_reader :liability_shift
13
14
  attr_reader :transaction_risk_score
14
15
 
15
16
  def initialize(attributes)
16
17
  set_instance_variables_from_hash attributes unless attributes.nil?
18
+ @liability_shift = LiabilityShift.new(attributes[:liability_shift]) if attributes[:liability_shift]
17
19
  end
18
20
 
19
21
  def inspect
20
- attr_order = [:id, :decision, :decision_reasons, :device_data_captured, :fraud_service_provider, :transaction_risk_score]
22
+ attr_order = [:id, :decision, :decision_reasons, :device_data_captured, :fraud_service_provider, :liability_shift, :transaction_risk_score]
21
23
  formatted_attrs = attr_order.map do |attr|
22
24
  "#{attr}: #{send(attr).inspect}"
23
25
  end
@@ -6,10 +6,12 @@ module Braintree
6
6
  attr_reader :apple_pay_options
7
7
  attr_reader :credentials
8
8
  attr_reader :credit_card
9
+ attr_reader :credit_card_verification
9
10
  attr_reader :customer
10
11
  attr_reader :disputes
11
12
  attr_reader :document_upload
12
13
  attr_reader :evidence
14
+ attr_reader :exchange_rate_quote_payload
13
15
  attr_reader :merchant
14
16
  attr_reader :merchant_account
15
17
  attr_reader :merchant_accounts
@@ -22,7 +24,6 @@ module Braintree
22
24
  attr_reader :supported_networks
23
25
  attr_reader :transaction
24
26
  attr_reader :us_bank_account_verification
25
- attr_reader :credit_card_verification
26
27
 
27
28
  def initialize(attributes = {}) # :nodoc:
28
29
  @attrs = attributes.keys
@@ -91,6 +91,7 @@ module Braintree
91
91
  end
92
92
 
93
93
  attr_reader :acquirer_reference_number
94
+ attr_reader :ach_return_code
94
95
  attr_reader :add_ons
95
96
  attr_reader :additional_processor_response # The raw response from the processor.
96
97
  attr_reader :amount
@@ -146,6 +147,7 @@ module Braintree
146
147
  attr_reader :refund_ids
147
148
  attr_reader :refunded_transaction_id
148
149
  attr_reader :refunded_installments
150
+ attr_reader :retried
149
151
  attr_reader :retrieval_reference_number
150
152
  attr_reader :risk_data
151
153
  attr_reader :samsung_pay_card_details
@@ -168,6 +170,7 @@ module Braintree
168
170
  attr_reader :venmo_account_details
169
171
  attr_reader :visa_checkout_card_details
170
172
  attr_reader :voice_referral_number
173
+ attr_reader :ach_return_responses
171
174
 
172
175
  def self.adjust_authorization(*args)
173
176
  Configuration.gateway.transaction.adjust_authorization(*args)
@@ -288,38 +291,40 @@ module Braintree
288
291
  def initialize(gateway, attributes) # :nodoc:
289
292
  @gateway = gateway
290
293
  set_instance_variables_from_hash(attributes)
294
+
291
295
  @amount = Util.to_big_decimal(amount)
296
+ @apple_pay_details = ApplePayDetails.new(@apple_pay)
297
+ @billing_details = AddressDetails.new(@billing)
292
298
  @credit_card_details = CreditCardDetails.new(@credit_card)
293
- @service_fee_amount = Util.to_big_decimal(service_fee_amount)
294
- @subscription_details = SubscriptionDetails.new(@subscription)
299
+ @custom_fields = attributes[:custom_fields].is_a?(Hash) ? attributes[:custom_fields] : {}
295
300
  @customer_details = CustomerDetails.new(@customer)
296
- @billing_details = AddressDetails.new(@billing)
297
- @disbursement_details = DisbursementDetails.new(@disbursement_details)
298
- @shipping_details = AddressDetails.new(@shipping)
299
- @status_history = attributes[:status_history] ? attributes[:status_history].map { |s| StatusDetails.new(s) } : []
300
- @tax_amount = Util.to_big_decimal(tax_amount)
301
301
  @descriptor = Descriptor.new(@descriptor)
302
+ @disbursement_details = DisbursementDetails.new(@disbursement_details)
303
+ @google_pay_details = GooglePayDetails.new(@google_pay_card)
302
304
  @local_payment_details = LocalPaymentDetails.new(@local_payment)
305
+ @payment_instrument_type = attributes[:payment_instrument_type]
303
306
  @paypal_details = PayPalDetails.new(@paypal)
304
307
  @paypal_here_details = PayPalHereDetails.new(@paypal_here)
305
- @apple_pay_details = ApplePayDetails.new(@apple_pay)
306
- @google_pay_details = GooglePayDetails.new(@google_pay_card)
308
+ @samsung_pay_card_details = SamsungPayCardDetails.new(attributes[:samsung_pay_card])
309
+ @sca_exemption_requested = attributes[:sca_exemption_requested]
310
+ @service_fee_amount = Util.to_big_decimal(service_fee_amount)
311
+ @shipping_details = AddressDetails.new(@shipping)
312
+ @status_history = attributes[:status_history] ? attributes[:status_history].map { |s| StatusDetails.new(s) } : []
313
+ @subscription_details = SubscriptionDetails.new(@subscription)
314
+ @tax_amount = Util.to_big_decimal(tax_amount)
307
315
  @venmo_account_details = VenmoAccountDetails.new(@venmo_account)
308
- disputes.map! { |attrs| Dispute._new(attrs) } if disputes
309
- @custom_fields = attributes[:custom_fields].is_a?(Hash) ? attributes[:custom_fields] : {}
310
- add_ons.map! { |attrs| AddOn._new(attrs) } if add_ons
311
- discounts.map! { |attrs| Discount._new(attrs) } if discounts
312
- @payment_instrument_type = attributes[:payment_instrument_type]
313
- @risk_data = RiskData.new(attributes[:risk_data]) if attributes[:risk_data]
316
+ @visa_checkout_card_details = VisaCheckoutCardDetails.new(attributes[:visa_checkout_card])
317
+
314
318
  @facilitated_details = FacilitatedDetails.new(attributes[:facilitated_details]) if attributes[:facilitated_details]
315
319
  @facilitator_details = FacilitatorDetails.new(attributes[:facilitator_details]) if attributes[:facilitator_details]
320
+ @risk_data = RiskData.new(attributes[:risk_data]) if attributes[:risk_data]
316
321
  @three_d_secure_info = ThreeDSecureInfo.new(attributes[:three_d_secure_info]) if attributes[:three_d_secure_info]
317
322
  @us_bank_account_details = UsBankAccountDetails.new(attributes[:us_bank_account]) if attributes[:us_bank_account]
318
- @visa_checkout_card_details = VisaCheckoutCardDetails.new(attributes[:visa_checkout_card])
319
- @samsung_pay_card_details = SamsungPayCardDetails.new(attributes[:samsung_pay_card])
320
- @sca_exemption_requested = attributes[:sca_exemption_requested]
321
- authorization_adjustments.map! { |attrs| AuthorizationAdjustment._new(attrs) } if authorization_adjustments
322
323
 
324
+ add_ons.map! { |attrs| AddOn._new(attrs) } if add_ons
325
+ authorization_adjustments.map! { |attrs| AuthorizationAdjustment._new(attrs) } if authorization_adjustments
326
+ discounts.map! { |attrs| Discount._new(attrs) } if discounts
327
+ disputes.map! { |attrs| Dispute._new(attrs) } if disputes
323
328
  installments.map! { |attrs| Installment.new(attrs) } if installments
324
329
  refunded_installments.map! { |attrs| Installment.new(attrs) } if refunded_installments
325
330
  end
@@ -61,12 +61,13 @@ module Braintree
61
61
  multiple_value_field :source
62
62
  multiple_value_field :type, :allows => Transaction::Type::All
63
63
  multiple_value_field :store_ids
64
+ multiple_value_field :reason_code
64
65
 
65
66
  key_value_fields :refund
66
67
 
67
68
  range_fields :amount, :created_at, :authorization_expired_at, :authorized_at,
68
69
  :failed_at, :gateway_rejected_at, :processor_declined_at,
69
70
  :settled_at, :submitted_for_settlement_at, :voided_at,
70
- :disbursement_date, :dispute_date
71
+ :disbursement_date, :dispute_date, :ach_return_responses_created_at
71
72
  end
72
73
  end
@@ -0,0 +1,23 @@
1
+ module Braintree
2
+ class VenmoProfileData
3
+ include BaseModule
4
+
5
+ attr_reader :username
6
+ attr_reader :first_name
7
+ attr_reader :last_name
8
+ attr_reader :phone_number
9
+ attr_reader :email
10
+
11
+ def initialize(attributes) # :nodoc:
12
+ set_instance_variables_from_hash(attributes)
13
+ end
14
+
15
+ class << self
16
+ protected :new
17
+ end
18
+
19
+ def self._new(*args) # :nodoc:
20
+ self.new(*args)
21
+ end
22
+ end
23
+ end
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 4
4
- Minor = 5
4
+ Minor = 8
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -38,6 +38,8 @@ module Braintree
38
38
  PartnerMerchantDisconnected = "partner_merchant_disconnected"
39
39
  PartnerMerchantDeclined = "partner_merchant_declined"
40
40
 
41
+ PaymentMethodCustomerDataUpdated = "payment_method_customer_data_updated"
42
+
41
43
  PaymentMethodRevokedByCustomer = "payment_method_revoked_by_customer"
42
44
 
43
45
  RecipientUpdatedGrantedPaymentMethod = "recipient_updated_granted_payment_method"
@@ -73,6 +75,7 @@ module Braintree
73
75
  attr_reader :local_payment_reversed
74
76
  attr_reader :oauth_access_revocation
75
77
  attr_reader :partner_merchant
78
+ attr_reader :payment_method_customer_data_updated_metadata
76
79
  attr_reader :source_merchant_id
77
80
  attr_reader :subscription
78
81
  attr_reader :timestamp
@@ -108,6 +111,8 @@ module Braintree
108
111
  @local_payment_expired = LocalPaymentExpired._new(@subject[:local_payment_expired]) if @subject.has_key?(:local_payment_expired) && Kind::LocalPaymentExpired == @kind
109
112
  @local_payment_funded = LocalPaymentFunded._new(@subject[:local_payment_funded]) if @subject.has_key?(:local_payment_funded) && Kind::LocalPaymentFunded == @kind
110
113
  @local_payment_reversed = LocalPaymentReversed._new(@subject[:local_payment_reversed]) if @subject.has_key?(:local_payment_reversed) && Kind::LocalPaymentReversed == @kind
114
+ @payment_method_customer_data_updated_metadata = PaymentMethodCustomerDataUpdatedMetadata._new(gateway, @subject[:payment_method_customer_data_updated_metadata]) if @subject.has_key?(:payment_method_customer_data_updated_metadata) && Kind::PaymentMethodCustomerDataUpdated == @kind
115
+
111
116
  end
112
117
 
113
118
  def merchant_account
@@ -96,6 +96,8 @@ module Braintree
96
96
  _local_payment_funded_sample_xml(id)
97
97
  when Braintree::WebhookNotification::Kind::LocalPaymentReversed
98
98
  _local_payment_reversed_sample_xml
99
+ when Braintree::WebhookNotification::Kind::PaymentMethodCustomerDataUpdated
100
+ _payment_method_customer_data_updated_sample_xml(id)
99
101
  else
100
102
  _subscription_sample_xml(id)
101
103
  end
@@ -899,21 +901,7 @@ module Braintree
899
901
  end
900
902
 
901
903
  def _granted_payment_method_revoked_xml(id)
902
- <<-XML
903
- <venmo-account>
904
- <created-at type='dateTime'>2018-10-11T21:28:37Z</created-at>
905
- <updated-at type='dateTime'>2018-10-11T21:28:37Z</updated-at>
906
- <default type='boolean'>true</default>
907
- <image-url>https://assets.braintreegateway.com/payment_method_logo/venmo.png?environment=test</image-url>
908
- <token>#{id}</token>
909
- <source-description>Venmo Account: venmojoe</source-description>
910
- <username>venmojoe</username>
911
- <venmo-user-id>456</venmo-user-id>
912
- <subscriptions type='array'/>
913
- <customer-id>venmo_customer_id</customer-id>
914
- <global-id>cGF5bWVudG1ldGhvZF92ZW5tb2FjY291bnQ</global-id>
915
- </venmo-account>
916
- XML
904
+ _venmo_account_xml(id)
917
905
  end
918
906
 
919
907
  def _payment_method_revoked_by_customer_sample_xml(id)
@@ -986,5 +974,47 @@ module Braintree
986
974
  </local-payment-reversed>
987
975
  XML
988
976
  end
977
+
978
+ def _payment_method_customer_data_updated_sample_xml(id)
979
+ <<-XML
980
+ <payment-method-customer-data-updated-metadata>
981
+ <token>TOKEN-12345</token>
982
+ <payment-method>
983
+ #{_venmo_account_xml(id)}
984
+ </payment-method>
985
+ <datetime-updated type='dateTime'>2022-01-01T21:28:37Z</datetime-updated>
986
+ <enriched-customer-data>
987
+ <fields-updated type='array'>
988
+ <item>username</item>
989
+ </fields-updated>
990
+ <profile-data>
991
+ <username>venmo_username</username>
992
+ <first-name>John</first-name>
993
+ <last-name>Doe</last-name>
994
+ <phone-number>1231231234</phone-number>
995
+ <email>john.doe@paypal.com</email>
996
+ </profile-data>
997
+ </enriched-customer-data>
998
+ </payment-method-customer-data-updated-metadata>
999
+ XML
1000
+ end
1001
+
1002
+ def _venmo_account_xml(id)
1003
+ <<-XML
1004
+ <venmo-account>
1005
+ <created-at type='dateTime'>2018-10-11T21:28:37Z</created-at>
1006
+ <updated-at type='dateTime'>2018-10-11T21:28:37Z</updated-at>
1007
+ <default type='boolean'>true</default>
1008
+ <image-url>https://assets.braintreegateway.com/payment_method_logo/venmo.png?environment=test</image-url>
1009
+ <token>#{id}</token>
1010
+ <source-description>Venmo Account: venmojoe</source-description>
1011
+ <username>venmojoe</username>
1012
+ <venmo-user-id>456</venmo-user-id>
1013
+ <subscriptions type='array'/>
1014
+ <customer-id>venmo_customer_id</customer-id>
1015
+ <global-id>cGF5bWVudG1ldGhvZF92ZW5tb2FjY291bnQ</global-id>
1016
+ </venmo-account>
1017
+ XML
1018
+ end
989
1019
  end
990
1020
  end
data/lib/braintree.rb CHANGED
@@ -65,9 +65,16 @@ require "braintree/dispute/transaction"
65
65
  require "braintree/dispute/transaction_details"
66
66
  require "braintree/document_upload"
67
67
  require "braintree/document_upload_gateway"
68
+ require "braintree/enriched_customer_data"
68
69
  require "braintree/error_codes"
69
70
  require "braintree/error_result"
70
71
  require "braintree/errors"
72
+ require "braintree/exchange_rate"
73
+ require "braintree/exchange_rate_quote"
74
+ require "braintree/exchange_rate_quote_gateway"
75
+ require "braintree/exchange_rate_quote_input"
76
+ require "braintree/exchange_rate_quote_response"
77
+ require "braintree/exchange_rate_quote_request"
71
78
  require "braintree/gateway"
72
79
  require "braintree/graphql_client"
73
80
  require "braintree/google_pay_card"
@@ -88,6 +95,7 @@ require "braintree/oauth_gateway"
88
95
  require "braintree/oauth_credentials"
89
96
  require "braintree/payment_instrument_type"
90
97
  require "braintree/payment_method"
98
+ require "braintree/payment_method_customer_data_updated_metadata"
91
99
  require "braintree/payment_method_gateway"
92
100
  require "braintree/payment_method_nonce"
93
101
  require "braintree/payment_method_nonce_details"
@@ -100,6 +108,7 @@ require "braintree/plan"
100
108
  require "braintree/plan_gateway"
101
109
  require "braintree/processor_response_types"
102
110
  require "braintree/risk_data"
111
+ require "braintree/risk_data/liability_shift"
103
112
  require "braintree/facilitated_details"
104
113
  require "braintree/facilitator_details"
105
114
  require "braintree/three_d_secure_info"
@@ -128,33 +137,34 @@ require "braintree/test/venmo_sdk"
128
137
  require "braintree/test/nonce"
129
138
  require "braintree/test/transaction_amounts"
130
139
  require "braintree/testing_gateway"
131
- require "braintree/transaction"
132
- require "braintree/transaction_line_item"
133
140
  require "braintree/test_transaction"
141
+ require "braintree/transaction"
134
142
  require "braintree/transaction/address_details"
135
143
  require "braintree/transaction/apple_pay_details"
136
144
  require "braintree/transaction/credit_card_details"
137
145
  require "braintree/transaction/customer_details"
138
146
  require "braintree/transaction/disbursement_details"
139
147
  require "braintree/transaction/google_pay_details"
148
+ require "braintree/transaction/installment"
149
+ require "braintree/transaction/installment/adjustment"
140
150
  require "braintree/transaction/paypal_details"
141
151
  require "braintree/transaction/paypal_here_details"
152
+ require "braintree/transaction/samsung_pay_card_details"
153
+ require "braintree/transaction/status_details"
142
154
  require "braintree/transaction/subscription_details"
155
+ require "braintree/transaction/venmo_account_details"
156
+ require "braintree/transaction/visa_checkout_card_details"
143
157
  require "braintree/transaction_gateway"
158
+ require "braintree/transaction_line_item"
144
159
  require "braintree/transaction_line_item_gateway"
145
160
  require "braintree/transaction_search"
146
- require "braintree/transaction/status_details"
147
- require "braintree/transaction/venmo_account_details"
148
- require "braintree/transaction/visa_checkout_card_details"
149
- require "braintree/transaction/samsung_pay_card_details"
150
- require "braintree/transaction/installment"
151
- require "braintree/transaction/installment/adjustment"
152
161
  require "braintree/unknown_payment_method"
153
162
  require "braintree/disbursement"
154
163
  require "braintree/dispute_search"
155
164
  require "braintree/validation_error"
156
165
  require "braintree/validation_error_collection"
157
166
  require "braintree/venmo_account"
167
+ require "braintree/venmo_profile_data"
158
168
  require "braintree/version"
159
169
  require "braintree/visa_checkout_card"
160
170
  require "braintree/samsung_pay_card"