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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67e6afaacba1448a5c2aafd4b1e9432aa6875c3f22d5a8812c4e102a156e2d67
4
- data.tar.gz: 2c620e47df93ef23542d98b092bf93cf9ef7bfe21b5d4e424976d5b51187836a
3
+ metadata.gz: 80f9d00b4dec8e85066f61cecaf04c5863399c8c6552d5158d0fe69f8b81a64f
4
+ data.tar.gz: 4664e8431f59bf1293d6cafbaf3623b6fe2069aa81af17520384b5e85c34a0a5
5
5
  SHA512:
6
- metadata.gz: ca18891a468ccdfa0e22960490781c60206775cccad4a2e23edad4a7a3883b515e68ec71436c6b1edf4e57c51c3633e6127986025aead83055f1f37b55640459
7
- data.tar.gz: 0cdcff4610e50bfd41d939f27d164dc87d95c7949fef5fa07dd3d21a42df851cb642590be7088aa9e53008611208cbfac7d3dbd062e0eca6a5197430e7a61266
6
+ metadata.gz: 73131e462a1c99744d967f82cecdda88dc2780e04c3bb69f51cd7149fc8e747d7e487e31cc5e5e3fe7f4440d6da3ef42a90ee7e027c7fa0f567ad2b84a6119dd
7
+ data.tar.gz: a17216eb8f219f33af17d79accae60eccc23e059753ac159aed34063ec7f8abb0566c6268097647bb1a657fabf507d4f9d1d90c39e3c73b0e66f9d4c1a29c8bc
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
 
@@ -1,5 +1,5 @@
1
1
  module Braintree
2
- class AccountUpdaterDailyReport # :nodoc:
2
+ class AccountUpdaterDailyReport
3
3
  include BaseModule
4
4
 
5
5
  attr_reader :report_date
@@ -7,12 +7,12 @@ module Braintree
7
7
 
8
8
  class << self
9
9
  protected :new
10
- def _new(*args) # :nodoc:
11
- self.new *args
10
+ def _new(*args)
11
+ self.new(*args)
12
12
  end
13
13
  end
14
14
 
15
- def initialize(attributes) # :nodoc:
15
+ def initialize(attributes)
16
16
  set_instance_variables_from_hash(attributes)
17
17
  @report_date = Date.parse(report_date)
18
18
  end
@@ -1,6 +1,6 @@
1
1
  module Braintree
2
2
  class AchMandate
3
- include BaseModule # :nodoc:
3
+ include BaseModule
4
4
 
5
5
  attr_reader :accepted_at
6
6
  attr_reader :text
@@ -1,5 +1,5 @@
1
1
  module Braintree
2
- class AddOnGateway # :nodoc
2
+ class AddOnGateway
3
3
  def initialize(gateway)
4
4
  @gateway = gateway
5
5
  @config = gateway.config
@@ -1,6 +1,6 @@
1
1
  module Braintree
2
2
  class Address
3
- include BaseModule # :nodoc:
3
+ include BaseModule
4
4
 
5
5
  attr_reader :company
6
6
  attr_reader :country_code_alpha2
@@ -12,8 +12,10 @@ module Braintree
12
12
  attr_reader :extended_address
13
13
  attr_reader :first_name
14
14
  attr_reader :id
15
+ attr_reader :international_phone
15
16
  attr_reader :last_name
16
17
  attr_reader :locality
18
+ attr_reader :phone_number
17
19
  attr_reader :postal_code
18
20
  attr_reader :region
19
21
  attr_reader :street_address
@@ -43,44 +45,22 @@ module Braintree
43
45
  Configuration.gateway.address.update!(*args)
44
46
  end
45
47
 
46
- def initialize(gateway, attributes) # :nodoc:
48
+ def initialize(gateway, attributes)
47
49
  @gateway = gateway
48
50
  set_instance_variables_from_hash(attributes)
49
51
  end
50
52
 
51
- def ==(other) # :nodoc:
53
+ def ==(other)
52
54
  return false unless other.is_a?(Address)
53
55
  id == other.id && customer_id == other.customer_id
54
56
  end
55
57
 
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
58
  class << self
79
59
  protected :new
80
60
  end
81
61
 
82
- def self._new(*args) # :nodoc:
83
- self.new *args
62
+ def self._new(*args)
63
+ self.new(*args)
84
64
  end
85
65
  end
86
66
  end
@@ -1,5 +1,5 @@
1
1
  module Braintree
2
- class AddressGateway # :nodoc
2
+ class AddressGateway
3
3
  include BaseModule
4
4
 
5
5
  def initialize(gateway)
@@ -62,7 +62,7 @@ module Braintree
62
62
  return_object_or_raise(:address) { update(*args) }
63
63
  end
64
64
 
65
- def _determine_customer_id(customer_or_customer_id) # :nodoc:
65
+ def _determine_customer_id(customer_or_customer_id)
66
66
  customer_id = customer_or_customer_id.is_a?(Customer) ? customer_or_customer_id.id : customer_or_customer_id
67
67
  unless customer_id =~ /\A[\w_-]+\z/
68
68
  raise ArgumentError, "customer_id contains invalid characters"
@@ -70,17 +70,18 @@ module Braintree
70
70
  customer_id
71
71
  end
72
72
 
73
- def self._create_signature # :nodoc:
73
+ def self._create_signature
74
74
  _shared_signature + [:customer_id]
75
75
  end
76
76
 
77
- def self._shared_signature # :nodoc:
77
+ def self._shared_signature
78
78
  [:company, :country_code_alpha2, :country_code_alpha3, :country_code_numeric,
79
- :country_name, :extended_address, :first_name,
80
- :last_name, :locality, :postal_code, :region, :street_address]
79
+ :country_name, :extended_address, :first_name,
80
+ {:international_phone => [:country_code, :national_number]},
81
+ :last_name, :locality, :phone_number, :postal_code, :region, :street_address]
81
82
  end
82
83
 
83
- def self._update_signature # :nodoc:
84
+ def self._update_signature
84
85
  _create_signature
85
86
  end
86
87
  end
@@ -1,6 +1,6 @@
1
1
  module Braintree
2
- class AdvancedSearch # :nodoc:
3
- class SearchNode # :nodoc:
2
+ class AdvancedSearch
3
+ class SearchNode
4
4
  def self.operators(*operator_names)
5
5
  operator_names.each do |operator|
6
6
  define_method(operator) do |value|
@@ -14,29 +14,29 @@ module Braintree
14
14
  end
15
15
  end
16
16
 
17
- class IsNode < SearchNode # :nodoc:
17
+ class IsNode < SearchNode
18
18
  operators :is
19
19
  end
20
20
 
21
- class EqualityNode < IsNode # :nodoc:
21
+ class EqualityNode < IsNode
22
22
  operators :is_not
23
23
  end
24
24
 
25
- class PartialMatchNode < EqualityNode # :nodoc:
25
+ class PartialMatchNode < EqualityNode
26
26
  operators :ends_with, :starts_with
27
27
  end
28
28
 
29
- class TextNode < PartialMatchNode # :nodoc:
29
+ class TextNode < PartialMatchNode
30
30
  operators :contains
31
31
  end
32
32
 
33
- class KeyValueNode < SearchNode # :nodoc:
33
+ class KeyValueNode < SearchNode
34
34
  def is(value)
35
35
  @parent.add_criteria(@node_name, value)
36
36
  end
37
37
  end
38
38
 
39
- class MultipleValueNode < SearchNode # :nodoc:
39
+ class MultipleValueNode < SearchNode
40
40
  def in(*values)
41
41
  values.flatten!
42
42
 
@@ -62,7 +62,7 @@ module Braintree
62
62
  end
63
63
  end
64
64
 
65
- class EndsWithNode < SearchNode # :nodoc:
65
+ class EndsWithNode < SearchNode
66
66
  operators :ends_with
67
67
  end
68
68
 
@@ -76,12 +76,11 @@ module Braintree
76
76
  end
77
77
  end
78
78
 
79
- class RangeNode < SearchNode # :nodoc:
79
+ class RangeNode < SearchNode
80
80
  operators :is
81
81
 
82
82
  def between(min, max)
83
- self >= min
84
- self <= max
83
+ self >= min && self <= max
85
84
  end
86
85
 
87
86
  def >=(min)
@@ -1,8 +1,8 @@
1
1
  module Braintree
2
2
  class ApplePay
3
- include BaseModule # :nodoc:
3
+ include BaseModule
4
4
 
5
- def initialize(gateway, attributes) # :nodoc:
5
+ def initialize(gateway, attributes)
6
6
  set_instance_variables_from_hash(attributes)
7
7
  end
8
8
 
@@ -10,8 +10,8 @@ module Braintree
10
10
  protected :new
11
11
  end
12
12
 
13
- def self._new(*args) # :nodoc:
14
- self.new *args
13
+ def self._new(*args)
14
+ self.new(*args)
15
15
  end
16
16
 
17
17
  def self.register_domain(domain)
@@ -1,6 +1,6 @@
1
1
  module Braintree
2
2
  class ApplePayCard
3
- include BaseModule # :nodoc:
3
+ include BaseModule
4
4
 
5
5
  module CardType
6
6
  AmEx = "Apple Pay - American Express"
@@ -10,25 +10,39 @@ module Braintree
10
10
  All = constants.map { |c| const_get(c) }
11
11
  end
12
12
 
13
+ attr_reader :billing_address
13
14
  attr_reader :bin
14
15
  attr_reader :card_type
16
+ attr_reader :cardholder_name
17
+ attr_reader :commercial
18
+ attr_reader :country_of_issuance
15
19
  attr_reader :created_at
16
20
  attr_reader :customer_id
21
+ attr_reader :debit
17
22
  attr_reader :default
23
+ attr_reader :durbin_regulated
18
24
  attr_reader :expiration_month
19
25
  attr_reader :expiration_year
20
26
  attr_reader :expired
27
+ attr_reader :healthcare
21
28
  attr_reader :image_url
29
+ attr_reader :issuing_bank
22
30
  attr_reader :last_4
31
+ attr_reader :merchant_token_identifier
23
32
  attr_reader :payment_instrument_name
33
+ attr_reader :payroll
34
+ attr_reader :prepaid
35
+ attr_reader :product_id
36
+ attr_reader :source_card_last4
24
37
  attr_reader :source_description
25
38
  attr_reader :subscriptions
26
39
  attr_reader :token
27
40
  attr_reader :updated_at
28
41
 
29
- def initialize(gateway, attributes) # :nodoc:
42
+ def initialize(gateway, attributes)
30
43
  @gateway = gateway
31
44
  set_instance_variables_from_hash(attributes)
45
+ @billing_address = attributes[:billing_address] ? Address._new(@gateway, attributes[:billing_address]) : nil
32
46
  @subscriptions = (@subscriptions || []).map { |subscription_hash| Subscription._new(@gateway, subscription_hash) }
33
47
  end
34
48
 
@@ -44,8 +58,8 @@ module Braintree
44
58
  protected :new
45
59
  end
46
60
 
47
- def self._new(*args) # :nodoc:
48
- self.new *args
61
+ def self._new(*args)
62
+ self.new(*args)
49
63
  end
50
64
  end
51
65
  end
@@ -1,10 +1,10 @@
1
1
  module Braintree
2
2
  class ApplePayOptions
3
- include BaseModule # :nodoc:
3
+ include BaseModule
4
4
 
5
5
  attr_reader :domains
6
6
 
7
- def initialize(attributes) # :nodoc:
7
+ def initialize(attributes)
8
8
  set_instance_variables_from_hash(attributes)
9
9
  end
10
10
 
@@ -12,8 +12,8 @@ module Braintree
12
12
  protected :new
13
13
  end
14
14
 
15
- def self._new(*args) # :nodoc:
16
- self.new *args
15
+ def self._new(*args)
16
+ self.new(*args)
17
17
  end
18
18
  end
19
19
  end
@@ -1,5 +1,5 @@
1
1
  module Braintree
2
- class AuthorizationAdjustment # :nodoc:
2
+ class AuthorizationAdjustment
3
3
  include BaseModule
4
4
 
5
5
  attr_reader :amount
@@ -11,12 +11,12 @@ module Braintree
11
11
 
12
12
  class << self
13
13
  protected :new
14
- def _new(*args) # :nodoc:
15
- self.new *args
14
+ def _new(*args)
15
+ self.new(*args)
16
16
  end
17
17
  end
18
18
 
19
- def initialize(attributes) # :nodoc:
19
+ def initialize(attributes)
20
20
  set_instance_variables_from_hash(attributes)
21
21
  end
22
22
  end
@@ -1,5 +1,5 @@
1
1
  module Braintree
2
- module BaseModule # :nodoc: all
2
+ module BaseModule
3
3
  module Methods
4
4
  def return_object_or_raise(object_to_return)
5
5
  result = yield
@@ -18,6 +18,16 @@ module Braintree
18
18
 
19
19
  def set_instance_variables_from_hash(hash)
20
20
  hash.each do |key, value|
21
+ if key == :global_id
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
29
+ end
30
+
21
31
  instance_variable_set "@#{key}", value
22
32
  end
23
33
  end
@@ -1,5 +1,5 @@
1
1
  module Braintree
2
- class BinData # :nodoc:
2
+ class BinData
3
3
  include BaseModule
4
4
 
5
5
  attr_reader :commercial
@@ -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
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
@@ -25,16 +25,17 @@ module Braintree
25
25
  end
26
26
  end
27
27
 
28
- def self._generate_signature # :nodoc:
28
+ def self._generate_signature
29
29
  [
30
30
  :address_id, :customer_id, :proxy_merchant_id, :merchant_account_id,
31
31
  :version,
32
- {:options => [:make_default, :verify_card, :fail_on_duplicate_payment_method]}
32
+ {:domains => [:_any_key_]},
33
+ {:options => [:fail_on_duplicate_payment_method, :fail_on_duplicate_payment_method_for_customer, :make_default, :verify_card]}
33
34
  ]
34
35
  end
35
36
 
36
37
  def _validate_options(options)
37
- [:make_default, :fail_on_duplicate_payment_method, :verify_card].each do |credit_card_option|
38
+ [:fail_on_duplicate_payment_method, :fail_on_duplicate_payment_method_for_customer, :make_default, :verify_card].each do |credit_card_option|
38
39
  if options[credit_card_option]
39
40
  raise ArgumentError.new("cannot specify #{credit_card_option} without a customer_id") unless options[:customer_id]
40
41
  end
@@ -1,8 +1,9 @@
1
1
  module Braintree
2
2
  class Configuration
3
- API_VERSION = "5" # :nodoc:
4
- DEFAULT_ENDPOINT = "api" # :nodoc:
5
- GRAPHQL_API_VERSION = "2018-09-10" # :nodoc:
3
+ API_VERSION = "6"
4
+ DEFAULT_ENDPOINT = "api"
5
+ # NEXT_MAJOR_VERSION update to the latest version of GraphQL API
6
+ GRAPHQL_API_VERSION = "2018-09-10"
6
7
 
7
8
  READABLE_ATTRIBUTES = [
8
9
  :merchant_id,
@@ -40,25 +41,24 @@ module Braintree
40
41
  ]
41
42
 
42
43
  class << self
43
- attr_writer *WRITABLE_ATTRIBUTES
44
- attr_reader *NON_REQUIRED_READABLE_ATTRIBUTES
44
+ attr_writer(*WRITABLE_ATTRIBUTES)
45
+ attr_reader(*NON_REQUIRED_READABLE_ATTRIBUTES)
45
46
  end
46
- attr_reader *READABLE_ATTRIBUTES
47
- attr_reader *NON_REQUIRED_READABLE_ATTRIBUTES
48
- attr_writer *WRITABLE_ATTRIBUTES
47
+ attr_reader(*READABLE_ATTRIBUTES)
48
+ attr_reader(*NON_REQUIRED_READABLE_ATTRIBUTES)
49
+ attr_writer(*WRITABLE_ATTRIBUTES)
49
50
 
50
- def self.expectant_reader(*attributes) # :nodoc:
51
+ def self.expectant_reader(*attributes)
51
52
  attributes.each do |attribute|
52
53
  (class << self; self; end).send(:define_method, attribute) do
53
54
  attribute_value = instance_variable_get("@#{attribute}")
54
- raise ConfigurationError.new("Braintree::Configuration.#{attribute.to_s} needs to be set") if attribute_value.nil? || attribute_value.to_s.empty?
55
+ raise ConfigurationError.new("Braintree::Configuration.#{attribute} needs to be set") if attribute_value.nil? || attribute_value.to_s.empty?
55
56
  attribute_value
56
57
  end
57
58
  end
58
59
  end
59
- expectant_reader *READABLE_ATTRIBUTES
60
+ expectant_reader(*READABLE_ATTRIBUTES)
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)
63
63
  env = env.to_sym
64
64
  unless [:development, :qa, :sandbox, :production].include?(env)
@@ -67,12 +67,12 @@ module Braintree
67
67
  @environment = env
68
68
  end
69
69
 
70
- def self.gateway # :nodoc:
70
+ def self.gateway
71
71
  Braintree::Gateway.new(instantiate)
72
72
  end
73
73
 
74
- def self.instantiate # :nodoc:
75
- config = new(
74
+ def self.instantiate
75
+ new(
76
76
  :custom_user_agent => @custom_user_agent,
77
77
  :endpoint => @endpoint,
78
78
  :environment => environment,
@@ -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
 
@@ -158,15 +158,15 @@ module Braintree
158
158
  end
159
159
  end
160
160
 
161
- def api_version # :nodoc:
161
+ def api_version
162
162
  API_VERSION
163
163
  end
164
164
 
165
- def graphql_api_version # :nodoc:
165
+ def graphql_api_version
166
166
  GRAPHQL_API_VERSION
167
167
  end
168
168
 
169
- def base_merchant_path # :nodoc:
169
+ def base_merchant_path
170
170
  "/merchants/#{merchant_id}"
171
171
  end
172
172
 
@@ -178,11 +178,11 @@ module Braintree
178
178
  "#{protocol}://#{graphql_server}:#{graphql_port}/graphql"
179
179
  end
180
180
 
181
- def base_merchant_url # :nodoc:
181
+ def base_merchant_url
182
182
  "#{base_url}#{base_merchant_path}"
183
183
  end
184
184
 
185
- def ca_file # :nodoc:
185
+ def ca_file
186
186
  File.expand_path(File.join(File.dirname(__FILE__), "..", "ssl", "api_braintreegateway_com.ca.crt"))
187
187
  end
188
188
 
@@ -190,7 +190,7 @@ module Braintree
190
190
  @endpoint || DEFAULT_ENDPOINT
191
191
  end
192
192
 
193
- def http # :nodoc:
193
+ def http
194
194
  Http.new(self)
195
195
  end
196
196
 
@@ -202,25 +202,25 @@ module Braintree
202
202
  @logger ||= self.class._default_logger
203
203
  end
204
204
 
205
- def port # :nodoc:
205
+ def port
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
212
212
  end
213
213
 
214
- def graphql_port # :nodoc:
214
+ def graphql_port
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
221
221
  end
222
222
 
223
- def protocol # :nodoc:
223
+ def protocol
224
224
  ssl? ? "https" : "http"
225
225
  end
226
226
 
@@ -232,23 +232,23 @@ module Braintree
232
232
  @http_read_timeout
233
233
  end
234
234
 
235
- def server # :nodoc:
235
+ def server
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
242
- "gateway.qa.braintreepayments.com"
242
+ "gateway.qa2.braintreepayments.com"
243
243
  when :sandbox
244
244
  "api.sandbox.braintreegateway.com"
245
245
  end
246
246
  end
247
247
 
248
- def graphql_server # :nodoc:
248
+ def graphql_server
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
@@ -271,7 +271,7 @@ module Braintree
271
271
  end
272
272
  end
273
273
 
274
- def ssl? # :nodoc:
274
+ def ssl?
275
275
  case @environment
276
276
  when :development, :integration
277
277
  false
@@ -280,12 +280,12 @@ module Braintree
280
280
  end
281
281
  end
282
282
 
283
- def user_agent # :nodoc:
283
+ def user_agent
284
284
  base_user_agent = "Braintree Ruby Gem #{Braintree::Version::String}"
285
285
  @custom_user_agent ? "#{base_user_agent} (#{@custom_user_agent})" : base_user_agent
286
286
  end
287
287
 
288
- def self._default_logger # :nodoc:
288
+ def self._default_logger
289
289
  logger = Logger.new(STDOUT)
290
290
  logger.level = Logger::INFO
291
291
  logger