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
@@ -41,7 +41,7 @@ VALID_APPLICATION_PARAMS = {
41
41
  :business => {
42
42
  :legal_name => "Joe's Bloggs",
43
43
  :dba_name => "Joe's Junkyard",
44
- :tax_id => "123456789",
44
+ :tax_id => "423456789",
45
45
  :address => {
46
46
  :street_address => "456 Fake St",
47
47
  :postal_code => "48104",
@@ -65,7 +65,7 @@ describe Braintree::MerchantAccount do
65
65
  gateway = Braintree::Gateway.new(
66
66
  :client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
67
67
  :client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
68
- :logger => Logger.new("/dev/null")
68
+ :logger => Logger.new("/dev/null"),
69
69
  )
70
70
 
71
71
  code = Braintree::OAuthTestHelper.create_grant(gateway, {
@@ -75,50 +75,50 @@ describe Braintree::MerchantAccount do
75
75
 
76
76
  result = gateway.oauth.create_token_from_code(
77
77
  :code => code,
78
- :scope => "read_write"
78
+ :scope => "read_write",
79
79
  )
80
80
 
81
81
  gateway = Braintree::Gateway.new(
82
82
  :access_token => result.credentials.access_token,
83
- :logger => Logger.new("/dev/null")
83
+ :logger => Logger.new("/dev/null"),
84
84
  )
85
85
 
86
86
  result = gateway.merchant_account.all
87
- result.should be_success
88
- result.merchant_accounts.count.should > 20
87
+ expect(result).to be_success
88
+ expect(result.merchant_accounts.count).to be > 20
89
89
  end
90
90
 
91
91
  it "returns merchant account with correct attributes" do
92
92
  gateway = Braintree::Gateway.new(
93
93
  :client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
94
94
  :client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
95
- :logger => Logger.new("/dev/null")
95
+ :logger => Logger.new("/dev/null"),
96
96
  )
97
97
 
98
98
  result = gateway.merchant.create(
99
99
  :email => "name@email.com",
100
- :country_code_alpha3 => "USA",
101
- :payment_methods => ["credit_card", "paypal"]
100
+ :country_code_alpha3 => "GBR",
101
+ :payment_methods => ["credit_card", "paypal"],
102
102
  )
103
103
 
104
104
  gateway = Braintree::Gateway.new(
105
105
  :access_token => result.credentials.access_token,
106
- :logger => Logger.new("/dev/null")
106
+ :logger => Logger.new("/dev/null"),
107
107
  )
108
108
 
109
109
  result = gateway.merchant_account.all
110
- result.should be_success
111
- result.merchant_accounts.count.should == 1
112
- result.merchant_accounts.first.currency_iso_code.should == "USD"
113
- result.merchant_accounts.first.status.should == "active"
114
- result.merchant_accounts.first.default.should == true
110
+ expect(result).to be_success
111
+ expect(result.merchant_accounts.count).to eq(1)
112
+ expect(result.merchant_accounts.first.currency_iso_code).to eq("GBP")
113
+ expect(result.merchant_accounts.first.status).to eq("active")
114
+ expect(result.merchant_accounts.first.default).to eq(true)
115
115
  end
116
116
 
117
117
  it "returns all merchant accounts for read_only scoped grants" do
118
118
  gateway = Braintree::Gateway.new(
119
119
  :client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
120
120
  :client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
121
- :logger => Logger.new("/dev/null")
121
+ :logger => Logger.new("/dev/null"),
122
122
  )
123
123
 
124
124
  code = Braintree::OAuthTestHelper.create_grant(gateway, {
@@ -128,17 +128,17 @@ describe Braintree::MerchantAccount do
128
128
 
129
129
  result = gateway.oauth.create_token_from_code(
130
130
  :code => code,
131
- :scope => "read_only"
131
+ :scope => "read_only",
132
132
  )
133
133
 
134
134
  gateway = Braintree::Gateway.new(
135
135
  :access_token => result.credentials.access_token,
136
- :logger => Logger.new("/dev/null")
136
+ :logger => Logger.new("/dev/null"),
137
137
  )
138
138
 
139
139
  result = gateway.merchant_account.all
140
- result.should be_success
141
- result.merchant_accounts.count.should > 20
140
+ expect(result).to be_success
141
+ expect(result.merchant_accounts.count).to be > 20
142
142
  end
143
143
  end
144
144
 
@@ -146,17 +146,17 @@ describe Braintree::MerchantAccount do
146
146
  it "accepts the deprecated parameters" do
147
147
  result = Braintree::MerchantAccount.create(DEPRECATED_APPLICATION_PARAMS)
148
148
 
149
- result.should be_success
150
- result.merchant_account.status.should == Braintree::MerchantAccount::Status::Pending
151
- result.merchant_account.master_merchant_account.id.should == "sandbox_master_merchant_account"
149
+ expect(result).to be_success
150
+ expect(result.merchant_account.status).to eq(Braintree::MerchantAccount::Status::Pending)
151
+ expect(result.merchant_account.master_merchant_account.id).to eq("sandbox_master_merchant_account")
152
152
  end
153
153
 
154
154
  it "creates a merchant account with the new parameters and doesn't require an id" do
155
155
  result = Braintree::MerchantAccount.create(VALID_APPLICATION_PARAMS)
156
156
 
157
- result.should be_success
158
- result.merchant_account.status.should == Braintree::MerchantAccount::Status::Pending
159
- result.merchant_account.master_merchant_account.id.should == "sandbox_master_merchant_account"
157
+ expect(result).to be_success
158
+ expect(result.merchant_account.status).to eq(Braintree::MerchantAccount::Status::Pending)
159
+ expect(result.merchant_account.master_merchant_account.id).to eq("sandbox_master_merchant_account")
160
160
  end
161
161
 
162
162
  it "allows an id to be passed" do
@@ -164,28 +164,28 @@ describe Braintree::MerchantAccount do
164
164
  sub_merchant_account_id = "sub_merchant_account_id#{random_number}"
165
165
  result = Braintree::MerchantAccount.create(
166
166
  VALID_APPLICATION_PARAMS.merge(
167
- :id => sub_merchant_account_id
168
- )
167
+ :id => sub_merchant_account_id,
168
+ ),
169
169
  )
170
170
 
171
- result.should be_success
172
- result.merchant_account.status.should == Braintree::MerchantAccount::Status::Pending
173
- result.merchant_account.id.should == sub_merchant_account_id
174
- result.merchant_account.master_merchant_account.id.should == "sandbox_master_merchant_account"
171
+ expect(result).to be_success
172
+ expect(result.merchant_account.status).to eq(Braintree::MerchantAccount::Status::Pending)
173
+ expect(result.merchant_account.id).to eq(sub_merchant_account_id)
174
+ expect(result.merchant_account.master_merchant_account.id).to eq("sandbox_master_merchant_account")
175
175
  end
176
176
 
177
177
  it "handles unsuccessful results" do
178
178
  result = Braintree::MerchantAccount.create({})
179
- result.should_not be_success
180
- result.errors.for(:merchant_account).on(:master_merchant_account_id).first.code.should == Braintree::ErrorCodes::MerchantAccount::MasterMerchantAccountIdIsRequired
179
+ expect(result).not_to be_success
180
+ expect(result.errors.for(:merchant_account).on(:master_merchant_account_id).first.code).to eq(Braintree::ErrorCodes::MerchantAccount::MasterMerchantAccountIdIsRequired)
181
181
  end
182
182
 
183
183
  it "requires all fields" do
184
184
  result = Braintree::MerchantAccount.create(
185
- :master_merchant_account_id => "sandbox_master_merchant_account"
185
+ :master_merchant_account_id => "sandbox_master_merchant_account",
186
186
  )
187
- result.should_not be_success
188
- result.errors.for(:merchant_account).on(:tos_accepted).first.code.should == Braintree::ErrorCodes::MerchantAccount::TosAcceptedIsRequired
187
+ expect(result).not_to be_success
188
+ expect(result.errors.for(:merchant_account).on(:tos_accepted).first.code).to eq(Braintree::ErrorCodes::MerchantAccount::TosAcceptedIsRequired)
189
189
  end
190
190
 
191
191
  context "funding destination" do
@@ -194,7 +194,7 @@ describe Braintree::MerchantAccount do
194
194
  params[:funding][:destination] = ::Braintree::MerchantAccount::FundingDestination::Bank
195
195
  result = Braintree::MerchantAccount.create(params)
196
196
 
197
- result.should be_success
197
+ expect(result).to be_success
198
198
  end
199
199
 
200
200
  it "accepts an email" do
@@ -203,7 +203,7 @@ describe Braintree::MerchantAccount do
203
203
  params[:funding][:email] = "joebloggs@compuserve.com"
204
204
  result = Braintree::MerchantAccount.create(params)
205
205
 
206
- result.should be_success
206
+ expect(result).to be_success
207
207
  end
208
208
 
209
209
  it "accepts a mobile_phone" do
@@ -212,7 +212,7 @@ describe Braintree::MerchantAccount do
212
212
  params[:funding][:mobile_phone] = "3125882300"
213
213
  result = Braintree::MerchantAccount.create(params)
214
214
 
215
- result.should be_success
215
+ expect(result).to be_success
216
216
  end
217
217
  end
218
218
  end
@@ -221,138 +221,137 @@ describe Braintree::MerchantAccount do
221
221
  it "creates a merchant account with the new parameters and doesn't require an id" do
222
222
  merchant_account = Braintree::MerchantAccount.create!(VALID_APPLICATION_PARAMS)
223
223
 
224
- merchant_account.status.should == Braintree::MerchantAccount::Status::Pending
225
- merchant_account.master_merchant_account.id.should == "sandbox_master_merchant_account"
224
+ expect(merchant_account.status).to eq(Braintree::MerchantAccount::Status::Pending)
225
+ expect(merchant_account.master_merchant_account.id).to eq("sandbox_master_merchant_account")
226
226
  end
227
227
  end
228
228
 
229
229
  describe "create_for_currency" do
230
230
  it "creates a new merchant account for currency" do
231
231
  result = SpecHelper::create_merchant
232
- result.should be_success
232
+ expect(result).to be_success
233
233
 
234
234
  gateway = Braintree::Gateway.new(
235
235
  :access_token => result.credentials.access_token,
236
- :logger => Logger.new("/dev/null")
236
+ :logger => Logger.new("/dev/null"),
237
237
  )
238
238
 
239
239
  result = gateway.merchant_account.create_for_currency(
240
- :currency => "JPY"
240
+ :currency => "JPY",
241
241
  )
242
- result.should be_success
243
- result.merchant_account.currency_iso_code.should == "JPY"
242
+ expect(result).to be_success
243
+ expect(result.merchant_account.currency_iso_code).to eq("JPY")
244
244
  end
245
245
 
246
246
  it "returns error if a merchant account already exists for that currency" do
247
247
  result = SpecHelper::create_merchant
248
- result.should be_success
248
+ expect(result).to be_success
249
249
 
250
250
  gateway = Braintree::Gateway.new(
251
251
  :access_token => result.credentials.access_token,
252
- :logger => Logger.new("/dev/null")
252
+ :logger => Logger.new("/dev/null"),
253
253
  )
254
254
 
255
255
  result = gateway.merchant_account.create_for_currency(
256
- :currency => "USD"
256
+ :currency => "USD",
257
257
  )
258
- result.should be_success
258
+ expect(result).to be_success
259
259
 
260
260
  result = gateway.merchant_account.create_for_currency(
261
- :currency => "USD"
261
+ :currency => "USD",
262
262
  )
263
- result.should_not be_success
263
+ expect(result).not_to be_success
264
264
 
265
265
  errors = result.errors.for(:merchant).on(:currency)
266
- errors[0].code.should == Braintree::ErrorCodes::Merchant::MerchantAccountExistsForCurrency
266
+ expect(errors[0].code).to eq(Braintree::ErrorCodes::Merchant::MerchantAccountExistsForCurrency)
267
267
  end
268
268
 
269
269
  it "returns error if no currency is provided" do
270
270
  result = SpecHelper::create_merchant
271
- result.should be_success
271
+ expect(result).to be_success
272
272
 
273
273
  gateway = Braintree::Gateway.new(
274
274
  :access_token => result.credentials.access_token,
275
- :logger => Logger.new("/dev/null")
275
+ :logger => Logger.new("/dev/null"),
276
276
  )
277
277
 
278
278
  result = gateway.merchant_account.create_for_currency(
279
- :currency => nil
279
+ :currency => nil,
280
280
  )
281
- result.should_not be_success
281
+ expect(result).not_to be_success
282
282
 
283
283
  errors = result.errors.for(:merchant).on(:currency)
284
- errors[0].code.should == Braintree::ErrorCodes::Merchant::CurrencyIsRequired
284
+ expect(errors[0].code).to eq(Braintree::ErrorCodes::Merchant::CurrencyIsRequired)
285
285
 
286
286
  result = gateway.merchant_account.create_for_currency({})
287
- result.should_not be_success
287
+ expect(result).not_to be_success
288
288
 
289
289
  errors = result.errors.for(:merchant).on(:currency)
290
- errors[0].code.should == Braintree::ErrorCodes::Merchant::CurrencyIsRequired
290
+ expect(errors[0].code).to eq(Braintree::ErrorCodes::Merchant::CurrencyIsRequired)
291
291
  end
292
292
 
293
293
  it "returns error if a currency is not supported" do
294
294
  result = SpecHelper::create_merchant
295
- result.should be_success
295
+ expect(result).to be_success
296
296
 
297
297
  gateway = Braintree::Gateway.new(
298
298
  :access_token => result.credentials.access_token,
299
- :logger => Logger.new("/dev/null")
299
+ :logger => Logger.new("/dev/null"),
300
300
  )
301
301
 
302
302
  result = gateway.merchant_account.create_for_currency(
303
- :currency => "FAKE_CURRENCY"
303
+ :currency => "FAKE_CURRENCY",
304
304
  )
305
- result.should_not be_success
305
+ expect(result).not_to be_success
306
306
 
307
307
  errors = result.errors.for(:merchant).on(:currency)
308
- errors[0].code.should == Braintree::ErrorCodes::Merchant::CurrencyIsInvalid
308
+ expect(errors[0].code).to eq(Braintree::ErrorCodes::Merchant::CurrencyIsInvalid)
309
309
  end
310
310
 
311
311
  it "returns error if id is passed and already taken" do
312
312
  result = SpecHelper::create_merchant
313
- result.should be_success
313
+ expect(result).to be_success
314
314
 
315
315
  gateway = Braintree::Gateway.new(
316
316
  :access_token => result.credentials.access_token,
317
- :logger => Logger.new("/dev/null")
317
+ :logger => Logger.new("/dev/null"),
318
318
  )
319
319
 
320
320
  merchant = result.merchant
321
321
  result = gateway.merchant_account.create_for_currency(
322
322
  :currency => "USD",
323
- :id => merchant.merchant_accounts.first.id
323
+ :id => merchant.merchant_accounts.first.id,
324
324
  )
325
- result.should_not be_success
325
+ expect(result).not_to be_success
326
326
 
327
327
  errors = result.errors.for(:merchant).on(:id)
328
- errors[0].code.should == Braintree::ErrorCodes::Merchant::MerchantAccountExistsForId
328
+ expect(errors[0].code).to eq(Braintree::ErrorCodes::Merchant::MerchantAccountExistsForId)
329
329
  end
330
330
  end
331
331
 
332
332
  describe "find" do
333
333
  it "finds the merchant account with the given token" do
334
334
  result = Braintree::MerchantAccount.create(VALID_APPLICATION_PARAMS)
335
- result.should be_success
336
- result.merchant_account.status.should == Braintree::MerchantAccount::Status::Pending
335
+ expect(result).to be_success
336
+ expect(result.merchant_account.status).to eq(Braintree::MerchantAccount::Status::Pending)
337
337
 
338
338
  id = result.merchant_account.id
339
339
  merchant_account = Braintree::MerchantAccount.find(id)
340
340
 
341
- merchant_account.status.should == Braintree::MerchantAccount::Status::Active
342
- merchant_account.individual_details.first_name.should == VALID_APPLICATION_PARAMS[:individual][:first_name]
343
- merchant_account.individual_details.last_name.should == VALID_APPLICATION_PARAMS[:individual][:last_name]
341
+ expect(merchant_account.individual_details.first_name).to eq(VALID_APPLICATION_PARAMS[:individual][:first_name])
342
+ expect(merchant_account.individual_details.last_name).to eq(VALID_APPLICATION_PARAMS[:individual][:last_name])
344
343
  end
345
344
 
346
345
  it "retrieves the currency iso code for an existing master merchant account" do
347
346
  merchant_account = Braintree::MerchantAccount.find("sandbox_master_merchant_account")
348
347
 
349
- merchant_account.currency_iso_code.should == "USD"
348
+ expect(merchant_account.currency_iso_code).to eq("USD")
350
349
  end
351
350
 
352
351
  it "raises a NotFoundError exception if merchant account cannot be found" do
353
352
  expect do
354
353
  Braintree::MerchantAccount.find("non-existant")
355
- end.to raise_error(Braintree::NotFoundError, 'Merchant account with id non-existant not found')
354
+ end.to raise_error(Braintree::NotFoundError, "Merchant account with id non-existant not found")
356
355
  end
357
356
  end
358
357
 
@@ -372,7 +371,7 @@ describe Braintree::MerchantAccount do
372
371
  params[:individual][:address][:postal_code] = "60622"
373
372
  params[:business][:dba_name] = "James's Bloggs"
374
373
  params[:business][:legal_name] = "James's Bloggs Inc"
375
- params[:business][:tax_id] = "123456789"
374
+ params[:business][:tax_id] = "423456789"
376
375
  params[:business][:address][:street_address] = "999 Fake St"
377
376
  params[:business][:address][:locality] = "Miami"
378
377
  params[:business][:address][:region] = "FL"
@@ -383,37 +382,37 @@ describe Braintree::MerchantAccount do
383
382
  params[:funding][:mobile_phone] = "1234567890"
384
383
  params[:funding][:destination] = Braintree::MerchantAccount::FundingDestination::MobilePhone
385
384
  result = Braintree::MerchantAccount.update("sandbox_sub_merchant_account", params)
386
- result.should be_success
387
- result.merchant_account.status.should == "active"
388
- result.merchant_account.id.should == "sandbox_sub_merchant_account"
389
- result.merchant_account.master_merchant_account.id.should == "sandbox_master_merchant_account"
390
- result.merchant_account.individual_details.first_name.should == "John"
391
- result.merchant_account.individual_details.last_name.should == "Doe"
392
- result.merchant_account.individual_details.email.should == "john.doe@example.com"
393
- result.merchant_account.individual_details.date_of_birth.should == "1970-01-01"
394
- result.merchant_account.individual_details.phone.should == "3125551234"
395
- result.merchant_account.individual_details.address_details.street_address.should == "123 Fake St"
396
- result.merchant_account.individual_details.address_details.locality.should == "Chicago"
397
- result.merchant_account.individual_details.address_details.region.should == "IL"
398
- result.merchant_account.individual_details.address_details.postal_code.should == "60622"
399
- result.merchant_account.business_details.dba_name.should == "James's Bloggs"
400
- result.merchant_account.business_details.legal_name.should == "James's Bloggs Inc"
401
- result.merchant_account.business_details.tax_id.should == "123456789"
402
- result.merchant_account.business_details.address_details.street_address.should == "999 Fake St"
403
- result.merchant_account.business_details.address_details.locality.should == "Miami"
404
- result.merchant_account.business_details.address_details.region.should == "FL"
405
- result.merchant_account.business_details.address_details.postal_code.should == "99999"
406
- result.merchant_account.funding_details.account_number_last_4.should == "8798"
407
- result.merchant_account.funding_details.routing_number.should == "071000013"
408
- result.merchant_account.funding_details.email.should == "check@this.com"
409
- result.merchant_account.funding_details.mobile_phone.should == "1234567890"
410
- result.merchant_account.funding_details.destination.should == Braintree::MerchantAccount::FundingDestination::MobilePhone
411
- result.merchant_account.funding_details.descriptor.should == "Joes Bloggs MI"
385
+ expect(result).to be_success
386
+ expect(result.merchant_account.status).to eq("active")
387
+ expect(result.merchant_account.id).to eq("sandbox_sub_merchant_account")
388
+ expect(result.merchant_account.master_merchant_account.id).to eq("sandbox_master_merchant_account")
389
+ expect(result.merchant_account.individual_details.first_name).to eq("John")
390
+ expect(result.merchant_account.individual_details.last_name).to eq("Doe")
391
+ expect(result.merchant_account.individual_details.email).to eq("john.doe@example.com")
392
+ expect(result.merchant_account.individual_details.date_of_birth).to eq("1970-01-01")
393
+ expect(result.merchant_account.individual_details.phone).to eq("3125551234")
394
+ expect(result.merchant_account.individual_details.address_details.street_address).to eq("123 Fake St")
395
+ expect(result.merchant_account.individual_details.address_details.locality).to eq("Chicago")
396
+ expect(result.merchant_account.individual_details.address_details.region).to eq("IL")
397
+ expect(result.merchant_account.individual_details.address_details.postal_code).to eq("60622")
398
+ expect(result.merchant_account.business_details.dba_name).to eq("James's Bloggs")
399
+ expect(result.merchant_account.business_details.legal_name).to eq("James's Bloggs Inc")
400
+ expect(result.merchant_account.business_details.tax_id).to eq("423456789")
401
+ expect(result.merchant_account.business_details.address_details.street_address).to eq("999 Fake St")
402
+ expect(result.merchant_account.business_details.address_details.locality).to eq("Miami")
403
+ expect(result.merchant_account.business_details.address_details.region).to eq("FL")
404
+ expect(result.merchant_account.business_details.address_details.postal_code).to eq("99999")
405
+ expect(result.merchant_account.funding_details.account_number_last_4).to eq("8798")
406
+ expect(result.merchant_account.funding_details.routing_number).to eq("071000013")
407
+ expect(result.merchant_account.funding_details.email).to eq("check@this.com")
408
+ expect(result.merchant_account.funding_details.mobile_phone).to eq("1234567890")
409
+ expect(result.merchant_account.funding_details.destination).to eq(Braintree::MerchantAccount::FundingDestination::MobilePhone)
410
+ expect(result.merchant_account.funding_details.descriptor).to eq("Joes Bloggs MI")
412
411
  end
413
412
 
414
413
  it "does not require all fields" do
415
- result = Braintree::MerchantAccount.update("sandbox_sub_merchant_account", { :individual => { :first_name => "Jose" } })
416
- result.should be_success
414
+ result = Braintree::MerchantAccount.update("sandbox_sub_merchant_account", {:individual => {:first_name => "Jose"}})
415
+ expect(result).to be_success
417
416
  end
418
417
 
419
418
  it "handles validation errors for blank fields" do
@@ -446,17 +445,17 @@ describe Braintree::MerchantAccount do
446
445
  }
447
446
  )
448
447
 
449
- result.should_not be_success
450
- result.errors.for(:merchant_account).for(:individual).on(:first_name).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::FirstNameIsRequired]
451
- result.errors.for(:merchant_account).for(:individual).on(:last_name).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::LastNameIsRequired]
452
- result.errors.for(:merchant_account).for(:individual).on(:date_of_birth).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::DateOfBirthIsRequired]
453
- result.errors.for(:merchant_account).for(:individual).on(:email).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::EmailIsRequired]
454
- result.errors.for(:merchant_account).for(:individual).for(:address).on(:street_address).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::Address::StreetAddressIsRequired]
455
- result.errors.for(:merchant_account).for(:individual).for(:address).on(:postal_code).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::Address::PostalCodeIsRequired]
456
- result.errors.for(:merchant_account).for(:individual).for(:address).on(:locality).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::Address::LocalityIsRequired]
457
- result.errors.for(:merchant_account).for(:individual).for(:address).on(:region).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::Address::RegionIsRequired]
458
- result.errors.for(:merchant_account).for(:funding).on(:destination).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::DestinationIsRequired]
459
- result.errors.for(:merchant_account).on(:base).should be_empty
448
+ expect(result).not_to be_success
449
+ expect(result.errors.for(:merchant_account).for(:individual).on(:first_name).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::FirstNameIsRequired])
450
+ expect(result.errors.for(:merchant_account).for(:individual).on(:last_name).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::LastNameIsRequired])
451
+ expect(result.errors.for(:merchant_account).for(:individual).on(:date_of_birth).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::DateOfBirthIsRequired])
452
+ expect(result.errors.for(:merchant_account).for(:individual).on(:email).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::EmailIsRequired])
453
+ expect(result.errors.for(:merchant_account).for(:individual).for(:address).on(:street_address).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::Address::StreetAddressIsRequired])
454
+ expect(result.errors.for(:merchant_account).for(:individual).for(:address).on(:postal_code).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::Address::PostalCodeIsRequired])
455
+ expect(result.errors.for(:merchant_account).for(:individual).for(:address).on(:locality).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::Address::LocalityIsRequired])
456
+ expect(result.errors.for(:merchant_account).for(:individual).for(:address).on(:region).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::Address::RegionIsRequired])
457
+ expect(result.errors.for(:merchant_account).for(:funding).on(:destination).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::DestinationIsRequired])
458
+ expect(result.errors.for(:merchant_account).on(:base)).to be_empty
460
459
  end
461
460
 
462
461
  it "handles validation errors for invalid fields" do
@@ -495,30 +494,30 @@ describe Braintree::MerchantAccount do
495
494
  }
496
495
  )
497
496
 
498
- result.should_not be_success
499
- result.errors.for(:merchant_account).for(:individual).on(:first_name).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::FirstNameIsInvalid]
500
- result.errors.for(:merchant_account).for(:individual).on(:last_name).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::LastNameIsInvalid]
501
- result.errors.for(:merchant_account).for(:individual).on(:email).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::EmailIsInvalid]
502
- result.errors.for(:merchant_account).for(:individual).on(:phone).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::PhoneIsInvalid]
503
- result.errors.for(:merchant_account).for(:individual).for(:address).on(:street_address).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::Address::StreetAddressIsInvalid]
504
- result.errors.for(:merchant_account).for(:individual).for(:address).on(:postal_code).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::Address::PostalCodeIsInvalid]
505
- result.errors.for(:merchant_account).for(:individual).for(:address).on(:region).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::Address::RegionIsInvalid]
506
- result.errors.for(:merchant_account).for(:individual).on(:ssn).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::SsnIsInvalid]
507
-
508
- result.errors.for(:merchant_account).for(:business).on(:legal_name).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Business::LegalNameIsInvalid]
509
- result.errors.for(:merchant_account).for(:business).on(:dba_name).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Business::DbaNameIsInvalid]
510
- result.errors.for(:merchant_account).for(:business).on(:tax_id).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Business::TaxIdIsInvalid]
511
- result.errors.for(:merchant_account).for(:business).for(:address).on(:street_address).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Business::Address::StreetAddressIsInvalid]
512
- result.errors.for(:merchant_account).for(:business).for(:address).on(:postal_code).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Business::Address::PostalCodeIsInvalid]
513
- result.errors.for(:merchant_account).for(:business).for(:address).on(:region).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Business::Address::RegionIsInvalid]
514
-
515
- result.errors.for(:merchant_account).for(:funding).on(:destination).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::DestinationIsInvalid]
516
- result.errors.for(:merchant_account).for(:funding).on(:routing_number).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::RoutingNumberIsInvalid]
517
- result.errors.for(:merchant_account).for(:funding).on(:account_number).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::AccountNumberIsInvalid]
518
- result.errors.for(:merchant_account).for(:funding).on(:email).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::EmailIsInvalid]
519
- result.errors.for(:merchant_account).for(:funding).on(:mobile_phone).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::MobilePhoneIsInvalid]
520
-
521
- result.errors.for(:merchant_account).on(:base).should be_empty
497
+ expect(result).not_to be_success
498
+ expect(result.errors.for(:merchant_account).for(:individual).on(:first_name).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::FirstNameIsInvalid])
499
+ expect(result.errors.for(:merchant_account).for(:individual).on(:last_name).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::LastNameIsInvalid])
500
+ expect(result.errors.for(:merchant_account).for(:individual).on(:email).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::EmailIsInvalid])
501
+ expect(result.errors.for(:merchant_account).for(:individual).on(:phone).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::PhoneIsInvalid])
502
+ expect(result.errors.for(:merchant_account).for(:individual).for(:address).on(:street_address).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::Address::StreetAddressIsInvalid])
503
+ expect(result.errors.for(:merchant_account).for(:individual).for(:address).on(:postal_code).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::Address::PostalCodeIsInvalid])
504
+ expect(result.errors.for(:merchant_account).for(:individual).for(:address).on(:region).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::Address::RegionIsInvalid])
505
+ expect(result.errors.for(:merchant_account).for(:individual).on(:ssn).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::SsnIsInvalid])
506
+
507
+ expect(result.errors.for(:merchant_account).for(:business).on(:legal_name).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Business::LegalNameIsInvalid])
508
+ expect(result.errors.for(:merchant_account).for(:business).on(:dba_name).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Business::DbaNameIsInvalid])
509
+ expect(result.errors.for(:merchant_account).for(:business).on(:tax_id).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Business::TaxIdIsInvalid])
510
+ expect(result.errors.for(:merchant_account).for(:business).for(:address).on(:street_address).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Business::Address::StreetAddressIsInvalid])
511
+ expect(result.errors.for(:merchant_account).for(:business).for(:address).on(:postal_code).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Business::Address::PostalCodeIsInvalid])
512
+ expect(result.errors.for(:merchant_account).for(:business).for(:address).on(:region).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Business::Address::RegionIsInvalid])
513
+
514
+ expect(result.errors.for(:merchant_account).for(:funding).on(:destination).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::DestinationIsInvalid])
515
+ expect(result.errors.for(:merchant_account).for(:funding).on(:routing_number).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::RoutingNumberIsInvalid])
516
+ expect(result.errors.for(:merchant_account).for(:funding).on(:account_number).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::AccountNumberIsInvalid])
517
+ expect(result.errors.for(:merchant_account).for(:funding).on(:email).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::EmailIsInvalid])
518
+ expect(result.errors.for(:merchant_account).for(:funding).on(:mobile_phone).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::MobilePhoneIsInvalid])
519
+
520
+ expect(result.errors.for(:merchant_account).on(:base)).to be_empty
522
521
  end
523
522
 
524
523
  it "handles validation errors for business fields" do
@@ -531,9 +530,9 @@ describe Braintree::MerchantAccount do
531
530
  }
532
531
  )
533
532
 
534
- result.should_not be_success
535
- result.errors.for(:merchant_account).for(:business).on(:legal_name).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Business::LegalNameIsRequiredWithTaxId]
536
- result.errors.for(:merchant_account).for(:business).on(:tax_id).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Business::TaxIdMustBeBlank]
533
+ expect(result).not_to be_success
534
+ expect(result.errors.for(:merchant_account).for(:business).on(:legal_name).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Business::LegalNameIsRequiredWithTaxId])
535
+ expect(result.errors.for(:merchant_account).for(:business).on(:tax_id).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Business::TaxIdMustBeBlank])
537
536
 
538
537
  result = Braintree::MerchantAccount.update(
539
538
  "sandbox_sub_merchant_account", {
@@ -544,8 +543,8 @@ describe Braintree::MerchantAccount do
544
543
  }
545
544
  )
546
545
 
547
- result.should_not be_success
548
- result.errors.for(:merchant_account).for(:business).on(:tax_id).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Business::TaxIdIsRequiredWithLegalName]
546
+ expect(result).not_to be_success
547
+ expect(result.errors.for(:merchant_account).for(:business).on(:tax_id).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Business::TaxIdIsRequiredWithLegalName])
549
548
  end
550
549
 
551
550
  it "handles validation errors for funding fields" do
@@ -559,9 +558,9 @@ describe Braintree::MerchantAccount do
559
558
  }
560
559
  )
561
560
 
562
- result.should_not be_success
563
- result.errors.for(:merchant_account).for(:funding).on(:routing_number).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::RoutingNumberIsRequired]
564
- result.errors.for(:merchant_account).for(:funding).on(:account_number).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::AccountNumberIsRequired]
561
+ expect(result).not_to be_success
562
+ expect(result.errors.for(:merchant_account).for(:funding).on(:routing_number).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::RoutingNumberIsRequired])
563
+ expect(result.errors.for(:merchant_account).for(:funding).on(:account_number).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::AccountNumberIsRequired])
565
564
 
566
565
  result = Braintree::MerchantAccount.update(
567
566
  "sandbox_sub_merchant_account", {
@@ -572,8 +571,8 @@ describe Braintree::MerchantAccount do
572
571
  }
573
572
  )
574
573
 
575
- result.should_not be_success
576
- result.errors.for(:merchant_account).for(:funding).on(:email).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::EmailIsRequired]
574
+ expect(result).not_to be_success
575
+ expect(result.errors.for(:merchant_account).for(:funding).on(:email).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::EmailIsRequired])
577
576
 
578
577
  result = Braintree::MerchantAccount.update(
579
578
  "sandbox_sub_merchant_account", {
@@ -584,8 +583,8 @@ describe Braintree::MerchantAccount do
584
583
  }
585
584
  )
586
585
 
587
- result.should_not be_success
588
- result.errors.for(:merchant_account).for(:funding).on(:mobile_phone).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::MobilePhoneIsRequired]
586
+ expect(result).not_to be_success
587
+ expect(result.errors.for(:merchant_account).for(:funding).on(:mobile_phone).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::MobilePhoneIsRequired])
589
588
  end
590
589
  end
591
590
 
@@ -597,8 +596,8 @@ describe Braintree::MerchantAccount do
597
596
  params[:individual][:first_name] = "John"
598
597
  params[:individual][:last_name] = "Doe"
599
598
  merchant_account = Braintree::MerchantAccount.update!("sandbox_sub_merchant_account", params)
600
- merchant_account.individual_details.first_name.should == "John"
601
- merchant_account.individual_details.last_name.should == "Doe"
599
+ expect(merchant_account.individual_details.first_name).to eq("John")
600
+ expect(merchant_account.individual_details.last_name).to eq("Doe")
602
601
  end
603
602
  end
604
603
  end