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
@@ -1,4 +1,4 @@
1
- require 'stringio'
1
+ require "stringio"
2
2
 
3
3
  require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
4
4
 
@@ -22,26 +22,26 @@ describe Braintree::Configuration do
22
22
  describe "initialize" do
23
23
  it "accepts merchant credentials" do
24
24
  config = Braintree::Configuration.new(
25
- :merchant_id => 'merchant_id',
26
- :public_key => 'public_key',
27
- :private_key => 'private_key'
25
+ :merchant_id => "merchant_id",
26
+ :public_key => "public_key",
27
+ :private_key => "private_key",
28
28
  )
29
29
 
30
- config.merchant_id.should == 'merchant_id'
31
- config.public_key.should == 'public_key'
32
- config.private_key.should == 'private_key'
30
+ expect(config.merchant_id).to eq("merchant_id")
31
+ expect(config.public_key).to eq("public_key")
32
+ expect(config.private_key).to eq("private_key")
33
33
  end
34
34
 
35
35
  it "accepts partner credentials" do
36
36
  config = Braintree::Configuration.new(
37
- :partner_id => 'partner_id',
38
- :public_key => 'public_key',
39
- :private_key => 'private_key'
37
+ :partner_id => "partner_id",
38
+ :public_key => "public_key",
39
+ :private_key => "private_key",
40
40
  )
41
41
 
42
- config.merchant_id.should == 'partner_id'
43
- config.public_key.should == 'public_key'
44
- config.private_key.should == 'private_key'
42
+ expect(config.merchant_id).to eq("partner_id")
43
+ expect(config.public_key).to eq("public_key")
44
+ expect(config.private_key).to eq("private_key")
45
45
  end
46
46
 
47
47
  it "raises if combining client_id/secret with access_token" do
@@ -49,7 +49,7 @@ describe Braintree::Configuration do
49
49
  Braintree::Configuration.new(
50
50
  :client_id => "client_id$development$integration_client_id",
51
51
  :client_secret => "client_secret$development$integration_client_secret",
52
- :access_token => "access_token$development$integration_merchant_id$fb27c79dd"
52
+ :access_token => "access_token$development$integration_merchant_id$fb27c79dd",
53
53
  )
54
54
  end.to raise_error(Braintree::ConfigurationError, /mixed credential types/)
55
55
  end
@@ -62,7 +62,7 @@ describe Braintree::Configuration do
62
62
  :merchant_id => "merchant_id",
63
63
  :public_key => "public_key",
64
64
  :private_key => "private_key",
65
- :environment => "development"
65
+ :environment => "development",
66
66
  )
67
67
  end.to raise_error(Braintree::ConfigurationError, /mixed credential types/)
68
68
  end
@@ -82,7 +82,7 @@ describe Braintree::Configuration do
82
82
  :access_token => "access_token$development$integration_merchant_id$fb27c79dd",
83
83
  :environment => "sandbox",
84
84
  )
85
- $stderr.string.should == "Braintree::Gateway should not be initialized with mixed environments: environment parameter and access_token do not match, environment from access_token is used.\n"
85
+ expect($stderr.string).to eq("Braintree::Gateway should not be initialized with mixed environments: environment parameter and access_token do not match, environment from access_token is used.\n")
86
86
  end
87
87
 
88
88
  it "does not warn if both environment and access_token are provided and their environments match" do
@@ -90,36 +90,36 @@ describe Braintree::Configuration do
90
90
  :access_token => "access_token$development$integration_merchant_id$fb27c79dd",
91
91
  :environment => "development",
92
92
  )
93
- $stderr.string.should == ""
93
+ expect($stderr.string).to eq("")
94
94
  end
95
95
  end
96
96
 
97
97
  it "accepts proxy params" do
98
98
  config = Braintree::Configuration.new(
99
- :proxy_address => 'localhost',
99
+ :proxy_address => "localhost",
100
100
  :proxy_port => 8080,
101
- :proxy_user => 'user',
102
- :proxy_pass => 'test'
101
+ :proxy_user => "user",
102
+ :proxy_pass => "test",
103
103
  )
104
104
 
105
- config.proxy_address.should == 'localhost'
106
- config.proxy_port.should == 8080
107
- config.proxy_user.should == 'user'
108
- config.proxy_pass.should == 'test'
105
+ expect(config.proxy_address).to eq("localhost")
106
+ expect(config.proxy_port).to eq(8080)
107
+ expect(config.proxy_user).to eq("user")
108
+ expect(config.proxy_pass).to eq("test")
109
109
  end
110
110
 
111
111
  it "accepts ssl version" do
112
112
  config = Braintree::Configuration.new(
113
- :ssl_version => :TLSv1_2
113
+ :ssl_version => :TLSv1_2,
114
114
  )
115
115
 
116
- config.ssl_version.should == :TLSv1_2
116
+ expect(config.ssl_version).to eq(:TLSv1_2)
117
117
  end
118
118
  end
119
119
 
120
120
  describe "base_merchant_path" do
121
121
  it "returns /merchants/{merchant_id}" do
122
- Braintree::Configuration.instantiate.base_merchant_path.should == "/merchants/integration_merchant_id"
122
+ expect(Braintree::Configuration.instantiate.base_merchant_path).to eq("/merchants/integration_merchant_id")
123
123
  end
124
124
  end
125
125
 
@@ -127,17 +127,17 @@ describe Braintree::Configuration do
127
127
  it "returns the expected url for the development env" do
128
128
  Braintree::Configuration.environment = :development
129
129
  port = Braintree::Configuration.instantiate.port
130
- Braintree::Configuration.instantiate.base_merchant_url.should == "http://localhost:#{port}/merchants/integration_merchant_id"
130
+ expect(Braintree::Configuration.instantiate.base_merchant_url).to eq("http://localhost:#{port}/merchants/integration_merchant_id")
131
131
  end
132
132
 
133
133
  it "returns the expected url for the sandbox env" do
134
134
  Braintree::Configuration.environment = :sandbox
135
- Braintree::Configuration.instantiate.base_merchant_url.should == "https://api.sandbox.braintreegateway.com:443/merchants/integration_merchant_id"
135
+ expect(Braintree::Configuration.instantiate.base_merchant_url).to eq("https://api.sandbox.braintreegateway.com:443/merchants/integration_merchant_id")
136
136
  end
137
137
 
138
138
  it "returns the expected url for the production env" do
139
139
  Braintree::Configuration.environment = :production
140
- Braintree::Configuration.instantiate.base_merchant_url.should == "https://api.braintreegateway.com:443/merchants/integration_merchant_id"
140
+ expect(Braintree::Configuration.instantiate.base_merchant_url).to eq("https://api.braintreegateway.com:443/merchants/integration_merchant_id")
141
141
  end
142
142
  end
143
143
 
@@ -145,27 +145,27 @@ describe Braintree::Configuration do
145
145
  it "sandbox" do
146
146
  Braintree::Configuration.environment = :sandbox
147
147
  ca_file = Braintree::Configuration.instantiate.ca_file
148
- ca_file.should match(/api_braintreegateway_com\.ca\.crt$/)
149
- File.exists?(ca_file).should == true
148
+ expect(ca_file).to match(/api_braintreegateway_com\.ca\.crt$/)
149
+ expect(File.exist?(ca_file)).to eq(true)
150
150
  end
151
151
 
152
152
  it "production" do
153
153
  Braintree::Configuration.environment = :production
154
154
  ca_file = Braintree::Configuration.instantiate.ca_file
155
- ca_file.should match(/api_braintreegateway_com\.ca\.crt$/)
156
- File.exists?(ca_file).should == true
155
+ expect(ca_file).to match(/api_braintreegateway_com\.ca\.crt$/)
156
+ expect(File.exist?(ca_file)).to eq(true)
157
157
  end
158
158
  end
159
159
 
160
160
  describe "logger" do
161
161
  it "defaults to logging to stdout with log_level info" do
162
162
  config = Braintree::Configuration.new
163
- config.logger.level.should == Logger::INFO
163
+ expect(config.logger.level).to eq(Logger::INFO)
164
164
  end
165
165
 
166
166
  it "lazily initializes so that you can do Braintree::Configuration.logger.level = when configuring the client lib" do
167
167
  config = Braintree::Configuration.new :logger => nil
168
- config.logger.should_not == nil
168
+ expect(config.logger).not_to eq(nil)
169
169
  end
170
170
 
171
171
  it "can set logger on gateway instance" do
@@ -215,17 +215,17 @@ describe Braintree::Configuration do
215
215
 
216
216
  gateway = Braintree::Configuration.gateway
217
217
 
218
- gateway.config.proxy_address.should == "localhost"
219
- gateway.config.proxy_port.should == 8080
220
- gateway.config.proxy_user.should == "user"
221
- gateway.config.proxy_pass.should == "test"
218
+ expect(gateway.config.proxy_address).to eq("localhost")
219
+ expect(gateway.config.proxy_port).to eq(8080)
220
+ expect(gateway.config.proxy_user).to eq("user")
221
+ expect(gateway.config.proxy_pass).to eq("test")
222
222
  end
223
223
 
224
224
  it "sets the ssl version" do
225
225
  Braintree::Configuration.ssl_version = :TLSv1_2
226
226
  gateway = Braintree::Configuration.gateway
227
227
 
228
- gateway.config.ssl_version.should == :TLSv1_2
228
+ expect(gateway.config.ssl_version).to eq(:TLSv1_2)
229
229
  end
230
230
  end
231
231
 
@@ -238,12 +238,12 @@ describe Braintree::Configuration do
238
238
 
239
239
  it "allows the environment to be set with a string value" do
240
240
  expect do
241
- Braintree::Configuration.environment = 'sandbox'
241
+ Braintree::Configuration.environment = "sandbox"
242
242
  end.not_to raise_error
243
243
  end
244
244
 
245
245
  it "sets the environment as a symbol" do
246
- Braintree::Configuration.environment = 'sandbox'
246
+ Braintree::Configuration.environment = "sandbox"
247
247
  expect(Braintree::Configuration.environment).to eq :sandbox
248
248
  end
249
249
  end
@@ -253,7 +253,7 @@ describe Braintree::Configuration do
253
253
  begin
254
254
  old_logger = Braintree::Configuration.logger
255
255
  Braintree::Configuration.logger = nil
256
- Braintree::Configuration.instantiate.logger.level.should == Logger::INFO
256
+ expect(Braintree::Configuration.instantiate.logger.level).to eq(Logger::INFO)
257
257
  ensure
258
258
  Braintree::Configuration.logger = old_logger
259
259
  end
@@ -261,7 +261,7 @@ describe Braintree::Configuration do
261
261
 
262
262
  it "lazily initializes so that you can do Braintree::Configuration.logger.level = when configuring the client lib" do
263
263
  Braintree::Configuration.logger = nil
264
- Braintree::Configuration.logger.should_not == nil
264
+ expect(Braintree::Configuration.logger).not_to eq(nil)
265
265
  end
266
266
  end
267
267
 
@@ -316,25 +316,25 @@ describe Braintree::Configuration do
316
316
  describe "self.port" do
317
317
  it "is 443 for production" do
318
318
  Braintree::Configuration.environment = :production
319
- Braintree::Configuration.instantiate.port.should == 443
319
+ expect(Braintree::Configuration.instantiate.port).to eq(443)
320
320
  end
321
321
 
322
322
  it "is 443 for sandbox" do
323
323
  Braintree::Configuration.environment = :sandbox
324
- Braintree::Configuration.instantiate.port.should == 443
324
+ expect(Braintree::Configuration.instantiate.port).to eq(443)
325
325
  end
326
326
 
327
327
  it "is 3000 or GATEWAY_PORT environment variable for development" do
328
328
  Braintree::Configuration.environment = :development
329
- old_gateway_port = ENV['GATEWAY_PORT']
329
+ old_gateway_port = ENV["GATEWAY_PORT"]
330
330
  begin
331
- ENV['GATEWAY_PORT'] = nil
332
- Braintree::Configuration.instantiate.port.should == 3000
331
+ ENV["GATEWAY_PORT"] = nil
332
+ expect(Braintree::Configuration.instantiate.port).to eq(3000)
333
333
 
334
- ENV['GATEWAY_PORT'] = '1234'
335
- Braintree::Configuration.instantiate.port.should == '1234'
334
+ ENV["GATEWAY_PORT"] = "1234"
335
+ expect(Braintree::Configuration.instantiate.port).to eq("1234")
336
336
  ensure
337
- ENV['GATEWAY_PORT'] = old_gateway_port
337
+ ENV["GATEWAY_PORT"] = old_gateway_port
338
338
  end
339
339
  end
340
340
  end
@@ -342,32 +342,32 @@ describe Braintree::Configuration do
342
342
  describe "self.protocol" do
343
343
  it "is http for development" do
344
344
  Braintree::Configuration.environment = :development
345
- Braintree::Configuration.instantiate.protocol.should == "http"
345
+ expect(Braintree::Configuration.instantiate.protocol).to eq("http")
346
346
  end
347
347
 
348
348
  it "is https for production" do
349
349
  Braintree::Configuration.environment = :production
350
- Braintree::Configuration.instantiate.protocol.should == "https"
350
+ expect(Braintree::Configuration.instantiate.protocol).to eq("https")
351
351
  end
352
352
 
353
353
  it "is https for sandbox" do
354
354
  Braintree::Configuration.environment = :sandbox
355
- Braintree::Configuration.instantiate.protocol.should == "https"
355
+ expect(Braintree::Configuration.instantiate.protocol).to eq("https")
356
356
  end
357
357
  end
358
358
 
359
359
  describe "graphql_server" do
360
360
  it "is localhost or GRAPHQL_HOST environment variable for development" do
361
361
  Braintree::Configuration.environment = :development
362
- old_gateway_url = ENV['GRAPHQL_HOST']
362
+ old_gateway_url = ENV["GRAPHQL_HOST"]
363
363
  begin
364
- ENV['GRAPHQL_HOST'] = nil
365
- Braintree::Configuration.instantiate.graphql_server.should == "graphql.bt.local"
364
+ ENV["GRAPHQL_HOST"] = nil
365
+ expect(Braintree::Configuration.instantiate.graphql_server).to eq("graphql.bt.local")
366
366
 
367
- ENV['GRAPHQL_HOST'] = 'gateway'
368
- Braintree::Configuration.instantiate.graphql_server.should == 'gateway'
367
+ ENV["GRAPHQL_HOST"] = "gateway"
368
+ expect(Braintree::Configuration.instantiate.graphql_server).to eq("gateway")
369
369
  ensure
370
- ENV['GRAPHQL_HOST'] = old_gateway_url
370
+ ENV["GRAPHQL_HOST"] = old_gateway_url
371
371
  end
372
372
  end
373
373
  end
@@ -375,76 +375,76 @@ describe Braintree::Configuration do
375
375
  describe "server" do
376
376
  it "is localhost or GATEWAY_HOST environment variable for development" do
377
377
  Braintree::Configuration.environment = :development
378
- old_gateway_url = ENV['GATEWAY_HOST']
378
+ old_gateway_url = ENV["GATEWAY_HOST"]
379
379
  begin
380
- ENV['GATEWAY_HOST'] = nil
381
- Braintree::Configuration.instantiate.server.should == "localhost"
380
+ ENV["GATEWAY_HOST"] = nil
381
+ expect(Braintree::Configuration.instantiate.server).to eq("localhost")
382
382
 
383
- ENV['GATEWAY_HOST'] = 'gateway'
384
- Braintree::Configuration.instantiate.server.should == 'gateway'
383
+ ENV["GATEWAY_HOST"] = "gateway"
384
+ expect(Braintree::Configuration.instantiate.server).to eq("gateway")
385
385
  ensure
386
- ENV['GATEWAY_HOST'] = old_gateway_url
386
+ ENV["GATEWAY_HOST"] = old_gateway_url
387
387
  end
388
388
  end
389
389
 
390
390
  it "is api.braintreegateway.com for production" do
391
391
  Braintree::Configuration.environment = :production
392
- Braintree::Configuration.instantiate.server.should == "api.braintreegateway.com"
392
+ expect(Braintree::Configuration.instantiate.server).to eq("api.braintreegateway.com")
393
393
  end
394
394
 
395
395
  it "is api.sandbox.braintreegateway.com for sandbox" do
396
396
  Braintree::Configuration.environment = :sandbox
397
- Braintree::Configuration.instantiate.server.should == "api.sandbox.braintreegateway.com"
397
+ expect(Braintree::Configuration.instantiate.server).to eq("api.sandbox.braintreegateway.com")
398
398
  end
399
399
 
400
400
  it "is qa.braintreegateway.com for qa" do
401
401
  Braintree::Configuration.environment = :qa
402
- Braintree::Configuration.instantiate.server.should == "gateway.qa.braintreepayments.com"
402
+ expect(Braintree::Configuration.instantiate.server).to eq("gateway.qa2.braintreepayments.com")
403
403
  end
404
404
 
405
405
  it "can by changed by configuring the production endpoint" do
406
406
  Braintree::Configuration.environment = :production
407
407
  Braintree::Configuration.endpoint = "custom-endpoint"
408
- Braintree::Configuration.instantiate.server.should == "custom-endpoint.braintreegateway.com"
408
+ expect(Braintree::Configuration.instantiate.server).to eq("custom-endpoint.braintreegateway.com")
409
409
  end
410
410
  end
411
411
 
412
412
  describe "auth_url" do
413
413
  it "is http://auth.venmo.dev for development" do
414
414
  Braintree::Configuration.environment = :development
415
- Braintree::Configuration.instantiate.auth_url.should == "http://auth.venmo.dev:9292"
415
+ expect(Braintree::Configuration.instantiate.auth_url).to eq("http://auth.venmo.dev:9292")
416
416
  end
417
417
 
418
418
  it "is https://auth.venmo.com for production" do
419
419
  Braintree::Configuration.environment = :production
420
- Braintree::Configuration.instantiate.auth_url.should == "https://auth.venmo.com"
420
+ expect(Braintree::Configuration.instantiate.auth_url).to eq("https://auth.venmo.com")
421
421
  end
422
422
 
423
423
  it "is https://auth.sandbox.venmo.com for sandbox" do
424
424
  Braintree::Configuration.environment = :sandbox
425
- Braintree::Configuration.instantiate.auth_url.should == "https://auth.venmo.sandbox.braintreegateway.com"
425
+ expect(Braintree::Configuration.instantiate.auth_url).to eq("https://auth.venmo.sandbox.braintreegateway.com")
426
426
  end
427
427
 
428
428
  it "is https://auth.qa.venmo.com for qa" do
429
429
  Braintree::Configuration.environment = :qa
430
- Braintree::Configuration.instantiate.auth_url.should == "https://auth.venmo.qa2.braintreegateway.com"
430
+ expect(Braintree::Configuration.instantiate.auth_url).to eq("https://auth.venmo.qa2.braintreegateway.com")
431
431
  end
432
432
  end
433
433
 
434
434
  describe "ssl?" do
435
435
  it "returns false for development" do
436
436
  Braintree::Configuration.environment = :development
437
- Braintree::Configuration.instantiate.ssl?.should == false
437
+ expect(Braintree::Configuration.instantiate.ssl?).to eq(false)
438
438
  end
439
439
 
440
440
  it "returns true for production" do
441
441
  Braintree::Configuration.environment = :production
442
- Braintree::Configuration.instantiate.ssl?.should == true
442
+ expect(Braintree::Configuration.instantiate.ssl?).to eq(true)
443
443
  end
444
444
 
445
445
  it "returns true for sandbox" do
446
446
  Braintree::Configuration.environment = :sandbox
447
- Braintree::Configuration.instantiate.ssl?.should == true
447
+ expect(Braintree::Configuration.instantiate.ssl?).to eq(true)
448
448
  end
449
449
  end
450
450
 
@@ -455,20 +455,20 @@ describe Braintree::Configuration do
455
455
 
456
456
  it "appends the default user_agent with the given value" do
457
457
  Braintree::Configuration.custom_user_agent = "ActiveMerchant 1.2.3"
458
- Braintree::Configuration.instantiate.user_agent.should == "Braintree Ruby Gem #{Braintree::Version::String} (ActiveMerchant 1.2.3)"
458
+ expect(Braintree::Configuration.instantiate.user_agent).to eq("Braintree Ruby Gem #{Braintree::Version::String} (ActiveMerchant 1.2.3)")
459
459
  end
460
460
 
461
461
  it "does not append anything if there is no custom_user_agent" do
462
462
  Braintree::Configuration.custom_user_agent = nil
463
- Braintree::Configuration.instantiate.user_agent.should == "Braintree Ruby Gem #{Braintree::Version::String}"
463
+ expect(Braintree::Configuration.instantiate.user_agent).to eq("Braintree Ruby Gem #{Braintree::Version::String}")
464
464
  end
465
465
  end
466
466
 
467
467
  describe "inspect" do
468
468
  it "masks the private_key" do
469
469
  config = Braintree::Configuration.new(:private_key => "secret_key")
470
- config.inspect.should include('@private_key="[FILTERED]"')
471
- config.inspect.should_not include('secret_key')
470
+ expect(config.inspect).to include('@private_key="[FILTERED]"')
471
+ expect(config.inspect).not_to include("secret_key")
472
472
  end
473
473
  end
474
474
 
@@ -476,7 +476,7 @@ describe Braintree::Configuration do
476
476
  it "has a signature service initialized with the private key" do
477
477
  config = Braintree::Configuration.new(:private_key => "secret_key")
478
478
 
479
- config.signature_service.key.should == "secret_key"
479
+ expect(config.signature_service.key).to eq("secret_key")
480
480
  end
481
481
  end
482
482
  end
@@ -6,9 +6,9 @@ describe Braintree::CredentialsParser do
6
6
  parser = Braintree::CredentialsParser.new
7
7
  parser.parse_client_credentials("client_id$development$integration_client_id", "client_secret$development$integration_client_secret")
8
8
 
9
- parser.client_id.should == "client_id$development$integration_client_id"
10
- parser.client_secret.should == "client_secret$development$integration_client_secret"
11
- parser.environment.should == :development
9
+ expect(parser.client_id).to eq("client_id$development$integration_client_id")
10
+ expect(parser.client_secret).to eq("client_secret$development$integration_client_secret")
11
+ expect(parser.environment).to eq(:development)
12
12
  end
13
13
 
14
14
  it "raises error on inconsistent environment" do
@@ -57,9 +57,9 @@ describe Braintree::CredentialsParser do
57
57
  parser = Braintree::CredentialsParser.new
58
58
  parser.parse_access_token("access_token$development$integration_merchant_id$fb27c79dd")
59
59
 
60
- parser.merchant_id.should == "integration_merchant_id"
61
- parser.access_token.should == "access_token$development$integration_merchant_id$fb27c79dd"
62
- parser.environment.should == :development
60
+ expect(parser.merchant_id).to eq("integration_merchant_id")
61
+ expect(parser.access_token).to eq("access_token$development$integration_merchant_id$fb27c79dd")
62
+ expect(parser.environment).to eq(:development)
63
63
  end
64
64
 
65
65
  it "raises error on nil access_token" do