braintree 4.14.0 → 4.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (241) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/account_updater_daily_report.rb +3 -3
  3. data/lib/braintree/ach_mandate.rb +1 -1
  4. data/lib/braintree/add_on_gateway.rb +1 -1
  5. data/lib/braintree/address.rb +4 -4
  6. data/lib/braintree/address_gateway.rb +5 -5
  7. data/lib/braintree/advanced_search.rb +10 -10
  8. data/lib/braintree/apple_pay.rb +3 -3
  9. data/lib/braintree/apple_pay_card.rb +3 -3
  10. data/lib/braintree/apple_pay_options.rb +3 -3
  11. data/lib/braintree/authorization_adjustment.rb +3 -3
  12. data/lib/braintree/base_module.rb +1 -1
  13. data/lib/braintree/bin_data.rb +2 -2
  14. data/lib/braintree/client_token_gateway.rb +1 -1
  15. data/lib/braintree/configuration.rb +22 -22
  16. data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
  17. data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
  18. data/lib/braintree/credit_card.rb +22 -9
  19. data/lib/braintree/credit_card_gateway.rb +23 -11
  20. data/lib/braintree/credit_card_verification.rb +3 -3
  21. data/lib/braintree/credit_card_verification_search.rb +1 -1
  22. data/lib/braintree/customer.rb +5 -9
  23. data/lib/braintree/customer_gateway.rb +7 -7
  24. data/lib/braintree/customer_search.rb +1 -1
  25. data/lib/braintree/descriptor.rb +1 -1
  26. data/lib/braintree/digest.rb +1 -1
  27. data/lib/braintree/disbursement.rb +5 -5
  28. data/lib/braintree/discount_gateway.rb +1 -1
  29. data/lib/braintree/dispute/evidence.rb +1 -1
  30. data/lib/braintree/dispute/paypal_message.rb +1 -1
  31. data/lib/braintree/dispute/status_history.rb +1 -1
  32. data/lib/braintree/dispute/transaction.rb +1 -1
  33. data/lib/braintree/dispute/transaction_details.rb +1 -1
  34. data/lib/braintree/dispute.rb +3 -3
  35. data/lib/braintree/dispute_gateway.rb +1 -1
  36. data/lib/braintree/dispute_search.rb +1 -1
  37. data/lib/braintree/document_upload.rb +2 -2
  38. data/lib/braintree/document_upload_gateway.rb +3 -3
  39. data/lib/braintree/enriched_customer_data.rb +2 -2
  40. data/lib/braintree/error_result.rb +2 -3
  41. data/lib/braintree/errors.rb +3 -3
  42. data/lib/braintree/exceptions.rb +1 -2
  43. data/lib/braintree/exchange_rate.rb +2 -2
  44. data/lib/braintree/exchange_rate_quote.rb +3 -3
  45. data/lib/braintree/exchange_rate_quote_gateway.rb +1 -1
  46. data/lib/braintree/exchange_rate_quote_input.rb +3 -3
  47. data/lib/braintree/exchange_rate_quote_request.rb +3 -3
  48. data/lib/braintree/exchange_rate_quote_response.rb +3 -3
  49. data/lib/braintree/facilitated_details.rb +1 -1
  50. data/lib/braintree/facilitator_details.rb +1 -1
  51. data/lib/braintree/google_pay_card.rb +3 -3
  52. data/lib/braintree/granted_payment_instrument_update.rb +1 -1
  53. data/lib/braintree/graphql_client.rb +1 -1
  54. data/lib/braintree/http.rb +1 -1
  55. data/lib/braintree/local_payment_completed.rb +2 -2
  56. data/lib/braintree/local_payment_expired.rb +2 -2
  57. data/lib/braintree/local_payment_funded.rb +2 -2
  58. data/lib/braintree/local_payment_reversed.rb +2 -2
  59. data/lib/braintree/merchant.rb +3 -3
  60. data/lib/braintree/merchant_account.rb +2 -2
  61. data/lib/braintree/merchant_account_gateway.rb +9 -9
  62. data/lib/braintree/meta_checkout_card.rb +89 -0
  63. data/lib/braintree/meta_checkout_token.rb +88 -0
  64. data/lib/braintree/modification.rb +3 -3
  65. data/lib/braintree/oauth_credentials.rb +3 -3
  66. data/lib/braintree/paginated_collection.rb +2 -2
  67. data/lib/braintree/paginated_result.rb +1 -1
  68. data/lib/braintree/payment_instrument_type.rb +2 -0
  69. data/lib/braintree/payment_method_customer_data_updated_metadata.rb +2 -2
  70. data/lib/braintree/payment_method_gateway.rb +23 -10
  71. data/lib/braintree/payment_method_nonce.rb +4 -4
  72. data/lib/braintree/payment_method_nonce_details.rb +1 -1
  73. data/lib/braintree/payment_method_nonce_details_payer_info.rb +1 -1
  74. data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
  75. data/lib/braintree/paypal_account.rb +1 -2
  76. data/lib/braintree/paypal_account_gateway.rb +5 -5
  77. data/lib/braintree/plan.rb +1 -1
  78. data/lib/braintree/plan_gateway.rb +2 -2
  79. data/lib/braintree/resource_collection.rb +2 -2
  80. data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
  81. data/lib/braintree/risk_data.rb +1 -1
  82. data/lib/braintree/samsung_pay_card.rb +5 -5
  83. data/lib/braintree/sepa_direct_debit_account.rb +2 -2
  84. data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +1 -1
  85. data/lib/braintree/settlement_batch_summary_gateway.rb +1 -1
  86. data/lib/braintree/sha256_digest.rb +1 -1
  87. data/lib/braintree/subscription/status_details.rb +1 -1
  88. data/lib/braintree/subscription.rb +2 -2
  89. data/lib/braintree/subscription_gateway.rb +6 -6
  90. data/lib/braintree/subscription_search.rb +1 -1
  91. data/lib/braintree/successful_result.rb +2 -2
  92. data/lib/braintree/test/credit_card.rb +7 -10
  93. data/lib/braintree/test/merchant_account.rb +1 -1
  94. data/lib/braintree/test/nonce.rb +4 -0
  95. data/lib/braintree/test/transaction_amounts.rb +2 -3
  96. data/lib/braintree/test/venmo_sdk.rb +2 -0
  97. data/lib/braintree/testing_gateway.rb +1 -1
  98. data/lib/braintree/three_d_secure_info.rb +1 -1
  99. data/lib/braintree/transaction/address_details.rb +1 -1
  100. data/lib/braintree/transaction/credit_card_details.rb +4 -1
  101. data/lib/braintree/transaction/customer_details.rb +1 -1
  102. data/lib/braintree/transaction/disbursement_details.rb +1 -1
  103. data/lib/braintree/transaction/local_payment_details.rb +2 -0
  104. data/lib/braintree/transaction/meta_checkout_card_details.rb +52 -0
  105. data/lib/braintree/transaction/meta_checkout_token_details.rb +54 -0
  106. data/lib/braintree/transaction/samsung_pay_card_details.rb +1 -1
  107. data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +1 -1
  108. data/lib/braintree/transaction/status_details.rb +1 -1
  109. data/lib/braintree/transaction/subscription_details.rb +1 -1
  110. data/lib/braintree/transaction/us_bank_account_details.rb +1 -1
  111. data/lib/braintree/transaction/visa_checkout_card_details.rb +1 -1
  112. data/lib/braintree/transaction.rb +27 -20
  113. data/lib/braintree/transaction_gateway.rb +23 -12
  114. data/lib/braintree/transaction_line_item.rb +2 -2
  115. data/lib/braintree/transaction_line_item_gateway.rb +1 -1
  116. data/lib/braintree/transaction_review.rb +1 -1
  117. data/lib/braintree/transaction_search.rb +7 -6
  118. data/lib/braintree/unknown_payment_method.rb +1 -1
  119. data/lib/braintree/us_bank_account.rb +2 -2
  120. data/lib/braintree/us_bank_account_verification.rb +23 -15
  121. data/lib/braintree/us_bank_account_verification_search.rb +1 -1
  122. data/lib/braintree/util.rb +3 -3
  123. data/lib/braintree/validation_error.rb +1 -1
  124. data/lib/braintree/validation_error_collection.rb +3 -3
  125. data/lib/braintree/venmo_account.rb +3 -3
  126. data/lib/braintree/venmo_profile_data.rb +6 -4
  127. data/lib/braintree/version.rb +1 -1
  128. data/lib/braintree/visa_checkout_card.rb +7 -7
  129. data/lib/braintree/webhook_notification.rb +3 -2
  130. data/lib/braintree/webhook_notification_gateway.rb +3 -3
  131. data/lib/braintree/webhook_testing.rb +1 -1
  132. data/lib/braintree/webhook_testing_gateway.rb +18 -1
  133. data/lib/braintree/xml/generator.rb +1 -1
  134. data/lib/braintree/xml/libxml.rb +1 -1
  135. data/lib/braintree/xml/parser.rb +2 -2
  136. data/lib/braintree/xml/rexml.rb +2 -2
  137. data/lib/braintree/xml.rb +1 -1
  138. data/lib/braintree.rb +4 -1
  139. data/spec/integration/braintree/add_on_spec.rb +9 -9
  140. data/spec/integration/braintree/address_spec.rb +69 -69
  141. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  142. data/spec/integration/braintree/apple_pay_spec.rb +8 -8
  143. data/spec/integration/braintree/client_api/client_token_spec.rb +15 -15
  144. data/spec/integration/braintree/credit_card_spec.rb +223 -223
  145. data/spec/integration/braintree/credit_card_verification_search_spec.rb +16 -16
  146. data/spec/integration/braintree/credit_card_verification_spec.rb +52 -52
  147. data/spec/integration/braintree/customer_search_spec.rb +20 -20
  148. data/spec/integration/braintree/customer_spec.rb +313 -313
  149. data/spec/integration/braintree/disbursement_spec.rb +2 -2
  150. data/spec/integration/braintree/discount_spec.rb +9 -9
  151. data/spec/integration/braintree/dispute_search_spec.rb +0 -1
  152. data/spec/integration/braintree/dispute_spec.rb +87 -87
  153. data/spec/integration/braintree/document_upload_spec.rb +17 -17
  154. data/spec/integration/braintree/error_codes_spec.rb +2 -2
  155. data/spec/integration/braintree/http_spec.rb +28 -28
  156. data/spec/integration/braintree/merchant_account_spec.rb +127 -127
  157. data/spec/integration/braintree/merchant_spec.rb +103 -103
  158. data/spec/integration/braintree/oauth_spec.rb +61 -61
  159. data/spec/integration/braintree/payment_method_nonce_spec.rb +89 -69
  160. data/spec/integration/braintree/payment_method_spec.rb +389 -389
  161. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +150 -78
  162. data/spec/integration/braintree/paypal_account_spec.rb +38 -38
  163. data/spec/integration/braintree/plan_spec.rb +15 -15
  164. data/spec/integration/braintree/samsung_pay_card_spec.rb +65 -65
  165. data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +51 -51
  166. data/spec/integration/braintree/settlement_batch_summary_spec.rb +11 -11
  167. data/spec/integration/braintree/subscription_spec.rb +364 -364
  168. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  169. data/spec/integration/braintree/test_transaction_spec.rb +19 -19
  170. data/spec/integration/braintree/transaction_line_item_spec.rb +6 -6
  171. data/spec/integration/braintree/transaction_search_spec.rb +225 -165
  172. data/spec/integration/braintree/transaction_spec.rb +1502 -1210
  173. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -32
  174. data/spec/integration/braintree/us_bank_account_spec.rb +30 -30
  175. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +18 -18
  176. data/spec/integration/braintree/us_bank_account_verification_spec.rb +33 -33
  177. data/spec/integration/braintree/visa_checkout_card_spec.rb +57 -57
  178. data/spec/spec_helper.rb +9 -8
  179. data/spec/unit/braintree/address_spec.rb +8 -8
  180. data/spec/unit/braintree/base_module_spec.rb +4 -4
  181. data/spec/unit/braintree/client_token_spec.rb +2 -2
  182. data/spec/unit/braintree/configuration_spec.rb +57 -57
  183. data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
  184. data/spec/unit/braintree/credit_card_spec.rb +31 -29
  185. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +28 -28
  186. data/spec/unit/braintree/credit_card_verification_search_spec.rb +9 -9
  187. data/spec/unit/braintree/credit_card_verification_spec.rb +17 -17
  188. data/spec/unit/braintree/customer_spec.rb +41 -40
  189. data/spec/unit/braintree/digest_spec.rb +5 -5
  190. data/spec/unit/braintree/disbursement_spec.rb +11 -11
  191. data/spec/unit/braintree/dispute_search_spec.rb +2 -2
  192. data/spec/unit/braintree/dispute_spec.rb +56 -56
  193. data/spec/unit/braintree/document_upload_spec.rb +8 -8
  194. data/spec/unit/braintree/enriched_customer_data_spec.rb +11 -2
  195. data/spec/unit/braintree/error_result_spec.rb +5 -5
  196. data/spec/unit/braintree/errors_spec.rb +9 -9
  197. data/spec/unit/braintree/http_spec.rb +9 -9
  198. data/spec/unit/braintree/local_payment_completed_spec.rb +11 -11
  199. data/spec/unit/braintree/local_payment_expired_spec.rb +2 -2
  200. data/spec/unit/braintree/local_payment_funded_spec.rb +6 -6
  201. data/spec/unit/braintree/merchant_account_spec.rb +4 -4
  202. data/spec/unit/braintree/meta_checkout_card_details_spec.rb +60 -0
  203. data/spec/unit/braintree/meta_checkout_card_spec.rb +60 -0
  204. data/spec/unit/braintree/meta_checkout_token_details_spec.rb +63 -0
  205. data/spec/unit/braintree/meta_checkout_token_spec.rb +63 -0
  206. data/spec/unit/braintree/modification_spec.rb +1 -1
  207. data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +6 -6
  208. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +7 -7
  209. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +14 -14
  210. data/spec/unit/braintree/payment_method_spec.rb +19 -19
  211. data/spec/unit/braintree/paypal_account_spec.rb +4 -4
  212. data/spec/unit/braintree/resource_collection_spec.rb +7 -7
  213. data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +1 -1
  214. data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
  215. data/spec/unit/braintree/signature_service_spec.rb +2 -2
  216. data/spec/unit/braintree/subscription_search_spec.rb +17 -17
  217. data/spec/unit/braintree/subscription_spec.rb +8 -8
  218. data/spec/unit/braintree/successful_result_spec.rb +5 -5
  219. data/spec/unit/braintree/three_d_secure_info_spec.rb +20 -20
  220. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +5 -5
  221. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  222. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  223. data/spec/unit/braintree/transaction/local_payment_details_spec.rb +30 -0
  224. data/spec/unit/braintree/transaction_gateway_spec.rb +39 -7
  225. data/spec/unit/braintree/transaction_search_spec.rb +2 -2
  226. data/spec/unit/braintree/transaction_spec.rb +101 -93
  227. data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
  228. data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
  229. data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
  230. data/spec/unit/braintree/us_bank_account_verification_spec.rb +12 -7
  231. data/spec/unit/braintree/util_spec.rb +27 -27
  232. data/spec/unit/braintree/validation_error_collection_spec.rb +34 -34
  233. data/spec/unit/braintree/validation_error_spec.rb +4 -4
  234. data/spec/unit/braintree/venmo_profile_data_spec.rb +16 -5
  235. data/spec/unit/braintree/webhook_notification_spec.rb +206 -191
  236. data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
  237. data/spec/unit/braintree/xml/parser_spec.rb +8 -8
  238. data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
  239. data/spec/unit/braintree/xml_spec.rb +17 -17
  240. data/spec/unit/braintree_spec.rb +2 -2
  241. metadata +11 -2
@@ -25,7 +25,7 @@ describe Braintree::PaymentMethod do
25
25
  :expirationMonth => 12,
26
26
  :expirationYear => 2020,
27
27
  )
28
- response.code.should == "201"
28
+ expect(response.code).to eq("201")
29
29
 
30
30
  nonce = JSON.parse(response.body)["creditCards"].first["nonce"]
31
31
  result = Braintree::PaymentMethod.create(
@@ -33,12 +33,12 @@ describe Braintree::PaymentMethod do
33
33
  :customer_id => customer.id,
34
34
  )
35
35
 
36
- result.should be_success
37
- result.payment_method.should be_a(Braintree::CreditCard)
36
+ expect(result).to be_success
37
+ expect(result.payment_method).to be_a(Braintree::CreditCard)
38
38
  token = result.payment_method.token
39
39
 
40
40
  found_credit_card = Braintree::CreditCard.find(token)
41
- found_credit_card.should_not be_nil
41
+ expect(found_credit_card).not_to be_nil
42
42
  end
43
43
 
44
44
  it "creates a payment method from an unvalidated credit card nonce" do
@@ -60,7 +60,7 @@ describe Braintree::PaymentMethod do
60
60
  :expirationYear => "2020",
61
61
  :options => {:validate => false},
62
62
  )
63
- response.code.should == "202"
63
+ expect(response.code).to eq("202")
64
64
 
65
65
  nonce = JSON.parse(response.body)["creditCards"].first["nonce"]
66
66
  result = Braintree::PaymentMethod.create(
@@ -68,12 +68,12 @@ describe Braintree::PaymentMethod do
68
68
  :customer_id => customer.id,
69
69
  )
70
70
 
71
- result.should be_success
72
- result.payment_method.should be_a(Braintree::CreditCard)
71
+ expect(result).to be_success
72
+ expect(result.payment_method).to be_a(Braintree::CreditCard)
73
73
  token = result.payment_method.token
74
74
 
75
75
  found_credit_card = Braintree::CreditCard.find(token)
76
- found_credit_card.should_not be_nil
76
+ expect(found_credit_card).not_to be_nil
77
77
  end
78
78
 
79
79
  it "creates a payment method from a fake apple pay nonce" do
@@ -85,29 +85,29 @@ describe Braintree::PaymentMethod do
85
85
  :token => token,
86
86
  )
87
87
 
88
- result.should be_success
88
+ expect(result).to be_success
89
89
  apple_pay_card = result.payment_method
90
- apple_pay_card.should be_a(Braintree::ApplePayCard)
91
- apple_pay_card.should_not be_nil
92
- apple_pay_card.bin.should_not be_nil
93
- apple_pay_card.token.should == token
94
- apple_pay_card.card_type.should == Braintree::ApplePayCard::CardType::AmEx
95
- apple_pay_card.payment_instrument_name.should == "AmEx 41002"
96
- apple_pay_card.source_description.should == "AmEx 41002"
97
- apple_pay_card.default.should == true
98
- apple_pay_card.image_url.should =~ /apple_pay/
99
- apple_pay_card.expiration_month.to_i.should > 0
100
- apple_pay_card.expiration_year.to_i.should > 0
101
- apple_pay_card.customer_id.should == customer.id
102
- apple_pay_card.commercial.should_not be_nil
103
- apple_pay_card.country_of_issuance.should_not be_nil
104
- apple_pay_card.debit.should_not be_nil
105
- apple_pay_card.durbin_regulated.should_not be_nil
106
- apple_pay_card.healthcare.should_not be_nil
107
- apple_pay_card.issuing_bank.should_not be_nil
108
- apple_pay_card.payroll.should_not be_nil
109
- apple_pay_card.prepaid.should_not be_nil
110
- apple_pay_card.product_id.should_not be_nil
90
+ expect(apple_pay_card).to be_a(Braintree::ApplePayCard)
91
+ expect(apple_pay_card).not_to be_nil
92
+ expect(apple_pay_card.bin).not_to be_nil
93
+ expect(apple_pay_card.token).to eq(token)
94
+ expect(apple_pay_card.card_type).to eq(Braintree::ApplePayCard::CardType::AmEx)
95
+ expect(apple_pay_card.payment_instrument_name).to eq("AmEx 41002")
96
+ expect(apple_pay_card.source_description).to eq("AmEx 41002")
97
+ expect(apple_pay_card.default).to eq(true)
98
+ expect(apple_pay_card.image_url).to match(/apple_pay/)
99
+ expect(apple_pay_card.expiration_month.to_i).to be > 0
100
+ expect(apple_pay_card.expiration_year.to_i).to be > 0
101
+ expect(apple_pay_card.customer_id).to eq(customer.id)
102
+ expect(apple_pay_card.commercial).not_to be_nil
103
+ expect(apple_pay_card.country_of_issuance).not_to be_nil
104
+ expect(apple_pay_card.debit).not_to be_nil
105
+ expect(apple_pay_card.durbin_regulated).not_to be_nil
106
+ expect(apple_pay_card.healthcare).not_to be_nil
107
+ expect(apple_pay_card.issuing_bank).not_to be_nil
108
+ expect(apple_pay_card.payroll).not_to be_nil
109
+ expect(apple_pay_card.prepaid).not_to be_nil
110
+ expect(apple_pay_card.product_id).not_to be_nil
111
111
  end
112
112
 
113
113
  it "creates a payment method from a fake apple pay mpan nonce" do
@@ -119,31 +119,31 @@ describe Braintree::PaymentMethod do
119
119
  :token => token,
120
120
  )
121
121
 
122
- result.should be_success
122
+ expect(result).to be_success
123
123
  apple_pay_card = result.payment_method
124
- apple_pay_card.should be_a(Braintree::ApplePayCard)
125
- apple_pay_card.should_not be_nil
126
- apple_pay_card.bin.should_not be_nil
127
- apple_pay_card.token.should == token
128
- apple_pay_card.card_type.should == Braintree::ApplePayCard::CardType::Visa
129
- apple_pay_card.payment_instrument_name.should == "Visa 8886"
130
- apple_pay_card.source_description.should == "Visa 8886"
131
- apple_pay_card.default.should == true
132
- apple_pay_card.image_url.should =~ /apple_pay/
133
- apple_pay_card.expiration_month.to_i.should > 0
134
- apple_pay_card.expiration_year.to_i.should > 0
135
- apple_pay_card.customer_id.should == customer.id
136
- apple_pay_card.commercial.should_not be_nil
137
- apple_pay_card.country_of_issuance.should_not be_nil
138
- apple_pay_card.debit.should_not be_nil
139
- apple_pay_card.durbin_regulated.should_not be_nil
140
- apple_pay_card.healthcare.should_not be_nil
141
- apple_pay_card.issuing_bank.should_not be_nil
142
- apple_pay_card.payroll.should_not be_nil
143
- apple_pay_card.prepaid.should_not be_nil
144
- apple_pay_card.product_id.should_not be_nil
145
- apple_pay_card.merchant_token_identifier.should_not be_nil
146
- apple_pay_card.source_card_last4.should_not be_nil
124
+ expect(apple_pay_card).to be_a(Braintree::ApplePayCard)
125
+ expect(apple_pay_card).not_to be_nil
126
+ expect(apple_pay_card.bin).not_to be_nil
127
+ expect(apple_pay_card.token).to eq(token)
128
+ expect(apple_pay_card.card_type).to eq(Braintree::ApplePayCard::CardType::Visa)
129
+ expect(apple_pay_card.payment_instrument_name).to eq("Visa 8886")
130
+ expect(apple_pay_card.source_description).to eq("Visa 8886")
131
+ expect(apple_pay_card.default).to eq(true)
132
+ expect(apple_pay_card.image_url).to match(/apple_pay/)
133
+ expect(apple_pay_card.expiration_month.to_i).to be > 0
134
+ expect(apple_pay_card.expiration_year.to_i).to be > 0
135
+ expect(apple_pay_card.customer_id).to eq(customer.id)
136
+ expect(apple_pay_card.commercial).not_to be_nil
137
+ expect(apple_pay_card.country_of_issuance).not_to be_nil
138
+ expect(apple_pay_card.debit).not_to be_nil
139
+ expect(apple_pay_card.durbin_regulated).not_to be_nil
140
+ expect(apple_pay_card.healthcare).not_to be_nil
141
+ expect(apple_pay_card.issuing_bank).not_to be_nil
142
+ expect(apple_pay_card.payroll).not_to be_nil
143
+ expect(apple_pay_card.prepaid).not_to be_nil
144
+ expect(apple_pay_card.product_id).not_to be_nil
145
+ expect(apple_pay_card.merchant_token_identifier).not_to be_nil
146
+ expect(apple_pay_card.source_card_last4).not_to be_nil
147
147
  end
148
148
 
149
149
  it "creates a payment method from a fake google pay proxy card nonce" do
@@ -155,32 +155,32 @@ describe Braintree::PaymentMethod do
155
155
  :token => token,
156
156
  )
157
157
 
158
- result.should be_success
158
+ expect(result).to be_success
159
159
  google_pay_card = result.payment_method
160
- google_pay_card.should be_a(Braintree::GooglePayCard)
161
- google_pay_card.should_not be_nil
162
- google_pay_card.token.should == token
163
- google_pay_card.card_type.should == Braintree::CreditCard::CardType::Discover
164
- google_pay_card.virtual_card_type.should == Braintree::CreditCard::CardType::Discover
165
- google_pay_card.expiration_month.to_i.should > 0
166
- google_pay_card.expiration_year.to_i.should > 0
167
- google_pay_card.default.should == true
168
- google_pay_card.image_url.should =~ /android_pay/
169
- google_pay_card.is_network_tokenized?.should == false
170
- google_pay_card.source_card_type.should == Braintree::CreditCard::CardType::Discover
171
- google_pay_card.source_card_last_4.should == "1111"
172
- google_pay_card.google_transaction_id.should == "google_transaction_id"
173
- google_pay_card.source_description.should == "Discover 1111"
174
- google_pay_card.customer_id.should == customer.id
175
- google_pay_card.commercial.should_not be_nil
176
- google_pay_card.country_of_issuance.should_not be_nil
177
- google_pay_card.debit.should_not be_nil
178
- google_pay_card.durbin_regulated.should_not be_nil
179
- google_pay_card.healthcare.should_not be_nil
180
- google_pay_card.issuing_bank.should_not be_nil
181
- google_pay_card.payroll.should_not be_nil
182
- google_pay_card.prepaid.should_not be_nil
183
- google_pay_card.product_id.should_not be_nil
160
+ expect(google_pay_card).to be_a(Braintree::GooglePayCard)
161
+ expect(google_pay_card).not_to be_nil
162
+ expect(google_pay_card.token).to eq(token)
163
+ expect(google_pay_card.card_type).to eq(Braintree::CreditCard::CardType::Discover)
164
+ expect(google_pay_card.virtual_card_type).to eq(Braintree::CreditCard::CardType::Discover)
165
+ expect(google_pay_card.expiration_month.to_i).to be > 0
166
+ expect(google_pay_card.expiration_year.to_i).to be > 0
167
+ expect(google_pay_card.default).to eq(true)
168
+ expect(google_pay_card.image_url).to match(/android_pay/)
169
+ expect(google_pay_card.is_network_tokenized?).to eq(false)
170
+ expect(google_pay_card.source_card_type).to eq(Braintree::CreditCard::CardType::Discover)
171
+ expect(google_pay_card.source_card_last_4).to eq("1111")
172
+ expect(google_pay_card.google_transaction_id).to eq("google_transaction_id")
173
+ expect(google_pay_card.source_description).to eq("Discover 1111")
174
+ expect(google_pay_card.customer_id).to eq(customer.id)
175
+ expect(google_pay_card.commercial).not_to be_nil
176
+ expect(google_pay_card.country_of_issuance).not_to be_nil
177
+ expect(google_pay_card.debit).not_to be_nil
178
+ expect(google_pay_card.durbin_regulated).not_to be_nil
179
+ expect(google_pay_card.healthcare).not_to be_nil
180
+ expect(google_pay_card.issuing_bank).not_to be_nil
181
+ expect(google_pay_card.payroll).not_to be_nil
182
+ expect(google_pay_card.prepaid).not_to be_nil
183
+ expect(google_pay_card.product_id).not_to be_nil
184
184
  end
185
185
 
186
186
  it "creates a payment method from a google pay network token nonce" do
@@ -192,32 +192,32 @@ describe Braintree::PaymentMethod do
192
192
  :token => token,
193
193
  )
194
194
 
195
- result.should be_success
195
+ expect(result).to be_success
196
196
  google_pay_card = result.payment_method
197
- google_pay_card.should be_a(Braintree::GooglePayCard)
198
- google_pay_card.should_not be_nil
199
- google_pay_card.token.should == token
200
- google_pay_card.card_type.should == Braintree::CreditCard::CardType::MasterCard
201
- google_pay_card.virtual_card_type.should == Braintree::CreditCard::CardType::MasterCard
202
- google_pay_card.expiration_month.to_i.should > 0
203
- google_pay_card.expiration_year.to_i.should > 0
204
- google_pay_card.default.should == true
205
- google_pay_card.image_url.should =~ /android_pay/
206
- google_pay_card.is_network_tokenized?.should == true
207
- google_pay_card.source_card_type.should == Braintree::CreditCard::CardType::MasterCard
208
- google_pay_card.source_card_last_4.should == "4444"
209
- google_pay_card.google_transaction_id.should == "google_transaction_id"
210
- google_pay_card.source_description.should == "MasterCard 4444"
211
- google_pay_card.customer_id.should == customer.id
212
- google_pay_card.commercial.should_not be_nil
213
- google_pay_card.country_of_issuance.should_not be_nil
214
- google_pay_card.debit.should_not be_nil
215
- google_pay_card.durbin_regulated.should_not be_nil
216
- google_pay_card.healthcare.should_not be_nil
217
- google_pay_card.issuing_bank.should_not be_nil
218
- google_pay_card.payroll.should_not be_nil
219
- google_pay_card.prepaid.should_not be_nil
220
- google_pay_card.product_id.should_not be_nil
197
+ expect(google_pay_card).to be_a(Braintree::GooglePayCard)
198
+ expect(google_pay_card).not_to be_nil
199
+ expect(google_pay_card.token).to eq(token)
200
+ expect(google_pay_card.card_type).to eq(Braintree::CreditCard::CardType::MasterCard)
201
+ expect(google_pay_card.virtual_card_type).to eq(Braintree::CreditCard::CardType::MasterCard)
202
+ expect(google_pay_card.expiration_month.to_i).to be > 0
203
+ expect(google_pay_card.expiration_year.to_i).to be > 0
204
+ expect(google_pay_card.default).to eq(true)
205
+ expect(google_pay_card.image_url).to match(/android_pay/)
206
+ expect(google_pay_card.is_network_tokenized?).to eq(true)
207
+ expect(google_pay_card.source_card_type).to eq(Braintree::CreditCard::CardType::MasterCard)
208
+ expect(google_pay_card.source_card_last_4).to eq("4444")
209
+ expect(google_pay_card.google_transaction_id).to eq("google_transaction_id")
210
+ expect(google_pay_card.source_description).to eq("MasterCard 4444")
211
+ expect(google_pay_card.customer_id).to eq(customer.id)
212
+ expect(google_pay_card.commercial).not_to be_nil
213
+ expect(google_pay_card.country_of_issuance).not_to be_nil
214
+ expect(google_pay_card.debit).not_to be_nil
215
+ expect(google_pay_card.durbin_regulated).not_to be_nil
216
+ expect(google_pay_card.healthcare).not_to be_nil
217
+ expect(google_pay_card.issuing_bank).not_to be_nil
218
+ expect(google_pay_card.payroll).not_to be_nil
219
+ expect(google_pay_card.prepaid).not_to be_nil
220
+ expect(google_pay_card.product_id).not_to be_nil
221
221
  end
222
222
 
223
223
  it "creates a payment method from venmo account nonce" do
@@ -229,17 +229,17 @@ describe Braintree::PaymentMethod do
229
229
  :token => token,
230
230
  )
231
231
 
232
- result.should be_success
232
+ expect(result).to be_success
233
233
  venmo_account = result.payment_method
234
- venmo_account.should be_a(Braintree::VenmoAccount)
235
-
236
- venmo_account.default.should == true
237
- venmo_account.token.should == token
238
- venmo_account.username.should == "venmojoe"
239
- venmo_account.venmo_user_id.should == "1234567891234567891"
240
- venmo_account.image_url.should include(".png")
241
- venmo_account.source_description.should == "Venmo Account: venmojoe"
242
- venmo_account.customer_id.should == customer.id
234
+ expect(venmo_account).to be_a(Braintree::VenmoAccount)
235
+
236
+ expect(venmo_account.default).to eq(true)
237
+ expect(venmo_account.token).to eq(token)
238
+ expect(venmo_account.username).to eq("venmojoe")
239
+ expect(venmo_account.venmo_user_id).to eq("1234567891234567891")
240
+ expect(venmo_account.image_url).to include(".png")
241
+ expect(venmo_account.source_description).to eq("Venmo Account: venmojoe")
242
+ expect(venmo_account.customer_id).to eq(customer.id)
243
243
  end
244
244
 
245
245
  it "allows passing the make_default option alongside the nonce" do
@@ -250,9 +250,9 @@ describe Braintree::PaymentMethod do
250
250
  :expiration_date => "05/2009",
251
251
  :cvv => "100",
252
252
  )
253
- result.success?.should == true
253
+ expect(result.success?).to eq(true)
254
254
  original_payment_method = result.credit_card
255
- original_payment_method.should be_default
255
+ expect(original_payment_method).to be_default
256
256
 
257
257
  nonce = nonce_for_paypal_account(:consent_code => "PAYPAL_CONSENT_CODE")
258
258
  result = Braintree::PaymentMethod.create(
@@ -261,9 +261,9 @@ describe Braintree::PaymentMethod do
261
261
  :options => {:make_default => true},
262
262
  )
263
263
 
264
- result.should be_success
264
+ expect(result).to be_success
265
265
  new_payment_method = result.payment_method
266
- new_payment_method.should be_default
266
+ expect(new_payment_method).to be_default
267
267
  end
268
268
 
269
269
  it "overrides the token in the nonce" do
@@ -281,9 +281,9 @@ describe Braintree::PaymentMethod do
281
281
  :token => second_token,
282
282
  )
283
283
 
284
- result.should be_success
284
+ expect(result).to be_success
285
285
  payment_method = result.payment_method
286
- payment_method.token.should == second_token
286
+ expect(payment_method.token).to eq(second_token)
287
287
  end
288
288
 
289
289
  it "respects verify_card and verification_merchant_account_id when included outside of the nonce" do
@@ -304,11 +304,11 @@ describe Braintree::PaymentMethod do
304
304
  },
305
305
  )
306
306
 
307
- result.should_not be_success
308
- result.credit_card_verification.status.should == Braintree::Transaction::Status::ProcessorDeclined
309
- result.credit_card_verification.processor_response_code.should == "2000"
310
- result.credit_card_verification.processor_response_text.should == "Do Not Honor"
311
- result.credit_card_verification.merchant_account_id.should == SpecHelper::NonDefaultMerchantAccountId
307
+ expect(result).not_to be_success
308
+ expect(result.credit_card_verification.status).to eq(Braintree::Transaction::Status::ProcessorDeclined)
309
+ expect(result.credit_card_verification.processor_response_code).to eq("2000")
310
+ expect(result.credit_card_verification.processor_response_text).to eq("Do Not Honor")
311
+ expect(result.credit_card_verification.merchant_account_id).to eq(SpecHelper::NonDefaultMerchantAccountId)
312
312
  end
313
313
 
314
314
  it "respects verification amount when included outside of the nonce" do
@@ -329,11 +329,11 @@ describe Braintree::PaymentMethod do
329
329
  },
330
330
  )
331
331
 
332
- result.should_not be_success
333
- result.credit_card_verification.status.should == Braintree::Transaction::Status::ProcessorDeclined
334
- result.credit_card_verification.processor_response_code.should == "2000"
335
- result.credit_card_verification.processor_response_text.should == "Do Not Honor"
336
- result.credit_card_verification.amount.should == BigDecimal("100.00")
332
+ expect(result).not_to be_success
333
+ expect(result.credit_card_verification.status).to eq(Braintree::Transaction::Status::ProcessorDeclined)
334
+ expect(result.credit_card_verification.processor_response_code).to eq("2000")
335
+ expect(result.credit_card_verification.processor_response_text).to eq("Do Not Honor")
336
+ expect(result.credit_card_verification.amount).to eq(BigDecimal("100.00"))
337
337
  end
338
338
 
339
339
  it "validates presence of three_d_secure_version in 3ds pass thru params" do
@@ -387,18 +387,18 @@ describe Braintree::PaymentMethod do
387
387
  :options => {:verify_card => true},
388
388
  :customer_id => customer.id,
389
389
  )
390
- result.success?.should == true
390
+ expect(result.success?).to eq(true)
391
391
 
392
392
  three_d_secure_info = result.payment_method.verification.three_d_secure_info
393
- three_d_secure_info.enrolled.should == "Y"
394
- three_d_secure_info.should be_liability_shifted
395
- three_d_secure_info.should be_liability_shift_possible
396
- three_d_secure_info.status.should == "authenticate_successful"
397
- three_d_secure_info.cavv.should == "cavv_value"
398
- three_d_secure_info.xid.should == "xid_value"
399
- three_d_secure_info.eci_flag.should == "05"
400
- three_d_secure_info.three_d_secure_version.should == "1.0.2"
401
- three_d_secure_info.ds_transaction_id.should == nil
393
+ expect(three_d_secure_info.enrolled).to eq("Y")
394
+ expect(three_d_secure_info).to be_liability_shifted
395
+ expect(three_d_secure_info).to be_liability_shift_possible
396
+ expect(three_d_secure_info.status).to eq("authenticate_successful")
397
+ expect(three_d_secure_info.cavv).to eq("cavv_value")
398
+ expect(three_d_secure_info.xid).to eq("xid_value")
399
+ expect(three_d_secure_info.eci_flag).to eq("05")
400
+ expect(three_d_secure_info.three_d_secure_version).to eq("1.0.2")
401
+ expect(three_d_secure_info.ds_transaction_id).to eq(nil)
402
402
  end
403
403
 
404
404
  it "respects fail_on_duplicate_payment_method when included outside of the nonce" do
@@ -408,7 +408,7 @@ describe Braintree::PaymentMethod do
408
408
  :number => Braintree::Test::CreditCardNumbers::Visa,
409
409
  :expiration_date => "05/2012",
410
410
  )
411
- result.should be_success
411
+ expect(result).to be_success
412
412
 
413
413
  nonce = nonce_for_new_payment_method(
414
414
  :credit_card => {
@@ -424,8 +424,8 @@ describe Braintree::PaymentMethod do
424
424
  },
425
425
  )
426
426
 
427
- result.should_not be_success
428
- result.errors.first.code.should == "81724"
427
+ expect(result).not_to be_success
428
+ expect(result.errors.first.code).to eq("81724")
429
429
  end
430
430
 
431
431
  it "allows passing the billing address outside of the nonce" do
@@ -447,7 +447,7 @@ describe Braintree::PaymentMethod do
447
447
  :expirationYear => "2020",
448
448
  :options => {:validate => false},
449
449
  )
450
- response.code.should == "202"
450
+ expect(response.code).to eq("202")
451
451
 
452
452
  nonce = JSON.parse(response.body)["creditCards"].first["nonce"]
453
453
  result = Braintree::PaymentMethod.create(
@@ -458,13 +458,13 @@ describe Braintree::PaymentMethod do
458
458
  },
459
459
  )
460
460
 
461
- result.should be_success
462
- result.payment_method.should be_a(Braintree::CreditCard)
461
+ expect(result).to be_success
462
+ expect(result.payment_method).to be_a(Braintree::CreditCard)
463
463
  token = result.payment_method.token
464
464
 
465
465
  found_credit_card = Braintree::CreditCard.find(token)
466
- found_credit_card.should_not be_nil
467
- found_credit_card.billing_address.street_address.should == "123 Abc Way"
466
+ expect(found_credit_card).not_to be_nil
467
+ expect(found_credit_card.billing_address.street_address).to eq("123 Abc Way")
468
468
  end
469
469
 
470
470
  it "allows passing a billing address id outside of the nonce" do
@@ -486,7 +486,7 @@ describe Braintree::PaymentMethod do
486
486
  :expirationYear => "2020",
487
487
  :options => {:validate => false},
488
488
  )
489
- response.code.should == "202"
489
+ expect(response.code).to eq("202")
490
490
 
491
491
  nonce = JSON.parse(response.body)["creditCards"].first["nonce"]
492
492
 
@@ -497,14 +497,14 @@ describe Braintree::PaymentMethod do
497
497
  :billing_address_id => address.id,
498
498
  )
499
499
 
500
- result.should be_success
501
- result.payment_method.should be_a(Braintree::CreditCard)
500
+ expect(result).to be_success
501
+ expect(result.payment_method).to be_a(Braintree::CreditCard)
502
502
  token = result.payment_method.token
503
503
 
504
504
  found_credit_card = Braintree::CreditCard.find(token)
505
- found_credit_card.should_not be_nil
506
- found_credit_card.billing_address.first_name.should == "Bobby"
507
- found_credit_card.billing_address.last_name.should == "Tables"
505
+ expect(found_credit_card).not_to be_nil
506
+ expect(found_credit_card.billing_address.first_name).to eq("Bobby")
507
+ expect(found_credit_card.billing_address.last_name).to eq("Tables")
508
508
  end
509
509
 
510
510
  it "overrides the billing address in the nonce" do
@@ -529,7 +529,7 @@ describe Braintree::PaymentMethod do
529
529
  :street_address => "456 Xyz Way"
530
530
  },
531
531
  )
532
- response.code.should == "202"
532
+ expect(response.code).to eq("202")
533
533
 
534
534
  nonce = JSON.parse(response.body)["creditCards"].first["nonce"]
535
535
  result = Braintree::PaymentMethod.create(
@@ -540,13 +540,13 @@ describe Braintree::PaymentMethod do
540
540
  },
541
541
  )
542
542
 
543
- result.should be_success
544
- result.payment_method.should be_a(Braintree::CreditCard)
543
+ expect(result).to be_success
544
+ expect(result.payment_method).to be_a(Braintree::CreditCard)
545
545
  token = result.payment_method.token
546
546
 
547
547
  found_credit_card = Braintree::CreditCard.find(token)
548
- found_credit_card.should_not be_nil
549
- found_credit_card.billing_address.street_address.should == "123 Abc Way"
548
+ expect(found_credit_card).not_to be_nil
549
+ expect(found_credit_card.billing_address.street_address).to eq("123 Abc Way")
550
550
  end
551
551
 
552
552
  it "does not override the billing address for a vaulted credit card" do
@@ -570,7 +570,7 @@ describe Braintree::PaymentMethod do
570
570
  :street_address => "456 Xyz Way"
571
571
  },
572
572
  )
573
- response.code.should == "201"
573
+ expect(response.code).to eq("201")
574
574
 
575
575
  nonce = JSON.parse(response.body)["creditCards"].first["nonce"]
576
576
  result = Braintree::PaymentMethod.create(
@@ -581,13 +581,13 @@ describe Braintree::PaymentMethod do
581
581
  },
582
582
  )
583
583
 
584
- result.should be_success
585
- result.payment_method.should be_a(Braintree::CreditCard)
584
+ expect(result).to be_success
585
+ expect(result.payment_method).to be_a(Braintree::CreditCard)
586
586
  token = result.payment_method.token
587
587
 
588
588
  found_credit_card = Braintree::CreditCard.find(token)
589
- found_credit_card.should_not be_nil
590
- found_credit_card.billing_address.street_address.should == "456 Xyz Way"
589
+ expect(found_credit_card).not_to be_nil
590
+ expect(found_credit_card.billing_address.street_address).to eq("456 Xyz Way")
591
591
  end
592
592
 
593
593
  it "includes risk data when skip_advanced_fraud_checking is false" do
@@ -662,8 +662,8 @@ describe Braintree::PaymentMethod do
662
662
  },
663
663
  )
664
664
 
665
- result.should be_success
666
- result.payment_method.verification.credit_card[:account_type].should == "debit"
665
+ expect(result).to be_success
666
+ expect(result.payment_method.verification.credit_card[:account_type]).to eq("debit")
667
667
  end
668
668
 
669
669
  it "verifies card with account_type credit" do
@@ -685,8 +685,8 @@ describe Braintree::PaymentMethod do
685
685
  },
686
686
  )
687
687
 
688
- result.should be_success
689
- result.payment_method.verification.credit_card[:account_type].should == "credit"
688
+ expect(result).to be_success
689
+ expect(result.payment_method.verification.credit_card[:account_type]).to eq("credit")
690
690
  end
691
691
 
692
692
  it "errors with invalid account_type" do
@@ -708,8 +708,8 @@ describe Braintree::PaymentMethod do
708
708
  },
709
709
  )
710
710
 
711
- result.should_not be_success
712
- result.errors.for(:credit_card).for(:options).on(:verification_account_type)[0].code.should == Braintree::ErrorCodes::CreditCard::VerificationAccountTypeIsInvalid
711
+ expect(result).not_to be_success
712
+ expect(result.errors.for(:credit_card).for(:options).on(:verification_account_type)[0].code).to eq(Braintree::ErrorCodes::CreditCard::VerificationAccountTypeIsInvalid)
713
713
  end
714
714
 
715
715
  it "errors when account_type not supported by merchant" do
@@ -730,8 +730,8 @@ describe Braintree::PaymentMethod do
730
730
  },
731
731
  )
732
732
 
733
- result.should_not be_success
734
- result.errors.for(:credit_card).for(:options).on(:verification_account_type)[0].code.should == Braintree::ErrorCodes::CreditCard::VerificationAccountTypeNotSupported
733
+ expect(result).not_to be_success
734
+ expect(result.errors.for(:credit_card).for(:options).on(:verification_account_type)[0].code).to eq(Braintree::ErrorCodes::CreditCard::VerificationAccountTypeNotSupported)
735
735
  end
736
736
 
737
737
  it "updates the credit card with account_type credit" do
@@ -754,8 +754,8 @@ describe Braintree::PaymentMethod do
754
754
  :verification_account_type => "credit",
755
755
  },
756
756
  )
757
- update_result.success?.should == true
758
- update_result.payment_method.verification.credit_card[:account_type].should == "credit"
757
+ expect(update_result.success?).to eq(true)
758
+ expect(update_result.payment_method.verification.credit_card[:account_type]).to eq("credit")
759
759
  end
760
760
 
761
761
  it "updates the credit card with account_type debit" do
@@ -778,8 +778,8 @@ describe Braintree::PaymentMethod do
778
778
  :verification_account_type => "debit",
779
779
  },
780
780
  )
781
- update_result.success?.should == true
782
- update_result.payment_method.verification.credit_card[:account_type].should == "debit"
781
+ expect(update_result.success?).to eq(true)
782
+ expect(update_result.payment_method.verification.credit_card[:account_type]).to eq("debit")
783
783
  end
784
784
  end
785
785
 
@@ -792,13 +792,13 @@ describe Braintree::PaymentMethod do
792
792
  :customer_id => customer.id,
793
793
  )
794
794
 
795
- result.should be_success
796
- result.payment_method.should be_a(Braintree::PayPalAccount)
797
- result.payment_method.image_url.should_not be_nil
795
+ expect(result).to be_success
796
+ expect(result.payment_method).to be_a(Braintree::PayPalAccount)
797
+ expect(result.payment_method.image_url).not_to be_nil
798
798
  token = result.payment_method.token
799
799
 
800
800
  found_paypal_account = Braintree::PayPalAccount.find(token)
801
- found_paypal_account.should_not be_nil
801
+ expect(found_paypal_account).not_to be_nil
802
802
  end
803
803
 
804
804
  it "creates a limited use payment method from a paypal account nonce for a paypal intent==order payment" do
@@ -831,15 +831,15 @@ describe Braintree::PaymentMethod do
831
831
  },
832
832
  )
833
833
 
834
- result.should be_success
835
- result.payment_method.should be_a(Braintree::PayPalAccount)
836
- result.payment_method.image_url.should_not be_nil
837
- result.payment_method.payer_id.should_not be_nil
834
+ expect(result).to be_success
835
+ expect(result.payment_method).to be_a(Braintree::PayPalAccount)
836
+ expect(result.payment_method.image_url).not_to be_nil
837
+ expect(result.payment_method.payer_id).not_to be_nil
838
838
  token = result.payment_method.token
839
839
 
840
840
  found_paypal_account = Braintree::PayPalAccount.find(token)
841
- found_paypal_account.should_not be_nil
842
- found_paypal_account.payer_id.should_not be_nil
841
+ expect(found_paypal_account).not_to be_nil
842
+ expect(found_paypal_account.payer_id).not_to be_nil
843
843
  end
844
844
 
845
845
  it "creates a billing agreement payment method from a refresh token" do
@@ -849,16 +849,16 @@ describe Braintree::PaymentMethod do
849
849
  :paypal_refresh_token => "some_future_payment_token",
850
850
  )
851
851
 
852
- result.should be_success
853
- result.payment_method.should be_a(Braintree::PayPalAccount)
854
- result.payment_method.billing_agreement_id.should eq("B_FAKE_ID")
855
- result.payment_method.payer_id.should_not be_nil
852
+ expect(result).to be_success
853
+ expect(result.payment_method).to be_a(Braintree::PayPalAccount)
854
+ expect(result.payment_method.billing_agreement_id).to eq("B_FAKE_ID")
855
+ expect(result.payment_method.payer_id).not_to be_nil
856
856
  token = result.payment_method.token
857
857
 
858
858
  found_paypal_account = Braintree::PayPalAccount.find(token)
859
- found_paypal_account.should_not be_nil
860
- found_paypal_account.billing_agreement_id.should eq("B_FAKE_ID")
861
- found_paypal_account.payer_id.should_not be_nil
859
+ expect(found_paypal_account).not_to be_nil
860
+ expect(found_paypal_account.billing_agreement_id).to eq("B_FAKE_ID")
861
+ expect(found_paypal_account.payer_id).not_to be_nil
862
862
  end
863
863
 
864
864
  it "does not create a payment method from an unvalidated onetime paypal account nonce" do
@@ -869,8 +869,8 @@ describe Braintree::PaymentMethod do
869
869
  :customer_id => customer.id,
870
870
  )
871
871
 
872
- result.should_not be_success
873
- result.errors.first.code.should == "82902"
872
+ expect(result).not_to be_success
873
+ expect(result.errors.first.code).to eq("82902")
874
874
  end
875
875
 
876
876
  it "ignores passed billing address params" do
@@ -884,13 +884,13 @@ describe Braintree::PaymentMethod do
884
884
  },
885
885
  )
886
886
 
887
- result.should be_success
888
- result.payment_method.should be_a(Braintree::PayPalAccount)
889
- result.payment_method.image_url.should_not be_nil
887
+ expect(result).to be_success
888
+ expect(result.payment_method).to be_a(Braintree::PayPalAccount)
889
+ expect(result.payment_method.image_url).not_to be_nil
890
890
  token = result.payment_method.token
891
891
 
892
892
  found_paypal_account = Braintree::PayPalAccount.find(token)
893
- found_paypal_account.should_not be_nil
893
+ expect(found_paypal_account).not_to be_nil
894
894
  end
895
895
 
896
896
  it "ignores passed billing address id" do
@@ -902,13 +902,13 @@ describe Braintree::PaymentMethod do
902
902
  :billing_address_id => "address_id",
903
903
  )
904
904
 
905
- result.should be_success
906
- result.payment_method.should be_a(Braintree::PayPalAccount)
907
- result.payment_method.image_url.should_not be_nil
905
+ expect(result).to be_success
906
+ expect(result.payment_method).to be_a(Braintree::PayPalAccount)
907
+ expect(result.payment_method.image_url).not_to be_nil
908
908
  token = result.payment_method.token
909
909
 
910
910
  found_paypal_account = Braintree::PayPalAccount.find(token)
911
- found_paypal_account.should_not be_nil
911
+ expect(found_paypal_account).not_to be_nil
912
912
  end
913
913
 
914
914
  it "returns appropriate validation errors" do
@@ -919,10 +919,10 @@ describe Braintree::PaymentMethod do
919
919
  :customer_id => customer.id,
920
920
  )
921
921
 
922
- result.should_not be_success
922
+ expect(result).not_to be_success
923
923
  errors = result.errors.map(&:code)
924
- errors.should include("82901")
925
- errors.should include("82902")
924
+ expect(errors).to include("82901")
925
+ expect(errors).to include("82902")
926
926
  end
927
927
 
928
928
  it "doesn't return an error if credit card options are present for a paypal nonce" do
@@ -943,7 +943,7 @@ describe Braintree::PaymentMethod do
943
943
  },
944
944
  )
945
945
 
946
- result.should be_success
946
+ expect(result).to be_success
947
947
  end
948
948
  end
949
949
 
@@ -957,11 +957,11 @@ describe Braintree::PaymentMethod do
957
957
  :token => token,
958
958
  )
959
959
 
960
- result.should be_success
960
+ expect(result).to be_success
961
961
  payment_method = result.payment_method
962
- payment_method.should_not be_nil
963
- payment_method.token.should == token
964
- payment_method.should be_a Braintree::UnknownPaymentMethod
962
+ expect(payment_method).not_to be_nil
963
+ expect(payment_method.token).to eq(token)
964
+ expect(payment_method).to be_a Braintree::UnknownPaymentMethod
965
965
  end
966
966
  end
967
967
 
@@ -984,7 +984,7 @@ describe Braintree::PaymentMethod do
984
984
  },
985
985
  )
986
986
 
987
- result.should be_success
987
+ expect(result).to be_success
988
988
  result.payment_method.verification.currency_iso_code == "USD"
989
989
  end
990
990
 
@@ -1007,7 +1007,7 @@ describe Braintree::PaymentMethod do
1007
1007
  },
1008
1008
  )
1009
1009
 
1010
- result.should be_success
1010
+ expect(result).to be_success
1011
1011
  result.payment_method.verification.currency_iso_code == "USD"
1012
1012
  result.payment_method.verification.merchant_account_id == SpecHelper::NonDefaultMerchantAccountId
1013
1013
  end
@@ -1030,8 +1030,8 @@ describe Braintree::PaymentMethod do
1030
1030
  :verification_currency_iso_code => "GBP"
1031
1031
  },
1032
1032
  )
1033
- result.should_not be_success
1034
- result.errors.for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code.should == Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount
1033
+ expect(result).not_to be_success
1034
+ expect(result.errors.for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code).to eq(Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount)
1035
1035
  end
1036
1036
 
1037
1037
  it "errors with invalid presentment currency due to verification_currency_iso_code not matching with currency configured in verification_merchant_account_id" do
@@ -1053,8 +1053,8 @@ describe Braintree::PaymentMethod do
1053
1053
  },
1054
1054
  )
1055
1055
 
1056
- result.should_not be_success
1057
- result.errors.for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code.should == Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount
1056
+ expect(result).not_to be_success
1057
+ expect(result.errors.for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code).to eq(Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount)
1058
1058
  end
1059
1059
  end
1060
1060
  end
@@ -1078,7 +1078,7 @@ describe Braintree::PaymentMethod do
1078
1078
  :expirationMonth => 12,
1079
1079
  :expirationYear => 2020,
1080
1080
  )
1081
- response.code.should == "201"
1081
+ expect(response.code).to eq("201")
1082
1082
 
1083
1083
  nonce = JSON.parse(response.body)["creditCards"].first["nonce"]
1084
1084
  payment_method = Braintree::PaymentMethod.create!(
@@ -1086,11 +1086,11 @@ describe Braintree::PaymentMethod do
1086
1086
  :customer_id => customer.id,
1087
1087
  )
1088
1088
 
1089
- payment_method.should be_a(Braintree::CreditCard)
1089
+ expect(payment_method).to be_a(Braintree::CreditCard)
1090
1090
  token = payment_method.token
1091
1091
 
1092
1092
  found_credit_card = Braintree::CreditCard.find(token)
1093
- found_credit_card.should_not be_nil
1093
+ expect(found_credit_card).not_to be_nil
1094
1094
  end
1095
1095
  end
1096
1096
 
@@ -1103,13 +1103,13 @@ describe Braintree::PaymentMethod do
1103
1103
  :number => Braintree::Test::CreditCardNumbers::Visa,
1104
1104
  :expiration_date => "05/2012",
1105
1105
  )
1106
- result.success?.should == true
1106
+ expect(result.success?).to eq(true)
1107
1107
 
1108
1108
  credit_card = Braintree::PaymentMethod.find(result.credit_card.token)
1109
- credit_card.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
1110
- credit_card.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
1111
- credit_card.token.should == result.credit_card.token
1112
- credit_card.expiration_date.should == "05/2012"
1109
+ expect(credit_card.bin).to eq(Braintree::Test::CreditCardNumbers::Visa[0, 6])
1110
+ expect(credit_card.last_4).to eq(Braintree::Test::CreditCardNumbers::Visa[-4..-1])
1111
+ expect(credit_card.token).to eq(result.credit_card.token)
1112
+ expect(credit_card.expiration_date).to eq("05/2012")
1113
1113
  end
1114
1114
 
1115
1115
  it "returns associated subscriptions with the credit card" do
@@ -1127,10 +1127,10 @@ describe Braintree::PaymentMethod do
1127
1127
  ).subscription
1128
1128
 
1129
1129
  found_card = Braintree::PaymentMethod.find(credit_card.token)
1130
- found_card.subscriptions.first.id.should == subscription.id
1131
- found_card.subscriptions.first.plan_id.should == "integration_trialless_plan"
1132
- found_card.subscriptions.first.payment_method_token.should == credit_card.token
1133
- found_card.subscriptions.first.price.should == BigDecimal("1.00")
1130
+ expect(found_card.subscriptions.first.id).to eq(subscription.id)
1131
+ expect(found_card.subscriptions.first.plan_id).to eq("integration_trialless_plan")
1132
+ expect(found_card.subscriptions.first.payment_method_token).to eq(credit_card.token)
1133
+ expect(found_card.subscriptions.first.price).to eq(BigDecimal("1.00"))
1134
1134
  end
1135
1135
  end
1136
1136
 
@@ -1146,13 +1146,13 @@ describe Braintree::PaymentMethod do
1146
1146
  :payment_method_nonce => nonce,
1147
1147
  :customer_id => customer.id,
1148
1148
  )
1149
- result.should be_success
1149
+ expect(result).to be_success
1150
1150
 
1151
1151
  paypal_account = Braintree::PaymentMethod.find(payment_method_token)
1152
- paypal_account.should be_a(Braintree::PayPalAccount)
1153
- paypal_account.token.should == payment_method_token
1154
- paypal_account.email.should == "jane.doe@example.com"
1155
- paypal_account.customer_id.should == customer.id
1152
+ expect(paypal_account).to be_a(Braintree::PayPalAccount)
1153
+ expect(paypal_account.token).to eq(payment_method_token)
1154
+ expect(paypal_account.email).to eq("jane.doe@example.com")
1155
+ expect(paypal_account.customer_id).to eq(customer.id)
1156
1156
  end
1157
1157
  end
1158
1158
 
@@ -1165,19 +1165,19 @@ describe Braintree::PaymentMethod do
1165
1165
  :customer_id => customer.id,
1166
1166
  :token => payment_method_token,
1167
1167
  )
1168
- result.should be_success
1168
+ expect(result).to be_success
1169
1169
 
1170
1170
  apple_pay_card = Braintree::PaymentMethod.find(payment_method_token)
1171
- apple_pay_card.should be_a(Braintree::ApplePayCard)
1172
- apple_pay_card.should_not be_nil
1173
- apple_pay_card.token.should == payment_method_token
1174
- apple_pay_card.card_type.should == Braintree::ApplePayCard::CardType::AmEx
1175
- apple_pay_card.default.should == true
1176
- apple_pay_card.image_url.should =~ /apple_pay/
1177
- apple_pay_card.expiration_month.to_i.should > 0
1178
- apple_pay_card.expiration_year.to_i.should > 0
1179
- apple_pay_card.source_description.should == "AmEx 41002"
1180
- apple_pay_card.customer_id.should == customer.id
1171
+ expect(apple_pay_card).to be_a(Braintree::ApplePayCard)
1172
+ expect(apple_pay_card).not_to be_nil
1173
+ expect(apple_pay_card.token).to eq(payment_method_token)
1174
+ expect(apple_pay_card.card_type).to eq(Braintree::ApplePayCard::CardType::AmEx)
1175
+ expect(apple_pay_card.default).to eq(true)
1176
+ expect(apple_pay_card.image_url).to match(/apple_pay/)
1177
+ expect(apple_pay_card.expiration_month.to_i).to be > 0
1178
+ expect(apple_pay_card.expiration_year.to_i).to be > 0
1179
+ expect(apple_pay_card.source_description).to eq("AmEx 41002")
1180
+ expect(apple_pay_card.customer_id).to eq(customer.id)
1181
1181
  end
1182
1182
 
1183
1183
  it "finds the payment method with the given mpan token" do
@@ -1188,19 +1188,19 @@ describe Braintree::PaymentMethod do
1188
1188
  :customer_id => customer.id,
1189
1189
  :token => payment_method_token,
1190
1190
  )
1191
- result.should be_success
1191
+ expect(result).to be_success
1192
1192
 
1193
1193
  apple_pay_card = Braintree::PaymentMethod.find(payment_method_token)
1194
- apple_pay_card.should be_a(Braintree::ApplePayCard)
1195
- apple_pay_card.should_not be_nil
1196
- apple_pay_card.token.should == payment_method_token
1197
- apple_pay_card.card_type.should == Braintree::ApplePayCard::CardType::Visa
1198
- apple_pay_card.default.should == true
1199
- apple_pay_card.image_url.should =~ /apple_pay/
1200
- apple_pay_card.expiration_month.to_i.should > 0
1201
- apple_pay_card.expiration_year.to_i.should > 0
1202
- apple_pay_card.source_description.should == "Visa 8886"
1203
- apple_pay_card.customer_id.should == customer.id
1194
+ expect(apple_pay_card).to be_a(Braintree::ApplePayCard)
1195
+ expect(apple_pay_card).not_to be_nil
1196
+ expect(apple_pay_card.token).to eq(payment_method_token)
1197
+ expect(apple_pay_card.card_type).to eq(Braintree::ApplePayCard::CardType::Visa)
1198
+ expect(apple_pay_card.default).to eq(true)
1199
+ expect(apple_pay_card.image_url).to match(/apple_pay/)
1200
+ expect(apple_pay_card.expiration_month.to_i).to be > 0
1201
+ expect(apple_pay_card.expiration_year.to_i).to be > 0
1202
+ expect(apple_pay_card.source_description).to eq("Visa 8886")
1203
+ expect(apple_pay_card.customer_id).to eq(customer.id)
1204
1204
  apple_pay_card.merchant_token_identifier == "DNITHE302308980427388297"
1205
1205
  apple_pay_card.source_card_last4 == "2006"
1206
1206
  end
@@ -1215,18 +1215,18 @@ describe Braintree::PaymentMethod do
1215
1215
  :customer_id => customer.id,
1216
1216
  :token => payment_method_token,
1217
1217
  )
1218
- result.should be_success
1218
+ expect(result).to be_success
1219
1219
 
1220
1220
  venmo_account = Braintree::PaymentMethod.find(payment_method_token)
1221
- venmo_account.should be_a(Braintree::VenmoAccount)
1222
- venmo_account.should_not be_nil
1223
- venmo_account.token.should == payment_method_token
1224
- venmo_account.default.should == true
1225
- venmo_account.image_url.should =~ /venmo/
1226
- venmo_account.username.should == "venmojoe"
1227
- venmo_account.venmo_user_id.should == "1234567891234567891"
1228
- venmo_account.source_description.should == "Venmo Account: venmojoe"
1229
- venmo_account.customer_id.should == customer.id
1221
+ expect(venmo_account).to be_a(Braintree::VenmoAccount)
1222
+ expect(venmo_account).not_to be_nil
1223
+ expect(venmo_account.token).to eq(payment_method_token)
1224
+ expect(venmo_account.default).to eq(true)
1225
+ expect(venmo_account.image_url).to match(/venmo/)
1226
+ expect(venmo_account.username).to eq("venmojoe")
1227
+ expect(venmo_account.venmo_user_id).to eq("1234567891234567891")
1228
+ expect(venmo_account.source_description).to eq("Venmo Account: venmojoe")
1229
+ expect(venmo_account.customer_id).to eq(customer.id)
1230
1230
  end
1231
1231
  end
1232
1232
 
@@ -1239,24 +1239,24 @@ describe Braintree::PaymentMethod do
1239
1239
  :customer_id => customer.id,
1240
1240
  :token => payment_method_token,
1241
1241
  )
1242
- result.should be_success
1242
+ expect(result).to be_success
1243
1243
 
1244
1244
  google_pay_card = Braintree::PaymentMethod.find(payment_method_token)
1245
- google_pay_card.should be_a(Braintree::GooglePayCard)
1246
- google_pay_card.should_not be_nil
1247
- google_pay_card.token.should == payment_method_token
1248
- google_pay_card.card_type.should == Braintree::CreditCard::CardType::Discover
1249
- google_pay_card.virtual_card_type.should == Braintree::CreditCard::CardType::Discover
1250
- google_pay_card.expiration_month.to_i.should > 0
1251
- google_pay_card.expiration_year.to_i.should > 0
1252
- google_pay_card.default.should == true
1253
- google_pay_card.image_url.should =~ /android_pay/
1254
- google_pay_card.is_network_tokenized?.should == false
1255
- google_pay_card.source_card_type.should == Braintree::CreditCard::CardType::Discover
1256
- google_pay_card.source_card_last_4.should == "1111"
1257
- google_pay_card.google_transaction_id.should == "google_transaction_id"
1258
- google_pay_card.source_description.should == "Discover 1111"
1259
- google_pay_card.customer_id.should == customer.id
1245
+ expect(google_pay_card).to be_a(Braintree::GooglePayCard)
1246
+ expect(google_pay_card).not_to be_nil
1247
+ expect(google_pay_card.token).to eq(payment_method_token)
1248
+ expect(google_pay_card.card_type).to eq(Braintree::CreditCard::CardType::Discover)
1249
+ expect(google_pay_card.virtual_card_type).to eq(Braintree::CreditCard::CardType::Discover)
1250
+ expect(google_pay_card.expiration_month.to_i).to be > 0
1251
+ expect(google_pay_card.expiration_year.to_i).to be > 0
1252
+ expect(google_pay_card.default).to eq(true)
1253
+ expect(google_pay_card.image_url).to match(/android_pay/)
1254
+ expect(google_pay_card.is_network_tokenized?).to eq(false)
1255
+ expect(google_pay_card.source_card_type).to eq(Braintree::CreditCard::CardType::Discover)
1256
+ expect(google_pay_card.source_card_last_4).to eq("1111")
1257
+ expect(google_pay_card.google_transaction_id).to eq("google_transaction_id")
1258
+ expect(google_pay_card.source_description).to eq("Discover 1111")
1259
+ expect(google_pay_card.customer_id).to eq(customer.id)
1260
1260
  end
1261
1261
 
1262
1262
  it "finds the network token payment method with the given token" do
@@ -1267,24 +1267,24 @@ describe Braintree::PaymentMethod do
1267
1267
  :customer_id => customer.id,
1268
1268
  :token => payment_method_token,
1269
1269
  )
1270
- result.should be_success
1270
+ expect(result).to be_success
1271
1271
 
1272
1272
  google_pay_card = Braintree::PaymentMethod.find(payment_method_token)
1273
- google_pay_card.should be_a(Braintree::GooglePayCard)
1274
- google_pay_card.should_not be_nil
1275
- google_pay_card.token.should == payment_method_token
1276
- google_pay_card.card_type.should == Braintree::CreditCard::CardType::MasterCard
1277
- google_pay_card.virtual_card_type.should == Braintree::CreditCard::CardType::MasterCard
1278
- google_pay_card.expiration_month.to_i.should > 0
1279
- google_pay_card.expiration_year.to_i.should > 0
1280
- google_pay_card.default.should == true
1281
- google_pay_card.image_url.should =~ /android_pay/
1282
- google_pay_card.is_network_tokenized?.should == true
1283
- google_pay_card.source_card_type.should == Braintree::CreditCard::CardType::MasterCard
1284
- google_pay_card.source_card_last_4.should == "4444"
1285
- google_pay_card.google_transaction_id.should == "google_transaction_id"
1286
- google_pay_card.source_description.should == "MasterCard 4444"
1287
- google_pay_card.customer_id.should == customer.id
1273
+ expect(google_pay_card).to be_a(Braintree::GooglePayCard)
1274
+ expect(google_pay_card).not_to be_nil
1275
+ expect(google_pay_card.token).to eq(payment_method_token)
1276
+ expect(google_pay_card.card_type).to eq(Braintree::CreditCard::CardType::MasterCard)
1277
+ expect(google_pay_card.virtual_card_type).to eq(Braintree::CreditCard::CardType::MasterCard)
1278
+ expect(google_pay_card.expiration_month.to_i).to be > 0
1279
+ expect(google_pay_card.expiration_year.to_i).to be > 0
1280
+ expect(google_pay_card.default).to eq(true)
1281
+ expect(google_pay_card.image_url).to match(/android_pay/)
1282
+ expect(google_pay_card.is_network_tokenized?).to eq(true)
1283
+ expect(google_pay_card.source_card_type).to eq(Braintree::CreditCard::CardType::MasterCard)
1284
+ expect(google_pay_card.source_card_last_4).to eq("4444")
1285
+ expect(google_pay_card.google_transaction_id).to eq("google_transaction_id")
1286
+ expect(google_pay_card.source_description).to eq("MasterCard 4444")
1287
+ expect(google_pay_card.customer_id).to eq(customer.id)
1288
1288
  end
1289
1289
  end
1290
1290
 
@@ -1297,14 +1297,14 @@ describe Braintree::PaymentMethod do
1297
1297
  :customer_id => customer.id,
1298
1298
  :token => payment_method_token,
1299
1299
  )
1300
- result.should be_success
1300
+ expect(result).to be_success
1301
1301
 
1302
1302
  payment_method = Braintree::PaymentMethod.find(payment_method_token)
1303
- payment_method.should_not be_nil
1304
- payment_method.token.should == payment_method_token
1305
- payment_method.image_url.should_not be_nil
1306
- payment_method.should be_a Braintree::UnknownPaymentMethod
1307
- payment_method.customer_id.should == customer.id
1303
+ expect(payment_method).not_to be_nil
1304
+ expect(payment_method.token).to eq(payment_method_token)
1305
+ expect(payment_method.image_url).not_to be_nil
1306
+ expect(payment_method).to be_a Braintree::UnknownPaymentMethod
1307
+ expect(payment_method.customer_id).to eq(customer.id)
1308
1308
  end
1309
1309
  end
1310
1310
 
@@ -1327,10 +1327,10 @@ describe Braintree::PaymentMethod do
1327
1327
  token = create_result.payment_method.token
1328
1328
 
1329
1329
  google_card = Braintree::PaymentMethod.find(token)
1330
- google_card.should be_a(Braintree::GooglePayCard)
1330
+ expect(google_card).to be_a(Braintree::GooglePayCard)
1331
1331
 
1332
1332
  delete_result = Braintree::PaymentMethod.delete(token)
1333
- delete_result.success?.should == true
1333
+ expect(delete_result.success?).to eq(true)
1334
1334
 
1335
1335
  expect do
1336
1336
  Braintree::PaymentMethod.find(token)
@@ -1347,10 +1347,10 @@ describe Braintree::PaymentMethod do
1347
1347
  token = create_result.payment_method.token
1348
1348
 
1349
1349
  apple_pay_card = Braintree::PaymentMethod.find(token)
1350
- apple_pay_card.should be_a(Braintree::ApplePayCard)
1350
+ expect(apple_pay_card).to be_a(Braintree::ApplePayCard)
1351
1351
 
1352
1352
  delete_result = Braintree::PaymentMethod.delete(token)
1353
- delete_result.success?.should == true
1353
+ expect(delete_result.success?).to eq(true)
1354
1354
 
1355
1355
  expect do
1356
1356
  Braintree::PaymentMethod.find(token)
@@ -1371,10 +1371,10 @@ describe Braintree::PaymentMethod do
1371
1371
  )
1372
1372
 
1373
1373
  paypal_account = Braintree::PaymentMethod.find(paypal_account_token)
1374
- paypal_account.should be_a(Braintree::PayPalAccount)
1374
+ expect(paypal_account).to be_a(Braintree::PayPalAccount)
1375
1375
 
1376
1376
  result = Braintree::PaymentMethod.delete(paypal_account_token, {:revoke_all_grants => false})
1377
- result.success?.should == true
1377
+ expect(result.success?).to eq(true)
1378
1378
 
1379
1379
  expect do
1380
1380
  Braintree::PaymentMethod.find(paypal_account_token)
@@ -1400,7 +1400,7 @@ describe Braintree::PaymentMethod do
1400
1400
  )
1401
1401
 
1402
1402
  result = Braintree::PaymentMethod.delete(token)
1403
- result.success?.should == true
1403
+ expect(result.success?).to eq(true)
1404
1404
 
1405
1405
  expect do
1406
1406
  Braintree::PaymentMethod.find(token)
@@ -1475,13 +1475,13 @@ describe Braintree::PaymentMethod do
1475
1475
  },
1476
1476
  :options => {:verify_card => true},
1477
1477
  )
1478
- update_result.success?.should == true
1479
- update_result.payment_method.should == credit_card
1478
+ expect(update_result.success?).to eq(true)
1479
+ expect(update_result.payment_method).to eq(credit_card)
1480
1480
  updated_credit_card = update_result.payment_method
1481
- updated_credit_card.cardholder_name.should == "New Holder"
1482
- updated_credit_card.bin.should == Braintree::Test::CreditCardNumbers::MasterCard[0, 6]
1483
- updated_credit_card.last_4.should == Braintree::Test::CreditCardNumbers::MasterCard[-4..-1]
1484
- updated_credit_card.expiration_date.should == "06/2013"
1481
+ expect(updated_credit_card.cardholder_name).to eq("New Holder")
1482
+ expect(updated_credit_card.bin).to eq(Braintree::Test::CreditCardNumbers::MasterCard[0, 6])
1483
+ expect(updated_credit_card.last_4).to eq(Braintree::Test::CreditCardNumbers::MasterCard[-4..-1])
1484
+ expect(updated_credit_card.expiration_date).to eq("06/2013")
1485
1485
  end
1486
1486
 
1487
1487
  it "updates the credit card" do
@@ -1499,13 +1499,13 @@ describe Braintree::PaymentMethod do
1499
1499
  :number => Braintree::Test::CreditCardNumbers::MasterCard,
1500
1500
  :expiration_date => "06/2013",
1501
1501
  )
1502
- update_result.success?.should == true
1503
- update_result.payment_method.should == credit_card
1502
+ expect(update_result.success?).to eq(true)
1503
+ expect(update_result.payment_method).to eq(credit_card)
1504
1504
  updated_credit_card = update_result.payment_method
1505
- updated_credit_card.cardholder_name.should == "New Holder"
1506
- updated_credit_card.bin.should == Braintree::Test::CreditCardNumbers::MasterCard[0, 6]
1507
- updated_credit_card.last_4.should == Braintree::Test::CreditCardNumbers::MasterCard[-4..-1]
1508
- updated_credit_card.expiration_date.should == "06/2013"
1505
+ expect(updated_credit_card.cardholder_name).to eq("New Holder")
1506
+ expect(updated_credit_card.bin).to eq(Braintree::Test::CreditCardNumbers::MasterCard[0, 6])
1507
+ expect(updated_credit_card.last_4).to eq(Braintree::Test::CreditCardNumbers::MasterCard[-4..-1])
1508
+ expect(updated_credit_card.expiration_date).to eq("06/2013")
1509
1509
  end
1510
1510
 
1511
1511
  it "includes risk data when skip_advanced_fraud_checking is false" do
@@ -1577,7 +1577,7 @@ describe Braintree::PaymentMethod do
1577
1577
  :expiration_date => "06/2013",
1578
1578
  :options => {:verify_card => true, :verification_currency_iso_code => "USD"},
1579
1579
  )
1580
- update_result.success?.should == true
1580
+ expect(update_result.success?).to eq(true)
1581
1581
  update_result.payment_method.verification.currency_iso_code == "USD"
1582
1582
  end
1583
1583
 
@@ -1597,7 +1597,7 @@ describe Braintree::PaymentMethod do
1597
1597
  :expiration_date => "06/2013",
1598
1598
  :options => {:verify_card => true, :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId, :verification_currency_iso_code => "USD"},
1599
1599
  )
1600
- update_result.success?.should == true
1600
+ expect(update_result.success?).to eq(true)
1601
1601
  update_result.payment_method.verification.currency_iso_code == "USD"
1602
1602
  update_result.payment_method.verification.merchant_account_id == SpecHelper::NonDefaultMerchantAccountId
1603
1603
  end
@@ -1619,7 +1619,7 @@ describe Braintree::PaymentMethod do
1619
1619
  :options => {:verify_card => true, :verification_currency_iso_code => "GBP"},
1620
1620
  )
1621
1621
  expect(update_result).to_not be_success
1622
- update_result.errors.for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code.should == Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount
1622
+ expect(update_result.errors.for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code).to eq(Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount)
1623
1623
  end
1624
1624
 
1625
1625
  it "throws validation error when passing invalid verification_currency_iso_code of the given verification merchant account id" do
@@ -1639,7 +1639,7 @@ describe Braintree::PaymentMethod do
1639
1639
  :options => {:verify_card => true, :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId, :verification_currency_iso_code => "GBP"},
1640
1640
  )
1641
1641
  expect(update_result).to_not be_success
1642
- update_result.errors.for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code.should == Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount
1642
+ expect(update_result.errors.for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code).to eq(Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount)
1643
1643
  end
1644
1644
  end
1645
1645
 
@@ -1660,11 +1660,11 @@ describe Braintree::PaymentMethod do
1660
1660
  :region => "IL"
1661
1661
  },
1662
1662
  )
1663
- update_result.success?.should == true
1663
+ expect(update_result.success?).to eq(true)
1664
1664
  updated_credit_card = update_result.payment_method
1665
- updated_credit_card.billing_address.region.should == "IL"
1666
- updated_credit_card.billing_address.street_address.should == nil
1667
- updated_credit_card.billing_address.id.should_not == credit_card.billing_address.id
1665
+ expect(updated_credit_card.billing_address.region).to eq("IL")
1666
+ expect(updated_credit_card.billing_address.street_address).to eq(nil)
1667
+ expect(updated_credit_card.billing_address.id).not_to eq(credit_card.billing_address.id)
1668
1668
  end
1669
1669
 
1670
1670
  it "updates the billing address if option is specified" do
@@ -1683,11 +1683,11 @@ describe Braintree::PaymentMethod do
1683
1683
  :options => {:update_existing => true}
1684
1684
  },
1685
1685
  )
1686
- update_result.success?.should == true
1686
+ expect(update_result.success?).to eq(true)
1687
1687
  updated_credit_card = update_result.payment_method
1688
- updated_credit_card.billing_address.region.should == "IL"
1689
- updated_credit_card.billing_address.street_address.should == "123 Nigeria Ave"
1690
- updated_credit_card.billing_address.id.should == credit_card.billing_address.id
1688
+ expect(updated_credit_card.billing_address.region).to eq("IL")
1689
+ expect(updated_credit_card.billing_address.street_address).to eq("123 Nigeria Ave")
1690
+ expect(updated_credit_card.billing_address.id).to eq(credit_card.billing_address.id)
1691
1691
  end
1692
1692
 
1693
1693
  it "updates the country via codes" do
@@ -1709,12 +1709,12 @@ describe Braintree::PaymentMethod do
1709
1709
  :options => {:update_existing => true}
1710
1710
  },
1711
1711
  )
1712
- update_result.success?.should == true
1712
+ expect(update_result.success?).to eq(true)
1713
1713
  updated_credit_card = update_result.payment_method
1714
- updated_credit_card.billing_address.country_name.should == "American Samoa"
1715
- updated_credit_card.billing_address.country_code_alpha2.should == "AS"
1716
- updated_credit_card.billing_address.country_code_alpha3.should == "ASM"
1717
- updated_credit_card.billing_address.country_code_numeric.should == "016"
1714
+ expect(updated_credit_card.billing_address.country_name).to eq("American Samoa")
1715
+ expect(updated_credit_card.billing_address.country_code_alpha2).to eq("AS")
1716
+ expect(updated_credit_card.billing_address.country_code_alpha3).to eq("ASM")
1717
+ expect(updated_credit_card.billing_address.country_code_numeric).to eq("016")
1718
1718
  end
1719
1719
  end
1720
1720
 
@@ -1730,11 +1730,11 @@ describe Braintree::PaymentMethod do
1730
1730
  :expiration_month => "07",
1731
1731
  :expiration_year => "2011",
1732
1732
  )
1733
- update_result.success?.should == true
1734
- update_result.payment_method.should == credit_card
1735
- update_result.payment_method.expiration_month.should == "07"
1736
- update_result.payment_method.expiration_year.should == "2011"
1737
- update_result.payment_method.expiration_date.should == "07/2011"
1733
+ expect(update_result.success?).to eq(true)
1734
+ expect(update_result.payment_method).to eq(credit_card)
1735
+ expect(update_result.payment_method.expiration_month).to eq("07")
1736
+ expect(update_result.payment_method.expiration_year).to eq("2011")
1737
+ expect(update_result.payment_method.expiration_date).to eq("07/2011")
1738
1738
  end
1739
1739
 
1740
1740
  it "verifies the update if options[verify_card]=true" do
@@ -1753,9 +1753,9 @@ describe Braintree::PaymentMethod do
1753
1753
  :expiration_date => "06/2013",
1754
1754
  :options => {:verify_card => true},
1755
1755
  )
1756
- update_result.success?.should == false
1757
- update_result.credit_card_verification.status.should == Braintree::Transaction::Status::ProcessorDeclined
1758
- update_result.credit_card_verification.gateway_rejection_reason.should be_nil
1756
+ expect(update_result.success?).to eq(false)
1757
+ expect(update_result.credit_card_verification.status).to eq(Braintree::Transaction::Status::ProcessorDeclined)
1758
+ expect(update_result.credit_card_verification.gateway_rejection_reason).to be_nil
1759
1759
  end
1760
1760
 
1761
1761
  it "accepts a custom verification amount" do
@@ -1771,10 +1771,10 @@ describe Braintree::PaymentMethod do
1771
1771
  :payment_method_nonce => Braintree::Test::Nonce::ProcessorDeclinedMasterCard,
1772
1772
  :options => {:verify_card => true, :verification_amount => "2.34"},
1773
1773
  )
1774
- update_result.success?.should == false
1775
- update_result.credit_card_verification.status.should == Braintree::Transaction::Status::ProcessorDeclined
1776
- update_result.credit_card_verification.gateway_rejection_reason.should be_nil
1777
- update_result.credit_card_verification.amount.should == BigDecimal("2.34")
1774
+ expect(update_result.success?).to eq(false)
1775
+ expect(update_result.credit_card_verification.status).to eq(Braintree::Transaction::Status::ProcessorDeclined)
1776
+ expect(update_result.credit_card_verification.gateway_rejection_reason).to be_nil
1777
+ expect(update_result.credit_card_verification.amount).to eq(BigDecimal("2.34"))
1778
1778
  end
1779
1779
 
1780
1780
  it "can update the billing address" do
@@ -1811,17 +1811,17 @@ describe Braintree::PaymentMethod do
1811
1811
  :country_name => "United States of America"
1812
1812
  },
1813
1813
  )
1814
- result.success?.should == true
1814
+ expect(result.success?).to eq(true)
1815
1815
  address = result.payment_method.billing_address
1816
- address.first_name.should == "New First Name"
1817
- address.last_name.should == "New Last Name"
1818
- address.company.should == "New Company"
1819
- address.street_address.should == "123 New St"
1820
- address.extended_address.should == "Apt New"
1821
- address.locality.should == "New City"
1822
- address.region.should == "New State"
1823
- address.postal_code.should == "56789"
1824
- address.country_name.should == "United States of America"
1816
+ expect(address.first_name).to eq("New First Name")
1817
+ expect(address.last_name).to eq("New Last Name")
1818
+ expect(address.company).to eq("New Company")
1819
+ expect(address.street_address).to eq("123 New St")
1820
+ expect(address.extended_address).to eq("Apt New")
1821
+ expect(address.locality).to eq("New City")
1822
+ expect(address.region).to eq("New State")
1823
+ expect(address.postal_code).to eq("56789")
1824
+ expect(address.country_name).to eq("United States of America")
1825
1825
  end
1826
1826
 
1827
1827
  it "returns an error response if invalid" do
@@ -1837,8 +1837,8 @@ describe Braintree::PaymentMethod do
1837
1837
  :number => "invalid",
1838
1838
  :expiration_date => "05/2014",
1839
1839
  )
1840
- update_result.success?.should == false
1841
- update_result.errors.for(:credit_card).on(:number)[0].message.should == "Credit card number must be 12-19 digits."
1840
+ expect(update_result.success?).to eq(false)
1841
+ expect(update_result.errors.for(:credit_card).on(:number)[0].message).to eq("Credit card number must be 12-19 digits.")
1842
1842
  end
1843
1843
 
1844
1844
  it "can update the default" do
@@ -1854,13 +1854,13 @@ describe Braintree::PaymentMethod do
1854
1854
  :expiration_date => "05/2009",
1855
1855
  ).credit_card
1856
1856
 
1857
- card1.should be_default
1858
- card2.should_not be_default
1857
+ expect(card1).to be_default
1858
+ expect(card2).not_to be_default
1859
1859
 
1860
1860
  Braintree::PaymentMethod.update(card2.token, :options => {:make_default => true})
1861
1861
 
1862
- Braintree::CreditCard.find(card1.token).should_not be_default
1863
- Braintree::CreditCard.find(card2.token).should be_default
1862
+ expect(Braintree::CreditCard.find(card1.token)).not_to be_default
1863
+ expect(Braintree::CreditCard.find(card2.token)).to be_default
1864
1864
  end
1865
1865
  end
1866
1866
 
@@ -1884,7 +1884,7 @@ describe Braintree::PaymentMethod do
1884
1884
  )
1885
1885
 
1886
1886
  updated_paypal_account = Braintree::PayPalAccount.find(updated_token)
1887
- updated_paypal_account.email.should == original_result.payment_method.email
1887
+ expect(updated_paypal_account.email).to eq(original_result.payment_method.email)
1888
1888
 
1889
1889
  expect do
1890
1890
  Braintree::PayPalAccount.find(original_token)
@@ -1899,7 +1899,7 @@ describe Braintree::PaymentMethod do
1899
1899
  :expiration_date => "05/2009",
1900
1900
  :options => {:make_default => true},
1901
1901
  )
1902
- result.should be_success
1902
+ expect(result).to be_success
1903
1903
 
1904
1904
  nonce = nonce_for_paypal_account(:consent_code => "consent-code")
1905
1905
  original_token = Braintree::PaymentMethod.create(
@@ -1913,7 +1913,7 @@ describe Braintree::PaymentMethod do
1913
1913
  )
1914
1914
 
1915
1915
  updated_paypal_account = Braintree::PayPalAccount.find(original_token)
1916
- updated_paypal_account.should be_default
1916
+ expect(updated_paypal_account).to be_default
1917
1917
  end
1918
1918
 
1919
1919
  it "returns an error if a token for account is used to attempt an update" do
@@ -1944,8 +1944,8 @@ describe Braintree::PaymentMethod do
1944
1944
  :token => second_token,
1945
1945
  )
1946
1946
 
1947
- updated_result.should_not be_success
1948
- updated_result.errors.first.code.should == "92906"
1947
+ expect(updated_result).not_to be_success
1948
+ expect(updated_result.errors.first.code).to eq("92906")
1949
1949
  end
1950
1950
  end
1951
1951
  end
@@ -1966,11 +1966,11 @@ describe Braintree::PaymentMethod do
1966
1966
  :number => Braintree::Test::CreditCardNumbers::MasterCard,
1967
1967
  :expiration_date => "06/2013",
1968
1968
  )
1969
- payment_method.should == credit_card
1970
- payment_method.cardholder_name.should == "New Holder"
1971
- payment_method.bin.should == Braintree::Test::CreditCardNumbers::MasterCard[0, 6]
1972
- payment_method.last_4.should == Braintree::Test::CreditCardNumbers::MasterCard[-4..-1]
1973
- payment_method.expiration_date.should == "06/2013"
1969
+ expect(payment_method).to eq(credit_card)
1970
+ expect(payment_method.cardholder_name).to eq("New Holder")
1971
+ expect(payment_method.bin).to eq(Braintree::Test::CreditCardNumbers::MasterCard[0, 6])
1972
+ expect(payment_method.last_4).to eq(Braintree::Test::CreditCardNumbers::MasterCard[-4..-1])
1973
+ expect(payment_method.expiration_date).to eq("06/2013")
1974
1974
  end
1975
1975
  end
1976
1976
 
@@ -2018,24 +2018,24 @@ describe Braintree::PaymentMethod do
2018
2018
  describe "self.grant" do
2019
2019
  it "returns an error result when the grant doesn't succeed" do
2020
2020
  grant_result = @granting_gateway.payment_method.grant("payment_method_from_grant", true)
2021
- grant_result.should_not be_success
2021
+ expect(grant_result).not_to be_success
2022
2022
  end
2023
2023
 
2024
2024
  it "returns a nonce that is transactable by a partner merchant exactly once" do
2025
2025
  grant_result = @granting_gateway.payment_method.grant(@credit_card.token, :allow_vaulting => false)
2026
- grant_result.should be_success
2026
+ expect(grant_result).to be_success
2027
2027
 
2028
2028
  result = Braintree::Transaction.sale(
2029
2029
  :payment_method_nonce => grant_result.payment_method_nonce.nonce,
2030
2030
  :amount => Braintree::Test::TransactionAmounts::Authorize,
2031
2031
  )
2032
- result.should be_success
2032
+ expect(result).to be_success
2033
2033
 
2034
2034
  result2 = Braintree::Transaction.sale(
2035
2035
  :payment_method_nonce => grant_result.payment_method_nonce.nonce,
2036
2036
  :amount => Braintree::Test::TransactionAmounts::Authorize,
2037
2037
  )
2038
- result2.should_not be_success
2038
+ expect(result2).not_to be_success
2039
2039
  end
2040
2040
 
2041
2041
  it "returns a nonce that is not vaultable" do
@@ -2047,7 +2047,7 @@ describe Braintree::PaymentMethod do
2047
2047
  :customer_id => customer_result.customer.id,
2048
2048
  :payment_method_nonce => grant_result.payment_method_nonce.nonce,
2049
2049
  )
2050
- result.should_not be_success
2050
+ expect(result).not_to be_success
2051
2051
  end
2052
2052
 
2053
2053
  it "returns a nonce that is vaultable" do
@@ -2059,7 +2059,7 @@ describe Braintree::PaymentMethod do
2059
2059
  :customer_id => customer_result.customer.id,
2060
2060
  :payment_method_nonce => grant_result.payment_method_nonce.nonce,
2061
2061
  )
2062
- result.should be_success
2062
+ expect(result).to be_success
2063
2063
  end
2064
2064
 
2065
2065
  it "raises an error if the token isn't found" do
@@ -2071,7 +2071,7 @@ describe Braintree::PaymentMethod do
2071
2071
  it "returns a valid nonce with no options set" do
2072
2072
  expect do
2073
2073
  grant_result = @granting_gateway.payment_method.grant(@credit_card.token)
2074
- grant_result.should be_success
2074
+ expect(grant_result).to be_success
2075
2075
  end
2076
2076
  end
2077
2077
  end
@@ -2086,7 +2086,7 @@ describe Braintree::PaymentMethod do
2086
2086
  it "renders a granted nonce useless" do
2087
2087
  grant_result = @granting_gateway.payment_method.grant(@credit_card.token)
2088
2088
  revoke_result = @granting_gateway.payment_method.revoke(@credit_card.token)
2089
- revoke_result.should be_success
2089
+ expect(revoke_result).to be_success
2090
2090
 
2091
2091
  customer_result = Braintree::Customer.create()
2092
2092
 
@@ -2094,13 +2094,13 @@ describe Braintree::PaymentMethod do
2094
2094
  :customer_id => customer_result.customer.id,
2095
2095
  :payment_method_nonce => grant_result.payment_method_nonce.nonce,
2096
2096
  )
2097
- result.should_not be_success
2097
+ expect(result).not_to be_success
2098
2098
  end
2099
2099
 
2100
2100
  it "renders a granted nonce obtained uisng options hash, useless" do
2101
2101
  grant_result = @granting_gateway.payment_method.grant(@credit_card.token, :allow_vaulting => true)
2102
2102
  revoke_result = @granting_gateway.payment_method.revoke(@credit_card.token)
2103
- revoke_result.should be_success
2103
+ expect(revoke_result).to be_success
2104
2104
 
2105
2105
  customer_result = Braintree::Customer.create()
2106
2106
 
@@ -2108,7 +2108,7 @@ describe Braintree::PaymentMethod do
2108
2108
  :customer_id => customer_result.customer.id,
2109
2109
  :payment_method_nonce => grant_result.payment_method_nonce.nonce,
2110
2110
  )
2111
- result.should_not be_success
2111
+ expect(result).not_to be_success
2112
2112
  end
2113
2113
  end
2114
2114
  end