braintree 4.14.0 → 4.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (241) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/account_updater_daily_report.rb +3 -3
  3. data/lib/braintree/ach_mandate.rb +1 -1
  4. data/lib/braintree/add_on_gateway.rb +1 -1
  5. data/lib/braintree/address.rb +4 -4
  6. data/lib/braintree/address_gateway.rb +5 -5
  7. data/lib/braintree/advanced_search.rb +10 -10
  8. data/lib/braintree/apple_pay.rb +3 -3
  9. data/lib/braintree/apple_pay_card.rb +3 -3
  10. data/lib/braintree/apple_pay_options.rb +3 -3
  11. data/lib/braintree/authorization_adjustment.rb +3 -3
  12. data/lib/braintree/base_module.rb +1 -1
  13. data/lib/braintree/bin_data.rb +2 -2
  14. data/lib/braintree/client_token_gateway.rb +1 -1
  15. data/lib/braintree/configuration.rb +22 -22
  16. data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
  17. data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
  18. data/lib/braintree/credit_card.rb +22 -9
  19. data/lib/braintree/credit_card_gateway.rb +23 -11
  20. data/lib/braintree/credit_card_verification.rb +3 -3
  21. data/lib/braintree/credit_card_verification_search.rb +1 -1
  22. data/lib/braintree/customer.rb +5 -9
  23. data/lib/braintree/customer_gateway.rb +7 -7
  24. data/lib/braintree/customer_search.rb +1 -1
  25. data/lib/braintree/descriptor.rb +1 -1
  26. data/lib/braintree/digest.rb +1 -1
  27. data/lib/braintree/disbursement.rb +5 -5
  28. data/lib/braintree/discount_gateway.rb +1 -1
  29. data/lib/braintree/dispute/evidence.rb +1 -1
  30. data/lib/braintree/dispute/paypal_message.rb +1 -1
  31. data/lib/braintree/dispute/status_history.rb +1 -1
  32. data/lib/braintree/dispute/transaction.rb +1 -1
  33. data/lib/braintree/dispute/transaction_details.rb +1 -1
  34. data/lib/braintree/dispute.rb +3 -3
  35. data/lib/braintree/dispute_gateway.rb +1 -1
  36. data/lib/braintree/dispute_search.rb +1 -1
  37. data/lib/braintree/document_upload.rb +2 -2
  38. data/lib/braintree/document_upload_gateway.rb +3 -3
  39. data/lib/braintree/enriched_customer_data.rb +2 -2
  40. data/lib/braintree/error_result.rb +2 -3
  41. data/lib/braintree/errors.rb +3 -3
  42. data/lib/braintree/exceptions.rb +1 -2
  43. data/lib/braintree/exchange_rate.rb +2 -2
  44. data/lib/braintree/exchange_rate_quote.rb +3 -3
  45. data/lib/braintree/exchange_rate_quote_gateway.rb +1 -1
  46. data/lib/braintree/exchange_rate_quote_input.rb +3 -3
  47. data/lib/braintree/exchange_rate_quote_request.rb +3 -3
  48. data/lib/braintree/exchange_rate_quote_response.rb +3 -3
  49. data/lib/braintree/facilitated_details.rb +1 -1
  50. data/lib/braintree/facilitator_details.rb +1 -1
  51. data/lib/braintree/google_pay_card.rb +3 -3
  52. data/lib/braintree/granted_payment_instrument_update.rb +1 -1
  53. data/lib/braintree/graphql_client.rb +1 -1
  54. data/lib/braintree/http.rb +1 -1
  55. data/lib/braintree/local_payment_completed.rb +2 -2
  56. data/lib/braintree/local_payment_expired.rb +2 -2
  57. data/lib/braintree/local_payment_funded.rb +2 -2
  58. data/lib/braintree/local_payment_reversed.rb +2 -2
  59. data/lib/braintree/merchant.rb +3 -3
  60. data/lib/braintree/merchant_account.rb +2 -2
  61. data/lib/braintree/merchant_account_gateway.rb +9 -9
  62. data/lib/braintree/meta_checkout_card.rb +89 -0
  63. data/lib/braintree/meta_checkout_token.rb +88 -0
  64. data/lib/braintree/modification.rb +3 -3
  65. data/lib/braintree/oauth_credentials.rb +3 -3
  66. data/lib/braintree/paginated_collection.rb +2 -2
  67. data/lib/braintree/paginated_result.rb +1 -1
  68. data/lib/braintree/payment_instrument_type.rb +2 -0
  69. data/lib/braintree/payment_method_customer_data_updated_metadata.rb +2 -2
  70. data/lib/braintree/payment_method_gateway.rb +23 -10
  71. data/lib/braintree/payment_method_nonce.rb +4 -4
  72. data/lib/braintree/payment_method_nonce_details.rb +1 -1
  73. data/lib/braintree/payment_method_nonce_details_payer_info.rb +1 -1
  74. data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
  75. data/lib/braintree/paypal_account.rb +1 -2
  76. data/lib/braintree/paypal_account_gateway.rb +5 -5
  77. data/lib/braintree/plan.rb +1 -1
  78. data/lib/braintree/plan_gateway.rb +2 -2
  79. data/lib/braintree/resource_collection.rb +2 -2
  80. data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
  81. data/lib/braintree/risk_data.rb +1 -1
  82. data/lib/braintree/samsung_pay_card.rb +5 -5
  83. data/lib/braintree/sepa_direct_debit_account.rb +2 -2
  84. data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +1 -1
  85. data/lib/braintree/settlement_batch_summary_gateway.rb +1 -1
  86. data/lib/braintree/sha256_digest.rb +1 -1
  87. data/lib/braintree/subscription/status_details.rb +1 -1
  88. data/lib/braintree/subscription.rb +2 -2
  89. data/lib/braintree/subscription_gateway.rb +6 -6
  90. data/lib/braintree/subscription_search.rb +1 -1
  91. data/lib/braintree/successful_result.rb +2 -2
  92. data/lib/braintree/test/credit_card.rb +7 -10
  93. data/lib/braintree/test/merchant_account.rb +1 -1
  94. data/lib/braintree/test/nonce.rb +4 -0
  95. data/lib/braintree/test/transaction_amounts.rb +2 -3
  96. data/lib/braintree/test/venmo_sdk.rb +2 -0
  97. data/lib/braintree/testing_gateway.rb +1 -1
  98. data/lib/braintree/three_d_secure_info.rb +1 -1
  99. data/lib/braintree/transaction/address_details.rb +1 -1
  100. data/lib/braintree/transaction/credit_card_details.rb +4 -1
  101. data/lib/braintree/transaction/customer_details.rb +1 -1
  102. data/lib/braintree/transaction/disbursement_details.rb +1 -1
  103. data/lib/braintree/transaction/local_payment_details.rb +2 -0
  104. data/lib/braintree/transaction/meta_checkout_card_details.rb +52 -0
  105. data/lib/braintree/transaction/meta_checkout_token_details.rb +54 -0
  106. data/lib/braintree/transaction/samsung_pay_card_details.rb +1 -1
  107. data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +1 -1
  108. data/lib/braintree/transaction/status_details.rb +1 -1
  109. data/lib/braintree/transaction/subscription_details.rb +1 -1
  110. data/lib/braintree/transaction/us_bank_account_details.rb +1 -1
  111. data/lib/braintree/transaction/visa_checkout_card_details.rb +1 -1
  112. data/lib/braintree/transaction.rb +27 -20
  113. data/lib/braintree/transaction_gateway.rb +23 -12
  114. data/lib/braintree/transaction_line_item.rb +2 -2
  115. data/lib/braintree/transaction_line_item_gateway.rb +1 -1
  116. data/lib/braintree/transaction_review.rb +1 -1
  117. data/lib/braintree/transaction_search.rb +7 -6
  118. data/lib/braintree/unknown_payment_method.rb +1 -1
  119. data/lib/braintree/us_bank_account.rb +2 -2
  120. data/lib/braintree/us_bank_account_verification.rb +23 -15
  121. data/lib/braintree/us_bank_account_verification_search.rb +1 -1
  122. data/lib/braintree/util.rb +3 -3
  123. data/lib/braintree/validation_error.rb +1 -1
  124. data/lib/braintree/validation_error_collection.rb +3 -3
  125. data/lib/braintree/venmo_account.rb +3 -3
  126. data/lib/braintree/venmo_profile_data.rb +6 -4
  127. data/lib/braintree/version.rb +1 -1
  128. data/lib/braintree/visa_checkout_card.rb +7 -7
  129. data/lib/braintree/webhook_notification.rb +3 -2
  130. data/lib/braintree/webhook_notification_gateway.rb +3 -3
  131. data/lib/braintree/webhook_testing.rb +1 -1
  132. data/lib/braintree/webhook_testing_gateway.rb +18 -1
  133. data/lib/braintree/xml/generator.rb +1 -1
  134. data/lib/braintree/xml/libxml.rb +1 -1
  135. data/lib/braintree/xml/parser.rb +2 -2
  136. data/lib/braintree/xml/rexml.rb +2 -2
  137. data/lib/braintree/xml.rb +1 -1
  138. data/lib/braintree.rb +4 -1
  139. data/spec/integration/braintree/add_on_spec.rb +9 -9
  140. data/spec/integration/braintree/address_spec.rb +69 -69
  141. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  142. data/spec/integration/braintree/apple_pay_spec.rb +8 -8
  143. data/spec/integration/braintree/client_api/client_token_spec.rb +15 -15
  144. data/spec/integration/braintree/credit_card_spec.rb +223 -223
  145. data/spec/integration/braintree/credit_card_verification_search_spec.rb +16 -16
  146. data/spec/integration/braintree/credit_card_verification_spec.rb +52 -52
  147. data/spec/integration/braintree/customer_search_spec.rb +20 -20
  148. data/spec/integration/braintree/customer_spec.rb +313 -313
  149. data/spec/integration/braintree/disbursement_spec.rb +2 -2
  150. data/spec/integration/braintree/discount_spec.rb +9 -9
  151. data/spec/integration/braintree/dispute_search_spec.rb +0 -1
  152. data/spec/integration/braintree/dispute_spec.rb +87 -87
  153. data/spec/integration/braintree/document_upload_spec.rb +17 -17
  154. data/spec/integration/braintree/error_codes_spec.rb +2 -2
  155. data/spec/integration/braintree/http_spec.rb +28 -28
  156. data/spec/integration/braintree/merchant_account_spec.rb +127 -127
  157. data/spec/integration/braintree/merchant_spec.rb +103 -103
  158. data/spec/integration/braintree/oauth_spec.rb +61 -61
  159. data/spec/integration/braintree/payment_method_nonce_spec.rb +89 -69
  160. data/spec/integration/braintree/payment_method_spec.rb +389 -389
  161. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +150 -78
  162. data/spec/integration/braintree/paypal_account_spec.rb +38 -38
  163. data/spec/integration/braintree/plan_spec.rb +15 -15
  164. data/spec/integration/braintree/samsung_pay_card_spec.rb +65 -65
  165. data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +51 -51
  166. data/spec/integration/braintree/settlement_batch_summary_spec.rb +11 -11
  167. data/spec/integration/braintree/subscription_spec.rb +364 -364
  168. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  169. data/spec/integration/braintree/test_transaction_spec.rb +19 -19
  170. data/spec/integration/braintree/transaction_line_item_spec.rb +6 -6
  171. data/spec/integration/braintree/transaction_search_spec.rb +225 -165
  172. data/spec/integration/braintree/transaction_spec.rb +1502 -1210
  173. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -32
  174. data/spec/integration/braintree/us_bank_account_spec.rb +30 -30
  175. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +18 -18
  176. data/spec/integration/braintree/us_bank_account_verification_spec.rb +33 -33
  177. data/spec/integration/braintree/visa_checkout_card_spec.rb +57 -57
  178. data/spec/spec_helper.rb +9 -8
  179. data/spec/unit/braintree/address_spec.rb +8 -8
  180. data/spec/unit/braintree/base_module_spec.rb +4 -4
  181. data/spec/unit/braintree/client_token_spec.rb +2 -2
  182. data/spec/unit/braintree/configuration_spec.rb +57 -57
  183. data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
  184. data/spec/unit/braintree/credit_card_spec.rb +31 -29
  185. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +28 -28
  186. data/spec/unit/braintree/credit_card_verification_search_spec.rb +9 -9
  187. data/spec/unit/braintree/credit_card_verification_spec.rb +17 -17
  188. data/spec/unit/braintree/customer_spec.rb +41 -40
  189. data/spec/unit/braintree/digest_spec.rb +5 -5
  190. data/spec/unit/braintree/disbursement_spec.rb +11 -11
  191. data/spec/unit/braintree/dispute_search_spec.rb +2 -2
  192. data/spec/unit/braintree/dispute_spec.rb +56 -56
  193. data/spec/unit/braintree/document_upload_spec.rb +8 -8
  194. data/spec/unit/braintree/enriched_customer_data_spec.rb +11 -2
  195. data/spec/unit/braintree/error_result_spec.rb +5 -5
  196. data/spec/unit/braintree/errors_spec.rb +9 -9
  197. data/spec/unit/braintree/http_spec.rb +9 -9
  198. data/spec/unit/braintree/local_payment_completed_spec.rb +11 -11
  199. data/spec/unit/braintree/local_payment_expired_spec.rb +2 -2
  200. data/spec/unit/braintree/local_payment_funded_spec.rb +6 -6
  201. data/spec/unit/braintree/merchant_account_spec.rb +4 -4
  202. data/spec/unit/braintree/meta_checkout_card_details_spec.rb +60 -0
  203. data/spec/unit/braintree/meta_checkout_card_spec.rb +60 -0
  204. data/spec/unit/braintree/meta_checkout_token_details_spec.rb +63 -0
  205. data/spec/unit/braintree/meta_checkout_token_spec.rb +63 -0
  206. data/spec/unit/braintree/modification_spec.rb +1 -1
  207. data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +6 -6
  208. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +7 -7
  209. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +14 -14
  210. data/spec/unit/braintree/payment_method_spec.rb +19 -19
  211. data/spec/unit/braintree/paypal_account_spec.rb +4 -4
  212. data/spec/unit/braintree/resource_collection_spec.rb +7 -7
  213. data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +1 -1
  214. data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
  215. data/spec/unit/braintree/signature_service_spec.rb +2 -2
  216. data/spec/unit/braintree/subscription_search_spec.rb +17 -17
  217. data/spec/unit/braintree/subscription_spec.rb +8 -8
  218. data/spec/unit/braintree/successful_result_spec.rb +5 -5
  219. data/spec/unit/braintree/three_d_secure_info_spec.rb +20 -20
  220. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +5 -5
  221. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  222. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  223. data/spec/unit/braintree/transaction/local_payment_details_spec.rb +30 -0
  224. data/spec/unit/braintree/transaction_gateway_spec.rb +39 -7
  225. data/spec/unit/braintree/transaction_search_spec.rb +2 -2
  226. data/spec/unit/braintree/transaction_spec.rb +101 -93
  227. data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
  228. data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
  229. data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
  230. data/spec/unit/braintree/us_bank_account_verification_spec.rb +12 -7
  231. data/spec/unit/braintree/util_spec.rb +27 -27
  232. data/spec/unit/braintree/validation_error_collection_spec.rb +34 -34
  233. data/spec/unit/braintree/validation_error_spec.rb +4 -4
  234. data/spec/unit/braintree/venmo_profile_data_spec.rb +16 -5
  235. data/spec/unit/braintree/webhook_notification_spec.rb +206 -191
  236. data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
  237. data/spec/unit/braintree/xml/parser_spec.rb +8 -8
  238. data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
  239. data/spec/unit/braintree/xml_spec.rb +17 -17
  240. data/spec/unit/braintree_spec.rb +2 -2
  241. metadata +11 -2
@@ -77,9 +77,9 @@ module Braintree
77
77
  All = constants.map { |c| const_get(c) }
78
78
  end
79
79
 
80
- module Type # :nodoc:
81
- Credit = "credit" # :nodoc:
82
- Sale = "sale" # :nodoc:
80
+ module Type
81
+ Credit = "credit"
82
+ Sale = "sale"
83
83
 
84
84
  All = constants.map { |c| const_get(c) }
85
85
  end
@@ -91,8 +91,9 @@ module Braintree
91
91
  end
92
92
  end
93
93
 
94
- attr_reader :acquirer_reference_number
95
94
  attr_reader :ach_return_code
95
+ attr_reader :ach_return_responses
96
+ attr_reader :acquirer_reference_number
96
97
  attr_reader :add_ons
97
98
  attr_reader :additional_processor_response # The raw response from the processor.
98
99
  attr_reader :amount
@@ -111,6 +112,7 @@ module Braintree
111
112
  attr_reader :custom_fields
112
113
  attr_reader :customer_details
113
114
  attr_reader :cvv_response_code
115
+ attr_reader :debit_network
114
116
  attr_reader :descriptor
115
117
  attr_reader :disbursement_details
116
118
  attr_reader :discount_amount
@@ -129,6 +131,8 @@ module Braintree
129
131
  attr_reader :merchant_account_id
130
132
  attr_reader :merchant_advice_code
131
133
  attr_reader :merchant_advice_code_text
134
+ attr_reader :meta_checkout_card_details
135
+ attr_reader :meta_checkout_token_details
132
136
  attr_reader :network_response_code # Response code from the card network
133
137
  attr_reader :network_response_text # Response text from the card network
134
138
  attr_reader :network_token_details
@@ -140,18 +144,18 @@ module Braintree
140
144
  attr_reader :paypal_details
141
145
  attr_reader :paypal_here_details
142
146
  attr_reader :plan_id
143
- attr_reader :processor_authorization_code # Authorization code from the processor.
144
- attr_reader :processor_response_code # Response code from the processor.
145
- attr_reader :processor_response_text # Response text from the processor.
146
- attr_reader :processor_response_type # Response type from the processor.
147
- attr_reader :processor_settlement_response_code # Settlement response code from the processor.
148
- attr_reader :processor_settlement_response_text # Settlement response text from the processor.
147
+ attr_reader :processor_authorization_code
148
+ attr_reader :processor_response_code
149
+ attr_reader :processor_response_text
150
+ attr_reader :processor_response_type
151
+ attr_reader :processor_settlement_response_code
152
+ attr_reader :processor_settlement_response_text
149
153
  attr_reader :product_sku
150
154
  attr_reader :purchase_order_number
151
155
  attr_reader :recurring
152
156
  attr_reader :refund_ids
153
- attr_reader :refunded_transaction_id
154
157
  attr_reader :refunded_installments
158
+ attr_reader :refunded_transaction_id
155
159
  attr_reader :retried
156
160
  attr_reader :retried_transaction_id # the primary/parent transaction id of any retried transaction
157
161
  attr_reader :retrieval_reference_number
@@ -159,9 +163,9 @@ module Braintree
159
163
  attr_reader :risk_data
160
164
  attr_reader :samsung_pay_card_details
161
165
  attr_reader :sca_exemption_requested
162
- attr_reader :service_fee_amount
163
166
  attr_reader :sepa_direct_debit_account_details
164
167
  attr_reader :sepa_direct_debit_return_code
168
+ attr_reader :service_fee_amount
165
169
  attr_reader :settlement_batch_id
166
170
  attr_reader :shipping_amount
167
171
  attr_reader :shipping_details
@@ -173,13 +177,12 @@ module Braintree
173
177
  attr_reader :tax_amount
174
178
  attr_reader :tax_exempt
175
179
  attr_reader :three_d_secure_info
176
- attr_reader :type # Will either be "sale" or "credit"
180
+ attr_reader :type
177
181
  attr_reader :updated_at
178
182
  attr_reader :us_bank_account_details
179
183
  attr_reader :venmo_account_details
180
184
  attr_reader :visa_checkout_card_details
181
185
  attr_reader :voice_referral_number
182
- attr_reader :ach_return_responses
183
186
 
184
187
  def self.adjust_authorization(*args)
185
188
  Configuration.gateway.transaction.adjust_authorization(*args)
@@ -297,7 +300,7 @@ module Braintree
297
300
  Configuration.gateway.transaction.void!(*args)
298
301
  end
299
302
 
300
- def initialize(gateway, attributes) # :nodoc:
303
+ def initialize(gateway, attributes)
301
304
  @gateway = gateway
302
305
  set_instance_variables_from_hash(attributes)
303
306
 
@@ -312,6 +315,8 @@ module Braintree
312
315
  @disbursement_details = DisbursementDetails.new(@disbursement_details)
313
316
  @google_pay_details = GooglePayDetails.new(@google_pay_card)
314
317
  @local_payment_details = LocalPaymentDetails.new(@local_payment)
318
+ @meta_checkout_card_details = MetaCheckoutCardDetails.new(attributes[:meta_checkout_card])
319
+ @meta_checkout_token_details = MetaCheckoutTokenDetails.new(attributes[:meta_checkout_token])
315
320
  @payment_instrument_type = attributes[:payment_instrument_type]
316
321
  @payment_receipt = PaymentReceipt.new(attributes[:payment_receipt]) if attributes[:payment_receipt]
317
322
  @paypal_details = PayPalDetails.new(@paypal)
@@ -341,7 +346,7 @@ module Braintree
341
346
  refunded_installments.map! { |attrs| Installment.new(attrs) } if refunded_installments
342
347
  end
343
348
 
344
- def inspect # :nodoc:
349
+ def inspect
345
350
  first = [:id, :type, :amount, :status]
346
351
  order = first + (self.class._attributes - first)
347
352
  nice_attributes = order.map do |attr|
@@ -358,12 +363,10 @@ module Braintree
358
363
  @gateway.transaction_line_item.find_all(id)
359
364
  end
360
365
 
361
- # Returns true if the transaction has been refunded. False otherwise.
362
366
  def refunded?
363
367
  !@refund_id.nil?
364
368
  end
365
369
 
366
- # Returns true if the transaction has been disbursed. False otherwise.
367
370
  def disbursed?
368
371
  @disbursement_details.valid?
369
372
  end
@@ -372,6 +375,7 @@ module Braintree
372
375
  # vault_billing_address will return the associated Braintree::Address. Because the
373
376
  # vault billing address can be updated after the transaction was created, the attributes
374
377
  # on vault_billing_address may not match the attributes on billing_details.
378
+ # NEXT_MAJOR_VERSION these methods are not documented in the developer docs, remove
375
379
  def vault_billing_address
376
380
  return nil if billing_details.id.nil?
377
381
  @gateway.address.find(customer_details.id, billing_details.id)
@@ -381,6 +385,7 @@ module Braintree
381
385
  # vault_credit_card will return the associated Braintree::CreditCard. Because the
382
386
  # vault credit card can be updated after the transaction was created, the attributes
383
387
  # on vault_credit_card may not match the attributes on credit_card_details.
388
+ # NEXT_MAJOR_VERSION these methods are not documented in the developer docs, remove
384
389
  def vault_credit_card
385
390
  return nil if credit_card_details.token.nil?
386
391
  @gateway.credit_card.find(credit_card_details.token)
@@ -390,6 +395,7 @@ module Braintree
390
395
  # vault_customer will return the associated Braintree::Customer. Because the
391
396
  # vault customer can be updated after the transaction was created, the attributes
392
397
  # on vault_customer may not match the attributes on customer_details.
398
+ # NEXT_MAJOR_VERSION these methods are not documented in the developer docs, remove
393
399
  def vault_customer
394
400
  return nil if customer_details.id.nil?
395
401
  @gateway.customer.find(customer_details.id)
@@ -399,6 +405,7 @@ module Braintree
399
405
  # vault_shipping_address will return the associated Braintree::Address. Because the
400
406
  # vault shipping address can be updated after the transaction was created, the attributes
401
407
  # on vault_shipping_address may not match the attributes on shipping_details.
408
+ # NEXT_MAJOR_VERSION these methods are not documented in the developer docs, remove
402
409
  def vault_shipping_address
403
410
  return nil if shipping_details.id.nil?
404
411
  @gateway.address.find(customer_details.id, shipping_details.id)
@@ -410,12 +417,12 @@ module Braintree
410
417
 
411
418
  class << self
412
419
  protected :new
413
- def _new(*args) # :nodoc:
420
+ def _new(*args)
414
421
  self.new(*args)
415
422
  end
416
423
  end
417
424
 
418
- def self._attributes # :nodoc:
425
+ def self._attributes
419
426
  [:amount, :created_at, :credit_card_details, :customer_details, :id, :status, :subscription_details, :type, :updated_at, :processed_with_network_token?]
420
427
  end
421
428
  end
@@ -1,5 +1,5 @@
1
1
  module Braintree
2
- class TransactionGateway # :nodoc:
2
+ class TransactionGateway
3
3
  include BaseModule
4
4
 
5
5
  def initialize(gateway)
@@ -9,6 +9,14 @@ module Braintree
9
9
  end
10
10
 
11
11
  def create(attributes)
12
+ # NEXT_MAJOR_VERSION remove this check
13
+ if attributes.has_key?(:venmo_sdk_payment_method_code) || attributes.has_key?(:venmo_sdk_session)
14
+ warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead."
15
+ end
16
+ # NEXT_MAJOR_VERSION remove this check
17
+ if attributes.has_key?(:three_d_secure_token)
18
+ warn "[DEPRECATED] Passing :three_d_secure_token to create is deprecated. Please use :three_d_secure_authentication_id"
19
+ end
12
20
  Util.verify_keys(TransactionGateway._create_signature, attributes)
13
21
  _do_create "/transactions", :transaction => attributes
14
22
  end
@@ -179,19 +187,22 @@ module Braintree
179
187
  return_object_or_raise(:transaction) { void(*args) }
180
188
  end
181
189
 
182
- def self._clone_signature # :nodoc:
190
+ def self._clone_signature
183
191
  [:amount, :channel, {:options => [:submit_for_settlement]}]
184
192
  end
185
193
 
186
- def self._create_signature # :nodoc:
194
+ # NEXT_MAJOR_VERSION Remove venmo_sdk_payment_method_code, venmo_sdk_session, and three_d_secure_token
195
+ # The old venmo SDK class has been deprecated
196
+ # three_d_secure_token has been deprecated in favor of three_d_secure_authentication_id
197
+ def self._create_signature
187
198
  [
188
199
  :amount, :billing_address_id, :channel, :customer_id, :device_data, :discount_amount,
189
200
  :merchant_account_id, :order_id, :payment_method_nonce, :payment_method_token,
190
201
  :product_sku, :purchase_order_number, :service_fee_amount, :shared_billing_address_id,
191
202
  :shared_customer_id, :shared_payment_method_nonce, :shared_payment_method_token,
192
203
  :shared_shipping_address_id, :shipping_address_id, :shipping_amount,
193
- :ships_from_postal_code, :tax_amount, :tax_exempt, :three_d_secure_authentication_id,
194
- :three_d_secure_token, :transaction_source, :type, :venmo_sdk_payment_method_code,
204
+ :ships_from_postal_code, :tax_amount, :tax_exempt, :three_d_secure_authentication_id,:three_d_secure_token, #Deprecated
205
+ :transaction_source, :type, :venmo_sdk_payment_method_code, # Deprecated
195
206
  :sca_exemption, :currency_iso_code, :exchange_rate_quote_id,
196
207
  {: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
208
  {:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
@@ -222,7 +233,7 @@ module Braintree
222
233
  :submit_for_settlement,
223
234
  :add_billing_address_to_payment_method,
224
235
  :store_shipping_address_in_vault,
225
- :venmo_sdk_session,
236
+ :venmo_sdk_session, # Deprecated
226
237
  :payee_id,
227
238
  :payee_email,
228
239
  :skip_advanced_fraud_checking,
@@ -246,7 +257,7 @@ module Braintree
246
257
  {:industry => [
247
258
  :industry_type,
248
259
  {:data => [
249
- :folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
260
+ :country_code, :date_of_birth, :folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
250
261
  :passenger_first_name, :passenger_last_name, :passenger_middle_initial, :passenger_title, :issued_date, :travel_agency_name, :travel_agency_code, :ticket_number,
251
262
  :issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket, :no_show, :advanced_deposit, :fire_safe, :property_phone, :ticket_issuer_address, :arrival_date,
252
263
  {:legs => [
@@ -264,14 +275,14 @@ module Braintree
264
275
  ]
265
276
  end
266
277
 
267
- def self._submit_for_settlement_signature # :nodoc:
278
+ def self._submit_for_settlement_signature
268
279
  [
269
280
  :order_id,
270
281
  {:descriptor => [:name, :phone, :url]},
271
282
  {:industry => [
272
283
  :industry_type,
273
284
  {:data => [
274
- :folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
285
+ :country_code, :date_of_birth, :folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
275
286
  :passenger_first_name, :passenger_last_name, :passenger_middle_initial, :passenger_title, :issued_date, :travel_agency_name, :travel_agency_code, :ticket_number,
276
287
  :issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket, :no_show, :advanced_deposit, :fire_safe, :property_phone, :ticket_issuer_address, :arrival_date,
277
288
  {:legs => [
@@ -299,7 +310,7 @@ module Braintree
299
310
  ]
300
311
  end
301
312
 
302
- def self._update_details_signature # :nodoc:
313
+ def self._update_details_signature
303
314
  [
304
315
  :amount,
305
316
  :order_id,
@@ -315,7 +326,7 @@ module Braintree
315
326
  ]
316
327
  end
317
328
 
318
- def _do_create(path, params=nil) # :nodoc:
329
+ def _do_create(path, params=nil)
319
330
  if !params.nil?
320
331
  params = Util.replace_key(params, :google_pay_card, :android_pay_card)
321
332
  end
@@ -323,7 +334,7 @@ module Braintree
323
334
  _handle_transaction_response(response)
324
335
  end
325
336
 
326
- def _fetch_transactions(search, ids) # :nodoc:
337
+ def _fetch_transactions(search, ids)
327
338
  search.ids.in ids
328
339
  response = @config.http.post("#{@config.base_merchant_path}/transactions/advanced_search", {:search => search.to_hash})
329
340
  attributes = response[:credit_card_transactions]
@@ -15,7 +15,7 @@ module Braintree
15
15
  attr_reader :commodity_code
16
16
  attr_reader :url
17
17
 
18
- def initialize(gateway, attributes) # :nodoc:
18
+ def initialize(gateway, attributes)
19
19
  @gateway = gateway
20
20
  set_instance_variables_from_hash(attributes)
21
21
  @quantity = Util.to_big_decimal(quantity)
@@ -28,7 +28,7 @@ module Braintree
28
28
 
29
29
  class << self
30
30
  protected :new
31
- def _new(*args) # :nodoc:
31
+ def _new(*args)
32
32
  self.new(*args)
33
33
  end
34
34
  end
@@ -1,5 +1,5 @@
1
1
  module Braintree
2
- class TransactionLineItemGateway # :nodoc:
2
+ class TransactionLineItemGateway
3
3
  def initialize(gateway)
4
4
  @gateway = gateway
5
5
  @config = gateway.config
@@ -10,7 +10,7 @@ module Braintree
10
10
 
11
11
  class << self
12
12
  protected :new
13
- def _new(*args) # :nodoc:
13
+ def _new(*args)
14
14
  self.new(*args)
15
15
  end
16
16
  end
@@ -1,5 +1,5 @@
1
1
  module Braintree
2
- class TransactionSearch < AdvancedSearch # :nodoc:
2
+ class TransactionSearch < AdvancedSearch
3
3
  text_fields(
4
4
  :billing_company,
5
5
  :billing_country_name,
@@ -54,15 +54,16 @@ module Braintree
54
54
  CreditCard::CustomerLocation::International,
55
55
  CreditCard::CustomerLocation::US
56
56
  ]
57
+ multiple_value_field :debit_network, :allows => CreditCard::DebitNetwork::All
57
58
  multiple_value_field :ids
58
- multiple_value_field :payment_instrument_type
59
- multiple_value_field :user
60
59
  multiple_value_field :merchant_account_id
61
- multiple_value_field :status, :allows => Transaction::Status::All
60
+ multiple_value_field :payment_instrument_type
61
+ multiple_value_field :reason_code
62
62
  multiple_value_field :source
63
- multiple_value_field :type, :allows => Transaction::Type::All
63
+ multiple_value_field :status, :allows => Transaction::Status::All
64
64
  multiple_value_field :store_ids
65
- multiple_value_field :reason_code
65
+ multiple_value_field :type, :allows => Transaction::Type::All
66
+ multiple_value_field :user
66
67
 
67
68
  key_value_fields :refund
68
69
 
@@ -19,7 +19,7 @@ module Braintree
19
19
  "https://assets.braintreegateway.com/payment_method_logo/unknown.png"
20
20
  end
21
21
 
22
- def self._new(*args) # :nodoc:
22
+ def self._new(*args)
23
23
  self.new(*args)
24
24
  end
25
25
  end
@@ -14,7 +14,7 @@ module Braintree
14
14
  attr_reader :verifications
15
15
  attr_reader :verified
16
16
 
17
- def initialize(gateway, attributes) # :nodoc:
17
+ def initialize(gateway, attributes)
18
18
  @gateway = gateway
19
19
  set_instance_variables_from_hash(attributes)
20
20
  @ach_mandate = AchMandate.new(attributes[:ach_mandate]) if attributes[:ach_mandate]
@@ -34,7 +34,7 @@ module Braintree
34
34
  protected :new
35
35
  end
36
36
 
37
- def self._new(*args) # :nodoc:
37
+ def self._new(*args)
38
38
  self.new(*args)
39
39
  end
40
40
 
@@ -22,33 +22,41 @@ module Braintree
22
22
  All = [IndependentCheck, NetworkCheck, TokenizedCheck, MicroTransfers]
23
23
  end
24
24
 
25
+ module VerificationAddOns
26
+ CustomerVerification = "customer_verification"
27
+
28
+ All = [CustomerVerification]
29
+ end
30
+
31
+ attr_reader :additional_processor_response
32
+ attr_reader :created_at
33
+ attr_reader :gateway_rejection_reason
25
34
  attr_reader :id
26
- attr_reader :status
27
- attr_reader :verification_determined_at
28
- attr_reader :verification_method
35
+ attr_reader :merchant_account_id
29
36
  attr_reader :processor_response_code
30
37
  attr_reader :processor_response_text
31
- attr_reader :merchant_account_id
32
- attr_reader :gateway_rejection_reason
38
+ attr_reader :status
33
39
  attr_reader :us_bank_account
34
- attr_reader :created_at
40
+ attr_reader :verification_determined_at
41
+ attr_reader :verification_method
35
42
 
36
- def initialize(attributes) # :nodoc:
43
+ def initialize(attributes)
37
44
  set_instance_variables_from_hash(attributes)
38
45
  end
39
46
 
40
- def inspect # :nodoc:
47
+ def inspect
41
48
  attr_order = [
42
- :status,
43
- :processor_response_code,
44
- :processor_response_text,
45
- :merchant_account_id,
49
+ :additional_processor_response,
50
+ :created_at,
46
51
  :gateway_rejection_reason,
47
52
  :id,
53
+ :merchant_account_id,
54
+ :processor_response_code,
55
+ :processor_response_text,
56
+ :status,
48
57
  :us_bank_account,
49
- :verification_method,
50
58
  :verification_determined_at,
51
- :created_at
59
+ :verification_method
52
60
  ]
53
61
 
54
62
  formatted_attrs = attr_order.map do |attr|
@@ -62,7 +70,7 @@ module Braintree
62
70
  protected :new
63
71
  end
64
72
 
65
- def self._new(*args) # :nodoc:
73
+ def self._new(*args)
66
74
  self.new(*args)
67
75
  end
68
76
 
@@ -1,5 +1,5 @@
1
1
  module Braintree
2
- class UsBankAccountVerificationSearch < AdvancedSearch # :nodoc:
2
+ class UsBankAccountVerificationSearch < AdvancedSearch
3
3
  text_fields(
4
4
  :id,
5
5
  :account_holder_name,
@@ -1,5 +1,5 @@
1
1
  module Braintree
2
- module Util # :nodoc:
2
+ module Util
3
3
  def self.extract_attribute_as_array(hash, attribute)
4
4
  raise UnexpectedError.new("Unprocessable entity due to an invalid request") if hash.nil?
5
5
  value = hash.has_key?(attribute) ? hash.delete(attribute) : []
@@ -195,14 +195,14 @@ module Braintree
195
195
  end
196
196
 
197
197
  module IdEquality
198
- def ==(other) # :nodoc:
198
+ def ==(other)
199
199
  return false unless other.is_a?(self.class)
200
200
  id == other.id
201
201
  end
202
202
  end
203
203
 
204
204
  module TokenEquality
205
- def ==(other) # :nodoc:
205
+ def ==(other)
206
206
  return false unless other.is_a?(self.class)
207
207
  token == other.token
208
208
  end
@@ -18,7 +18,7 @@ module Braintree
18
18
  set_instance_variables_from_hash error_hash
19
19
  end
20
20
 
21
- def inspect # :nodoc:
21
+ def inspect
22
22
  "#<#{self.class} (#{code}) #{message}>"
23
23
  end
24
24
  end
@@ -2,7 +2,7 @@ module Braintree
2
2
  class ValidationErrorCollection
3
3
  include Enumerable
4
4
 
5
- def initialize(data) # :nodoc:
5
+ def initialize(data)
6
6
  return if !data.is_a? Hash
7
7
  @errors = (data[:errors] || {}).map { |hash| Braintree::ValidationError.new(hash) }
8
8
  @nested = {}
@@ -42,7 +42,7 @@ module Braintree
42
42
  self.for("index_#{index}".to_sym)
43
43
  end
44
44
 
45
- def inspect # :nodoc:
45
+ def inspect
46
46
  "#<#{self.class} errors#{_inner_inspect}>"
47
47
  end
48
48
 
@@ -61,7 +61,7 @@ module Braintree
61
61
  @errors.size
62
62
  end
63
63
 
64
- def _inner_inspect(scope = []) # :nodoc:
64
+ def _inner_inspect(scope = [])
65
65
  all = []
66
66
  scope_string = scope.join("/")
67
67
  if @errors.any?
@@ -1,6 +1,6 @@
1
1
  module Braintree
2
2
  class VenmoAccount
3
- include BaseModule # :nodoc:
3
+ include BaseModule
4
4
 
5
5
  attr_reader :created_at
6
6
  attr_reader :customer_id
@@ -13,7 +13,7 @@ module Braintree
13
13
  attr_reader :username
14
14
  attr_reader :venmo_user_id
15
15
 
16
- def initialize(gateway, attributes) # :nodoc:
16
+ def initialize(gateway, attributes)
17
17
  @gateway = gateway
18
18
  set_instance_variables_from_hash(attributes)
19
19
  @subscriptions = (@subscriptions || []).map { |subscription_hash| Subscription._new(@gateway, subscription_hash) }
@@ -27,7 +27,7 @@ module Braintree
27
27
  protected :new
28
28
  end
29
29
 
30
- def self._new(*args) # :nodoc:
30
+ def self._new(*args)
31
31
  self.new(*args)
32
32
  end
33
33
  end
@@ -2,13 +2,15 @@ module Braintree
2
2
  class VenmoProfileData
3
3
  include BaseModule
4
4
 
5
- attr_reader :username
5
+ attr_reader :billing_address
6
+ attr_reader :email
6
7
  attr_reader :first_name
7
8
  attr_reader :last_name
8
9
  attr_reader :phone_number
9
- attr_reader :email
10
+ attr_reader :shipping_address
11
+ attr_reader :username
10
12
 
11
- def initialize(attributes) # :nodoc:
13
+ def initialize(attributes)
12
14
  set_instance_variables_from_hash(attributes)
13
15
  end
14
16
 
@@ -16,7 +18,7 @@ module Braintree
16
18
  protected :new
17
19
  end
18
20
 
19
- def self._new(*args) # :nodoc:
21
+ def self._new(*args)
20
22
  self.new(*args)
21
23
  end
22
24
  end
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 4
4
- Minor = 14
4
+ Minor = 16
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -1,6 +1,6 @@
1
1
  module Braintree
2
2
  class VisaCheckoutCard
3
- include BaseModule # :nodoc:
3
+ include BaseModule
4
4
  include Braintree::Util::TokenEquality
5
5
 
6
6
  attr_reader :billing_address
@@ -30,7 +30,7 @@ module Braintree
30
30
  attr_reader :updated_at
31
31
  attr_reader :verification
32
32
 
33
- def initialize(gateway, attributes) # :nodoc:
33
+ def initialize(gateway, attributes)
34
34
  @gateway = gateway
35
35
  set_instance_variables_from_hash(attributes)
36
36
  @billing_address = attributes[:billing_address] ? Address._new(@gateway, attributes[:billing_address]) : nil
@@ -39,8 +39,8 @@ module Braintree
39
39
  end
40
40
 
41
41
  def _most_recent_verification(attributes)
42
- verification = (attributes[:verifications] || []).sort_by { |verification| verification[:created_at] }.reverse.first
43
- CreditCardVerification._new(verification) if verification
42
+ sorted_verifications = (attributes[:verifications] || []).sort_by { |verification| verification[:created_at] }.reverse.first
43
+ CreditCardVerification._new(sorted_verifications) if sorted_verifications
44
44
  end
45
45
 
46
46
  def default?
@@ -56,7 +56,7 @@ module Braintree
56
56
  @expired
57
57
  end
58
58
 
59
- def inspect # :nodoc:
59
+ def inspect
60
60
  first = [:token]
61
61
  order = first + (self.class._attributes - first)
62
62
  nice_attributes = order.map do |attr|
@@ -73,7 +73,7 @@ module Braintree
73
73
  protected :new
74
74
  end
75
75
 
76
- def self._attributes # :nodoc:
76
+ def self._attributes
77
77
  [
78
78
  :billing_address, :bin, :card_type, :cardholder_name, :created_at,
79
79
  :customer_id, :customer_location, :expiration_month, :expiration_year,
@@ -83,7 +83,7 @@ module Braintree
83
83
  ]
84
84
  end
85
85
 
86
- def self._new(*args) # :nodoc:
86
+ def self._new(*args)
87
87
  self.new(*args)
88
88
  end
89
89
  end
@@ -45,6 +45,7 @@ module Braintree
45
45
 
46
46
  RecipientUpdatedGrantedPaymentMethod = "recipient_updated_granted_payment_method"
47
47
 
48
+ SubscriptionBillingSkipped = "subscription_billing_skipped"
48
49
  SubscriptionCanceled = "subscription_canceled"
49
50
  SubscriptionChargedSuccessfully = "subscription_charged_successfully"
50
51
  SubscriptionChargedUnsuccessfully = "subscription_charged_unsuccessfully"
@@ -91,7 +92,7 @@ module Braintree
91
92
  Configuration.gateway.webhook_notification.verify(*args)
92
93
  end
93
94
 
94
- def initialize(gateway, attributes) # :nodoc:
95
+ def initialize(gateway, attributes)
95
96
  @gateway = gateway
96
97
  set_instance_variables_from_hash(attributes)
97
98
  @error_result = ErrorResult.new(gateway, @subject[:api_error_response]) if @subject.has_key?(:api_error_response)
@@ -134,7 +135,7 @@ module Braintree
134
135
 
135
136
  class << self
136
137
  protected :new
137
- def _new(*args) # :nodoc:
138
+ def _new(*args)
138
139
  self.new(*args)
139
140
  end
140
141
  end
@@ -1,5 +1,5 @@
1
1
  module Braintree
2
- class WebhookNotificationGateway # :nodoc:
2
+ class WebhookNotificationGateway
3
3
  def initialize(gateway)
4
4
  @gateway = gateway
5
5
  @config = gateway.config
@@ -36,8 +36,8 @@ module Braintree
36
36
  public_key, signature = _matching_signature_pair(signature_string)
37
37
  raise InvalidSignature, "no matching public key" if public_key.nil?
38
38
 
39
- signature_matches = [payload, payload + "\n"].any? do |payload|
40
- payload_signature = Braintree::Digest.hexdigest(@config.private_key, payload)
39
+ signature_matches = [payload, payload + "\n"].any? do |_payload|
40
+ payload_signature = Braintree::Digest.hexdigest(@config.private_key, _payload)
41
41
  Braintree::Digest.secure_compare(signature, payload_signature)
42
42
  end
43
43
  raise InvalidSignature, "signature does not match payload - one has been modified" unless signature_matches