braintree 3.2.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/braintree.gemspec +3 -3
  3. data/lib/braintree.rb +6 -1
  4. data/lib/braintree/account_updater_daily_report.rb +1 -1
  5. data/lib/braintree/address.rb +2 -1
  6. data/lib/braintree/apple_pay.rb +1 -1
  7. data/lib/braintree/apple_pay_card.rb +1 -1
  8. data/lib/braintree/apple_pay_options.rb +1 -1
  9. data/lib/braintree/authorization_adjustment.rb +1 -1
  10. data/lib/braintree/client_token.rb +1 -1
  11. data/lib/braintree/configuration.rb +11 -11
  12. data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
  13. data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
  14. data/lib/braintree/credit_card.rb +2 -2
  15. data/lib/braintree/credit_card_gateway.rb +14 -4
  16. data/lib/braintree/credit_card_verification.rb +5 -5
  17. data/lib/braintree/credit_card_verification_search.rb +1 -1
  18. data/lib/braintree/customer.rb +6 -4
  19. data/lib/braintree/customer_gateway.rb +2 -0
  20. data/lib/braintree/customer_search.rb +1 -1
  21. data/lib/braintree/disbursement.rb +1 -1
  22. data/lib/braintree/dispute.rb +15 -1
  23. data/lib/braintree/dispute/paypal_message.rb +15 -0
  24. data/lib/braintree/dispute_gateway.rb +2 -2
  25. data/lib/braintree/dispute_search.rb +3 -2
  26. data/lib/braintree/document_upload.rb +1 -1
  27. data/lib/braintree/error_codes.rb +10 -6
  28. data/lib/braintree/google_pay_card.rb +1 -1
  29. data/lib/braintree/granted_payment_instrument_update.rb +1 -1
  30. data/lib/braintree/graphql_client.rb +7 -7
  31. data/lib/braintree/http.rb +3 -3
  32. data/lib/braintree/local_payment_completed.rb +1 -1
  33. data/lib/braintree/local_payment_reversed.rb +19 -0
  34. data/lib/braintree/merchant.rb +1 -1
  35. data/lib/braintree/merchant_account.rb +1 -1
  36. data/lib/braintree/merchant_account_gateway.rb +1 -1
  37. data/lib/braintree/merchant_gateway.rb +1 -1
  38. data/lib/braintree/modification.rb +1 -1
  39. data/lib/braintree/oauth_credentials.rb +1 -1
  40. data/lib/braintree/oauth_gateway.rb +5 -5
  41. data/lib/braintree/payment_instrument_type.rb +10 -10
  42. data/lib/braintree/payment_method_gateway.rb +10 -7
  43. data/lib/braintree/payment_method_nonce.rb +7 -4
  44. data/lib/braintree/payment_method_nonce_details.rb +37 -0
  45. data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
  46. data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
  47. data/lib/braintree/plan.rb +1 -1
  48. data/lib/braintree/processor_response_types.rb +3 -3
  49. data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
  50. data/lib/braintree/risk_data.rb +3 -1
  51. data/lib/braintree/samsung_pay_card.rb +1 -1
  52. data/lib/braintree/settlement_batch_summary.rb +2 -2
  53. data/lib/braintree/subscription.rb +6 -6
  54. data/lib/braintree/three_d_secure_info.rb +22 -12
  55. data/lib/braintree/transaction.rb +32 -24
  56. data/lib/braintree/transaction_gateway.rb +24 -5
  57. data/lib/braintree/transaction_line_item.rb +1 -1
  58. data/lib/braintree/transaction_search.rb +3 -1
  59. data/lib/braintree/unknown_payment_method.rb +1 -1
  60. data/lib/braintree/us_bank_account.rb +3 -3
  61. data/lib/braintree/us_bank_account_verification.rb +1 -1
  62. data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
  63. data/lib/braintree/util.rb +4 -4
  64. data/lib/braintree/venmo_account.rb +1 -1
  65. data/lib/braintree/version.rb +1 -1
  66. data/lib/braintree/visa_checkout_card.rb +2 -2
  67. data/lib/braintree/webhook_notification.rb +30 -20
  68. data/lib/braintree/webhook_notification_gateway.rb +5 -5
  69. data/lib/braintree/webhook_testing_gateway.rb +30 -0
  70. data/lib/braintree/xml/generator.rb +5 -4
  71. data/lib/braintree/xml/libxml.rb +0 -1
  72. data/lib/braintree/xml/parser.rb +22 -12
  73. data/lib/braintree/xml/rexml.rb +70 -0
  74. data/spec/integration/braintree/add_on_spec.rb +1 -1
  75. data/spec/integration/braintree/address_spec.rb +28 -24
  76. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  77. data/spec/integration/braintree/apple_pay_spec.rb +3 -3
  78. data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
  79. data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
  80. data/spec/integration/braintree/client_api/spec_helper.rb +5 -5
  81. data/spec/integration/braintree/credit_card_spec.rb +213 -122
  82. data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
  83. data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
  84. data/spec/integration/braintree/customer_search_spec.rb +8 -8
  85. data/spec/integration/braintree/customer_spec.rb +282 -165
  86. data/spec/integration/braintree/dispute_search_spec.rb +28 -3
  87. data/spec/integration/braintree/dispute_spec.rb +6 -6
  88. data/spec/integration/braintree/error_codes_spec.rb +1 -1
  89. data/spec/integration/braintree/http_spec.rb +2 -2
  90. data/spec/integration/braintree/merchant_account_spec.rb +25 -26
  91. data/spec/integration/braintree/merchant_spec.rb +14 -14
  92. data/spec/integration/braintree/oauth_spec.rb +11 -11
  93. data/spec/integration/braintree/payment_method_nonce_spec.rb +28 -35
  94. data/spec/integration/braintree/payment_method_spec.rb +269 -165
  95. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +9 -9
  96. data/spec/integration/braintree/paypal_account_spec.rb +28 -28
  97. data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
  98. data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
  99. data/spec/integration/braintree/subscription_spec.rb +133 -133
  100. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  101. data/spec/integration/braintree/test_transaction_spec.rb +10 -10
  102. data/spec/integration/braintree/transaction_search_spec.rb +93 -67
  103. data/spec/integration/braintree/transaction_spec.rb +574 -360
  104. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +20 -20
  105. data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
  106. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
  107. data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
  108. data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
  109. data/spec/integration/spec_helper.rb +9 -3
  110. data/spec/oauth_test_helper.rb +1 -1
  111. data/spec/script/httpsd.rb +6 -6
  112. data/spec/spec_helper.rb +6 -3
  113. data/spec/unit/braintree/address_spec.rb +1 -1
  114. data/spec/unit/braintree/apple_pay_card_spec.rb +1 -1
  115. data/spec/unit/braintree/client_token_spec.rb +2 -2
  116. data/spec/unit/braintree/configuration_spec.rb +42 -42
  117. data/spec/unit/braintree/credit_card_spec.rb +13 -13
  118. data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
  119. data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
  120. data/spec/unit/braintree/customer_spec.rb +20 -10
  121. data/spec/unit/braintree/disbursement_spec.rb +7 -7
  122. data/spec/unit/braintree/dispute_search_spec.rb +1 -0
  123. data/spec/unit/braintree/dispute_spec.rb +34 -9
  124. data/spec/unit/braintree/error_result_spec.rb +5 -5
  125. data/spec/unit/braintree/errors_spec.rb +8 -8
  126. data/spec/unit/braintree/http_spec.rb +5 -5
  127. data/spec/unit/braintree/merchant_account_spec.rb +1 -1
  128. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
  129. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +43 -0
  130. data/spec/unit/braintree/payment_method_nonce_spec.rb +40 -0
  131. data/spec/unit/braintree/payment_method_spec.rb +1 -1
  132. data/spec/unit/braintree/paypal_account_spec.rb +2 -2
  133. data/spec/unit/braintree/resource_collection_spec.rb +9 -9
  134. data/spec/unit/braintree/risk_data_spec.rb +9 -5
  135. data/spec/unit/braintree/subscription_search_spec.rb +1 -1
  136. data/spec/unit/braintree/successful_result_spec.rb +1 -1
  137. data/spec/unit/braintree/three_d_secure_info_spec.rb +32 -14
  138. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
  139. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  140. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  141. data/spec/unit/braintree/transaction/paypal_details_spec.rb +1 -1
  142. data/spec/unit/braintree/transaction_search_spec.rb +12 -12
  143. data/spec/unit/braintree/transaction_spec.rb +25 -17
  144. data/spec/unit/braintree/util_spec.rb +18 -18
  145. data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
  146. data/spec/unit/braintree/webhook_notification_spec.rb +88 -56
  147. data/spec/unit/braintree/xml/rexml_spec.rb +51 -0
  148. data/spec/unit/braintree/xml_spec.rb +31 -31
  149. metadata +16 -8
  150. data/lib/braintree/settlement_batch.rb +0 -0
@@ -0,0 +1,15 @@
1
+ module Braintree
2
+ class Dispute
3
+ class PayPalMessage # :nodoc:
4
+ include BaseModule
5
+
6
+ attr_reader :message,
7
+ :sender,
8
+ :sent_at
9
+
10
+ def initialize(attributes)
11
+ set_instance_variables_from_hash attributes unless attributes.nil?
12
+ end
13
+ end
14
+ end
15
+ end
@@ -25,7 +25,7 @@ module Braintree
25
25
  raise ArgumentError, "dispute_id cannot be blank" if dispute_id.nil? || dispute_id.to_s.strip == ""
26
26
  raise ArgumentError, "document_id_or_request cannot be blank" if document_id_or_request.nil?
27
27
 
28
- request = document_id_or_request.is_a?(Hash) ? document_id_or_request : { document_id: document_id_or_request }
28
+ request = document_id_or_request.is_a?(Hash) ? document_id_or_request : {document_id: document_id_or_request}
29
29
 
30
30
  raise ArgumentError, "document_id contains invalid characters" unless request[:document_id].to_s =~ /\A[\w-]+\z/
31
31
  raise ArgumentError, "document_id cannot be blank" if request[:document_id].nil? || dispute_id.to_s.strip == ""
@@ -55,7 +55,7 @@ module Braintree
55
55
  raise ArgumentError, "dispute_id cannot be blank" if dispute_id.nil? || dispute_id.to_s.strip == ""
56
56
  raise ArgumentError, "content_or_request cannot be blank" if content_or_request.nil?
57
57
 
58
- request = content_or_request.is_a?(String) ? { content: content_or_request } : content_or_request
58
+ request = content_or_request.is_a?(String) ? {content: content_or_request} : content_or_request
59
59
 
60
60
  raise ArgumentError, "content cannot be blank" if request[:content].nil? || request[:content].to_s.strip == ""
61
61
  raise ArgumentError, "request can only contain the keys [:content, :category, :sequence_number]" if (request.keys - [:category, :content, :sequence_number]).any?
@@ -5,9 +5,10 @@ module Braintree
5
5
  :customer_id,
6
6
  :id,
7
7
  :reference_number,
8
- :transaction_id
8
+ :transaction_id,
9
9
  )
10
10
 
11
+ multiple_value_field :chargeback_protection_level, :allows => Dispute::ChargebackProtectionLevel::All
11
12
  multiple_value_field :kind, :allows => Dispute::Kind::All
12
13
  multiple_value_field :merchant_account_id
13
14
  multiple_value_field :reason, :allows => Dispute::Reason::All
@@ -21,7 +22,7 @@ module Braintree
21
22
  :disbursement_date,
22
23
  :effective_date,
23
24
  :received_date,
24
- :reply_by_date
25
+ :reply_by_date,
25
26
  )
26
27
  end
27
28
  end
@@ -30,7 +30,7 @@ module Braintree
30
30
  class << self
31
31
  protected :new
32
32
  def _new(*args) # :nodoc:
33
- self.new *args
33
+ self.new(*args)
34
34
  end
35
35
  end
36
36
  end
@@ -271,6 +271,7 @@ module Braintree
271
271
  end
272
272
 
273
273
  module Transaction
274
+ AdjustmentAmountMustBeGreaterThanZero = "95605"
274
275
  AmountCannotBeNegative = "81501"
275
276
  AmountDoesNotMatch3DSecureAmount = "91585"
276
277
  AmountFormatIsInvalid = "81503" # Keep for backwards compatibility
@@ -322,6 +323,7 @@ module Braintree
322
323
  MerchantAccountIdDoesNotMatchSubscription = "915180"
323
324
  MerchantAccountIdIsInvalid = "91513"
324
325
  MerchantAccountIsSuspended = "91514"
326
+ NoNetAmountToPerformAuthAdjustment = "95606"
325
327
  OrderIdIsTooLong = "91501"
326
328
  PayPalAuthExpired = "91579"
327
329
  PayPalNotEnabled = "91576"
@@ -343,8 +345,11 @@ module Braintree
343
345
  ProcessorAuthorizationCodeCannotBeSet = "91519"
344
346
  ProcessorAuthorizationCodeIsInvalid = "81520"
345
347
  ProcessorDoesNotSupportAuths = "915104"
348
+ ProcessorDoesNotSupportAuthAdjustment = "915222"
346
349
  ProcessorDoesNotSupportCredits = "91546"
350
+ ProcessorDoesNotSupportIncrementalAuth = "915220"
347
351
  ProcessorDoesNotSupportMotoForCardType = "915195"
352
+ ProcessorDoesNotSupportPartialAuthReversal = "915221"
348
353
  ProcessorDoesNotSupportPartialSettlement = "915102"
349
354
  ProcessorDoesNotSupportUpdatingDescriptor = "915108"
350
355
  ProcessorDoesNotSupportUpdatingOrderId = "915107"
@@ -380,6 +385,7 @@ module Braintree
380
385
  SubscriptionStatusMustBePastDue = "91531"
381
386
  TaxAmountCannotBeNegative = "81534"
382
387
  TaxAmountFormatIsInvalid = "81535"
388
+ TaxAmountIsRequiredForAibSwedish = "815224"
383
389
  TaxAmountIsTooLarge = "81536"
384
390
  ThreeDSecureAuthenticationFailed = "81571"
385
391
  ThreeDSecureAuthenticationIdDoesntMatchNonceThreeDSecureAuthentication = "915198"
@@ -398,6 +404,8 @@ module Braintree
398
404
  ThreeDSecureTransactionPaymentMethodDoesntMatchThreeDSecureAuthenticationPaymentMethod = "915197"
399
405
  ThreeDSecureXidIsRequired = "915115"
400
406
  TooManyLineItems = "915157"
407
+ TransactionIsNotEligibleForAdjustment = "915219"
408
+ TransactionMustBeInStateAuthorized = "915218"
401
409
  TransactionSourceIsInvalid = "915133"
402
410
  TypeIsInvalid = "91523"
403
411
  TypeIsRequired = "91524"
@@ -510,8 +518,6 @@ module Braintree
510
518
  end
511
519
 
512
520
  module ExternalVault
513
- # NEXT_MAJOR_VERSION remove this validation error as it is no longer returned by the gateway
514
- CardTypeIsInvalid = "915178"
515
521
  PreviousNetworkTransactionIdIsInvalid = "915179"
516
522
  StatusIsInvalid = "915175"
517
523
  StatusWithPreviousNetworkTransactionIdIsInvalid = "915177"
@@ -698,13 +704,13 @@ module Braintree
698
704
  end
699
705
 
700
706
  module PaymentMethod
701
- CannotForwardPaymentMethodType = "93107"
707
+ CannotForwardPaymentMethodType = "93106"
702
708
  CustomerIdIsInvalid = "93105"
703
709
  CustomerIdIsRequired = "93104"
704
710
  NonceIsInvalid = "93102"
705
711
  NonceIsRequired = "93103"
706
712
  PaymentMethodNoLongerSupported = "93117"
707
- PaymentMethodNonceConsumed = "93106"
713
+ PaymentMethodNonceConsumed = "93107"
708
714
  PaymentMethodNonceLocked = "93109"
709
715
  PaymentMethodNonceUnknown = "93108"
710
716
  PaymentMethodParamsAreRequired = "93101"
@@ -779,8 +785,6 @@ module Braintree
779
785
  end
780
786
 
781
787
  module RiskData
782
- # NEXT_MAJOR_VERSION Remove CustomerBrowserIsTooLong (this validation is no longer applied)
783
- CustomerBrowserIsTooLong = "94701"
784
788
  CustomerDeviceIdIsTooLong = "94702"
785
789
  CustomerLocationZipInvalidCharacters = "94703"
786
790
  CustomerLocationZipIsInvalid = "94704"
@@ -46,7 +46,7 @@ module Braintree
46
46
  end
47
47
 
48
48
  def self._new(*args) # :nodoc:
49
- self.new *args
49
+ self.new(*args)
50
50
  end
51
51
  end
52
52
  end
@@ -16,7 +16,7 @@ module Braintree
16
16
  class << self
17
17
  protected :new
18
18
  def _new(*args) # :nodoc:
19
- self.new *args
19
+ self.new(*args)
20
20
  end
21
21
  end
22
22
  end
@@ -4,9 +4,9 @@ module Braintree
4
4
  def initialize(config)
5
5
  @config = config
6
6
  @graphql_headers = {
7
- 'Accept' => 'application/json',
8
- 'Braintree-Version' => @config.graphql_api_version,
9
- 'Content-Type' => 'application/json'
7
+ "Accept" => "application/json",
8
+ "Braintree-Version" => @config.graphql_api_version,
9
+ "Content-Type" => "application/json"
10
10
  }
11
11
  end
12
12
 
@@ -14,9 +14,9 @@ module Braintree
14
14
  graphql_connection = _setup_connection(@config.graphql_server, @config.graphql_port)
15
15
 
16
16
  request = {}
17
- request['query'] = definition
18
- request['operationName'] = operationName if operationName
19
- request['variables'] = variables
17
+ request["query"] = definition
18
+ request["operationName"] = operationName if operationName
19
+ request["variables"] = variables
20
20
 
21
21
  response = _http_do Net::HTTP::Post, @config.graphql_base_url, request.to_json, nil, graphql_connection, @graphql_headers
22
22
  data = _parse_response(response)
@@ -27,7 +27,7 @@ module Braintree
27
27
 
28
28
  def _parse_response(response)
29
29
  body = response.body
30
- body = Zlib::GzipReader.new(StringIO.new(body)).read if response.header['Content-Encoding'] == "gzip"
30
+ body = Zlib::GzipReader.new(StringIO.new(body)).read if response.header["Content-Encoding"] == "gzip"
31
31
  JSON.parse(body, :symbolize_names => true)
32
32
  end
33
33
  end
@@ -75,7 +75,7 @@ module Braintree
75
75
  @config.proxy_address,
76
76
  @config.proxy_port,
77
77
  @config.proxy_user,
78
- @config.proxy_pass
78
+ @config.proxy_pass,
79
79
  )
80
80
  else
81
81
  connection = Net::HTTP.new(server, port)
@@ -127,7 +127,7 @@ module Braintree
127
127
  form_params.push(_add_form_field(k, v))
128
128
  end
129
129
  form_params.push(_add_file_part("file", file))
130
- request.body = form_params.collect {|p| "--" + boundary + "#{LINE_FEED}" + p}.join("") + "--" + boundary + "--"
130
+ request.body = form_params.collect { |p| "--" + boundary + "#{LINE_FEED}" + p }.join("") + "--" + boundary + "--"
131
131
  @config.logger.debug _format_and_sanitize_body_for_log(_build_xml(body))
132
132
  else
133
133
  request.body = body
@@ -187,7 +187,7 @@ module Braintree
187
187
  def _format_and_sanitize_body_for_log(input_xml)
188
188
  formatted_xml = input_xml.gsub(/^/, "[Braintree] ")
189
189
  formatted_xml = formatted_xml.gsub(/<number>(.{6}).+?(.{4})<\/number>/m, '<number>\1******\2</number>')
190
- formatted_xml = formatted_xml.gsub(/<cvv>.+?<\/cvv>/m, '<cvv>***</cvv>')
190
+ formatted_xml = formatted_xml.gsub(/<cvv>.+?<\/cvv>/m, "<cvv>***</cvv>")
191
191
  formatted_xml
192
192
  end
193
193
 
@@ -17,7 +17,7 @@ module Braintree
17
17
  end
18
18
 
19
19
  def self._new(*args) # :nodoc:
20
- self.new *args
20
+ self.new(*args)
21
21
  end
22
22
  end
23
23
  end
@@ -0,0 +1,19 @@
1
+ module Braintree
2
+ class LocalPaymentReversed
3
+ include BaseModule
4
+
5
+ attr_reader :payment_id
6
+
7
+ def initialize(attributes) # :nodoc:
8
+ set_instance_variables_from_hash(attributes)
9
+ end
10
+
11
+ class << self
12
+ protected :new
13
+ end
14
+
15
+ def self._new(*args) # :nodoc:
16
+ self.new(*args)
17
+ end
18
+ end
19
+ end
@@ -24,7 +24,7 @@ module Braintree
24
24
  end
25
25
 
26
26
  def self._new(*args) # :nodoc:
27
- self.new *args
27
+ self.new(*args)
28
28
  end
29
29
 
30
30
  def self.provision_raw_apple_pay
@@ -61,7 +61,7 @@ module Braintree
61
61
  class << self
62
62
  protected :new
63
63
  def _new(*args) # :nodoc:
64
- self.new *args
64
+ self.new(*args)
65
65
  end
66
66
  end
67
67
 
@@ -74,7 +74,7 @@ module Braintree
74
74
 
75
75
  if response.has_key?(:response) && response[:response][:merchant_account]
76
76
  Braintree::SuccessfulResult.new(
77
- :merchant_account => MerchantAccount._new(@gateway, response[:response][:merchant_account])
77
+ :merchant_account => MerchantAccount._new(@gateway, response[:response][:merchant_account]),
78
78
  )
79
79
  elsif response[:api_error_response]
80
80
  ErrorResult.new(@gateway, response[:api_error_response])
@@ -26,7 +26,7 @@ module Braintree
26
26
  if response.has_key?(:response) && response[:response][:merchant]
27
27
  Braintree::SuccessfulResult.new(
28
28
  :merchant => Merchant._new(@gateway, response[:response][:merchant]),
29
- :credentials => OAuthCredentials._new(response[:response][:credentials])
29
+ :credentials => OAuthCredentials._new(response[:response][:credentials]),
30
30
  )
31
31
  elsif response[:api_error_response]
32
32
  ErrorResult.new(@gateway, response[:api_error_response])
@@ -18,7 +18,7 @@ module Braintree
18
18
  class << self
19
19
  protected :new
20
20
  def _new(*args) # :nodoc:
21
- self.new *args
21
+ self.new(*args)
22
22
  end
23
23
  end
24
24
 
@@ -16,7 +16,7 @@ module Braintree
16
16
  end
17
17
 
18
18
  def self._new(*args) # :nodoc:
19
- self.new *args
19
+ self.new(*args)
20
20
  end
21
21
  end
22
22
  end
@@ -22,7 +22,7 @@ module Braintree
22
22
  })
23
23
  if response[:credentials]
24
24
  Braintree::SuccessfulResult.new(
25
- :credentials => OAuthCredentials._new(response[:credentials])
25
+ :credentials => OAuthCredentials._new(response[:credentials]),
26
26
  )
27
27
  elsif response[:api_error_response]
28
28
  ErrorResult.new(@gateway, response[:api_error_response])
@@ -47,10 +47,10 @@ module Braintree
47
47
  user_params = _sub_query(params, :user)
48
48
  business_params = _sub_query(params, :business)
49
49
  payment_methods = _sub_array_query(params, :payment_methods)
50
- query = params.to_a.
51
- concat(user_params).
52
- concat(business_params).
53
- concat(payment_methods)
50
+ query = params.to_a
51
+ .concat(user_params)
52
+ .concat(business_params)
53
+ .concat(payment_methods)
54
54
 
55
55
  query_string = query.map { |k, v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" }.join("&")
56
56
  "#{@config.base_url}/oauth/connect?#{query_string}"
@@ -1,14 +1,14 @@
1
1
  module Braintree
2
2
  module PaymentInstrumentType
3
- PayPalAccount = 'paypal_account'
4
- CreditCard = 'credit_card'
5
- ApplePayCard = 'apple_pay_card'
6
- GooglePayCard = 'android_pay_card'
7
- VenmoAccount = 'venmo_account'
8
- UsBankAccount = 'us_bank_account'
9
- VisaCheckoutCard = 'visa_checkout_card'
10
- SamsungPayCard = 'samsung_pay_card'
11
- LocalPayment = 'local_payment'
12
- PayPalHere = 'paypal_here'
3
+ PayPalAccount = "paypal_account"
4
+ CreditCard = "credit_card"
5
+ ApplePayCard = "apple_pay_card"
6
+ GooglePayCard = "android_pay_card"
7
+ VenmoAccount = "venmo_account"
8
+ UsBankAccount = "us_bank_account"
9
+ VisaCheckoutCard = "visa_checkout_card"
10
+ SamsungPayCard = "samsung_pay_card"
11
+ LocalPayment = "local_payment"
12
+ PayPalHere = "paypal_here"
13
13
  end
14
14
  end
@@ -82,7 +82,7 @@ module Braintree
82
82
  if options.class == Hash
83
83
  grant_options = options
84
84
  elsif [true, false].include?(options)
85
- grant_options = { :allow_vaulting => options }
85
+ grant_options = {:allow_vaulting => options}
86
86
  else
87
87
  raise ArgumentError
88
88
  end
@@ -91,7 +91,7 @@ module Braintree
91
91
  "/payment_methods/grant",
92
92
  :payment_method => {
93
93
  :shared_payment_method_token => token,
94
- }.merge(grant_options)
94
+ }.merge(grant_options),
95
95
  )
96
96
  rescue NotFoundError
97
97
  raise NotFoundError, "payment method with token #{token.inspect} not found"
@@ -115,7 +115,7 @@ module Braintree
115
115
  "/payment_methods/revoke",
116
116
  :payment_method => {
117
117
  :shared_payment_method_token => token
118
- }
118
+ },
119
119
  )
120
120
  rescue NotFoundError
121
121
  raise NotFoundError, "payment method with token #{token.inspect} not found"
@@ -148,10 +148,15 @@ module Braintree
148
148
  billing_address_params = AddressGateway._shared_signature
149
149
  paypal_options_shipping_signature = AddressGateway._shared_signature
150
150
  options = [
151
- :make_default, :verification_merchant_account_id, :verify_card, :venmo_sdk_session,
152
- :verification_amount, :us_bank_account_verification_method,
151
+ :make_default,
152
+ :skip_advanced_fraud_checking,
153
+ :us_bank_account_verification_method,
154
+ :venmo_sdk_session,
153
155
  :verification_account_type,
156
+ :verification_amount,
154
157
  :verification_currency_iso_code,
158
+ :verification_merchant_account_id,
159
+ :verify_card,
155
160
  :paypal => [
156
161
  :payee_email,
157
162
  :order_id,
@@ -186,8 +191,6 @@ module Braintree
186
191
  options << :fail_on_duplicate_payment_method
187
192
  signature << :customer_id
188
193
  signature << :paypal_refresh_token
189
- # NEXT_MAJOR_VERSION remove this from the signature
190
- signature << :paypal_vault_without_upgrade
191
194
  when :update
192
195
  billing_address_params << {:options => [:update_existing]}
193
196
  else
@@ -15,6 +15,7 @@ module Braintree
15
15
  end
16
16
 
17
17
  attr_reader :bin_data
18
+ attr_reader :default
18
19
  attr_reader :details
19
20
  attr_reader :nonce
20
21
  attr_reader :three_d_secure_info
@@ -23,14 +24,16 @@ module Braintree
23
24
 
24
25
  def initialize(gateway, attributes) # :nodoc:
25
26
  @gateway = gateway
26
- @nonce = attributes.fetch(:nonce)
27
- @type = attributes.fetch(:type)
28
- @details = attributes.fetch(:details)
29
- @authentication_insight = attributes.fetch(:authentication_insight, nil)
27
+ set_instance_variables_from_hash(attributes)
28
+ @details = PaymentMethodNonceDetails.new(attributes[:details]) if attributes[:details]
30
29
  @three_d_secure_info = ThreeDSecureInfo.new(attributes[:three_d_secure_info]) if attributes[:three_d_secure_info]
31
30
  @bin_data = BinData.new(attributes[:bin_data]) if attributes[:bin_data]
32
31
  end
33
32
 
33
+ def default?
34
+ @default
35
+ end
36
+
34
37
  def to_s # :nodoc:
35
38
  nonce
36
39
  end