braintree 2.104.0 → 4.9.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 (213) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/braintree.gemspec +7 -4
  4. data/lib/braintree/account_updater_daily_report.rb +1 -1
  5. data/lib/braintree/address.rb +2 -23
  6. data/lib/braintree/apple_pay.rb +1 -1
  7. data/lib/braintree/apple_pay_card.rb +11 -1
  8. data/lib/braintree/apple_pay_options.rb +1 -1
  9. data/lib/braintree/authorization_adjustment.rb +1 -1
  10. data/lib/braintree/base_module.rb +6 -0
  11. data/lib/braintree/bin_data.rb +9 -2
  12. data/lib/braintree/client_token.rb +1 -1
  13. data/lib/braintree/configuration.rb +12 -12
  14. data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
  15. data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
  16. data/lib/braintree/credit_card.rb +2 -77
  17. data/lib/braintree/credit_card_gateway.rb +17 -36
  18. data/lib/braintree/credit_card_verification.rb +18 -5
  19. data/lib/braintree/credit_card_verification_search.rb +1 -1
  20. data/lib/braintree/customer.rb +9 -78
  21. data/lib/braintree/customer_gateway.rb +2 -23
  22. data/lib/braintree/customer_search.rb +1 -1
  23. data/lib/braintree/disbursement.rb +1 -1
  24. data/lib/braintree/{transaction/coinbase_details.rb → dispute/paypal_message.rb} +5 -6
  25. data/lib/braintree/dispute/{history_event.rb → status_history.rb} +3 -1
  26. data/lib/braintree/dispute.rb +32 -8
  27. data/lib/braintree/dispute_gateway.rb +4 -9
  28. data/lib/braintree/dispute_search.rb +6 -3
  29. data/lib/braintree/document_upload.rb +1 -1
  30. data/lib/braintree/enriched_customer_data.rb +21 -0
  31. data/lib/braintree/error_codes.rb +150 -171
  32. data/lib/braintree/exceptions.rb +5 -3
  33. data/lib/braintree/exchange_rate.rb +13 -0
  34. data/lib/braintree/exchange_rate_quote.rb +24 -0
  35. data/lib/braintree/exchange_rate_quote_gateway.rb +35 -0
  36. data/lib/braintree/exchange_rate_quote_input.rb +21 -0
  37. data/lib/braintree/exchange_rate_quote_request.rb +18 -0
  38. data/lib/braintree/exchange_rate_quote_response.rb +18 -0
  39. data/lib/braintree/gateway.rb +4 -14
  40. data/lib/braintree/{android_pay_card.rb → google_pay_card.rb} +11 -3
  41. data/lib/braintree/granted_payment_instrument_update.rb +1 -1
  42. data/lib/braintree/graphql_client.rb +7 -7
  43. data/lib/braintree/http.rb +4 -3
  44. data/lib/braintree/local_payment_completed.rb +2 -2
  45. data/lib/braintree/local_payment_expired.rb +21 -0
  46. data/lib/braintree/local_payment_funded.rb +22 -0
  47. data/lib/braintree/local_payment_reversed.rb +19 -0
  48. data/lib/braintree/merchant.rb +1 -1
  49. data/lib/braintree/merchant_account.rb +1 -1
  50. data/lib/braintree/merchant_account_gateway.rb +3 -1
  51. data/lib/braintree/merchant_gateway.rb +1 -1
  52. data/lib/braintree/modification.rb +1 -1
  53. data/lib/braintree/oauth_credentials.rb +1 -1
  54. data/lib/braintree/oauth_gateway.rb +5 -5
  55. data/lib/braintree/payment_instrument_type.rb +10 -14
  56. data/lib/braintree/payment_method_customer_data_updated_metadata.rb +24 -0
  57. data/lib/braintree/payment_method_gateway.rb +15 -17
  58. data/lib/braintree/payment_method_nonce.rb +7 -4
  59. data/lib/braintree/payment_method_nonce_details.rb +37 -0
  60. data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
  61. data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
  62. data/lib/braintree/payment_method_parser.rb +1 -8
  63. data/lib/braintree/plan.rb +21 -1
  64. data/lib/braintree/plan_gateway.rb +100 -0
  65. data/lib/braintree/processor_response_types.rb +3 -3
  66. data/lib/braintree/resource_collection.rb +8 -3
  67. data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
  68. data/lib/braintree/risk_data/liability_shift.rb +22 -0
  69. data/lib/braintree/risk_data.rb +5 -1
  70. data/lib/braintree/samsung_pay_card.rb +1 -1
  71. data/lib/braintree/settlement_batch_summary.rb +2 -2
  72. data/lib/braintree/subscription.rb +11 -11
  73. data/lib/braintree/successful_result.rb +3 -2
  74. data/lib/braintree/test/credit_card.rb +1 -0
  75. data/lib/braintree/test/nonce.rb +4 -23
  76. data/lib/braintree/three_d_secure_info.rb +22 -12
  77. data/lib/braintree/transaction/disbursement_details.rb +1 -0
  78. data/lib/braintree/transaction/{android_pay_details.rb → google_pay_details.rb} +1 -1
  79. data/lib/braintree/transaction/installment/adjustment.rb +33 -0
  80. data/lib/braintree/transaction/installment.rb +28 -0
  81. data/lib/braintree/transaction/paypal_details.rb +3 -0
  82. data/lib/braintree/transaction/subscription_details.rb +2 -0
  83. data/lib/braintree/transaction.rb +65 -120
  84. data/lib/braintree/transaction_gateway.rb +39 -27
  85. data/lib/braintree/transaction_line_item.rb +1 -1
  86. data/lib/braintree/transaction_review.rb +18 -0
  87. data/lib/braintree/transaction_search.rb +5 -3
  88. data/lib/braintree/unknown_payment_method.rb +1 -1
  89. data/lib/braintree/us_bank_account.rb +3 -3
  90. data/lib/braintree/us_bank_account_verification.rb +1 -1
  91. data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
  92. data/lib/braintree/util.rb +21 -6
  93. data/lib/braintree/venmo_account.rb +1 -1
  94. data/lib/braintree/venmo_profile_data.rb +23 -0
  95. data/lib/braintree/version.rb +2 -2
  96. data/lib/braintree/visa_checkout_card.rb +2 -2
  97. data/lib/braintree/webhook_notification.rb +44 -30
  98. data/lib/braintree/webhook_notification_gateway.rb +5 -5
  99. data/lib/braintree/webhook_testing_gateway.rb +104 -43
  100. data/lib/braintree/xml/generator.rb +5 -4
  101. data/lib/braintree/xml/parser.rb +22 -35
  102. data/lib/braintree/xml/rexml.rb +4 -5
  103. data/lib/braintree.rb +28 -23
  104. data/spec/integration/braintree/add_on_spec.rb +1 -1
  105. data/spec/integration/braintree/address_spec.rb +30 -113
  106. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  107. data/spec/integration/braintree/apple_pay_spec.rb +3 -3
  108. data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
  109. data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
  110. data/spec/integration/braintree/client_api/spec_helper.rb +5 -31
  111. data/spec/integration/braintree/credit_card_spec.rb +219 -593
  112. data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
  113. data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
  114. data/spec/integration/braintree/customer_search_spec.rb +8 -8
  115. data/spec/integration/braintree/customer_spec.rb +484 -513
  116. data/spec/integration/braintree/dispute_search_spec.rb +35 -6
  117. data/spec/integration/braintree/dispute_spec.rb +6 -7
  118. data/spec/integration/braintree/error_codes_spec.rb +1 -1
  119. data/spec/integration/braintree/exchange_rate_quote_spec.rb +97 -0
  120. data/spec/integration/braintree/graphql_client_spec.rb +0 -2
  121. data/spec/integration/braintree/http_spec.rb +2 -2
  122. data/spec/integration/braintree/merchant_account_spec.rb +28 -29
  123. data/spec/integration/braintree/merchant_spec.rb +14 -14
  124. data/spec/integration/braintree/oauth_spec.rb +11 -11
  125. data/spec/integration/braintree/payment_method_nonce_spec.rb +29 -35
  126. data/spec/integration/braintree/payment_method_spec.rb +535 -270
  127. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +17 -13
  128. data/spec/integration/braintree/paypal_account_spec.rb +28 -28
  129. data/spec/integration/braintree/plan_spec.rb +82 -0
  130. data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
  131. data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
  132. data/spec/integration/braintree/subscription_spec.rb +144 -149
  133. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  134. data/spec/integration/braintree/test_transaction_spec.rb +10 -10
  135. data/spec/integration/braintree/transaction_search_spec.rb +175 -70
  136. data/spec/integration/braintree/transaction_spec.rb +955 -894
  137. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -26
  138. data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
  139. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
  140. data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
  141. data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
  142. data/spec/integration/spec_helper.rb +16 -7
  143. data/spec/oauth_test_helper.rb +1 -1
  144. data/spec/script/httpsd.rb +6 -6
  145. data/spec/spec_helper.rb +8 -14
  146. data/spec/unit/braintree/address_spec.rb +1 -9
  147. data/spec/unit/braintree/apple_pay_card_spec.rb +7 -1
  148. data/spec/unit/braintree/client_token_spec.rb +2 -2
  149. data/spec/unit/braintree/configuration_spec.rb +42 -42
  150. data/spec/unit/braintree/credit_card_spec.rb +13 -32
  151. data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
  152. data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
  153. data/spec/unit/braintree/customer_spec.rb +21 -22
  154. data/spec/unit/braintree/disbursement_spec.rb +7 -7
  155. data/spec/unit/braintree/dispute_search_spec.rb +3 -0
  156. data/spec/unit/braintree/dispute_spec.rb +75 -21
  157. data/spec/unit/braintree/enriched_customer_data_spec.rb +32 -0
  158. data/spec/unit/braintree/error_result_spec.rb +5 -5
  159. data/spec/unit/braintree/errors_spec.rb +8 -8
  160. data/spec/unit/braintree/exchange_rate_quote_input_spec.rb +42 -0
  161. data/spec/unit/braintree/exchange_rate_quote_request_spec.rb +82 -0
  162. data/spec/unit/braintree/exchange_rate_quote_response_spec.rb +52 -0
  163. data/spec/unit/braintree/exchange_rate_quote_spec.rb +42 -0
  164. data/spec/unit/braintree/exchange_rate_spec.rb +23 -0
  165. data/spec/unit/braintree/http_spec.rb +10 -8
  166. data/spec/unit/braintree/local_payment_completed_spec.rb +14 -0
  167. data/spec/unit/braintree/local_payment_expired_spec.rb +24 -0
  168. data/spec/unit/braintree/local_payment_funded_spec.rb +34 -0
  169. data/spec/unit/braintree/merchant_account_spec.rb +1 -1
  170. data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +45 -0
  171. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
  172. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +43 -0
  173. data/spec/unit/braintree/payment_method_nonce_spec.rb +40 -0
  174. data/spec/unit/braintree/payment_method_spec.rb +1 -1
  175. data/spec/unit/braintree/paypal_account_spec.rb +2 -2
  176. data/spec/unit/braintree/resource_collection_spec.rb +30 -1
  177. data/spec/unit/braintree/risk_data/liability_shift.rb +26 -0
  178. data/spec/unit/braintree/risk_data_spec.rb +38 -8
  179. data/spec/unit/braintree/subscription_search_spec.rb +1 -1
  180. data/spec/unit/braintree/successful_result_spec.rb +1 -1
  181. data/spec/unit/braintree/three_d_secure_info_spec.rb +32 -14
  182. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
  183. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  184. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  185. data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
  186. data/spec/unit/braintree/transaction/paypal_details_spec.rb +7 -1
  187. data/spec/unit/braintree/transaction_search_spec.rb +12 -12
  188. data/spec/unit/braintree/transaction_spec.rb +36 -54
  189. data/spec/unit/braintree/util_spec.rb +55 -21
  190. data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
  191. data/spec/unit/braintree/venmo_profile_data_spec.rb +32 -0
  192. data/spec/unit/braintree/webhook_notification_spec.rb +166 -57
  193. data/spec/unit/braintree/xml/parser_spec.rb +21 -16
  194. data/spec/unit/braintree/xml_spec.rb +31 -31
  195. metadata +62 -30
  196. data/lib/braintree/amex_express_checkout_card.rb +0 -40
  197. data/lib/braintree/coinbase_account.rb +0 -34
  198. data/lib/braintree/europe_bank_account.rb +0 -36
  199. data/lib/braintree/europe_bank_account_gateway.rb +0 -17
  200. data/lib/braintree/ideal_payment.rb +0 -61
  201. data/lib/braintree/ideal_payment_gateway.rb +0 -19
  202. data/lib/braintree/masterpass_card.rb +0 -83
  203. data/lib/braintree/settlement_batch.rb +0 -0
  204. data/lib/braintree/transaction/amex_express_checkout_details.rb +0 -21
  205. data/lib/braintree/transaction/ideal_payment_details.rb +0 -19
  206. data/lib/braintree/transaction/masterpass_card_details.rb +0 -49
  207. data/lib/braintree/transparent_redirect.rb +0 -40
  208. data/lib/braintree/transparent_redirect_gateway.rb +0 -105
  209. data/spec/hacks/tcp_socket.rb +0 -18
  210. data/spec/integration/braintree/coinbase_spec.rb +0 -34
  211. data/spec/integration/braintree/masterpass_card_spec.rb +0 -97
  212. data/spec/integration/braintree/transparent_redirect_spec.rb +0 -268
  213. data/spec/unit/braintree/transparent_redirect_spec.rb +0 -223
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5e73505966566953ef5df2f2e366b104d0ba4bae9fe485759a4cd2048100d75
4
- data.tar.gz: 5909d63f9c589f1c0ac70bd55c8b4eda61cd52fcaf53d46c1030ef7b18ffe1ec
3
+ metadata.gz: a83d6966dbe837625c68efa0fdee683820705fba7c4c1f65118892d61ea2261b
4
+ data.tar.gz: f947bda53f860763dc3c57080ded11b1823e9c48e71efb05a89bb0490e7dad79
5
5
  SHA512:
6
- metadata.gz: e2012367a1bc709459b1a65828ea01aa851d0e491e9071dee4ce8797603b75cf3f412f6ededf628e713d55bdc095762f50fc500e77519d8ec485679aa0033a92
7
- data.tar.gz: f7724b06f9b4447fe2051f50fa0c0f62e96d43342cf09e048fc8522ee0bb29e38d0fe35ab938fe1b16202e3a77be67d20b038d920eb4acc4e82db2416d555537
6
+ metadata.gz: f9a82a773ef66320358e028dbb9a403f6bcc97d7c32d727bff0b00a2936ab54ae8bbfba201024a7e8d5956ef17be0247b61f0e8e3cc23aecb819a5e77d833a9a
7
+ data.tar.gz: 21a069ff7615e48429c6882ed354334f37fd7e0600e6696b97b000178a03531955d6156dcd77b3927bc2d35a144ecafa07d65d2b6d9566d5202630bfac62cb37
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009-2017 Braintree, a division of PayPal, Inc.
1
+ Copyright (c) 2009-2020 Braintree, a division of PayPal, Inc.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person
4
4
  obtaining a copy of this software and associated documentation
data/braintree.gemspec CHANGED
@@ -1,21 +1,24 @@
1
1
  $:.push File.expand_path("../lib", __FILE__)
2
- require 'braintree/version'
2
+ require "braintree/version"
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "braintree"
6
- s.summary = "Braintree Gateway Ruby Client Library"
7
- s.description = "Ruby library for integrating with the Braintree Gateway"
6
+ s.summary = "Braintree Ruby Server SDK"
7
+ s.description = "Resources and tools for developers to integrate Braintree's global payments platform."
8
8
  s.version = Braintree::Version::String
9
9
  s.license = "MIT"
10
10
  s.author = "Braintree"
11
11
  s.email = "code@getbraintree.com"
12
12
  s.homepage = "https://www.braintreepayments.com/"
13
13
  s.files = Dir.glob ["README.rdoc", "LICENSE", "lib/**/*.{rb,crt}", "spec/**/*", "*.gemspec"]
14
- s.add_dependency "builder", ">= 2.0.0"
14
+ s.add_dependency "builder", ">= 3.2.4"
15
+ s.add_dependency "rexml", ">= 3.1.9" # Use rexml version associated with minimum supported Ruby version
16
+ s.required_ruby_version = ">=2.6.0"
15
17
  s.metadata = {
16
18
  "bug_tracker_uri" => "https://github.com/braintree/braintree_ruby/issues",
17
19
  "changelog_uri" => "https://github.com/braintree/braintree_ruby/blob/master/CHANGELOG.md",
18
20
  "source_code_uri" => "https://github.com/braintree/braintree_ruby",
21
+ "documentation_uri" => "https://developer.paypal.com/braintree/docs"
19
22
  }
20
23
  end
21
24
 
@@ -8,7 +8,7 @@ module Braintree
8
8
  class << self
9
9
  protected :new
10
10
  def _new(*args) # :nodoc:
11
- self.new *args
11
+ self.new(*args)
12
12
  end
13
13
  end
14
14
 
@@ -14,6 +14,7 @@ module Braintree
14
14
  attr_reader :id
15
15
  attr_reader :last_name
16
16
  attr_reader :locality
17
+ attr_reader :phone_number
17
18
  attr_reader :postal_code
18
19
  attr_reader :region
19
20
  attr_reader :street_address
@@ -53,34 +54,12 @@ module Braintree
53
54
  id == other.id && customer_id == other.customer_id
54
55
  end
55
56
 
56
- # Deprecated. Use Braintree::Address.delete
57
- def delete
58
- warn "[DEPRECATED] delete as an instance method is deprecated. Please use Address.delete"
59
- @gateway.address.delete(customer_id, self.id)
60
- end
61
-
62
- # Deprecated. Use Braintree::Address.update
63
- def update(attributes)
64
- warn "[DEPRECATED] update as an instance method is deprecated. Please use Address.update"
65
- result = @gateway.address.update(customer_id, id, attributes)
66
- if result.success?
67
- copy_instance_variables_from_object result.address
68
- end
69
- result
70
- end
71
-
72
- # Deprecated. Use Braintree::Address.update!
73
- def update!(attributes)
74
- warn "[DEPRECATED] update! as an instance method is deprecated. Please use Address.update!"
75
- return_object_or_raise(:address) { update(attributes) }
76
- end
77
-
78
57
  class << self
79
58
  protected :new
80
59
  end
81
60
 
82
61
  def self._new(*args) # :nodoc:
83
- self.new *args
62
+ self.new(*args)
84
63
  end
85
64
  end
86
65
  end
@@ -11,7 +11,7 @@ module Braintree
11
11
  end
12
12
 
13
13
  def self._new(*args) # :nodoc:
14
- self.new *args
14
+ self.new(*args)
15
15
  end
16
16
 
17
17
  def self.register_domain(domain)
@@ -12,15 +12,25 @@ module Braintree
12
12
 
13
13
  attr_reader :bin
14
14
  attr_reader :card_type
15
+ attr_reader :cardholder_name
16
+ attr_reader :commercial
17
+ attr_reader :country_of_issuance
15
18
  attr_reader :created_at
16
19
  attr_reader :customer_id
20
+ attr_reader :debit
17
21
  attr_reader :default
22
+ attr_reader :durbin_regulated
18
23
  attr_reader :expiration_month
19
24
  attr_reader :expiration_year
20
25
  attr_reader :expired
26
+ attr_reader :healthcare
21
27
  attr_reader :image_url
28
+ attr_reader :issuing_bank
22
29
  attr_reader :last_4
23
30
  attr_reader :payment_instrument_name
31
+ attr_reader :payroll
32
+ attr_reader :prepaid
33
+ attr_reader :product_id
24
34
  attr_reader :source_description
25
35
  attr_reader :subscriptions
26
36
  attr_reader :token
@@ -45,7 +55,7 @@ module Braintree
45
55
  end
46
56
 
47
57
  def self._new(*args) # :nodoc:
48
- self.new *args
58
+ self.new(*args)
49
59
  end
50
60
  end
51
61
  end
@@ -13,7 +13,7 @@ module Braintree
13
13
  end
14
14
 
15
15
  def self._new(*args) # :nodoc:
16
- self.new *args
16
+ self.new(*args)
17
17
  end
18
18
  end
19
19
  end
@@ -12,7 +12,7 @@ module Braintree
12
12
  class << self
13
13
  protected :new
14
14
  def _new(*args) # :nodoc:
15
- self.new *args
15
+ self.new(*args)
16
16
  end
17
17
  end
18
18
 
@@ -20,6 +20,12 @@ module Braintree
20
20
  hash.each do |key, value|
21
21
  if key == :global_id
22
22
  instance_variable_set "@graphql_id", value
23
+ elsif key == :android_pay_cards
24
+ instance_variable_set "@google_pay_cards", value
25
+ elsif key == :android_pay_card
26
+ instance_variable_set "@google_pay_card", value
27
+ elsif key == :android_pay_details
28
+ instance_variable_set "@google_pay_details", value
23
29
  end
24
30
 
25
31
  instance_variable_set "@#{key}", value
@@ -17,10 +17,17 @@ module Braintree
17
17
  end
18
18
 
19
19
  def inspect
20
- formatted_attrs = self.class._attributes.map do |attr|
20
+ formatted_attributes = self.class._attributes.map do |attr|
21
21
  "#{attr}: #{send(attr).inspect}"
22
22
  end
23
- "#<BinData #{formatted_attrs.join(", ")}>"
23
+ "#<#{self.class} #{formatted_attributes.join(", ")}>"
24
+ end
25
+
26
+ def self._attributes # :nodoc:
27
+ [
28
+ :commercial, :country_of_issuance, :debit, :durbin_regulated, :healthcare,
29
+ :issuing_bank, :payroll, :prepaid, :product_id
30
+ ]
24
31
  end
25
32
  end
26
33
  end
@@ -1,4 +1,4 @@
1
- require 'json'
1
+ require "json"
2
2
 
3
3
  module Braintree
4
4
  module ClientToken
@@ -1,6 +1,6 @@
1
1
  module Braintree
2
2
  class Configuration
3
- API_VERSION = "5" # :nodoc:
3
+ API_VERSION = "6" # :nodoc:
4
4
  DEFAULT_ENDPOINT = "api" # :nodoc:
5
5
  GRAPHQL_API_VERSION = "2018-09-10" # :nodoc:
6
6
 
@@ -40,12 +40,12 @@ module Braintree
40
40
  ]
41
41
 
42
42
  class << self
43
- attr_writer *WRITABLE_ATTRIBUTES
44
- attr_reader *NON_REQUIRED_READABLE_ATTRIBUTES
43
+ attr_writer(*WRITABLE_ATTRIBUTES)
44
+ attr_reader(*NON_REQUIRED_READABLE_ATTRIBUTES)
45
45
  end
46
- attr_reader *READABLE_ATTRIBUTES
47
- attr_reader *NON_REQUIRED_READABLE_ATTRIBUTES
48
- attr_writer *WRITABLE_ATTRIBUTES
46
+ attr_reader(*READABLE_ATTRIBUTES)
47
+ attr_reader(*NON_REQUIRED_READABLE_ATTRIBUTES)
48
+ attr_writer(*WRITABLE_ATTRIBUTES)
49
49
 
50
50
  def self.expectant_reader(*attributes) # :nodoc:
51
51
  attributes.each do |attribute|
@@ -56,7 +56,7 @@ module Braintree
56
56
  end
57
57
  end
58
58
  end
59
- expectant_reader *READABLE_ATTRIBUTES
59
+ expectant_reader(*READABLE_ATTRIBUTES)
60
60
 
61
61
  # Sets the Braintree environment to use. Valid values are <tt>:sandbox</tt> and <tt>:production</tt>
62
62
  def self.environment=(env)
@@ -86,7 +86,7 @@ module Braintree
86
86
  :proxy_port => proxy_port,
87
87
  :proxy_user => proxy_user,
88
88
  :proxy_pass => proxy_pass,
89
- :ssl_version => ssl_version
89
+ :ssl_version => ssl_version,
90
90
  )
91
91
  end
92
92
 
@@ -205,7 +205,7 @@ module Braintree
205
205
  def port # :nodoc:
206
206
  case @environment
207
207
  when :development, :integration
208
- ENV['GATEWAY_PORT'] || 3000
208
+ ENV["GATEWAY_PORT"] || 3000
209
209
  when :production, :qa, :sandbox
210
210
  443
211
211
  end
@@ -214,7 +214,7 @@ module Braintree
214
214
  def graphql_port # :nodoc:
215
215
  case @environment
216
216
  when :development, :integration
217
- ENV['GRAPHQL_PORT'] || 8080
217
+ ENV["GRAPHQL_PORT"] || 8080
218
218
  when :production, :qa, :sandbox
219
219
  443
220
220
  end
@@ -235,7 +235,7 @@ module Braintree
235
235
  def server # :nodoc:
236
236
  case @environment
237
237
  when :development, :integration
238
- ENV['GATEWAY_HOST'] || "localhost"
238
+ ENV["GATEWAY_HOST"] || "localhost"
239
239
  when :production
240
240
  "#{endpoint}.braintreegateway.com"
241
241
  when :qa
@@ -248,7 +248,7 @@ module Braintree
248
248
  def graphql_server # :nodoc:
249
249
  case @environment
250
250
  when :development, :integration
251
- ENV['GRAPHQL_HOST'] || "graphql.bt.local"
251
+ ENV["GRAPHQL_HOST"] || "graphql.bt.local"
252
252
  when :production
253
253
  "payments.braintree-api.com"
254
254
  when :qa
@@ -15,7 +15,7 @@ module Braintree
15
15
  class << self
16
16
  protected :new
17
17
  def _new(*args) # :nodoc:
18
- self.new *args
18
+ self.new(*args)
19
19
  end
20
20
  end
21
21
  end
@@ -15,7 +15,7 @@ module Braintree
15
15
  class << self
16
16
  protected :new
17
17
  def _new(*args) # :nodoc:
18
- self.new *args
18
+ self.new(*args)
19
19
  end
20
20
  end
21
21
  end
@@ -70,18 +70,6 @@ module Braintree
70
70
  Configuration.gateway.credit_card.create!(*args)
71
71
  end
72
72
 
73
- # Deprecated. Use Braintree::TransparentRedirect.url
74
- def self.create_credit_card_url
75
- warn "[DEPRECATED] CreditCard.create_credit_card_url is deprecated. Please use TransparentRedirect.url"
76
- Configuration.gateway.credit_card.create_credit_card_url
77
- end
78
-
79
- # Deprecated. Use Braintree::TransparentRedirect.confirm
80
- def self.create_from_transparent_redirect(query_string)
81
- warn "[DEPRECATED] CreditCard.create_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
82
- Configuration.gateway.credit_card.create_from_transparent_redirect(query_string)
83
- end
84
-
85
73
  def self.credit(token, transaction_attributes)
86
74
  Transaction.credit(transaction_attributes.merge(:payment_method_token => token))
87
75
  end
@@ -110,11 +98,6 @@ module Braintree
110
98
  Configuration.gateway.credit_card.from_nonce(*args)
111
99
  end
112
100
 
113
- # Deprecated. Use Braintree::PaymentMethod.grant
114
- def self.grant(*args)
115
- Configuration.gateway.credit_card.grant(*args)
116
- end
117
-
118
101
  def self.sale(token, transaction_attributes)
119
102
  Configuration.gateway.transaction.sale(transaction_attributes.merge(:payment_method_token => token))
120
103
  end
@@ -131,18 +114,6 @@ module Braintree
131
114
  Configuration.gateway.credit_card.update!(*args)
132
115
  end
133
116
 
134
- # Deprecated. Use Braintree::TransparentRedirect.confirm
135
- def self.update_from_transparent_redirect(query_string)
136
- warn "[DEPRECATED] CreditCard.update_via_transparent_redirect_request is deprecated. Please use TransparentRedirect.confirm"
137
- Configuration.gateway.credit_card.update_from_transparent_redirect(query_string)
138
- end
139
-
140
- # Deprecated. Use Braintree::TransparentRedirect.url
141
- def self.update_credit_card_url
142
- warn "[DEPRECATED] CreditCard.update_credit_card_url is deprecated. Please use TransparentRedirect.url"
143
- Configuration.gateway.credit_card.update_credit_card_url
144
- end
145
-
146
117
  def initialize(gateway, attributes) # :nodoc:
147
118
  @gateway = gateway
148
119
  set_instance_variables_from_hash(attributes)
@@ -152,28 +123,10 @@ module Braintree
152
123
  end
153
124
 
154
125
  def _most_recent_verification(attributes)
155
- verification = (attributes[:verifications] || []).sort_by{ |verification| verification[:created_at] }.reverse.first
126
+ verification = (attributes[:verifications] || []).sort_by { |verification| verification[:created_at] }.reverse.first
156
127
  CreditCardVerification._new(verification) if verification
157
128
  end
158
129
 
159
- # Deprecated. Use Braintree::CreditCard.credit
160
- def credit(transaction_attributes)
161
- warn "[DEPRECATED] credit as an instance method is deprecated. Please use CreditCard.credit"
162
- @gateway.transaction.credit(transaction_attributes.merge(:payment_method_token => token))
163
- end
164
-
165
- # Deprecated. Use Braintree::CreditCard.credit!
166
- def credit!(transaction_attributes)
167
- warn "[DEPRECATED] credit! as an instance method is deprecated. Please use CreditCard.credit!"
168
- return_object_or_raise(:transaction) { credit(transaction_attributes) }
169
- end
170
-
171
- # Deprecated. Use Braintree::CreditCard.delete
172
- def delete
173
- warn "[DEPRECATED] delete as an instance method is deprecated. Please use CreditCard.delete"
174
- @gateway.credit_card.delete(token)
175
- end
176
-
177
130
  # Returns true if this credit card is the customer's default payment method.
178
131
  def default?
179
132
  @default
@@ -202,34 +155,6 @@ module Braintree
202
155
  "#{bin}******#{last_4}"
203
156
  end
204
157
 
205
- # Deprecated. Use Braintree::CreditCard.sale
206
- def sale(transaction_attributes)
207
- warn "[DEPRECATED] sale as an instance method is deprecated. Please use CreditCard.sale"
208
- @gateway.transaction.sale(transaction_attributes.merge(:payment_method_token => token))
209
- end
210
-
211
- # Deprecated. Use Braintree::CreditCard.sale!
212
- def sale!(transaction_attributes)
213
- warn "[DEPRECATED] sale! as an instance method is deprecated. Please use CreditCard.sale!"
214
- return_object_or_raise(:transaction) { sale(transaction_attributes) }
215
- end
216
-
217
- # Deprecated. Use Braintree::CreditCard.update
218
- def update(attributes)
219
- warn "[DEPRECATED] update as an instance method is deprecated. Please use CreditCard.update"
220
- result = @gateway.credit_card.update(token, attributes)
221
- if result.success?
222
- copy_instance_variables_from_object result.credit_card
223
- end
224
- result
225
- end
226
-
227
- # Deprecated. Use Braintree::CreditCard.update!
228
- def update!(attributes)
229
- warn "[DEPRECATED] update! as an instance method is deprecated. Please use CreditCard.update!"
230
- return_object_or_raise(:credit_card) { update(attributes) }
231
- end
232
-
233
158
  def nonce
234
159
  @nonce ||= PaymentMethodNonce.create(token)
235
160
  end
@@ -256,7 +181,7 @@ module Braintree
256
181
  end
257
182
 
258
183
  def self._new(*args) # :nodoc:
259
- self.new *args
184
+ self.new(*args)
260
185
  end
261
186
  end
262
187
  end
@@ -20,17 +20,6 @@ module Braintree
20
20
  return_object_or_raise(:credit_card) { create(*args) }
21
21
  end
22
22
 
23
- # Deprecated
24
- def create_credit_card_url
25
- "#{@config.base_merchant_url}/payment_methods/all/create_via_transparent_redirect_request"
26
- end
27
-
28
- # Deprecated
29
- def create_from_transparent_redirect(query_string)
30
- params = @gateway.transparent_redirect.parse_and_validate_query_string query_string
31
- _do_create("/payment_methods/all/confirm_transparent_redirect_request", :id => params[:id])
32
- end
33
-
34
23
  def credit(token, transaction_attributes)
35
24
  @gateway.transaction.credit(transaction_attributes.merge(:payment_method_token => token))
36
25
  end
@@ -49,8 +38,8 @@ module Braintree
49
38
  end
50
39
 
51
40
  def expiring_between(start_date, end_date, options = {})
52
- formatted_start_date = start_date.strftime('%m%Y')
53
- formatted_end_date = end_date.strftime('%m%Y')
41
+ formatted_start_date = start_date.strftime("%m%Y")
42
+ formatted_end_date = end_date.strftime("%m%Y")
54
43
  response = @config.http.post("#{@config.base_merchant_path}/payment_methods/all/expiring_ids?start=#{formatted_start_date}&end=#{formatted_end_date}")
55
44
  ResourceCollection.new(response) { |ids| _fetch_expiring_between(formatted_start_date, formatted_end_date, ids) }
56
45
  end
@@ -71,11 +60,6 @@ module Braintree
71
60
  raise NotFoundError, "nonce #{nonce.inspect} locked, consumed, or not found"
72
61
  end
73
62
 
74
- # Deprecated in favor of PaymentMethodGateway.grant
75
- def grant(token, allow_vaulting)
76
- @gateway.payment_method.grant(token, allow_vaulting)
77
- end
78
-
79
63
  def update(token, attributes)
80
64
  Util.verify_keys(CreditCardGateway._update_signature, attributes)
81
65
  _do_update(:put, "/payment_methods/credit_card/#{token}", :credit_card => attributes)
@@ -85,19 +69,6 @@ module Braintree
85
69
  return_object_or_raise(:credit_card) { update(*args) }
86
70
  end
87
71
 
88
- # Deprecated
89
- def update_from_transparent_redirect(query_string)
90
- warn "[DEPRECATED] CreditCard.update_via_transparent_redirect_request is deprecated. Please use TransparentRedirect.confirm"
91
- params = @gateway.transparent_redirect.parse_and_validate_query_string query_string
92
- _do_update(:post, "/payment_methods/all/confirm_transparent_redirect_request", :id => params[:id])
93
- end
94
-
95
- # Deprecated
96
- def update_credit_card_url
97
- warn "[DEPRECATED] CreditCard.update_credit_card_url is deprecated. Please use TransparentRedirect.url"
98
- "#{@config.base_merchant_url}/payment_methods/all/update_via_transparent_redirect_request"
99
- end
100
-
101
72
  def self._create_signature # :nodoc:
102
73
  _signature(:create)
103
74
  end
@@ -108,11 +79,21 @@ module Braintree
108
79
 
109
80
  def self._signature(type) # :nodoc:
110
81
  billing_address_params = AddressGateway._shared_signature
111
- options = [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type]
82
+ options = [
83
+ :fail_on_duplicate_payment_method,
84
+ :make_default,
85
+ :skip_advanced_fraud_checking,
86
+ :venmo_sdk_session,
87
+ :verification_account_type,
88
+ :verification_amount,
89
+ :verification_currency_iso_code,
90
+ :verification_merchant_account_id,
91
+ :verify_card
92
+ ]
112
93
  signature = [
113
- :billing_address_id, :cardholder_name, :cvv, :device_session_id, :expiration_date,
114
- :expiration_month, :expiration_year, :number, :token, :venmo_sdk_payment_method_code,
115
- :device_data, :fraud_merchant_id, :payment_method_nonce,
94
+ :billing_address_id, :cardholder_name, :cvv, :expiration_date, :expiration_month,
95
+ :expiration_year, :number, :token, :venmo_sdk_payment_method_code, :device_data,
96
+ :payment_method_nonce,
116
97
  {:external_vault => [:network_transaction_id]},
117
98
  {:options => options},
118
99
  {:billing_address => billing_address_params}
@@ -174,7 +155,7 @@ module Braintree
174
155
  def _fetch_expiring_between(formatted_start_date, formatted_end_date, ids) # :nodoc:
175
156
  response = @config.http.post(
176
157
  "#{@config.base_merchant_path}/payment_methods/all/expiring?start=#{formatted_start_date}&end=#{formatted_end_date}",
177
- :search => {:ids => ids}
158
+ :search => {:ids => ids},
178
159
  )
179
160
  attributes = response[:payment_methods]
180
161
  Util.extract_attribute_as_array(attributes, :credit_card).map { |attrs| CreditCard._new(@gateway, attrs) }
@@ -3,11 +3,24 @@ module Braintree
3
3
  include BaseModule
4
4
  include Braintree::Util::IdEquality
5
5
 
6
+ module GatewayRejectionReason
7
+ ApplicationIncomplete = "application_incomplete"
8
+ AVS = "avs"
9
+ AVSAndCVV = "avs_and_cvv"
10
+ CVV = "cvv"
11
+ Duplicate = "duplicate"
12
+ Fraud = "fraud"
13
+ RiskThreshold = "risk_threshold"
14
+ ThreeDSecure = "three_d_secure"
15
+ TokenIssuance = "token_issuance"
16
+ Unrecognized = "unrecognized"
17
+ end
18
+
6
19
  module Status
7
- Failed = 'failed'
8
- GatewayRejected = 'gateway_rejected'
9
- ProcessorDeclined = 'processor_declined'
10
- Verified = 'verified'
20
+ Failed = "failed"
21
+ GatewayRejected = "gateway_rejected"
22
+ ProcessorDeclined = "processor_declined"
23
+ Verified = "verified"
11
24
 
12
25
  All = [Failed, GatewayRejected, ProcessorDeclined, Verified]
13
26
  end
@@ -79,7 +92,7 @@ module Braintree
79
92
  end
80
93
 
81
94
  def self._new(*args) # :nodoc:
82
- self.new *args
95
+ self.new(*args)
83
96
  end
84
97
 
85
98
  def self.find(*args)
@@ -6,7 +6,7 @@ module Braintree
6
6
  :customer_email,
7
7
  :customer_id,
8
8
  :id,
9
- :payment_method_token
9
+ :payment_method_token,
10
10
  )
11
11
 
12
12
  equality_fields :credit_card_expiration_date