braintree 3.1.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/braintree.gemspec +3 -3
  3. data/lib/braintree.rb +8 -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 +12 -4
  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 +11 -8
  43. data/lib/braintree/payment_method_nonce.rb +1 -1
  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/resource_collection.rb +8 -3
  50. data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
  51. data/lib/braintree/risk_data.rb +3 -1
  52. data/lib/braintree/samsung_pay_card.rb +1 -1
  53. data/lib/braintree/settlement_batch_summary.rb +2 -2
  54. data/lib/braintree/subscription.rb +6 -6
  55. data/lib/braintree/test/credit_card.rb +1 -0
  56. data/lib/braintree/three_d_secure_info.rb +22 -12
  57. data/lib/braintree/transaction.rb +40 -24
  58. data/lib/braintree/transaction/installment.rb +28 -0
  59. data/lib/braintree/transaction/installment/adjustment.rb +33 -0
  60. data/lib/braintree/transaction_gateway.rb +27 -6
  61. data/lib/braintree/transaction_line_item.rb +1 -1
  62. data/lib/braintree/transaction_search.rb +3 -1
  63. data/lib/braintree/unknown_payment_method.rb +1 -1
  64. data/lib/braintree/us_bank_account.rb +3 -3
  65. data/lib/braintree/us_bank_account_verification.rb +1 -1
  66. data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
  67. data/lib/braintree/util.rb +4 -4
  68. data/lib/braintree/venmo_account.rb +1 -1
  69. data/lib/braintree/version.rb +1 -1
  70. data/lib/braintree/visa_checkout_card.rb +2 -2
  71. data/lib/braintree/webhook_notification.rb +30 -20
  72. data/lib/braintree/webhook_notification_gateway.rb +5 -5
  73. data/lib/braintree/webhook_testing_gateway.rb +30 -0
  74. data/lib/braintree/xml/generator.rb +5 -4
  75. data/lib/braintree/xml/libxml.rb +0 -1
  76. data/lib/braintree/xml/parser.rb +22 -12
  77. data/lib/braintree/xml/rexml.rb +70 -0
  78. data/spec/integration/braintree/add_on_spec.rb +1 -1
  79. data/spec/integration/braintree/address_spec.rb +28 -24
  80. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  81. data/spec/integration/braintree/apple_pay_spec.rb +3 -3
  82. data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
  83. data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
  84. data/spec/integration/braintree/client_api/spec_helper.rb +5 -5
  85. data/spec/integration/braintree/credit_card_spec.rb +213 -122
  86. data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
  87. data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
  88. data/spec/integration/braintree/customer_search_spec.rb +8 -8
  89. data/spec/integration/braintree/customer_spec.rb +433 -149
  90. data/spec/integration/braintree/dispute_search_spec.rb +28 -3
  91. data/spec/integration/braintree/dispute_spec.rb +6 -6
  92. data/spec/integration/braintree/error_codes_spec.rb +1 -1
  93. data/spec/integration/braintree/http_spec.rb +2 -2
  94. data/spec/integration/braintree/merchant_account_spec.rb +25 -26
  95. data/spec/integration/braintree/merchant_spec.rb +14 -14
  96. data/spec/integration/braintree/oauth_spec.rb +11 -11
  97. data/spec/integration/braintree/payment_method_nonce_spec.rb +26 -35
  98. data/spec/integration/braintree/payment_method_spec.rb +430 -149
  99. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +17 -13
  100. data/spec/integration/braintree/paypal_account_spec.rb +28 -28
  101. data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
  102. data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
  103. data/spec/integration/braintree/subscription_spec.rb +133 -133
  104. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  105. data/spec/integration/braintree/test_transaction_spec.rb +10 -10
  106. data/spec/integration/braintree/transaction_search_spec.rb +93 -67
  107. data/spec/integration/braintree/transaction_spec.rb +752 -383
  108. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -26
  109. data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
  110. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
  111. data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
  112. data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
  113. data/spec/integration/spec_helper.rb +9 -3
  114. data/spec/oauth_test_helper.rb +1 -1
  115. data/spec/script/httpsd.rb +6 -6
  116. data/spec/spec_helper.rb +6 -3
  117. data/spec/unit/braintree/address_spec.rb +1 -1
  118. data/spec/unit/braintree/apple_pay_card_spec.rb +1 -1
  119. data/spec/unit/braintree/client_token_spec.rb +2 -2
  120. data/spec/unit/braintree/configuration_spec.rb +42 -42
  121. data/spec/unit/braintree/credit_card_spec.rb +13 -13
  122. data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
  123. data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
  124. data/spec/unit/braintree/customer_spec.rb +21 -10
  125. data/spec/unit/braintree/disbursement_spec.rb +7 -7
  126. data/spec/unit/braintree/dispute_search_spec.rb +1 -0
  127. data/spec/unit/braintree/dispute_spec.rb +34 -9
  128. data/spec/unit/braintree/error_result_spec.rb +5 -5
  129. data/spec/unit/braintree/errors_spec.rb +8 -8
  130. data/spec/unit/braintree/http_spec.rb +5 -5
  131. data/spec/unit/braintree/merchant_account_spec.rb +1 -1
  132. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
  133. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +43 -0
  134. data/spec/unit/braintree/payment_method_spec.rb +1 -1
  135. data/spec/unit/braintree/paypal_account_spec.rb +2 -2
  136. data/spec/unit/braintree/resource_collection_spec.rb +30 -1
  137. data/spec/unit/braintree/risk_data_spec.rb +9 -5
  138. data/spec/unit/braintree/subscription_search_spec.rb +1 -1
  139. data/spec/unit/braintree/successful_result_spec.rb +1 -1
  140. data/spec/unit/braintree/three_d_secure_info_spec.rb +32 -14
  141. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
  142. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  143. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  144. data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
  145. data/spec/unit/braintree/transaction/paypal_details_spec.rb +1 -1
  146. data/spec/unit/braintree/transaction_search_spec.rb +12 -12
  147. data/spec/unit/braintree/transaction_spec.rb +25 -17
  148. data/spec/unit/braintree/util_spec.rb +18 -18
  149. data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
  150. data/spec/unit/braintree/webhook_notification_spec.rb +88 -56
  151. data/spec/unit/braintree/xml/rexml_spec.rb +51 -0
  152. data/spec/unit/braintree/xml_spec.rb +31 -31
  153. metadata +18 -8
  154. 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
@@ -68,6 +68,7 @@ module Braintree
68
68
  CardholderNameIsTooLong = "81723"
69
69
  CreditCardTypeIsNotAccepted = "81703"
70
70
  CreditCardTypeIsNotAcceptedBySubscriptionMerchantAccount = "81718"
71
+ CurrencyCodeNotSupportedByMerchantAccount = "91760"
71
72
  CustomerIdIsInvalid = "91705"
72
73
  CustomerIdIsRequired = "91704"
73
74
  CvvIsInvalid = "81707"
@@ -270,6 +271,7 @@ module Braintree
270
271
  end
271
272
 
272
273
  module Transaction
274
+ AdjustmentAmountMustBeGreaterThanZero = "95605"
273
275
  AmountCannotBeNegative = "81501"
274
276
  AmountDoesNotMatch3DSecureAmount = "91585"
275
277
  AmountFormatIsInvalid = "81503" # Keep for backwards compatibility
@@ -301,6 +303,7 @@ module Braintree
301
303
  CannotUpdateTransactionDetailsNotSubmittedForSettlement = "915129"
302
304
  ChannelIsTooLong = "91550"
303
305
  CreditCardIsRequired = "91508"
306
+ CurrencyCodeNotSupportedByMerchantAccount = "915214"
304
307
  CustomFieldIsInvalid = "91526"
305
308
  CustomFieldIsTooLong = "81527"
306
309
  CustomerDefaultPaymentMethodCardTypeIsNotAccepted = "81509"
@@ -320,6 +323,7 @@ module Braintree
320
323
  MerchantAccountIdDoesNotMatchSubscription = "915180"
321
324
  MerchantAccountIdIsInvalid = "91513"
322
325
  MerchantAccountIsSuspended = "91514"
326
+ NoNetAmountToPerformAuthAdjustment = "95606"
323
327
  OrderIdIsTooLong = "91501"
324
328
  PayPalAuthExpired = "91579"
325
329
  PayPalNotEnabled = "91576"
@@ -341,8 +345,11 @@ module Braintree
341
345
  ProcessorAuthorizationCodeCannotBeSet = "91519"
342
346
  ProcessorAuthorizationCodeIsInvalid = "81520"
343
347
  ProcessorDoesNotSupportAuths = "915104"
348
+ ProcessorDoesNotSupportAuthAdjustment = "915222"
344
349
  ProcessorDoesNotSupportCredits = "91546"
350
+ ProcessorDoesNotSupportIncrementalAuth = "915220"
345
351
  ProcessorDoesNotSupportMotoForCardType = "915195"
352
+ ProcessorDoesNotSupportPartialAuthReversal = "915221"
346
353
  ProcessorDoesNotSupportPartialSettlement = "915102"
347
354
  ProcessorDoesNotSupportUpdatingDescriptor = "915108"
348
355
  ProcessorDoesNotSupportUpdatingOrderId = "915107"
@@ -354,6 +361,7 @@ module Braintree
354
361
  RefundAmountIsTooLarge = "91521"
355
362
  RefundAuthHardDeclined = "915200"
356
363
  RefundAuthSoftDeclined = "915201"
364
+ ScaExemptionInvalid = "915213"
357
365
  ServiceFeeAmountCannotBeNegative = "91554"
358
366
  ServiceFeeAmountFormatIsInvalid = "91555"
359
367
  ServiceFeeAmountIsTooLarge = "91556"
@@ -395,6 +403,8 @@ module Braintree
395
403
  ThreeDSecureTransactionPaymentMethodDoesntMatchThreeDSecureAuthenticationPaymentMethod = "915197"
396
404
  ThreeDSecureXidIsRequired = "915115"
397
405
  TooManyLineItems = "915157"
406
+ TransactionIsNotEligibleForAdjustment = "915219"
407
+ TransactionMustBeInStateAuthorized = "915218"
398
408
  TransactionSourceIsInvalid = "915133"
399
409
  TypeIsInvalid = "91523"
400
410
  TypeIsRequired = "91524"
@@ -507,7 +517,6 @@ module Braintree
507
517
  end
508
518
 
509
519
  module ExternalVault
510
- CardTypeIsInvalid = "915178"
511
520
  PreviousNetworkTransactionIdIsInvalid = "915179"
512
521
  StatusIsInvalid = "915175"
513
522
  StatusWithPreviousNetworkTransactionIdIsInvalid = "915177"
@@ -694,13 +703,13 @@ module Braintree
694
703
  end
695
704
 
696
705
  module PaymentMethod
697
- CannotForwardPaymentMethodType = "93107"
706
+ CannotForwardPaymentMethodType = "93106"
698
707
  CustomerIdIsInvalid = "93105"
699
708
  CustomerIdIsRequired = "93104"
700
709
  NonceIsInvalid = "93102"
701
710
  NonceIsRequired = "93103"
702
711
  PaymentMethodNoLongerSupported = "93117"
703
- PaymentMethodNonceConsumed = "93106"
712
+ PaymentMethodNonceConsumed = "93107"
704
713
  PaymentMethodNonceLocked = "93109"
705
714
  PaymentMethodNonceUnknown = "93108"
706
715
  PaymentMethodParamsAreRequired = "93101"
@@ -775,7 +784,6 @@ module Braintree
775
784
  end
776
785
 
777
786
  module RiskData
778
- CustomerBrowserIsTooLong = "94701"
779
787
  CustomerDeviceIdIsTooLong = "94702"
780
788
  CustomerLocationZipInvalidCharacters = "94703"
781
789
  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
@@ -19,7 +19,6 @@ module Braintree
19
19
 
20
20
  def _do_create(path, params=nil) # :nodoc:
21
21
  response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
22
-
23
22
  if response[:api_error_response]
24
23
  ErrorResult.new(@gateway, response[:api_error_response])
25
24
  elsif response
@@ -83,7 +82,7 @@ module Braintree
83
82
  if options.class == Hash
84
83
  grant_options = options
85
84
  elsif [true, false].include?(options)
86
- grant_options = { :allow_vaulting => options }
85
+ grant_options = {:allow_vaulting => options}
87
86
  else
88
87
  raise ArgumentError
89
88
  end
@@ -92,7 +91,7 @@ module Braintree
92
91
  "/payment_methods/grant",
93
92
  :payment_method => {
94
93
  :shared_payment_method_token => token,
95
- }.merge(grant_options)
94
+ }.merge(grant_options),
96
95
  )
97
96
  rescue NotFoundError
98
97
  raise NotFoundError, "payment method with token #{token.inspect} not found"
@@ -116,7 +115,7 @@ module Braintree
116
115
  "/payment_methods/revoke",
117
116
  :payment_method => {
118
117
  :shared_payment_method_token => token
119
- }
118
+ },
120
119
  )
121
120
  rescue NotFoundError
122
121
  raise NotFoundError, "payment method with token #{token.inspect} not found"
@@ -149,9 +148,15 @@ module Braintree
149
148
  billing_address_params = AddressGateway._shared_signature
150
149
  paypal_options_shipping_signature = AddressGateway._shared_signature
151
150
  options = [
152
- :make_default, :verification_merchant_account_id, :verify_card, :venmo_sdk_session,
153
- :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,
154
155
  :verification_account_type,
156
+ :verification_amount,
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
@@ -25,7 +25,7 @@ module Braintree
25
25
  @gateway = gateway
26
26
  @nonce = attributes.fetch(:nonce)
27
27
  @type = attributes.fetch(:type)
28
- @details = attributes.fetch(:details)
28
+ @details = PaymentMethodNonceDetails.new(attributes[:details]) if attributes[:details]
29
29
  @authentication_insight = attributes.fetch(:authentication_insight, nil)
30
30
  @three_d_secure_info = ThreeDSecureInfo.new(attributes[:three_d_secure_info]) if attributes[:three_d_secure_info]
31
31
  @bin_data = BinData.new(attributes[:bin_data]) if attributes[:bin_data]