braintree 2.98.0 → 4.23.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 (308) 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 +4 -4
  5. data/lib/braintree/ach_mandate.rb +1 -1
  6. data/lib/braintree/add_on_gateway.rb +1 -1
  7. data/lib/braintree/address.rb +7 -27
  8. data/lib/braintree/address_gateway.rb +8 -7
  9. data/lib/braintree/advanced_search.rb +11 -12
  10. data/lib/braintree/apple_pay.rb +4 -4
  11. data/lib/braintree/apple_pay_card.rb +18 -4
  12. data/lib/braintree/apple_pay_options.rb +4 -4
  13. data/lib/braintree/authorization_adjustment.rb +4 -4
  14. data/lib/braintree/base_module.rb +11 -1
  15. data/lib/braintree/bin_data.rb +10 -3
  16. data/lib/braintree/client_token.rb +1 -1
  17. data/lib/braintree/client_token_gateway.rb +4 -3
  18. data/lib/braintree/configuration.rb +35 -35
  19. data/lib/braintree/connected_merchant_paypal_status_changed.rb +2 -2
  20. data/lib/braintree/connected_merchant_status_transitioned.rb +2 -2
  21. data/lib/braintree/credit_card.rb +40 -86
  22. data/lib/braintree/credit_card_gateway.rb +58 -44
  23. data/lib/braintree/credit_card_verification.rb +39 -20
  24. data/lib/braintree/credit_card_verification_gateway.rb +35 -5
  25. data/lib/braintree/credit_card_verification_search.rb +2 -2
  26. data/lib/braintree/customer.rb +23 -88
  27. data/lib/braintree/customer_gateway.rb +17 -32
  28. data/lib/braintree/customer_search.rb +2 -2
  29. data/lib/braintree/descriptor.rb +1 -1
  30. data/lib/braintree/digest.rb +1 -1
  31. data/lib/braintree/disbursement.rb +7 -7
  32. data/lib/braintree/discount_gateway.rb +1 -1
  33. data/lib/braintree/dispute/evidence.rb +1 -1
  34. data/lib/braintree/{transaction/coinbase_details.rb → dispute/paypal_message.rb} +5 -6
  35. data/lib/braintree/dispute/{history_event.rb → status_history.rb} +3 -1
  36. data/lib/braintree/dispute/transaction.rb +3 -1
  37. data/lib/braintree/dispute/transaction_details.rb +1 -1
  38. data/lib/braintree/dispute.rb +47 -6
  39. data/lib/braintree/dispute_gateway.rb +5 -10
  40. data/lib/braintree/dispute_search.rb +8 -4
  41. data/lib/braintree/document_upload.rb +3 -3
  42. data/lib/braintree/document_upload_gateway.rb +3 -3
  43. data/lib/braintree/enriched_customer_data.rb +21 -0
  44. data/lib/braintree/error_codes.rb +217 -175
  45. data/lib/braintree/error_result.rb +2 -3
  46. data/lib/braintree/errors.rb +3 -3
  47. data/lib/braintree/exceptions.rb +6 -5
  48. data/lib/braintree/exchange_rate.rb +13 -0
  49. data/lib/braintree/exchange_rate_quote.rb +24 -0
  50. data/lib/braintree/exchange_rate_quote_gateway.rb +35 -0
  51. data/lib/braintree/exchange_rate_quote_input.rb +21 -0
  52. data/lib/braintree/exchange_rate_quote_request.rb +18 -0
  53. data/lib/braintree/exchange_rate_quote_response.rb +18 -0
  54. data/lib/braintree/facilitated_details.rb +1 -1
  55. data/lib/braintree/facilitator_details.rb +1 -1
  56. data/lib/braintree/gateway.rb +6 -12
  57. data/lib/braintree/{android_pay_card.rb → google_pay_card.rb} +18 -5
  58. data/lib/braintree/granted_payment_instrument_update.rb +2 -2
  59. data/lib/braintree/graphql_client.rb +14 -8
  60. data/lib/braintree/http.rb +9 -10
  61. data/lib/braintree/local_payment_completed/blik_alias.rb +23 -0
  62. data/lib/braintree/local_payment_completed.rb +10 -5
  63. data/lib/braintree/local_payment_expired.rb +21 -0
  64. data/lib/braintree/local_payment_funded.rb +22 -0
  65. data/lib/braintree/local_payment_reversed.rb +19 -0
  66. data/lib/braintree/merchant.rb +4 -4
  67. data/lib/braintree/merchant_account.rb +3 -3
  68. data/lib/braintree/merchant_account_gateway.rb +10 -8
  69. data/lib/braintree/merchant_gateway.rb +1 -1
  70. data/lib/braintree/meta_checkout_card.rb +89 -0
  71. data/lib/braintree/meta_checkout_token.rb +88 -0
  72. data/lib/braintree/modification.rb +4 -4
  73. data/lib/braintree/oauth_credentials.rb +4 -4
  74. data/lib/braintree/oauth_gateway.rb +5 -5
  75. data/lib/braintree/paginated_collection.rb +2 -2
  76. data/lib/braintree/paginated_result.rb +1 -1
  77. data/lib/braintree/payment_instrument_type.rb +14 -13
  78. data/lib/braintree/payment_method_customer_data_updated_metadata.rb +24 -0
  79. data/lib/braintree/payment_method_gateway.rb +52 -22
  80. data/lib/braintree/payment_method_nonce.rb +12 -7
  81. data/lib/braintree/payment_method_nonce_details.rb +40 -0
  82. data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
  83. data/lib/braintree/payment_method_nonce_gateway.rb +14 -3
  84. data/lib/braintree/payment_method_parser.rb +4 -7
  85. data/lib/braintree/paypal_account.rb +3 -2
  86. data/lib/braintree/paypal_account_gateway.rb +5 -5
  87. data/lib/braintree/plan.rb +22 -2
  88. data/lib/braintree/plan_gateway.rb +101 -1
  89. data/lib/braintree/processor_response_types.rb +3 -3
  90. data/lib/braintree/resource_collection.rb +10 -5
  91. data/lib/braintree/revoked_payment_method_metadata.rb +2 -2
  92. data/lib/braintree/risk_data/liability_shift.rb +22 -0
  93. data/lib/braintree/risk_data.rb +10 -3
  94. data/lib/braintree/samsung_pay_card.rb +8 -6
  95. data/lib/braintree/sepa_direct_debit_account.rb +60 -0
  96. data/lib/braintree/sepa_direct_debit_account_gateway.rb +25 -0
  97. data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +28 -0
  98. data/lib/braintree/settlement_batch_summary.rb +2 -2
  99. data/lib/braintree/settlement_batch_summary_gateway.rb +1 -1
  100. data/lib/braintree/sha256_digest.rb +1 -1
  101. data/lib/braintree/subscription/status_details.rb +1 -1
  102. data/lib/braintree/subscription.rb +13 -13
  103. data/lib/braintree/subscription_gateway.rb +6 -6
  104. data/lib/braintree/subscription_search.rb +1 -1
  105. data/lib/braintree/successful_result.rb +5 -4
  106. data/lib/braintree/test/authentication_id.rb +21 -0
  107. data/lib/braintree/test/credit_card.rb +9 -10
  108. data/lib/braintree/test/merchant_account.rb +1 -1
  109. data/lib/braintree/test/nonce.rb +27 -20
  110. data/lib/braintree/test/transaction_amounts.rb +2 -3
  111. data/lib/braintree/test/venmo_sdk.rb +2 -0
  112. data/lib/braintree/testing_gateway.rb +1 -1
  113. data/lib/braintree/three_d_secure_info.rb +23 -11
  114. data/lib/braintree/transaction/address_details.rb +14 -1
  115. data/lib/braintree/transaction/apple_pay_details.rb +13 -10
  116. data/lib/braintree/transaction/credit_card_details.rb +8 -1
  117. data/lib/braintree/transaction/customer_details.rb +3 -2
  118. data/lib/braintree/transaction/disbursement_details.rb +2 -1
  119. data/lib/braintree/transaction/{android_pay_details.rb → google_pay_details.rb} +6 -1
  120. data/lib/braintree/transaction/installment/adjustment.rb +33 -0
  121. data/lib/braintree/transaction/installment.rb +28 -0
  122. data/lib/braintree/transaction/local_payment_details.rb +3 -0
  123. data/lib/braintree/transaction/meta_checkout_card_details.rb +52 -0
  124. data/lib/braintree/transaction/meta_checkout_token_details.rb +54 -0
  125. data/lib/braintree/transaction/package_details.rb +19 -0
  126. data/lib/braintree/transaction/payment_receipt/card_present_data.rb +36 -0
  127. data/lib/braintree/transaction/payment_receipt/merchant_address.rb +19 -0
  128. data/lib/braintree/transaction/payment_receipt.rb +31 -0
  129. data/lib/braintree/transaction/paypal_details.rb +5 -0
  130. data/lib/braintree/transaction/samsung_pay_card_details.rb +3 -1
  131. data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +27 -0
  132. data/lib/braintree/transaction/status_details.rb +1 -1
  133. data/lib/braintree/transaction/subscription_details.rb +3 -1
  134. data/lib/braintree/transaction/us_bank_account_details.rb +2 -1
  135. data/lib/braintree/transaction/visa_checkout_card_details.rb +1 -1
  136. data/lib/braintree/transaction.rb +119 -128
  137. data/lib/braintree/transaction_gateway.rb +138 -64
  138. data/lib/braintree/transaction_line_item.rb +14 -11
  139. data/lib/braintree/transaction_line_item_gateway.rb +1 -1
  140. data/lib/braintree/transaction_review.rb +18 -0
  141. data/lib/braintree/transaction_search.rb +11 -7
  142. data/lib/braintree/unknown_payment_method.rb +2 -2
  143. data/lib/braintree/us_bank_account.rb +5 -5
  144. data/lib/braintree/us_bank_account_verification.rb +24 -16
  145. data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
  146. data/lib/braintree/us_bank_account_verification_search.rb +1 -1
  147. data/lib/braintree/util.rb +25 -10
  148. data/lib/braintree/validation_error.rb +1 -1
  149. data/lib/braintree/validation_error_collection.rb +3 -3
  150. data/lib/braintree/venmo_account.rb +4 -4
  151. data/lib/braintree/venmo_profile_data.rb +25 -0
  152. data/lib/braintree/version.rb +2 -2
  153. data/lib/braintree/visa_checkout_card.rb +8 -8
  154. data/lib/braintree/webhook_notification.rb +55 -33
  155. data/lib/braintree/webhook_notification_gateway.rb +9 -9
  156. data/lib/braintree/webhook_testing.rb +1 -1
  157. data/lib/braintree/webhook_testing_gateway.rb +569 -46
  158. data/lib/braintree/xml/generator.rb +6 -5
  159. data/lib/braintree/xml/libxml.rb +1 -1
  160. data/lib/braintree/xml/parser.rb +24 -37
  161. data/lib/braintree/xml/rexml.rb +6 -7
  162. data/lib/braintree/xml.rb +1 -1
  163. data/lib/braintree.rb +41 -24
  164. data/lib/ssl/api_braintreegateway_com.ca.crt +401 -168
  165. data/spec/integration/braintree/add_on_spec.rb +10 -10
  166. data/spec/integration/braintree/address_spec.rb +101 -178
  167. data/spec/integration/braintree/advanced_search_spec.rb +93 -93
  168. data/spec/integration/braintree/apple_pay_spec.rb +12 -12
  169. data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
  170. data/spec/integration/braintree/client_api/client_token_spec.rb +279 -62
  171. data/spec/integration/braintree/client_api/spec_helper.rb +99 -73
  172. data/spec/integration/braintree/credit_card_spec.rb +522 -821
  173. data/spec/integration/braintree/credit_card_verification_search_spec.rb +18 -18
  174. data/spec/integration/braintree/credit_card_verification_spec.rb +219 -30
  175. data/spec/integration/braintree/customer_search_spec.rb +28 -28
  176. data/spec/integration/braintree/customer_spec.rb +840 -757
  177. data/spec/integration/braintree/disbursement_spec.rb +2 -2
  178. data/spec/integration/braintree/discount_spec.rb +9 -9
  179. data/spec/integration/braintree/dispute_search_spec.rb +45 -9
  180. data/spec/integration/braintree/dispute_spec.rb +109 -82
  181. data/spec/integration/braintree/document_upload_spec.rb +29 -17
  182. data/spec/integration/braintree/error_codes_spec.rb +3 -3
  183. data/spec/integration/braintree/exchange_rate_quote_spec.rb +97 -0
  184. data/spec/integration/braintree/graphql_client_spec.rb +0 -2
  185. data/spec/integration/braintree/http_spec.rb +31 -33
  186. data/spec/integration/braintree/merchant_account_spec.rb +155 -156
  187. data/spec/integration/braintree/merchant_spec.rb +71 -192
  188. data/spec/integration/braintree/oauth_spec.rb +72 -72
  189. data/spec/integration/braintree/package_tracking_spec.rb +130 -0
  190. data/spec/integration/braintree/payment_method_nonce_spec.rb +173 -78
  191. data/spec/integration/braintree/payment_method_spec.rb +953 -501
  192. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +147 -234
  193. data/spec/integration/braintree/paypal_account_spec.rb +74 -72
  194. data/spec/integration/braintree/plan_spec.rb +96 -15
  195. data/spec/integration/braintree/samsung_pay_card_spec.rb +75 -73
  196. data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +194 -0
  197. data/spec/integration/braintree/settlement_batch_summary_spec.rb +18 -18
  198. data/spec/integration/braintree/subscription_spec.rb +507 -513
  199. data/spec/integration/braintree/test/transaction_amounts_spec.rb +4 -4
  200. data/spec/integration/braintree/test_transaction_spec.rb +29 -29
  201. data/spec/integration/braintree/transaction_line_item_spec.rb +12 -6
  202. data/spec/integration/braintree/transaction_search_spec.rb +410 -217
  203. data/spec/integration/braintree/transaction_spec.rb +3252 -2102
  204. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +42 -278
  205. data/spec/integration/braintree/us_bank_account_spec.rb +36 -36
  206. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +25 -25
  207. data/spec/integration/braintree/us_bank_account_verification_spec.rb +41 -41
  208. data/spec/integration/braintree/visa_checkout_card_spec.rb +62 -62
  209. data/spec/integration/spec_helper.rb +22 -7
  210. data/spec/oauth_test_helper.rb +1 -1
  211. data/spec/script/httpsd.rb +6 -6
  212. data/spec/spec_helper.rb +15 -20
  213. data/spec/unit/braintree/address_spec.rb +9 -17
  214. data/spec/unit/braintree/apple_pay_card_spec.rb +110 -7
  215. data/spec/unit/braintree/base_module_spec.rb +4 -4
  216. data/spec/unit/braintree/client_token_spec.rb +6 -6
  217. data/spec/unit/braintree/configuration_spec.rb +84 -84
  218. data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
  219. data/spec/unit/braintree/credit_card_spec.rb +91 -58
  220. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +56 -0
  221. data/spec/unit/braintree/credit_card_verification_search_spec.rb +10 -10
  222. data/spec/unit/braintree/credit_card_verification_spec.rb +40 -18
  223. data/spec/unit/braintree/customer_spec.rb +102 -57
  224. data/spec/unit/braintree/digest_spec.rb +5 -6
  225. data/spec/unit/braintree/disbursement_spec.rb +14 -14
  226. data/spec/unit/braintree/dispute_search_spec.rb +6 -2
  227. data/spec/unit/braintree/dispute_spec.rb +144 -66
  228. data/spec/unit/braintree/document_upload_spec.rb +8 -8
  229. data/spec/unit/braintree/enriched_customer_data_spec.rb +41 -0
  230. data/spec/unit/braintree/error_result_spec.rb +11 -11
  231. data/spec/unit/braintree/errors_spec.rb +17 -17
  232. data/spec/unit/braintree/exchange_rate_quote_input_spec.rb +42 -0
  233. data/spec/unit/braintree/exchange_rate_quote_request_spec.rb +82 -0
  234. data/spec/unit/braintree/exchange_rate_quote_response_spec.rb +52 -0
  235. data/spec/unit/braintree/exchange_rate_quote_spec.rb +42 -0
  236. data/spec/unit/braintree/exchange_rate_spec.rb +23 -0
  237. data/spec/unit/braintree/http_spec.rb +19 -17
  238. data/spec/unit/braintree/local_payment_completed_spec.rb +62 -8
  239. data/spec/unit/braintree/local_payment_expired_spec.rb +24 -0
  240. data/spec/unit/braintree/local_payment_funded_spec.rb +34 -0
  241. data/spec/unit/braintree/merchant_account_spec.rb +5 -5
  242. data/spec/unit/braintree/meta_checkout_card_details_spec.rb +60 -0
  243. data/spec/unit/braintree/meta_checkout_card_spec.rb +60 -0
  244. data/spec/unit/braintree/meta_checkout_token_details_spec.rb +63 -0
  245. data/spec/unit/braintree/meta_checkout_token_spec.rb +63 -0
  246. data/spec/unit/braintree/modification_spec.rb +1 -1
  247. data/spec/unit/braintree/package_tracking_spec.rb +77 -0
  248. data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +45 -0
  249. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
  250. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +51 -0
  251. data/spec/unit/braintree/payment_method_nonce_spec.rb +40 -0
  252. data/spec/unit/braintree/payment_method_spec.rb +20 -20
  253. data/spec/unit/braintree/paypal_account_spec.rb +16 -7
  254. data/spec/unit/braintree/resource_collection_spec.rb +34 -5
  255. data/spec/unit/braintree/risk_data/liability_shift.rb +26 -0
  256. data/spec/unit/braintree/risk_data_spec.rb +38 -8
  257. data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +29 -0
  258. data/spec/unit/braintree/sepa_debit_account_spec.rb +86 -0
  259. data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
  260. data/spec/unit/braintree/signature_service_spec.rb +2 -2
  261. data/spec/unit/braintree/subscription_search_spec.rb +18 -18
  262. data/spec/unit/braintree/subscription_spec.rb +8 -8
  263. data/spec/unit/braintree/successful_result_spec.rb +6 -6
  264. data/spec/unit/braintree/three_d_secure_info_spec.rb +37 -17
  265. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +22 -6
  266. data/spec/unit/braintree/transaction/customer_details_spec.rb +3 -2
  267. data/spec/unit/braintree/transaction/deposit_details_spec.rb +4 -4
  268. data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
  269. data/spec/unit/braintree/transaction/local_payment_details_spec.rb +36 -0
  270. data/spec/unit/braintree/transaction/payment_receipt_spec.rb +73 -0
  271. data/spec/unit/braintree/transaction/paypal_details_spec.rb +63 -0
  272. data/spec/unit/braintree/transaction/sepa_direct_debit_account_details_spec.rb +33 -0
  273. data/spec/unit/braintree/transaction_gateway_spec.rb +150 -0
  274. data/spec/unit/braintree/transaction_search_spec.rb +12 -12
  275. data/spec/unit/braintree/transaction_spec.rb +221 -124
  276. data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
  277. data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
  278. data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
  279. data/spec/unit/braintree/us_bank_account_verification_spec.rb +12 -7
  280. data/spec/unit/braintree/util_spec.rb +78 -44
  281. data/spec/unit/braintree/validation_error_collection_spec.rb +62 -62
  282. data/spec/unit/braintree/validation_error_spec.rb +4 -4
  283. data/spec/unit/braintree/venmo_profile_data_spec.rb +43 -0
  284. data/spec/unit/braintree/webhook_notification_spec.rb +434 -197
  285. data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
  286. data/spec/unit/braintree/xml/parser_spec.rb +27 -22
  287. data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
  288. data/spec/unit/braintree/xml_spec.rb +38 -38
  289. data/spec/unit/braintree_spec.rb +2 -2
  290. metadata +91 -30
  291. data/lib/braintree/amex_express_checkout_card.rb +0 -38
  292. data/lib/braintree/coinbase_account.rb +0 -34
  293. data/lib/braintree/europe_bank_account.rb +0 -36
  294. data/lib/braintree/europe_bank_account_gateway.rb +0 -17
  295. data/lib/braintree/ideal_payment.rb +0 -61
  296. data/lib/braintree/ideal_payment_gateway.rb +0 -19
  297. data/lib/braintree/masterpass_card.rb +0 -81
  298. data/lib/braintree/settlement_batch.rb +0 -0
  299. data/lib/braintree/transaction/amex_express_checkout_details.rb +0 -21
  300. data/lib/braintree/transaction/ideal_payment_details.rb +0 -19
  301. data/lib/braintree/transaction/masterpass_card_details.rb +0 -47
  302. data/lib/braintree/transparent_redirect.rb +0 -40
  303. data/lib/braintree/transparent_redirect_gateway.rb +0 -105
  304. data/spec/hacks/tcp_socket.rb +0 -18
  305. data/spec/integration/braintree/coinbase_spec.rb +0 -34
  306. data/spec/integration/braintree/masterpass_card_spec.rb +0 -97
  307. data/spec/integration/braintree/transparent_redirect_spec.rb +0 -268
  308. data/spec/unit/braintree/transparent_redirect_spec.rb +0 -223
@@ -14,8 +14,8 @@ module Braintree
14
14
 
15
15
  class << self
16
16
  protected :new
17
- def _new(*args) # :nodoc:
18
- self.new *args
17
+ def _new(*args)
18
+ self.new(*args)
19
19
  end
20
20
  end
21
21
  end
@@ -14,8 +14,8 @@ module Braintree
14
14
 
15
15
  class << self
16
16
  protected :new
17
- def _new(*args) # :nodoc:
18
- self.new *args
17
+ def _new(*args)
18
+ self.new(*args)
19
19
  end
20
20
  end
21
21
  end
@@ -1,6 +1,6 @@
1
1
  module Braintree
2
2
  class CreditCard
3
- include BaseModule # :nodoc:
3
+ include BaseModule
4
4
  include Braintree::Util::TokenEquality
5
5
 
6
6
  module CardType
@@ -23,6 +23,17 @@ module Braintree
23
23
  All = constants.map { |c| const_get(c) }
24
24
  end
25
25
 
26
+ module DebitNetwork
27
+ Accel = "ACCEL"
28
+ Maestro = "MAESTRO"
29
+ Nyce = "NYCE"
30
+ Pulse = "PULSE"
31
+ Star = "STAR"
32
+ Star_Access = "STAR_ACCESS"
33
+
34
+ All = constants.map { |c| const_get(c) }
35
+ end
36
+
26
37
  module CustomerLocation
27
38
  International = "international"
28
39
  US = "us"
@@ -70,23 +81,17 @@ module Braintree
70
81
  Configuration.gateway.credit_card.create!(*args)
71
82
  end
72
83
 
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
-
84
+ # NEXT_MAJOR_VERSION remove this method
85
+ # CreditCard.credit has been deprecated in favor of Transaction.credit
85
86
  def self.credit(token, transaction_attributes)
87
+ warn "[DEPRECATED] CreditCard.credit is deprecated. Use Transaction.credit instead"
86
88
  Transaction.credit(transaction_attributes.merge(:payment_method_token => token))
87
89
  end
88
90
 
91
+ # NEXT_MAJOR_VERSION remove this method
92
+ # CreditCard.credit has been deprecated in favor of Transaction.credit
89
93
  def self.credit!(token, transaction_attributes)
94
+ warn "[DEPRECATED] CreditCard.credit is deprecated. Use Transaction.credit instead"
90
95
  return_object_or_raise(:transaction) { credit(token, transaction_attributes) }
91
96
  end
92
97
 
@@ -110,16 +115,17 @@ module Braintree
110
115
  Configuration.gateway.credit_card.from_nonce(*args)
111
116
  end
112
117
 
113
- # Deprecated. Use Braintree::PaymentMethod.grant
114
- def self.grant(*args)
115
- Configuration.gateway.credit_card.grant(*args)
116
- end
117
-
118
+ # NEXT_MAJOR_VERSION remove this method
119
+ # CreditCard.sale has been deprecated in favor of Transaction.sale
118
120
  def self.sale(token, transaction_attributes)
121
+ warn "[DEPRECATED] CreditCard.sale is deprecated. Use Transaction.sale instead"
119
122
  Configuration.gateway.transaction.sale(transaction_attributes.merge(:payment_method_token => token))
120
123
  end
121
124
 
125
+ # NEXT_MAJOR_VERSION remove this method
126
+ # CreditCard.sale has been deprecated in favor of Transaction.sale
122
127
  def self.sale!(token, transaction_attributes)
128
+ warn "[DEPRECATED] CreditCard.sale is deprecated. Use Transaction.sale instead"
123
129
  return_object_or_raise(:transaction) { sale(token, transaction_attributes) }
124
130
  end
125
131
 
@@ -131,19 +137,7 @@ module Braintree
131
137
  Configuration.gateway.credit_card.update!(*args)
132
138
  end
133
139
 
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
- def initialize(gateway, attributes) # :nodoc:
140
+ def initialize(gateway, attributes)
147
141
  @gateway = gateway
148
142
  set_instance_variables_from_hash(attributes)
149
143
  @billing_address = attributes[:billing_address] ? Address._new(@gateway, attributes[:billing_address]) : nil
@@ -152,29 +146,10 @@ module Braintree
152
146
  end
153
147
 
154
148
  def _most_recent_verification(attributes)
155
- verification = (attributes[:verifications] || []).sort_by{ |verification| verification[:created_at] }.reverse.first
156
- CreditCardVerification._new(verification) if verification
157
- end
158
-
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))
149
+ sorted_verifications = (attributes[:verifications] || []).sort_by { |verification| verification[:created_at] }.reverse.first
150
+ CreditCardVerification._new(sorted_verifications) if sorted_verifications
163
151
  end
164
152
 
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
- # Returns true if this credit card is the customer's default payment method.
178
153
  def default?
179
154
  @default
180
155
  end
@@ -184,12 +159,11 @@ module Braintree
184
159
  "#{expiration_month}/#{expiration_year}"
185
160
  end
186
161
 
187
- # Returns true if the credit card is expired.
188
162
  def expired?
189
163
  @expired
190
164
  end
191
165
 
192
- def inspect # :nodoc:
166
+ def inspect
193
167
  first = [:token]
194
168
  order = first + (self.class._attributes - first)
195
169
  nice_attributes = order.map do |attr|
@@ -202,57 +176,37 @@ module Braintree
202
176
  "#{bin}******#{last_4}"
203
177
  end
204
178
 
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
179
  def nonce
234
180
  @nonce ||= PaymentMethodNonce.create(token)
235
181
  end
236
182
 
183
+ # NEXT_MAJOR_VERSION can this be removed? Venmo SDK integration is no more
237
184
  # Returns true if the card is associated with Venmo SDK
185
+ # NEXT_MAJOR_VERSION Remove this method
186
+ # The old venmo SDK class has been deprecated
238
187
  def venmo_sdk?
188
+ warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead."
239
189
  @venmo_sdk
240
190
  end
241
191
 
192
+ def is_network_tokenized?
193
+ @is_network_tokenized
194
+ end
195
+
242
196
  class << self
243
197
  protected :new
244
198
  end
245
199
 
246
- def self._attributes # :nodoc:
200
+ def self._attributes
247
201
  [
248
202
  :billing_address, :bin, :card_type, :cardholder_name, :created_at, :customer_id, :expiration_month,
249
203
  :expiration_year, :last_4, :token, :updated_at, :prepaid, :payroll, :product_id, :commercial, :debit, :durbin_regulated,
250
- :healthcare, :country_of_issuance, :issuing_bank, :image_url
204
+ :healthcare, :country_of_issuance, :issuing_bank, :image_url, :is_network_tokenized?
251
205
  ]
252
206
  end
253
207
 
254
- def self._new(*args) # :nodoc:
255
- self.new *args
208
+ def self._new(*args)
209
+ self.new(*args)
256
210
  end
257
211
  end
258
212
  end
@@ -1,5 +1,5 @@
1
1
  module Braintree
2
- class CreditCardGateway # :nodoc:
2
+ class CreditCardGateway
3
3
  include BaseModule
4
4
 
5
5
  def initialize(gateway)
@@ -12,6 +12,10 @@ module Braintree
12
12
  if attributes.has_key?(:expiration_date) && (attributes.has_key?(:expiration_month) || attributes.has_key?(:expiration_year))
13
13
  raise ArgumentError.new("create with both expiration_month and expiration_year or only expiration_date")
14
14
  end
15
+ # NEXT_MAJOR_VERSION remove this check
16
+ if attributes.has_key?(:venmo_sdk_payment_method_code) || attributes.has_key?(:venmo_sdk_session)
17
+ warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead."
18
+ end
15
19
  Util.verify_keys(CreditCardGateway._create_signature, attributes)
16
20
  _do_create("/payment_methods", :credit_card => attributes)
17
21
  end
@@ -20,22 +24,17 @@ module Braintree
20
24
  return_object_or_raise(:credit_card) { create(*args) }
21
25
  end
22
26
 
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
-
27
+ # NEXT_MAJOR_VERSION remove this method
28
+ # CreditCard.credit has been deprecated in favor of Transaction.credit
34
29
  def credit(token, transaction_attributes)
30
+ warn "[DEPRECATED] CreditCard.credit is deprecated. Use Transaction.credit instead"
35
31
  @gateway.transaction.credit(transaction_attributes.merge(:payment_method_token => token))
36
32
  end
37
33
 
34
+ # NEXT_MAJOR_VERSION remove this method
35
+ # CreditCard.credit has been deprecated in favor of Transaction.credit
38
36
  def credit!(*args)
37
+ warn "[DEPRECATED] CreditCard.credit is deprecated. Use Transaction.credit instead"
39
38
  return_object_or_raise(:transaction) { credit(*args) }
40
39
  end
41
40
 
@@ -49,8 +48,8 @@ module Braintree
49
48
  end
50
49
 
51
50
  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')
51
+ formatted_start_date = start_date.strftime("%m%Y")
52
+ formatted_end_date = end_date.strftime("%m%Y")
54
53
  response = @config.http.post("#{@config.base_merchant_path}/payment_methods/all/expiring_ids?start=#{formatted_start_date}&end=#{formatted_end_date}")
55
54
  ResourceCollection.new(response) { |ids| _fetch_expiring_between(formatted_start_date, formatted_end_date, ids) }
56
55
  end
@@ -71,12 +70,11 @@ module Braintree
71
70
  raise NotFoundError, "nonce #{nonce.inspect} locked, consumed, or not found"
72
71
  end
73
72
 
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
73
  def update(token, attributes)
74
+ # NEXT_MAJOR_VERSION remove this check
75
+ if attributes.has_key?(:venmo_sdk_payment_method_code) || attributes.has_key?(:venmo_sdk_session)
76
+ warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead."
77
+ end
80
78
  Util.verify_keys(CreditCardGateway._update_signature, attributes)
81
79
  _do_update(:put, "/payment_methods/credit_card/#{token}", :credit_card => attributes)
82
80
  end
@@ -85,38 +83,54 @@ module Braintree
85
83
  return_object_or_raise(:credit_card) { update(*args) }
86
84
  end
87
85
 
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
- def self._create_signature # :nodoc:
86
+ def self._create_signature
102
87
  _signature(:create)
103
88
  end
104
89
 
105
- def self._update_signature # :nodoc:
90
+ def self._update_signature
106
91
  _signature(:update)
107
92
  end
108
93
 
109
- def self._signature(type) # :nodoc:
94
+ def self._signature(type)
110
95
  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]
96
+ # NEXT_MAJOR_VERSION Remove venmo_sdk_session
97
+ # The old venmo SDK class has been deprecated
98
+ options = [
99
+ :fail_on_duplicate_payment_method,
100
+ :fail_on_duplicate_payment_method_for_customer,
101
+ :make_default,
102
+ :skip_advanced_fraud_checking,
103
+ :venmo_sdk_session, # Deprecated
104
+ :verification_account_type,
105
+ :verification_amount,
106
+ :verification_currency_iso_code,
107
+ :verification_merchant_account_id,
108
+ :verify_card
109
+ ]
110
+ # NEXT_MAJOR_VERSION Remove venmo_sdk_payment_method_code
111
+ # The old venmo SDK class has been deprecated
112
112
  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,
113
+ :billing_address_id, :cardholder_name, :cvv, :expiration_date, :expiration_month,
114
+ :expiration_year, :number, :token, :venmo_sdk_payment_method_code, # Deprecated
115
+ :device_data, :payment_method_nonce,
116
+ {:external_vault => [:network_transaction_id]},
116
117
  {:options => options},
117
118
  {:billing_address => billing_address_params}
118
119
  ]
119
120
 
121
+ signature << {
122
+ :three_d_secure_pass_thru => [
123
+ :eci_flag,
124
+ :cavv,
125
+ :xid,
126
+ :three_d_secure_version,
127
+ :authentication_response,
128
+ :directory_response,
129
+ :cavv_algorithm,
130
+ :ds_transaction_id,
131
+ ]
132
+ }
133
+
120
134
  case type
121
135
  when :create
122
136
  signature << :customer_id
@@ -129,7 +143,7 @@ module Braintree
129
143
  return signature
130
144
  end
131
145
 
132
- def _do_create(path, params=nil) # :nodoc:
146
+ def _do_create(path, params=nil)
133
147
  response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
134
148
  if response[:credit_card]
135
149
  SuccessfulResult.new(:credit_card => CreditCard._new(@gateway, response[:credit_card]))
@@ -140,7 +154,7 @@ module Braintree
140
154
  end
141
155
  end
142
156
 
143
- def _do_update(http_verb, path, params) # :nodoc:
157
+ def _do_update(http_verb, path, params)
144
158
  response = @config.http.send(http_verb, "#{@config.base_merchant_path}#{path}", params)
145
159
  if response[:credit_card]
146
160
  SuccessfulResult.new(:credit_card => CreditCard._new(@gateway, response[:credit_card]))
@@ -151,16 +165,16 @@ module Braintree
151
165
  end
152
166
  end
153
167
 
154
- def _fetch_expired(ids) # :nodoc:
168
+ def _fetch_expired(ids)
155
169
  response = @config.http.post("#{@config.base_merchant_path}/payment_methods/all/expired", :search => {:ids => ids})
156
170
  attributes = response[:payment_methods]
157
171
  Util.extract_attribute_as_array(attributes, :credit_card).map { |attrs| CreditCard._new(@gateway, attrs) }
158
172
  end
159
173
 
160
- def _fetch_expiring_between(formatted_start_date, formatted_end_date, ids) # :nodoc:
174
+ def _fetch_expiring_between(formatted_start_date, formatted_end_date, ids)
161
175
  response = @config.http.post(
162
176
  "#{@config.base_merchant_path}/payment_methods/all/expiring?start=#{formatted_start_date}&end=#{formatted_end_date}",
163
- :search => {:ids => ids}
177
+ :search => {:ids => ids},
164
178
  )
165
179
  attributes = response[:payment_methods]
166
180
  Util.extract_attribute_as_array(attributes, :credit_card).map { |attrs| CreditCard._new(@gateway, attrs) }
@@ -3,16 +3,31 @@ 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
14
27
 
15
28
  attr_reader :amount
29
+ attr_reader :ani_first_name_response_code
30
+ attr_reader :ani_last_name_response_code
16
31
  attr_reader :avs_error_response_code
17
32
  attr_reader :avs_postal_code_response_code
18
33
  attr_reader :avs_street_address_response_code
@@ -22,18 +37,20 @@ module Braintree
22
37
  attr_reader :currency_iso_code
23
38
  attr_reader :cvv_response_code
24
39
  attr_reader :gateway_rejection_reason
40
+ attr_reader :graphql_id
25
41
  attr_reader :id
26
42
  attr_reader :merchant_account_id
27
43
  attr_reader :network_response_code
28
44
  attr_reader :network_response_text
45
+ attr_reader :network_transaction_id
29
46
  attr_reader :processor_response_code
30
47
  attr_reader :processor_response_text
31
48
  attr_reader :processor_response_type
32
49
  attr_reader :risk_data
33
- attr_reader :three_d_secure_info
34
50
  attr_reader :status
51
+ attr_reader :three_d_secure_info
35
52
 
36
- def initialize(attributes) # :nodoc:
53
+ def initialize(attributes)
37
54
  set_instance_variables_from_hash(attributes)
38
55
 
39
56
  @amount = Util.to_big_decimal(amount)
@@ -42,25 +59,27 @@ module Braintree
42
59
  @three_d_secure_info = ThreeDSecureInfo.new(attributes[:three_d_secure_info]) if attributes[:three_d_secure_info]
43
60
  end
44
61
 
45
- def inspect # :nodoc:
62
+ def inspect
46
63
  attr_order = [
47
- :status,
48
- :processor_response_code,
49
- :processor_response_text,
50
64
  :amount,
51
- :currency_iso_code,
52
- :cvv_response_code,
65
+ :ani_first_name_response_code,
66
+ :ani_last_name_response_code,
53
67
  :avs_error_response_code,
54
68
  :avs_postal_code_response_code,
55
69
  :avs_street_address_response_code,
56
- :network_response_code,
57
- :network_response_text,
58
- :merchant_account_id,
70
+ :billing,
71
+ :created_at,
72
+ :credit_card,
73
+ :currency_iso_code,
74
+ :cvv_response_code,
59
75
  :gateway_rejection_reason,
60
76
  :id,
61
- :credit_card,
62
- :billing,
63
- :created_at
77
+ :merchant_account_id,
78
+ :network_response_code,
79
+ :network_response_text,
80
+ :processor_response_code,
81
+ :processor_response_text,
82
+ :status
64
83
  ]
65
84
  formatted_attrs = attr_order.map do |attr|
66
85
  if attr == :amount
@@ -76,8 +95,8 @@ module Braintree
76
95
  protected :new
77
96
  end
78
97
 
79
- def self._new(*args) # :nodoc:
80
- self.new *args
98
+ def self._new(*args)
99
+ self.new(*args)
81
100
  end
82
101
 
83
102
  def self.find(*args)
@@ -46,11 +46,41 @@ module Braintree
46
46
 
47
47
  def self._create_signature
48
48
  [
49
- {:options => [:amount, :merchant_account_id, :account_type]},
50
- {:credit_card => [
51
- :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year,
52
- :number, {:billing_address => AddressGateway._shared_signature}
53
- ]}
49
+ {:credit_card => [
50
+ {:billing_address => AddressGateway._shared_signature},
51
+ :cardholder_name,
52
+ :cvv,
53
+ :expiration_date,
54
+ :expiration_month,
55
+ :expiration_year,
56
+ :number,
57
+ ]},
58
+ {:external_vault => [
59
+ :previous_network_transaction_id,
60
+ :status,
61
+ ]},
62
+ :intended_transaction_source,
63
+ {:options => [
64
+ :account_type,
65
+ :amount,
66
+ :merchant_account_id,
67
+ ]},
68
+ :payment_method_nonce,
69
+ {:risk_data => [
70
+ :customer_browser,
71
+ :customer_ip,
72
+ ]},
73
+ :three_d_secure_authentication_id,
74
+ {:three_d_secure_pass_thru => [
75
+ :authentication_response,
76
+ :cavv,
77
+ :cavv_algorithm,
78
+ :directory_response,
79
+ :ds_transaction_id,
80
+ :eci_flag,
81
+ :three_d_secure_version,
82
+ :xid,
83
+ ]},
54
84
  ]
55
85
  end
56
86
  end
@@ -1,12 +1,12 @@
1
1
  module Braintree
2
- class CreditCardVerificationSearch < AdvancedSearch # :nodoc:
2
+ class CreditCardVerificationSearch < AdvancedSearch
3
3
  text_fields(
4
4
  :billing_address_details_postal_code,
5
5
  :credit_card_cardholder_name,
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