braintree 4.9.0 → 4.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/apple_pay_card.rb +2 -0
  3. data/lib/braintree/credit_card_verification_gateway.rb +18 -5
  4. data/lib/braintree/customer.rb +4 -1
  5. data/lib/braintree/dispute.rb +9 -0
  6. data/lib/braintree/dispute_search.rb +1 -0
  7. data/lib/braintree/error_codes.rb +7 -0
  8. data/lib/braintree/gateway.rb +4 -0
  9. data/lib/braintree/payment_instrument_type.rb +7 -6
  10. data/lib/braintree/payment_method_gateway.rb +2 -0
  11. data/lib/braintree/payment_method_nonce_details.rb +3 -0
  12. data/lib/braintree/payment_method_parser.rb +2 -0
  13. data/lib/braintree/sepa_direct_debit_account.rb +60 -0
  14. data/lib/braintree/sepa_direct_debit_account_gateway.rb +25 -0
  15. data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +28 -0
  16. data/lib/braintree/test/nonce.rb +2 -0
  17. data/lib/braintree/transaction/credit_card_details.rb +4 -0
  18. data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +27 -0
  19. data/lib/braintree/transaction.rb +6 -0
  20. data/lib/braintree/transaction_gateway.rb +1 -1
  21. data/lib/braintree/transaction_search.rb +1 -0
  22. data/lib/braintree/version.rb +1 -1
  23. data/lib/braintree/webhook_notification.rb +1 -0
  24. data/lib/braintree/webhook_testing_gateway.rb +76 -0
  25. data/lib/braintree.rb +4 -0
  26. data/spec/integration/braintree/credit_card_spec.rb +0 -60
  27. data/spec/integration/braintree/credit_card_verification_spec.rb +124 -1
  28. data/spec/integration/braintree/customer_spec.rb +1 -32
  29. data/spec/integration/braintree/dispute_search_spec.rb +28 -19
  30. data/spec/integration/braintree/dispute_spec.rb +27 -0
  31. data/spec/integration/braintree/http_spec.rb +1 -1
  32. data/spec/integration/braintree/paypal_account_spec.rb +2 -2
  33. data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +196 -0
  34. data/spec/integration/braintree/subscription_spec.rb +1 -1
  35. data/spec/integration/braintree/transaction_search_spec.rb +34 -2
  36. data/spec/integration/braintree/transaction_spec.rb +107 -101
  37. data/spec/integration/spec_helper.rb +6 -0
  38. data/spec/unit/braintree/apple_pay_card_spec.rb +99 -11
  39. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +51 -0
  40. data/spec/unit/braintree/customer_spec.rb +11 -1
  41. data/spec/unit/braintree/dispute_search_spec.rb +1 -0
  42. data/spec/unit/braintree/dispute_spec.rb +8 -0
  43. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +9 -1
  44. data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +29 -0
  45. data/spec/unit/braintree/sepa_debit_account_spec.rb +86 -0
  46. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +16 -0
  47. data/spec/unit/braintree/transaction/deposit_details_spec.rb +1 -1
  48. data/spec/unit/braintree/transaction/sepa_direct_debit_account_details_spec.rb +33 -0
  49. data/spec/unit/braintree/transaction_gateway_spec.rb +111 -0
  50. data/spec/unit/braintree/transaction_spec.rb +72 -0
  51. data/spec/unit/braintree/webhook_notification_spec.rb +16 -0
  52. metadata +13 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a83d6966dbe837625c68efa0fdee683820705fba7c4c1f65118892d61ea2261b
4
- data.tar.gz: f947bda53f860763dc3c57080ded11b1823e9c48e71efb05a89bb0490e7dad79
3
+ metadata.gz: 2bee761d9c397c8fd16648ea8fbb108ff57e10e821c3867391b9fb39f7f524a4
4
+ data.tar.gz: b638e5e4b14ddde9ed7034f7909b0b6c4ab3fc9332cebe5fffd8a141c2e7ab09
5
5
  SHA512:
6
- metadata.gz: f9a82a773ef66320358e028dbb9a403f6bcc97d7c32d727bff0b00a2936ab54ae8bbfba201024a7e8d5956ef17be0247b61f0e8e3cc23aecb819a5e77d833a9a
7
- data.tar.gz: 21a069ff7615e48429c6882ed354334f37fd7e0600e6696b97b000178a03531955d6156dcd77b3927bc2d35a144ecafa07d65d2b6d9566d5202630bfac62cb37
6
+ metadata.gz: 77c28cf2f97e235be57bca0e0443386c344af4e6c5295b9f9eda7433575a82920b2c5b977138c0b3ebf396101debc76d8a66e358d2119ae9b9c09733a4dfb982
7
+ data.tar.gz: d8e3cf8bad775556b0b3c2d89bb372443144d95086abcc21fa8a57e88b335525ec0181f4d11682bcc13d6e1d099beebbec4f7642b38aba29199c563e300a17af
@@ -10,6 +10,7 @@ module Braintree
10
10
  All = constants.map { |c| const_get(c) }
11
11
  end
12
12
 
13
+ attr_reader :billing_address
13
14
  attr_reader :bin
14
15
  attr_reader :card_type
15
16
  attr_reader :cardholder_name
@@ -39,6 +40,7 @@ module Braintree
39
40
  def initialize(gateway, attributes) # :nodoc:
40
41
  @gateway = gateway
41
42
  set_instance_variables_from_hash(attributes)
43
+ @billing_address = attributes[:billing_address] ? Address._new(@gateway, attributes[:billing_address]) : nil
42
44
  @subscriptions = (@subscriptions || []).map { |subscription_hash| Subscription._new(@gateway, subscription_hash) }
43
45
  end
44
46
 
@@ -46,11 +46,24 @@ module Braintree
46
46
 
47
47
  def self._create_signature
48
48
  [
49
- {:options => [:amount, :merchant_account_id, :account_type]},
50
- {:credit_card => [
51
- :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year,
52
- :number, {:billing_address => AddressGateway._shared_signature}
53
- ]}
49
+ {:credit_card => [
50
+ :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year,
51
+ :number, {:billing_address => AddressGateway._shared_signature}
52
+ ]},
53
+ :intended_transaction_source,
54
+ {:options => [:amount, :merchant_account_id, :account_type]},
55
+ :payment_method_nonce,
56
+ :three_d_secure_authentication_id,
57
+ {:three_d_secure_pass_thru => [
58
+ :eci_flag,
59
+ :cavv,
60
+ :xid,
61
+ :three_d_secure_version,
62
+ :authentication_response,
63
+ :directory_response,
64
+ :cavv_algorithm,
65
+ :ds_transaction_id,
66
+ ]},
54
67
  ]
55
68
  end
56
69
  end
@@ -19,6 +19,7 @@ module Braintree
19
19
  attr_reader :paypal_accounts
20
20
  attr_reader :phone
21
21
  attr_reader :samsung_pay_cards
22
+ attr_reader :sepa_direct_debit_accounts
22
23
  attr_reader :tax_identifiers
23
24
  attr_reader :updated_at
24
25
  attr_reader :us_bank_accounts
@@ -89,6 +90,7 @@ module Braintree
89
90
  @venmo_accounts = (@venmo_accounts || []).map { |pm| VenmoAccount._new gateway, pm }
90
91
  @us_bank_accounts = (@us_bank_accounts || []).map { |pm| UsBankAccount._new gateway, pm }
91
92
  @visa_checkout_cards = (@visa_checkout_cards|| []).map { |pm| VisaCheckoutCard._new gateway, pm }
93
+ @sepa_direct_debit_accounts = (@sepa_debit_accounts || []).map { |pm| SepaDirectDebitAccount._new gateway, pm }
92
94
  @samsung_pay_cards = (@samsung_pay_cards|| []).map { |pm| SamsungPayCard._new gateway, pm }
93
95
  @addresses = (@addresses || []).map { |addr| Address._new gateway, addr }
94
96
  @tax_identifiers = (@tax_identifiers || []).map { |addr| TaxIdentifier._new gateway, addr }
@@ -121,7 +123,8 @@ module Braintree
121
123
  @venmo_accounts +
122
124
  @us_bank_accounts +
123
125
  @visa_checkout_cards +
124
- @samsung_pay_cards
126
+ @samsung_pay_cards +
127
+ @sepa_direct_debit_accounts
125
128
  end
126
129
 
127
130
  def inspect # :nodoc:
@@ -21,6 +21,7 @@ module Braintree
21
21
  attr_reader :merchant_account_id
22
22
  attr_reader :original_dispute_id
23
23
  attr_reader :paypal_messages
24
+ attr_reader :pre_dispute_program
24
25
  attr_reader :processor_comments
25
26
  attr_reader :protection_level
26
27
  attr_reader :reason
@@ -37,6 +38,7 @@ module Braintree
37
38
 
38
39
  module Status
39
40
  Accepted = "accepted"
41
+ AutoAccepted = "auto_accepted"
40
42
  Disputed = "disputed"
41
43
  Expired = "expired"
42
44
  Open = "open"
@@ -86,6 +88,13 @@ module Braintree
86
88
  All = constants.map { |c| const_get(c) }
87
89
  end
88
90
 
91
+ module PreDisputeProgram
92
+ None = "none"
93
+ VisaRdr = "visa_rdr"
94
+
95
+ All = constants.map { |c| const_get(c) }
96
+ end
97
+
89
98
  class << self
90
99
  protected :new
91
100
  def _new(*args) # :nodoc:
@@ -13,6 +13,7 @@ module Braintree
13
13
  multiple_value_field :protection_level, :allows => Dispute::ProtectionLevel::All
14
14
  multiple_value_field :kind, :allows => Dispute::Kind::All
15
15
  multiple_value_field :merchant_account_id
16
+ multiple_value_field :pre_dispute_program, :allows => Dispute::PreDisputeProgram::All
16
17
  multiple_value_field :reason, :allows => Dispute::Reason::All
17
18
  multiple_value_field :reason_code
18
19
  multiple_value_field :status, :allows => Dispute::Status::All
@@ -83,6 +83,7 @@ module Braintree
83
83
  ExpirationYearIsInvalid = "81713"
84
84
  InvalidParamsForCreditCardUpdate = "91745"
85
85
  InvalidVenmoSDKPaymentMethodCode = "91727"
86
+ NetworkTokenizationAttributeCryptogramIsRequired = "81762"
86
87
  NumberIsInvalid = "81715"
87
88
  NumberIsProhibited = "81750"
88
89
  NumberIsRequired = "81714"
@@ -203,6 +204,12 @@ module Braintree
203
204
  TokenIsInUse = "92906"
204
205
  end
205
206
 
207
+ module SepaDirectDebitAccount
208
+ SepaDebitAccountPaymentMethodMandateTypeIsNotSupported = "87115"
209
+ SepaDebitAccountPaymentMethodCustomerIdIsInvalid = "87116"
210
+ SepaDebitAccountPaymentMethodCustomerIdIsRequired = "87117"
211
+ end
212
+
206
213
  module Subscription
207
214
  BillingDayOfMonthCannotBeUpdated = "91918"
208
215
  BillingDayOfMonthIsInvalid = "91914"
@@ -78,6 +78,10 @@ module Braintree
78
78
  UsBankAccountGateway.new(self)
79
79
  end
80
80
 
81
+ def sepa_direct_debit_account
82
+ SepaDirectDebitAccountGateway.new(self)
83
+ end
84
+
81
85
  def merchant
82
86
  MerchantGateway.new(self)
83
87
  end
@@ -1,14 +1,15 @@
1
1
  module Braintree
2
2
  module PaymentInstrumentType
3
- PayPalAccount = "paypal_account"
4
- CreditCard = "credit_card"
5
3
  ApplePayCard = "apple_pay_card"
4
+ CreditCard = "credit_card"
6
5
  GooglePayCard = "android_pay_card"
7
- VenmoAccount = "venmo_account"
8
- UsBankAccount = "us_bank_account"
9
- VisaCheckoutCard = "visa_checkout_card"
10
- SamsungPayCard = "samsung_pay_card"
11
6
  LocalPayment = "local_payment"
7
+ PayPalAccount = "paypal_account"
12
8
  PayPalHere = "paypal_here"
9
+ SamsungPayCard = "samsung_pay_card"
10
+ SepaDirectDebitAccount = "sepa_debit_account"
11
+ UsBankAccount = "us_bank_account"
12
+ VenmoAccount = "venmo_account"
13
+ VisaCheckoutCard = "visa_checkout_card"
13
14
  end
14
15
  end
@@ -50,6 +50,8 @@ module Braintree
50
50
  GooglePayCard._new(@gateway, response[:android_pay_card])
51
51
  elsif response.has_key?(:venmo_account)
52
52
  VenmoAccount._new(@gateway, response[:venmo_account])
53
+ elsif response.has_key?(:sepa_debit_account)
54
+ SepaDirectDebitAccount._new(@gateway, response[:sepa_debit_account])
53
55
  else
54
56
  UnknownPaymentMethod._new(@gateway, response)
55
57
  end
@@ -9,12 +9,14 @@ module Braintree
9
9
  attr_reader :is_network_tokenized
10
10
  attr_reader :last_two
11
11
  attr_reader :payer_info
12
+ attr_reader :sepa_direct_debit_account_nonce_details
12
13
 
13
14
  alias_method :is_network_tokenized?, :is_network_tokenized
14
15
 
15
16
  def initialize(attributes)
16
17
  set_instance_variables_from_hash attributes unless attributes.nil?
17
18
  @payer_info = PaymentMethodNonceDetailsPayerInfo.new(attributes[:payer_info]) if attributes[:payer_info]
19
+ @sepa_direct_debit_account_nonce_details = ::Braintree::SepaDirectDebitAccountNonceDetails.new(attributes)
18
20
  end
19
21
 
20
22
  def inspect
@@ -26,6 +28,7 @@ module Braintree
26
28
  :is_network_tokenized,
27
29
  :last_two,
28
30
  :payer_info,
31
+ :sepa_direct_debit_account_nonce_details,
29
32
  ]
30
33
 
31
34
  formatted_attrs = attr_order.map do |attr|
@@ -18,6 +18,8 @@ module Braintree
18
18
  VisaCheckoutCard._new(gateway, attributes[:visa_checkout_card])
19
19
  elsif attributes[:samsung_pay_card]
20
20
  SamsungPayCard._new(gateway, attributes[:samsung_pay_card])
21
+ elsif attributes[:sepa_debit_account]
22
+ SepaDirectDebitAccount._new(gateway, attributes[:sepa_debit_account])
21
23
  else
22
24
  UnknownPaymentMethod._new(gateway, attributes)
23
25
  end
@@ -0,0 +1,60 @@
1
+ module Braintree
2
+ class SepaDirectDebitAccount
3
+ include BaseModule
4
+
5
+ attr_reader :bank_reference_token
6
+ attr_reader :created_at
7
+ attr_reader :customer_id
8
+ attr_reader :customer_global_id
9
+ attr_reader :default
10
+ attr_reader :global_id
11
+ attr_reader :image_url
12
+ attr_reader :last_4
13
+ attr_reader :mandate_type
14
+ attr_reader :merchant_or_partner_customer_id
15
+ attr_reader :subscriptions
16
+ attr_reader :token
17
+ attr_reader :updated_at
18
+ attr_reader :view_mandate_url
19
+
20
+ def initialize(gateway, attributes) # :nodoc:
21
+ @gateway = gateway
22
+ @subscriptions = (@subscriptions || []).map { |subscription_hash| Subscription._new(@gateway, subscription_hash) }
23
+ set_instance_variables_from_hash(attributes)
24
+ end
25
+
26
+ def default?
27
+ @default
28
+ end
29
+
30
+ class << self
31
+ protected :new
32
+ end
33
+
34
+ def self._new(*args) # :nodoc:
35
+ self.new(*args)
36
+ end
37
+
38
+ def self.find(*args)
39
+ Configuration.gateway.sepa_direct_debit_account.find(*args)
40
+ end
41
+
42
+ def self.delete(*args)
43
+ Configuration.gateway.sepa_direct_debit_account.delete(*args)
44
+ end
45
+
46
+ def self.sale(token, transaction_attributes)
47
+ options = transaction_attributes[:options] || {}
48
+ Configuration.gateway.transaction.sale(
49
+ transaction_attributes.merge(
50
+ :payment_method_token => token,
51
+ :options => options.merge(:submit_for_settlement => true),
52
+ ),
53
+ )
54
+ end
55
+
56
+ def self.sale!(token, transaction_attributes)
57
+ return_object_or_raise(:transaction) { sale(token, transaction_attributes) }
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,25 @@
1
+ module Braintree
2
+ class SepaDirectDebitAccountGateway
3
+ def initialize(gateway)
4
+ @gateway = gateway
5
+ @config = gateway.config
6
+ @config.assert_has_access_token_or_keys
7
+ end
8
+
9
+ def find(token)
10
+ raise ArgumentError if token.nil? || token.to_s.strip == ""
11
+ response = @config.http.get("#{@config.base_merchant_path}/payment_methods/sepa_debit_account/#{token}")
12
+ SepaDirectDebitAccount._new(@gateway, response[:sepa_debit_account])
13
+ rescue NotFoundError
14
+ raise NotFoundError, "sepa direct debit account with token #{token.inspect} not found"
15
+ end
16
+
17
+ def delete(token)
18
+ raise ArgumentError if token.nil? || token.to_s.strip == ""
19
+ @config.http.delete("#{@config.base_merchant_path}/payment_methods/sepa_debit_account/#{token}")
20
+ SuccessfulResult.new
21
+ rescue NotFoundError
22
+ raise NotFoundError, "sepa direct debit account with token #{token.inspect} not found"
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,28 @@
1
+ module Braintree
2
+ class SepaDirectDebitAccountNonceDetails# :nodoc:
3
+ include BaseModule
4
+
5
+ attr_reader :bank_reference_token
6
+ attr_reader :last_4
7
+ attr_reader :mandate_type
8
+ attr_reader :merchant_or_partner_customer_id
9
+
10
+ def initialize(attributes)
11
+ set_instance_variables_from_hash attributes unless attributes.nil?
12
+ end
13
+
14
+ def inspect
15
+ attr_order = [
16
+ :bank_reference_token,
17
+ :last_4,
18
+ :mandate_type,
19
+ :merchant_or_partner_customer_id,
20
+ ]
21
+
22
+ formatted_attrs = attr_order.map do |attr|
23
+ "#{attr}: #{send(attr).inspect}"
24
+ end
25
+ "#<SepaDirectDebitAccountNonceDetails#{formatted_attrs.join(", ")}>"
26
+ end
27
+ end
28
+ end
@@ -4,6 +4,7 @@ module Braintree
4
4
  Transactable = "fake-valid-nonce"
5
5
  Consumed = "fake-consumed-nonce"
6
6
  PayPalOneTimePayment = "fake-paypal-one-time-nonce"
7
+ #NEXT_MAJOR_VERSION - no longer supported in the Gateway, remove this constant
7
8
  PayPalFuturePayment = "fake-paypal-future-nonce"
8
9
  PayPalBillingAgreement = "fake-paypal-billing-agreement-nonce"
9
10
  LocalPayment = "fake-local-payment-method-nonce"
@@ -68,6 +69,7 @@ module Braintree
68
69
  SamsungPayDiscover = "tokensam_fake_discover"
69
70
  SamsungPayMasterCard = "tokensam_fake_mastercard"
70
71
  SamsungPayVisa = "tokensam_fake_visa"
72
+ SepaDirectDebit = "fake-sepa-direct-debit-nonce"
71
73
  end
72
74
  end
73
75
  end
@@ -67,6 +67,10 @@ module Braintree
67
67
  def venmo_sdk?
68
68
  @venmo_sdk
69
69
  end
70
+
71
+ def is_network_tokenized?
72
+ @is_network_tokenized
73
+ end
70
74
  end
71
75
  end
72
76
  end
@@ -0,0 +1,27 @@
1
+ module Braintree
2
+ class Transaction
3
+ class SepaDirectDebitAccountDetails # :nodoc:
4
+ include BaseModule
5
+
6
+ attr_reader :bank_reference_token
7
+ attr_reader :capture_id
8
+ attr_reader :debug_id
9
+ attr_reader :global_id
10
+ attr_reader :last_4
11
+ attr_reader :mandate_type
12
+ attr_reader :merchant_or_partner_customer_id
13
+ attr_reader :paypal_v2_order_id
14
+ attr_reader :refund_from_transaction_fee_amount
15
+ attr_reader :refund_from_transaction_fee_currency_iso_code
16
+ attr_reader :refund_id
17
+ attr_reader :settlement_type
18
+ attr_reader :token
19
+ attr_reader :transaction_fee_amount
20
+ attr_reader :transaction_fee_currency_iso_code
21
+
22
+ def initialize(attributes)
23
+ set_instance_variables_from_hash attributes unless attributes.nil?
24
+ end
25
+ end
26
+ end
27
+ end
@@ -24,6 +24,7 @@ module Braintree
24
24
  AVSAndCVV = "avs_and_cvv"
25
25
  CVV = "cvv"
26
26
  Duplicate = "duplicate"
27
+ ExcessiveRetry = "excessive_retry"
27
28
  Fraud = "fraud"
28
29
  RiskThreshold = "risk_threshold"
29
30
  ThreeDSecure = "three_d_secure"
@@ -128,6 +129,7 @@ module Braintree
128
129
  attr_reader :merchant_account_id
129
130
  attr_reader :network_response_code # Response code from the card network
130
131
  attr_reader :network_response_text # Response text from the card network
132
+ attr_reader :network_token_details
131
133
  attr_reader :network_transaction_id
132
134
  attr_reader :order_id
133
135
  attr_reader :partial_settlement_transaction_ids
@@ -153,6 +155,8 @@ module Braintree
153
155
  attr_reader :samsung_pay_card_details
154
156
  attr_reader :sca_exemption_requested
155
157
  attr_reader :service_fee_amount
158
+ attr_reader :sepa_direct_debit_account_details
159
+ attr_reader :sepa_direct_debit_return_code
156
160
  attr_reader :settlement_batch_id
157
161
  attr_reader :shipping_amount
158
162
  attr_reader :shipping_details
@@ -296,6 +300,7 @@ module Braintree
296
300
  @apple_pay_details = ApplePayDetails.new(@apple_pay)
297
301
  @billing_details = AddressDetails.new(@billing)
298
302
  @credit_card_details = CreditCardDetails.new(@credit_card)
303
+ @network_token_details = CreditCardDetails.new(@network_token)
299
304
  @custom_fields = attributes[:custom_fields].is_a?(Hash) ? attributes[:custom_fields] : {}
300
305
  @customer_details = CustomerDetails.new(@customer)
301
306
  @descriptor = Descriptor.new(@descriptor)
@@ -307,6 +312,7 @@ module Braintree
307
312
  @paypal_here_details = PayPalHereDetails.new(@paypal_here)
308
313
  @samsung_pay_card_details = SamsungPayCardDetails.new(attributes[:samsung_pay_card])
309
314
  @sca_exemption_requested = attributes[:sca_exemption_requested]
315
+ @sepa_direct_debit_account_details = SepaDirectDebitAccountDetails.new(@sepa_debit_account_detail)
310
316
  @service_fee_amount = Util.to_big_decimal(service_fee_amount)
311
317
  @shipping_details = AddressDetails.new(@shipping)
312
318
  @status_history = attributes[:status_history] ? attributes[:status_history].map { |s| StatusDetails.new(s) } : []
@@ -195,7 +195,7 @@ module Braintree
195
195
  :sca_exemption, :currency_iso_code, :exchange_rate_quote_id,
196
196
  {: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]},
197
197
  {:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
198
- {:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number, {:payment_reader_card_details => [:encrypted_card_data, :key_serial_number]}]},
198
+ {:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number, {:payment_reader_card_details => [:encrypted_card_data, :key_serial_number]}, {:network_tokenization_attributes => [:cryptogram, :ecommerce_indicator, :token_requestor_id]}]},
199
199
  {:customer => [:id, :company, :email, :fax, :first_name, :last_name, :phone, :website]},
200
200
  {
201
201
  :billing => AddressGateway._shared_signature
@@ -28,6 +28,7 @@ module Braintree
28
28
  :paypal_authorization_id,
29
29
  :paypal_payer_email,
30
30
  :processor_authorization_code,
31
+ :sepa_debit_paypal_v2_order_id,
31
32
  :settlement_batch_id,
32
33
  :shipping_company,
33
34
  :shipping_country_name,
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 4
4
- Minor = 9
4
+ Minor = 11
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -19,6 +19,7 @@ module Braintree
19
19
  DisputeLost = "dispute_lost"
20
20
  DisputeWon = "dispute_won"
21
21
  DisputeAccepted = "dispute_accepted"
22
+ DisputeAutoAccepted = "dispute_auto_accepted"
22
23
  DisputeDisputed = "dispute_disputed"
23
24
  DisputeExpired = "dispute_expired"
24
25
 
@@ -42,6 +42,8 @@ module Braintree
42
42
  _dispute_won_sample_xml(id)
43
43
  when Braintree::WebhookNotification::Kind::DisputeAccepted
44
44
  _dispute_accepted_sample_xml(id)
45
+ when Braintree::WebhookNotification::Kind::DisputeAutoAccepted
46
+ _dispute_auto_accepted_sample_xml(id)
45
47
  when Braintree::WebhookNotification::Kind::DisputeDisputed
46
48
  _dispute_disputed_sample_xml(id)
47
49
  when Braintree::WebhookNotification::Kind::DisputeExpired
@@ -337,6 +339,14 @@ module Braintree
337
339
  end
338
340
  end
339
341
 
342
+ def _dispute_auto_accepted_sample_xml(id)
343
+ if id == "legacy_dispute_id"
344
+ _old_dispute_auto_accepted_sample_xml(id)
345
+ else
346
+ _new_dispute_auto_accepted_sample_xml(id)
347
+ end
348
+ end
349
+
340
350
  def _dispute_disputed_sample_xml(id)
341
351
  if id == "legacy_dispute_id"
342
352
  _old_dispute_disputed_sample_xml(id)
@@ -434,6 +444,26 @@ module Braintree
434
444
  XML
435
445
  end
436
446
 
447
+ def _old_dispute_auto_accepted_sample_xml(id)
448
+ <<-XML
449
+ <dispute>
450
+ <amount>100.00</amount>
451
+ <currency-iso-code>USD</currency-iso-code>
452
+ <received-date type="date">2014-03-01</received-date>
453
+ <reply-by-date type="date">2014-03-21</reply-by-date>
454
+ <kind>chargeback</kind>
455
+ <status>auto_accepted</status>
456
+ <reason>fraud</reason>
457
+ <id>#{id}</id>
458
+ <transaction>
459
+ <id>#{id}</id>
460
+ <amount>100.00</amount>
461
+ </transaction>
462
+ <date-opened type=\"date\">2014-03-21</date-opened>
463
+ </dispute>
464
+ XML
465
+ end
466
+
437
467
  def _old_dispute_disputed_sample_xml(id)
438
468
  <<-XML
439
469
  <dispute>
@@ -685,6 +715,52 @@ module Braintree
685
715
  XML
686
716
  end
687
717
 
718
+ def _new_dispute_auto_accepted_sample_xml(id)
719
+ <<-XML
720
+ <dispute>
721
+ <id>#{id}</id>
722
+ <amount>100.00</amount>
723
+ <amount-disputed>100.00</amount-disputed>
724
+ <amount-won>95.00</amount-won>
725
+ <case-number>CASE-12345</case-number>
726
+ <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
727
+ <currency-iso-code>USD</currency-iso-code>
728
+ <forwarded-comments nil="true"/>
729
+ <kind>chargeback</kind>
730
+ <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
731
+ <reason>fraud</reason>
732
+ <reason-code nil="true"/>
733
+ <reason-description nil="true"/>
734
+ <received-date type="date">2016-02-15</received-date>
735
+ <reference-number>REF-9876</reference-number>
736
+ <reply-by-date type="date">2016-02-22</reply-by-date>
737
+ <status>auto_accepted</status>
738
+ <updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
739
+ <original-dispute-id>9qde5qgp</original-dispute-id>
740
+ <status-history type="array">
741
+ <status-history>
742
+ <status>open</status>
743
+ <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
744
+ </status-history>
745
+ <status-history>
746
+ <status>auto_accepted</status>
747
+ <timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
748
+ </status-history>
749
+ </status-history>
750
+ <evidence type="array"/>
751
+ <transaction>
752
+ <id>#{id}</id>
753
+ <amount>100.00</amount>
754
+ <created-at>2017-06-21T20:44:41Z</created-at>
755
+ <order-id nil="true"/>
756
+ <purchase-order-number nil="true"/>
757
+ <payment-instrument-subtype>Visa</payment-instrument-subtype>
758
+ </transaction>
759
+ <date-opened type=\"date\">2014-03-21</date-opened>
760
+ </dispute>
761
+ XML
762
+ end
763
+
688
764
  def _new_dispute_disputed_sample_xml(id)
689
765
  <<-XML
690
766
  <dispute>
data/lib/braintree.rb CHANGED
@@ -124,6 +124,9 @@ require "braintree/us_bank_account_verification_gateway"
124
124
  require "braintree/us_bank_account_verification_search"
125
125
  require "braintree/us_bank_account_gateway"
126
126
  require "braintree/transaction/us_bank_account_details"
127
+ require "braintree/sepa_direct_debit_account"
128
+ require "braintree/sepa_direct_debit_account_gateway"
129
+ require "braintree/sepa_direct_debit_account_nonce_details"
127
130
  require "braintree/sha256_digest"
128
131
  require "braintree/signature_service"
129
132
  require "braintree/subscription"
@@ -150,6 +153,7 @@ require "braintree/transaction/installment/adjustment"
150
153
  require "braintree/transaction/paypal_details"
151
154
  require "braintree/transaction/paypal_here_details"
152
155
  require "braintree/transaction/samsung_pay_card_details"
156
+ require "braintree/transaction/sepa_direct_debit_account_details"
153
157
  require "braintree/transaction/status_details"
154
158
  require "braintree/transaction/subscription_details"
155
159
  require "braintree/transaction/venmo_account_details"
@@ -576,66 +576,6 @@ describe Braintree::CreditCard do
576
576
  end
577
577
  end
578
578
 
579
- context "venmo_sdk" do
580
- describe "venmo_sdk_payment_method_code" do
581
- it "can pass a venmo sdk payment method code" do
582
- customer = Braintree::Customer.create!
583
- result = Braintree::CreditCard.create(
584
- :customer_id => customer.id,
585
- :venmo_sdk_payment_method_code => Braintree::Test::VenmoSDK::VisaPaymentMethodCode,
586
- )
587
- result.success?.should == true
588
- result.credit_card.venmo_sdk?.should == false
589
- result.credit_card.bin.should == "400934"
590
- result.credit_card.last_4.should == "1881"
591
- end
592
-
593
- it "success? returns false when given an invalid venmo sdk payment method code" do
594
- customer = Braintree::Customer.create!
595
- result = Braintree::CreditCard.create(
596
- :customer_id => customer.id,
597
- :venmo_sdk_payment_method_code => Braintree::Test::VenmoSDK::InvalidPaymentMethodCode,
598
- )
599
-
600
- result.success?.should == false
601
- result.message.should == "Invalid VenmoSDK payment method code"
602
- result.errors.first.code.should == "91727"
603
- end
604
- end
605
-
606
- describe "venmo_sdk_session" do
607
- it "venmo_sdk? returns true when given a valid session" do
608
- customer = Braintree::Customer.create!
609
- result = Braintree::CreditCard.create(
610
- :customer_id => customer.id,
611
- :number => Braintree::Test::CreditCardNumbers::Visa,
612
- :expiration_date => "05/2009",
613
- :cvv => "100",
614
- :options => {
615
- :venmo_sdk_session => Braintree::Test::VenmoSDK::Session
616
- },
617
- )
618
- result.success?.should == true
619
- result.credit_card.venmo_sdk?.should == false
620
- end
621
-
622
- it "venmo_sdk? returns false when given an invalid session" do
623
- customer = Braintree::Customer.create!
624
- result = Braintree::CreditCard.create(
625
- :customer_id => customer.id,
626
- :number => Braintree::Test::CreditCardNumbers::Visa,
627
- :expiration_date => "05/2009",
628
- :cvv => "100",
629
- :options => {
630
- :venmo_sdk_session => Braintree::Test::VenmoSDK::InvalidSession
631
- },
632
- )
633
- result.success?.should == true
634
- result.credit_card.venmo_sdk?.should == false
635
- end
636
- end
637
- end
638
-
639
579
  context "client API" do
640
580
  it "adds credit card to an existing customer using a payment method nonce" do
641
581
  nonce = nonce_for_new_payment_method(