braintree 4.14.0 → 4.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (247) 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_gateway.rb +28 -11
  22. data/lib/braintree/credit_card_verification_search.rb +1 -1
  23. data/lib/braintree/customer.rb +5 -9
  24. data/lib/braintree/customer_gateway.rb +7 -7
  25. data/lib/braintree/customer_search.rb +1 -1
  26. data/lib/braintree/descriptor.rb +1 -1
  27. data/lib/braintree/digest.rb +1 -1
  28. data/lib/braintree/disbursement.rb +5 -5
  29. data/lib/braintree/discount_gateway.rb +1 -1
  30. data/lib/braintree/dispute/evidence.rb +1 -1
  31. data/lib/braintree/dispute/paypal_message.rb +1 -1
  32. data/lib/braintree/dispute/status_history.rb +1 -1
  33. data/lib/braintree/dispute/transaction.rb +1 -1
  34. data/lib/braintree/dispute/transaction_details.rb +1 -1
  35. data/lib/braintree/dispute.rb +3 -3
  36. data/lib/braintree/dispute_gateway.rb +1 -1
  37. data/lib/braintree/dispute_search.rb +1 -1
  38. data/lib/braintree/document_upload.rb +2 -2
  39. data/lib/braintree/document_upload_gateway.rb +3 -3
  40. data/lib/braintree/enriched_customer_data.rb +2 -2
  41. data/lib/braintree/error_codes.rb +4 -0
  42. data/lib/braintree/error_result.rb +2 -3
  43. data/lib/braintree/errors.rb +3 -3
  44. data/lib/braintree/exceptions.rb +1 -2
  45. data/lib/braintree/exchange_rate.rb +2 -2
  46. data/lib/braintree/exchange_rate_quote.rb +3 -3
  47. data/lib/braintree/exchange_rate_quote_gateway.rb +1 -1
  48. data/lib/braintree/exchange_rate_quote_input.rb +3 -3
  49. data/lib/braintree/exchange_rate_quote_request.rb +3 -3
  50. data/lib/braintree/exchange_rate_quote_response.rb +3 -3
  51. data/lib/braintree/facilitated_details.rb +1 -1
  52. data/lib/braintree/facilitator_details.rb +1 -1
  53. data/lib/braintree/google_pay_card.rb +3 -3
  54. data/lib/braintree/granted_payment_instrument_update.rb +1 -1
  55. data/lib/braintree/graphql_client.rb +1 -1
  56. data/lib/braintree/http.rb +5 -5
  57. data/lib/braintree/local_payment_completed.rb +2 -2
  58. data/lib/braintree/local_payment_expired.rb +2 -2
  59. data/lib/braintree/local_payment_funded.rb +2 -2
  60. data/lib/braintree/local_payment_reversed.rb +2 -2
  61. data/lib/braintree/merchant.rb +3 -3
  62. data/lib/braintree/merchant_account.rb +2 -2
  63. data/lib/braintree/merchant_account_gateway.rb +9 -9
  64. data/lib/braintree/meta_checkout_card.rb +89 -0
  65. data/lib/braintree/meta_checkout_token.rb +88 -0
  66. data/lib/braintree/modification.rb +3 -3
  67. data/lib/braintree/oauth_credentials.rb +3 -3
  68. data/lib/braintree/paginated_collection.rb +2 -2
  69. data/lib/braintree/paginated_result.rb +1 -1
  70. data/lib/braintree/payment_instrument_type.rb +2 -0
  71. data/lib/braintree/payment_method_customer_data_updated_metadata.rb +2 -2
  72. data/lib/braintree/payment_method_gateway.rb +23 -10
  73. data/lib/braintree/payment_method_nonce.rb +4 -4
  74. data/lib/braintree/payment_method_nonce_details.rb +1 -1
  75. data/lib/braintree/payment_method_nonce_details_payer_info.rb +1 -1
  76. data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
  77. data/lib/braintree/paypal_account.rb +1 -2
  78. data/lib/braintree/paypal_account_gateway.rb +5 -5
  79. data/lib/braintree/plan.rb +1 -1
  80. data/lib/braintree/plan_gateway.rb +2 -2
  81. data/lib/braintree/resource_collection.rb +2 -2
  82. data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
  83. data/lib/braintree/risk_data.rb +1 -1
  84. data/lib/braintree/samsung_pay_card.rb +5 -5
  85. data/lib/braintree/sepa_direct_debit_account.rb +2 -2
  86. data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +1 -1
  87. data/lib/braintree/settlement_batch_summary_gateway.rb +1 -1
  88. data/lib/braintree/sha256_digest.rb +1 -1
  89. data/lib/braintree/subscription/status_details.rb +1 -1
  90. data/lib/braintree/subscription.rb +2 -2
  91. data/lib/braintree/subscription_gateway.rb +6 -6
  92. data/lib/braintree/subscription_search.rb +1 -1
  93. data/lib/braintree/successful_result.rb +2 -2
  94. data/lib/braintree/test/credit_card.rb +7 -10
  95. data/lib/braintree/test/merchant_account.rb +1 -1
  96. data/lib/braintree/test/nonce.rb +4 -0
  97. data/lib/braintree/test/transaction_amounts.rb +2 -3
  98. data/lib/braintree/test/venmo_sdk.rb +2 -0
  99. data/lib/braintree/testing_gateway.rb +1 -1
  100. data/lib/braintree/three_d_secure_info.rb +1 -1
  101. data/lib/braintree/transaction/address_details.rb +2 -1
  102. data/lib/braintree/transaction/credit_card_details.rb +4 -1
  103. data/lib/braintree/transaction/customer_details.rb +1 -1
  104. data/lib/braintree/transaction/disbursement_details.rb +1 -1
  105. data/lib/braintree/transaction/local_payment_details.rb +2 -0
  106. data/lib/braintree/transaction/meta_checkout_card_details.rb +52 -0
  107. data/lib/braintree/transaction/meta_checkout_token_details.rb +54 -0
  108. data/lib/braintree/transaction/package_details.rb +16 -0
  109. data/lib/braintree/transaction/samsung_pay_card_details.rb +1 -1
  110. data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +1 -1
  111. data/lib/braintree/transaction/status_details.rb +1 -1
  112. data/lib/braintree/transaction/subscription_details.rb +1 -1
  113. data/lib/braintree/transaction/us_bank_account_details.rb +1 -1
  114. data/lib/braintree/transaction/visa_checkout_card_details.rb +1 -1
  115. data/lib/braintree/transaction.rb +37 -20
  116. data/lib/braintree/transaction_gateway.rb +44 -15
  117. data/lib/braintree/transaction_line_item.rb +13 -10
  118. data/lib/braintree/transaction_line_item_gateway.rb +1 -1
  119. data/lib/braintree/transaction_review.rb +1 -1
  120. data/lib/braintree/transaction_search.rb +7 -6
  121. data/lib/braintree/unknown_payment_method.rb +1 -1
  122. data/lib/braintree/us_bank_account.rb +2 -2
  123. data/lib/braintree/us_bank_account_verification.rb +23 -15
  124. data/lib/braintree/us_bank_account_verification_search.rb +1 -1
  125. data/lib/braintree/util.rb +3 -3
  126. data/lib/braintree/validation_error.rb +1 -1
  127. data/lib/braintree/validation_error_collection.rb +3 -3
  128. data/lib/braintree/venmo_account.rb +3 -3
  129. data/lib/braintree/venmo_profile_data.rb +6 -4
  130. data/lib/braintree/version.rb +1 -1
  131. data/lib/braintree/visa_checkout_card.rb +7 -7
  132. data/lib/braintree/webhook_notification.rb +3 -2
  133. data/lib/braintree/webhook_notification_gateway.rb +4 -4
  134. data/lib/braintree/webhook_testing.rb +1 -1
  135. data/lib/braintree/webhook_testing_gateway.rb +18 -1
  136. data/lib/braintree/xml/generator.rb +1 -1
  137. data/lib/braintree/xml/libxml.rb +1 -1
  138. data/lib/braintree/xml/parser.rb +3 -3
  139. data/lib/braintree/xml/rexml.rb +2 -2
  140. data/lib/braintree/xml.rb +1 -1
  141. data/lib/braintree.rb +5 -1
  142. data/spec/integration/braintree/add_on_spec.rb +9 -9
  143. data/spec/integration/braintree/address_spec.rb +69 -69
  144. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  145. data/spec/integration/braintree/apple_pay_spec.rb +8 -8
  146. data/spec/integration/braintree/client_api/client_token_spec.rb +15 -15
  147. data/spec/integration/braintree/client_api/spec_helper.rb +2 -2
  148. data/spec/integration/braintree/credit_card_spec.rb +227 -228
  149. data/spec/integration/braintree/credit_card_verification_search_spec.rb +16 -16
  150. data/spec/integration/braintree/credit_card_verification_spec.rb +98 -53
  151. data/spec/integration/braintree/customer_search_spec.rb +20 -20
  152. data/spec/integration/braintree/customer_spec.rb +317 -317
  153. data/spec/integration/braintree/disbursement_spec.rb +2 -2
  154. data/spec/integration/braintree/discount_spec.rb +9 -9
  155. data/spec/integration/braintree/dispute_search_spec.rb +0 -1
  156. data/spec/integration/braintree/dispute_spec.rb +87 -87
  157. data/spec/integration/braintree/document_upload_spec.rb +17 -17
  158. data/spec/integration/braintree/error_codes_spec.rb +2 -2
  159. data/spec/integration/braintree/http_spec.rb +28 -28
  160. data/spec/integration/braintree/merchant_account_spec.rb +127 -127
  161. data/spec/integration/braintree/merchant_spec.rb +103 -103
  162. data/spec/integration/braintree/oauth_spec.rb +61 -61
  163. data/spec/integration/braintree/package_tracking_spec.rb +111 -0
  164. data/spec/integration/braintree/payment_method_nonce_spec.rb +89 -69
  165. data/spec/integration/braintree/payment_method_spec.rb +391 -391
  166. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +150 -78
  167. data/spec/integration/braintree/paypal_account_spec.rb +38 -38
  168. data/spec/integration/braintree/plan_spec.rb +15 -15
  169. data/spec/integration/braintree/samsung_pay_card_spec.rb +65 -65
  170. data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +51 -51
  171. data/spec/integration/braintree/settlement_batch_summary_spec.rb +11 -11
  172. data/spec/integration/braintree/subscription_spec.rb +364 -364
  173. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  174. data/spec/integration/braintree/test_transaction_spec.rb +19 -19
  175. data/spec/integration/braintree/transaction_line_item_spec.rb +12 -6
  176. data/spec/integration/braintree/transaction_search_spec.rb +225 -165
  177. data/spec/integration/braintree/transaction_spec.rb +1606 -1230
  178. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -32
  179. data/spec/integration/braintree/us_bank_account_spec.rb +30 -30
  180. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +18 -18
  181. data/spec/integration/braintree/us_bank_account_verification_spec.rb +33 -33
  182. data/spec/integration/braintree/visa_checkout_card_spec.rb +57 -57
  183. data/spec/spec_helper.rb +9 -8
  184. data/spec/unit/braintree/address_spec.rb +8 -8
  185. data/spec/unit/braintree/base_module_spec.rb +4 -4
  186. data/spec/unit/braintree/client_token_spec.rb +2 -2
  187. data/spec/unit/braintree/configuration_spec.rb +57 -57
  188. data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
  189. data/spec/unit/braintree/credit_card_spec.rb +31 -29
  190. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +33 -28
  191. data/spec/unit/braintree/credit_card_verification_search_spec.rb +9 -9
  192. data/spec/unit/braintree/credit_card_verification_spec.rb +17 -17
  193. data/spec/unit/braintree/customer_spec.rb +41 -40
  194. data/spec/unit/braintree/digest_spec.rb +5 -5
  195. data/spec/unit/braintree/disbursement_spec.rb +11 -11
  196. data/spec/unit/braintree/dispute_search_spec.rb +2 -2
  197. data/spec/unit/braintree/dispute_spec.rb +56 -56
  198. data/spec/unit/braintree/document_upload_spec.rb +8 -8
  199. data/spec/unit/braintree/enriched_customer_data_spec.rb +11 -2
  200. data/spec/unit/braintree/error_result_spec.rb +5 -5
  201. data/spec/unit/braintree/errors_spec.rb +9 -9
  202. data/spec/unit/braintree/http_spec.rb +9 -9
  203. data/spec/unit/braintree/local_payment_completed_spec.rb +11 -11
  204. data/spec/unit/braintree/local_payment_expired_spec.rb +2 -2
  205. data/spec/unit/braintree/local_payment_funded_spec.rb +6 -6
  206. data/spec/unit/braintree/merchant_account_spec.rb +4 -4
  207. data/spec/unit/braintree/meta_checkout_card_details_spec.rb +60 -0
  208. data/spec/unit/braintree/meta_checkout_card_spec.rb +60 -0
  209. data/spec/unit/braintree/meta_checkout_token_details_spec.rb +63 -0
  210. data/spec/unit/braintree/meta_checkout_token_spec.rb +63 -0
  211. data/spec/unit/braintree/modification_spec.rb +1 -1
  212. data/spec/unit/braintree/package_tracking_spec.rb +74 -0
  213. data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +6 -6
  214. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +7 -7
  215. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +14 -14
  216. data/spec/unit/braintree/payment_method_spec.rb +19 -19
  217. data/spec/unit/braintree/paypal_account_spec.rb +4 -4
  218. data/spec/unit/braintree/resource_collection_spec.rb +7 -7
  219. data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +1 -1
  220. data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
  221. data/spec/unit/braintree/signature_service_spec.rb +2 -2
  222. data/spec/unit/braintree/subscription_search_spec.rb +17 -17
  223. data/spec/unit/braintree/subscription_spec.rb +8 -8
  224. data/spec/unit/braintree/successful_result_spec.rb +5 -5
  225. data/spec/unit/braintree/three_d_secure_info_spec.rb +20 -20
  226. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +5 -5
  227. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  228. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  229. data/spec/unit/braintree/transaction/local_payment_details_spec.rb +30 -0
  230. data/spec/unit/braintree/transaction_gateway_spec.rb +41 -9
  231. data/spec/unit/braintree/transaction_search_spec.rb +2 -2
  232. data/spec/unit/braintree/transaction_spec.rb +101 -93
  233. data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
  234. data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
  235. data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
  236. data/spec/unit/braintree/us_bank_account_verification_spec.rb +12 -7
  237. data/spec/unit/braintree/util_spec.rb +27 -27
  238. data/spec/unit/braintree/validation_error_collection_spec.rb +34 -34
  239. data/spec/unit/braintree/validation_error_spec.rb +4 -4
  240. data/spec/unit/braintree/venmo_profile_data_spec.rb +16 -5
  241. data/spec/unit/braintree/webhook_notification_spec.rb +206 -191
  242. data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
  243. data/spec/unit/braintree/xml/parser_spec.rb +8 -8
  244. data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
  245. data/spec/unit/braintree/xml_spec.rb +17 -17
  246. data/spec/unit/braintree_spec.rb +2 -2
  247. metadata +14 -2
@@ -17,15 +17,15 @@ describe Braintree::CreditCard do
17
17
  :expiration_date => "05/2009",
18
18
  :cvv => "100",
19
19
  )
20
- result.success?.should == true
20
+ expect(result.success?).to eq(true)
21
21
  credit_card = result.credit_card
22
- credit_card.token.should =~ /\A\w{4,}\z/
23
- credit_card.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
24
- credit_card.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
25
- credit_card.expiration_date.should == "05/2009"
26
- credit_card.unique_number_identifier.should =~ /\A\w{32}\z/
27
- credit_card.venmo_sdk?.should == false
28
- credit_card.image_url.should_not be_nil
22
+ expect(credit_card.token).to match(/\A\w{4,}\z/)
23
+ expect(credit_card.bin).to eq(Braintree::Test::CreditCardNumbers::Visa[0, 6])
24
+ expect(credit_card.last_4).to eq(Braintree::Test::CreditCardNumbers::Visa[-4..-1])
25
+ expect(credit_card.expiration_date).to eq("05/2009")
26
+ expect(credit_card.unique_number_identifier).to match(/\A\w{32}\z/)
27
+ expect(credit_card.venmo_sdk?).to eq(false)
28
+ expect(credit_card.image_url).not_to be_nil
29
29
  end
30
30
 
31
31
  it "supports creation of cards with security params" do
@@ -37,7 +37,7 @@ describe Braintree::CreditCard do
37
37
  :cvv => "100",
38
38
  :device_data => "device_data",
39
39
  )
40
- result.success?.should == true
40
+ expect(result.success?).to eq(true)
41
41
  end
42
42
 
43
43
  it "can provide expiration month and year separately" do
@@ -48,11 +48,11 @@ describe Braintree::CreditCard do
48
48
  :expiration_month => "05",
49
49
  :expiration_year => "2012",
50
50
  )
51
- result.success?.should == true
51
+ expect(result.success?).to eq(true)
52
52
  credit_card = result.credit_card
53
- credit_card.expiration_month.should == "05"
54
- credit_card.expiration_year.should == "2012"
55
- credit_card.expiration_date.should == "05/2012"
53
+ expect(credit_card.expiration_month).to eq("05")
54
+ expect(credit_card.expiration_year).to eq("2012")
55
+ expect(credit_card.expiration_date).to eq("05/2012")
56
56
  end
57
57
 
58
58
  it "can specify the desired token" do
@@ -65,12 +65,12 @@ describe Braintree::CreditCard do
65
65
  :cvv => "100",
66
66
  :token => token,
67
67
  )
68
- result.success?.should == true
68
+ expect(result.success?).to eq(true)
69
69
  credit_card = result.credit_card
70
- credit_card.token.should == token
71
- credit_card.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
72
- credit_card.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
73
- credit_card.expiration_date.should == "05/2009"
70
+ expect(credit_card.token).to eq(token)
71
+ expect(credit_card.bin).to eq(Braintree::Test::CreditCardNumbers::Visa[0, 6])
72
+ expect(credit_card.last_4).to eq(Braintree::Test::CreditCardNumbers::Visa[-4..-1])
73
+ expect(credit_card.expiration_date).to eq("05/2009")
74
74
  end
75
75
 
76
76
  it "accepts billing_address_id" do
@@ -84,9 +84,9 @@ describe Braintree::CreditCard do
84
84
  :billing_address_id => address.id,
85
85
  ).credit_card
86
86
 
87
- credit_card.billing_address.id.should == address.id
88
- credit_card.billing_address.first_name.should == "Bobby"
89
- credit_card.billing_address.last_name.should == "Tables"
87
+ expect(credit_card.billing_address.id).to eq(address.id)
88
+ expect(credit_card.billing_address.first_name).to eq("Bobby")
89
+ expect(credit_card.billing_address.last_name).to eq("Tables")
90
90
  end
91
91
 
92
92
  it "accepts empty options hash" do
@@ -97,7 +97,7 @@ describe Braintree::CreditCard do
97
97
  :expiration_date => "05/2009",
98
98
  :options => {},
99
99
  )
100
- result.success?.should == true
100
+ expect(result.success?).to eq(true)
101
101
  end
102
102
 
103
103
  it "verifies the credit card if options[verify_card]=true" do
@@ -108,14 +108,14 @@ describe Braintree::CreditCard do
108
108
  :expiration_date => "05/2009",
109
109
  :options => {:verify_card => true},
110
110
  )
111
- result.success?.should == false
112
- result.credit_card_verification.status.should == Braintree::CreditCardVerification::Status::ProcessorDeclined
113
- result.credit_card_verification.processor_response_code.should == "2000"
114
- result.credit_card_verification.processor_response_text.should == "Do Not Honor"
115
- result.credit_card_verification.cvv_response_code.should == "I"
116
- result.credit_card_verification.avs_error_response_code.should == nil
117
- result.credit_card_verification.avs_postal_code_response_code.should == "I"
118
- result.credit_card_verification.avs_street_address_response_code.should == "I"
111
+ expect(result.success?).to eq(false)
112
+ expect(result.credit_card_verification.status).to eq(Braintree::CreditCardVerification::Status::ProcessorDeclined)
113
+ expect(result.credit_card_verification.processor_response_code).to eq("2000")
114
+ expect(result.credit_card_verification.processor_response_text).to eq("Do Not Honor")
115
+ expect(result.credit_card_verification.cvv_response_code).to eq("I")
116
+ expect(result.credit_card_verification.avs_error_response_code).to eq(nil)
117
+ expect(result.credit_card_verification.avs_postal_code_response_code).to eq("I")
118
+ expect(result.credit_card_verification.avs_street_address_response_code).to eq("I")
119
119
  end
120
120
 
121
121
  it "allows passing a specific verification amount" do
@@ -126,14 +126,14 @@ describe Braintree::CreditCard do
126
126
  :expiration_date => "05/2009",
127
127
  :options => {:verify_card => true, :verification_amount => "100.00"},
128
128
  )
129
- result.success?.should == false
130
- result.credit_card_verification.status.should == Braintree::CreditCardVerification::Status::ProcessorDeclined
131
- result.credit_card_verification.processor_response_code.should == "2000"
132
- result.credit_card_verification.processor_response_text.should == "Do Not Honor"
133
- result.credit_card_verification.cvv_response_code.should == "I"
134
- result.credit_card_verification.avs_error_response_code.should == nil
135
- result.credit_card_verification.avs_postal_code_response_code.should == "I"
136
- result.credit_card_verification.avs_street_address_response_code.should == "I"
129
+ expect(result.success?).to eq(false)
130
+ expect(result.credit_card_verification.status).to eq(Braintree::CreditCardVerification::Status::ProcessorDeclined)
131
+ expect(result.credit_card_verification.processor_response_code).to eq("2000")
132
+ expect(result.credit_card_verification.processor_response_text).to eq("Do Not Honor")
133
+ expect(result.credit_card_verification.cvv_response_code).to eq("I")
134
+ expect(result.credit_card_verification.avs_error_response_code).to eq(nil)
135
+ expect(result.credit_card_verification.avs_postal_code_response_code).to eq("I")
136
+ expect(result.credit_card_verification.avs_street_address_response_code).to eq("I")
137
137
  end
138
138
 
139
139
  it "returns risk data on verification on credit_card create" do
@@ -148,9 +148,9 @@ describe Braintree::CreditCard do
148
148
  :options => {:verify_card => true},
149
149
  )
150
150
  verification = credit_card.verification
151
- verification.risk_data.id.should_not be_nil
152
- verification.risk_data.decision.should_not be_nil
153
- verification.risk_data.decision_reasons.should_not be_nil
151
+ expect(verification.risk_data.id).not_to be_nil
152
+ expect(verification.risk_data.decision).not_to be_nil
153
+ expect(verification.risk_data.decision_reasons).not_to be_nil
154
154
  expect(verification.risk_data).to respond_to(:device_data_captured)
155
155
  expect(verification.risk_data).to respond_to(:fraud_service_provider)
156
156
  expect(verification.risk_data).to respond_to(:transaction_risk_score)
@@ -217,8 +217,8 @@ describe Braintree::CreditCard do
217
217
  :cvv => "200",
218
218
  :options => {:verify_card => true},
219
219
  )
220
- result.success?.should == false
221
- result.credit_card_verification.gateway_rejection_reason.should == Braintree::CreditCardVerification::GatewayRejectionReason::CVV
220
+ expect(result.success?).to eq(false)
221
+ expect(result.credit_card_verification.gateway_rejection_reason).to eq(Braintree::CreditCardVerification::GatewayRejectionReason::CVV)
222
222
  ensure
223
223
  Braintree::Configuration.merchant_id = old_merchant
224
224
  Braintree::Configuration.public_key = old_public_key
@@ -234,14 +234,14 @@ describe Braintree::CreditCard do
234
234
  :expiration_date => "05/2009",
235
235
  :options => {:verify_card => true, :verification_amount => "1.01"},
236
236
  )
237
- result.success?.should == false
238
- result.credit_card_verification.status.should == Braintree::CreditCardVerification::Status::ProcessorDeclined
239
- result.credit_card_verification.processor_response_code.should == "2000"
240
- result.credit_card_verification.processor_response_text.should == "Do Not Honor"
241
- result.credit_card_verification.cvv_response_code.should == "I"
242
- result.credit_card_verification.avs_error_response_code.should == nil
243
- result.credit_card_verification.avs_postal_code_response_code.should == "I"
244
- result.credit_card_verification.avs_street_address_response_code.should == "I"
237
+ expect(result.success?).to eq(false)
238
+ expect(result.credit_card_verification.status).to eq(Braintree::CreditCardVerification::Status::ProcessorDeclined)
239
+ expect(result.credit_card_verification.processor_response_code).to eq("2000")
240
+ expect(result.credit_card_verification.processor_response_text).to eq("Do Not Honor")
241
+ expect(result.credit_card_verification.cvv_response_code).to eq("I")
242
+ expect(result.credit_card_verification.avs_error_response_code).to eq(nil)
243
+ expect(result.credit_card_verification.avs_postal_code_response_code).to eq("I")
244
+ expect(result.credit_card_verification.avs_street_address_response_code).to eq("I")
245
245
  end
246
246
 
247
247
  it "allows user to specify merchant account for verification" do
@@ -255,8 +255,8 @@ describe Braintree::CreditCard do
255
255
  :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId
256
256
  },
257
257
  )
258
- result.success?.should == false
259
- result.credit_card_verification.merchant_account_id.should == SpecHelper::NonDefaultMerchantAccountId
258
+ expect(result.success?).to eq(false)
259
+ expect(result.credit_card_verification.merchant_account_id).to eq(SpecHelper::NonDefaultMerchantAccountId)
260
260
  end
261
261
 
262
262
  it "does not verify the card if options[verify_card]=false" do
@@ -267,7 +267,7 @@ describe Braintree::CreditCard do
267
267
  :expiration_date => "05/2009",
268
268
  :options => {:verify_card => false},
269
269
  )
270
- result.success?.should == true
270
+ expect(result.success?).to eq(true)
271
271
  end
272
272
 
273
273
  it "validates presence of three_d_secure_version in 3ds pass thru params" do
@@ -276,7 +276,7 @@ describe Braintree::CreditCard do
276
276
  :customer_id => customer.id,
277
277
  :payment_method_nonce => Braintree::Test::Nonce::Transactable,
278
278
  :three_d_secure_pass_thru => {
279
- :eci_flag => "02",
279
+ :eci_flag => "05",
280
280
  :cavv => "some_cavv",
281
281
  :xid => "some_xid",
282
282
  :authentication_response => "Y",
@@ -298,7 +298,7 @@ describe Braintree::CreditCard do
298
298
  :customer_id => customer.id,
299
299
  :payment_method_nonce => Braintree::Test::Nonce::Transactable,
300
300
  :three_d_secure_pass_thru => {
301
- :eci_flag => "02",
301
+ :eci_flag => "05",
302
302
  :cavv => "some_cavv",
303
303
  :xid => "some_xid",
304
304
  :three_d_secure_version => "1.0.2",
@@ -309,8 +309,7 @@ describe Braintree::CreditCard do
309
309
  },
310
310
  :options => {:verify_card => true},
311
311
  )
312
- result.success?.should == true
313
-
312
+ expect(result.success?).to eq(true)
314
313
  end
315
314
 
316
315
  it "returns 3DS info on cc verification" do
@@ -320,19 +319,19 @@ describe Braintree::CreditCard do
320
319
  :payment_method_nonce => Braintree::Test::Nonce::ThreeDSecureVisaFullAuthentication,
321
320
  :options => {:verify_card => true},
322
321
  )
323
- result.success?.should == true
322
+ expect(result.success?).to eq(true)
324
323
 
325
324
  three_d_secure_info = result.credit_card.verification.three_d_secure_info
326
- three_d_secure_info.enrolled.should == "Y"
327
- three_d_secure_info.should be_liability_shifted
328
- three_d_secure_info.should be_liability_shift_possible
329
- three_d_secure_info.status.should == "authenticate_successful"
330
- three_d_secure_info.cavv.should == "cavv_value"
331
- three_d_secure_info.xid.should == "xid_value"
332
- three_d_secure_info.eci_flag.should == "05"
333
- three_d_secure_info.three_d_secure_version.should == "1.0.2"
334
- three_d_secure_info.ds_transaction_id.should == nil
335
- three_d_secure_info.three_d_secure_authentication_id.should_not be_nil
325
+ expect(three_d_secure_info.enrolled).to eq("Y")
326
+ expect(three_d_secure_info).to be_liability_shifted
327
+ expect(three_d_secure_info).to be_liability_shift_possible
328
+ expect(three_d_secure_info.status).to eq("authenticate_successful")
329
+ expect(three_d_secure_info.cavv).to eq("cavv_value")
330
+ expect(three_d_secure_info.xid).to eq("xid_value")
331
+ expect(three_d_secure_info.eci_flag).to eq("05")
332
+ expect(three_d_secure_info.three_d_secure_version).to eq("1.0.2")
333
+ expect(three_d_secure_info.ds_transaction_id).to eq(nil)
334
+ expect(three_d_secure_info.three_d_secure_authentication_id).not_to be_nil
336
335
  end
337
336
 
338
337
  it "adds credit card with billing address to customer" do
@@ -348,10 +347,10 @@ describe Braintree::CreditCard do
348
347
  :postal_code => "60622"
349
348
  },
350
349
  )
351
- result.success?.should == true
350
+ expect(result.success?).to eq(true)
352
351
  credit_card = result.credit_card
353
- credit_card.bin.should == Braintree::Test::CreditCardNumbers::MasterCard[0, 6]
354
- credit_card.billing_address.street_address.should == "123 Abc Way"
352
+ expect(credit_card.bin).to eq(Braintree::Test::CreditCardNumbers::MasterCard[0, 6])
353
+ expect(credit_card.billing_address.street_address).to eq("123 Abc Way")
355
354
  end
356
355
 
357
356
  it "adds credit card with billing using country_code" do
@@ -367,12 +366,12 @@ describe Braintree::CreditCard do
367
366
  :country_code_numeric => "840"
368
367
  },
369
368
  )
370
- result.success?.should == true
369
+ expect(result.success?).to eq(true)
371
370
  credit_card = result.credit_card
372
- credit_card.billing_address.country_name.should == "United States of America"
373
- credit_card.billing_address.country_code_alpha2.should == "US"
374
- credit_card.billing_address.country_code_alpha3.should == "USA"
375
- credit_card.billing_address.country_code_numeric.should == "840"
371
+ expect(credit_card.billing_address.country_name).to eq("United States of America")
372
+ expect(credit_card.billing_address.country_code_alpha2).to eq("US")
373
+ expect(credit_card.billing_address.country_code_alpha3).to eq("USA")
374
+ expect(credit_card.billing_address.country_code_numeric).to eq("840")
376
375
  end
377
376
 
378
377
  it "returns an error when given inconsistent country information" do
@@ -386,8 +385,8 @@ describe Braintree::CreditCard do
386
385
  :country_code_alpha2 => "US"
387
386
  },
388
387
  )
389
- result.success?.should == false
390
- result.errors.for(:credit_card).for(:billing_address).on(:base).map { |e| e.code }.should include(Braintree::ErrorCodes::Address::InconsistentCountry)
388
+ expect(result.success?).to eq(false)
389
+ expect(result.errors.for(:credit_card).for(:billing_address).on(:base).map { |e| e.code }).to include(Braintree::ErrorCodes::Address::InconsistentCountry)
391
390
  end
392
391
 
393
392
  it "returns an error response if unsuccessful" do
@@ -397,8 +396,8 @@ describe Braintree::CreditCard do
397
396
  :number => Braintree::Test::CreditCardNumbers::Visa,
398
397
  :expiration_date => "invalid_date",
399
398
  )
400
- result.success?.should == false
401
- result.errors.for(:credit_card).on(:expiration_date)[0].message.should == "Expiration date is invalid."
399
+ expect(result.success?).to eq(false)
400
+ expect(result.errors.for(:credit_card).on(:expiration_date)[0].message).to eq("Expiration date is invalid.")
402
401
  end
403
402
 
404
403
  it "can set the default flag" do
@@ -408,7 +407,7 @@ describe Braintree::CreditCard do
408
407
  :number => Braintree::Test::CreditCardNumbers::Visa,
409
408
  :expiration_date => "05/2009",
410
409
  ).credit_card
411
- card1.should be_default
410
+ expect(card1).to be_default
412
411
 
413
412
  card2 = Braintree::CreditCard.create(
414
413
  :customer_id => customer.id,
@@ -418,9 +417,9 @@ describe Braintree::CreditCard do
418
417
  :make_default => true
419
418
  },
420
419
  ).credit_card
421
- card2.should be_default
420
+ expect(card2).to be_default
422
421
 
423
- Braintree::CreditCard.find(card1.token).should_not be_default
422
+ expect(Braintree::CreditCard.find(card1.token)).not_to be_default
424
423
  end
425
424
 
426
425
  it "can set the network transaction identifier when creating a credit card" do
@@ -448,7 +447,7 @@ describe Braintree::CreditCard do
448
447
  :options => {:verify_card => true},
449
448
  )
450
449
  credit_card = result.credit_card
451
- credit_card.prepaid.should == Braintree::CreditCard::Prepaid::Yes
450
+ expect(credit_card.prepaid).to eq(Braintree::CreditCard::Prepaid::Yes)
452
451
  end
453
452
 
454
453
  it "sets the healthcare field if the card is healthcare" do
@@ -460,8 +459,8 @@ describe Braintree::CreditCard do
460
459
  :options => {:verify_card => true},
461
460
  )
462
461
  credit_card = result.credit_card
463
- credit_card.healthcare.should == Braintree::CreditCard::Healthcare::Yes
464
- credit_card.product_id.should == "J3"
462
+ expect(credit_card.healthcare).to eq(Braintree::CreditCard::Healthcare::Yes)
463
+ expect(credit_card.product_id).to eq("J3")
465
464
  end
466
465
 
467
466
  it "sets the durbin regulated field if the card is durbin regulated" do
@@ -473,7 +472,7 @@ describe Braintree::CreditCard do
473
472
  :options => {:verify_card => true},
474
473
  )
475
474
  credit_card = result.credit_card
476
- credit_card.durbin_regulated.should == Braintree::CreditCard::DurbinRegulated::Yes
475
+ expect(credit_card.durbin_regulated).to eq(Braintree::CreditCard::DurbinRegulated::Yes)
477
476
  end
478
477
 
479
478
  it "sets the country of issuance field" do
@@ -485,7 +484,7 @@ describe Braintree::CreditCard do
485
484
  :options => {:verify_card => true},
486
485
  )
487
486
  credit_card = result.credit_card
488
- credit_card.country_of_issuance.should == Braintree::Test::CreditCardDefaults::CountryOfIssuance
487
+ expect(credit_card.country_of_issuance).to eq(Braintree::Test::CreditCardDefaults::CountryOfIssuance)
489
488
  end
490
489
 
491
490
  it "sets the issuing bank field" do
@@ -497,7 +496,7 @@ describe Braintree::CreditCard do
497
496
  :options => {:verify_card => true},
498
497
  )
499
498
  credit_card = result.credit_card
500
- credit_card.issuing_bank.should == Braintree::Test::CreditCardDefaults::IssuingBank
499
+ expect(credit_card.issuing_bank).to eq(Braintree::Test::CreditCardDefaults::IssuingBank)
501
500
  end
502
501
 
503
502
  it "sets the payroll field if the card is payroll" do
@@ -509,8 +508,8 @@ describe Braintree::CreditCard do
509
508
  :options => {:verify_card => true},
510
509
  )
511
510
  credit_card = result.credit_card
512
- credit_card.payroll.should == Braintree::CreditCard::Payroll::Yes
513
- credit_card.product_id.should == "MSA"
511
+ expect(credit_card.payroll).to eq(Braintree::CreditCard::Payroll::Yes)
512
+ expect(credit_card.product_id).to eq("MSA")
514
513
  end
515
514
 
516
515
  it "sets the debit field if the card is debit" do
@@ -522,7 +521,7 @@ describe Braintree::CreditCard do
522
521
  :options => {:verify_card => true},
523
522
  )
524
523
  credit_card = result.credit_card
525
- credit_card.debit.should == Braintree::CreditCard::Debit::Yes
524
+ expect(credit_card.debit).to eq(Braintree::CreditCard::Debit::Yes)
526
525
  end
527
526
 
528
527
  it "sets the commercial field if the card is commercial" do
@@ -534,7 +533,7 @@ describe Braintree::CreditCard do
534
533
  :options => {:verify_card => true},
535
534
  )
536
535
  credit_card = result.credit_card
537
- credit_card.commercial.should == Braintree::CreditCard::Commercial::Yes
536
+ expect(credit_card.commercial).to eq(Braintree::CreditCard::Commercial::Yes)
538
537
  end
539
538
 
540
539
  it "sets negative card type identifiers" do
@@ -546,13 +545,13 @@ describe Braintree::CreditCard do
546
545
  :options => {:verify_card => true},
547
546
  )
548
547
  credit_card = result.credit_card
549
- credit_card.prepaid.should == Braintree::CreditCard::Prepaid::No
550
- credit_card.commercial.should == Braintree::CreditCard::Prepaid::No
551
- credit_card.payroll.should == Braintree::CreditCard::Prepaid::No
552
- credit_card.debit.should == Braintree::CreditCard::Prepaid::No
553
- credit_card.durbin_regulated.should == Braintree::CreditCard::Prepaid::No
554
- credit_card.healthcare.should == Braintree::CreditCard::Prepaid::No
555
- credit_card.product_id.should == "MSB"
548
+ expect(credit_card.prepaid).to eq(Braintree::CreditCard::Prepaid::No)
549
+ expect(credit_card.commercial).to eq(Braintree::CreditCard::Prepaid::No)
550
+ expect(credit_card.payroll).to eq(Braintree::CreditCard::Prepaid::No)
551
+ expect(credit_card.debit).to eq(Braintree::CreditCard::Prepaid::No)
552
+ expect(credit_card.durbin_regulated).to eq(Braintree::CreditCard::Prepaid::No)
553
+ expect(credit_card.healthcare).to eq(Braintree::CreditCard::Prepaid::No)
554
+ expect(credit_card.product_id).to eq("MSB")
556
555
  end
557
556
 
558
557
  it "doesn't set the card type identifiers for an un-identified card" do
@@ -564,12 +563,12 @@ describe Braintree::CreditCard do
564
563
  :options => {:verify_card => true},
565
564
  )
566
565
  credit_card = result.credit_card
567
- credit_card.prepaid.should == Braintree::CreditCard::Prepaid::Unknown
568
- credit_card.commercial.should == Braintree::CreditCard::Prepaid::Unknown
569
- credit_card.payroll.should == Braintree::CreditCard::Prepaid::Unknown
570
- credit_card.debit.should == Braintree::CreditCard::Prepaid::Unknown
571
- credit_card.durbin_regulated.should == Braintree::CreditCard::Prepaid::Unknown
572
- credit_card.healthcare.should == Braintree::CreditCard::Prepaid::Unknown
566
+ expect(credit_card.prepaid).to eq(Braintree::CreditCard::Prepaid::Unknown)
567
+ expect(credit_card.commercial).to eq(Braintree::CreditCard::Prepaid::Unknown)
568
+ expect(credit_card.payroll).to eq(Braintree::CreditCard::Prepaid::Unknown)
569
+ expect(credit_card.debit).to eq(Braintree::CreditCard::Prepaid::Unknown)
570
+ expect(credit_card.durbin_regulated).to eq(Braintree::CreditCard::Prepaid::Unknown)
571
+ expect(credit_card.healthcare).to eq(Braintree::CreditCard::Prepaid::Unknown)
573
572
  credit_card.country_of_issuance == Braintree::CreditCard::CountryOfIssuance::Unknown
574
573
  credit_card.issuing_bank == Braintree::CreditCard::IssuingBank::Unknown
575
574
  credit_card.product_id == Braintree::CreditCard::ProductId::Unknown
@@ -592,11 +591,11 @@ describe Braintree::CreditCard do
592
591
  :payment_method_nonce => nonce,
593
592
  )
594
593
 
595
- result.success?.should == true
594
+ expect(result.success?).to eq(true)
596
595
  credit_card = result.credit_card
597
- credit_card.bin.should == "411111"
598
- credit_card.last_4.should == "1111"
599
- credit_card.expiration_date.should == "11/2099"
596
+ expect(credit_card.bin).to eq("411111")
597
+ expect(credit_card.last_4).to eq("1111")
598
+ expect(credit_card.expiration_date).to eq("11/2099")
600
599
  end
601
600
  end
602
601
 
@@ -608,9 +607,9 @@ describe Braintree::CreditCard do
608
607
  :number => Braintree::Test::CreditCardNumbers::Elo,
609
608
  :expiration_date => "10/2020",
610
609
  )
611
- result.success?.should == true
610
+ expect(result.success?).to eq(true)
612
611
  credit_card = result.credit_card
613
- credit_card.card_type.should == Braintree::CreditCard::CardType::Elo
612
+ expect(credit_card.card_type).to eq(Braintree::CreditCard::CardType::Elo)
614
613
  end
615
614
  end
616
615
 
@@ -693,10 +692,10 @@ describe Braintree::CreditCard do
693
692
  :number => Braintree::Test::CreditCardNumbers::Visa,
694
693
  :expiration_date => "05/2009",
695
694
  )
696
- credit_card.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
697
- credit_card.cardholder_name.should == "Adam Davis"
698
- credit_card.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
699
- credit_card.expiration_date.should == "05/2009"
695
+ expect(credit_card.bin).to eq(Braintree::Test::CreditCardNumbers::Visa[0, 6])
696
+ expect(credit_card.cardholder_name).to eq("Adam Davis")
697
+ expect(credit_card.last_4).to eq(Braintree::Test::CreditCardNumbers::Visa[-4..-1])
698
+ expect(credit_card.expiration_date).to eq("05/2009")
700
699
  end
701
700
 
702
701
  it "raises a ValidationsFailed if unsuccessful" do
@@ -723,14 +722,14 @@ describe Braintree::CreditCard do
723
722
  customer.credit_cards[0].token,
724
723
  :amount => "100.00",
725
724
  )
726
- result.success?.should == true
727
- result.transaction.amount.should == BigDecimal("100.00")
728
- result.transaction.type.should == "credit"
729
- result.transaction.customer_details.id.should == customer.id
730
- result.transaction.credit_card_details.token.should == customer.credit_cards[0].token
731
- result.transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
732
- result.transaction.credit_card_details.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
733
- result.transaction.credit_card_details.expiration_date.should == "05/2010"
725
+ expect(result.success?).to eq(true)
726
+ expect(result.transaction.amount).to eq(BigDecimal("100.00"))
727
+ expect(result.transaction.type).to eq("credit")
728
+ expect(result.transaction.customer_details.id).to eq(customer.id)
729
+ expect(result.transaction.credit_card_details.token).to eq(customer.credit_cards[0].token)
730
+ expect(result.transaction.credit_card_details.bin).to eq(Braintree::Test::CreditCardNumbers::Visa[0, 6])
731
+ expect(result.transaction.credit_card_details.last_4).to eq(Braintree::Test::CreditCardNumbers::Visa[-4..-1])
732
+ expect(result.transaction.credit_card_details.expiration_date).to eq("05/2010")
734
733
  end
735
734
  end
736
735
 
@@ -746,13 +745,13 @@ describe Braintree::CreditCard do
746
745
  customer.credit_cards[0].token,
747
746
  :amount => "100.00",
748
747
  )
749
- transaction.amount.should == BigDecimal("100.00")
750
- transaction.type.should == "credit"
751
- transaction.customer_details.id.should == customer.id
752
- transaction.credit_card_details.token.should == customer.credit_cards[0].token
753
- transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
754
- transaction.credit_card_details.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
755
- transaction.credit_card_details.expiration_date.should == "05/2010"
748
+ expect(transaction.amount).to eq(BigDecimal("100.00"))
749
+ expect(transaction.type).to eq("credit")
750
+ expect(transaction.customer_details.id).to eq(customer.id)
751
+ expect(transaction.credit_card_details.token).to eq(customer.credit_cards[0].token)
752
+ expect(transaction.credit_card_details.bin).to eq(Braintree::Test::CreditCardNumbers::Visa[0, 6])
753
+ expect(transaction.credit_card_details.last_4).to eq(Braintree::Test::CreditCardNumbers::Visa[-4..-1])
754
+ expect(transaction.credit_card_details.expiration_date).to eq("05/2010")
756
755
  end
757
756
  end
758
757
 
@@ -772,13 +771,13 @@ describe Braintree::CreditCard do
772
771
  :number => Braintree::Test::CreditCardNumbers::MasterCard,
773
772
  :expiration_date => "06/2013",
774
773
  )
775
- update_result.success?.should == true
776
- update_result.credit_card.should == credit_card
774
+ expect(update_result.success?).to eq(true)
775
+ expect(update_result.credit_card).to eq(credit_card)
777
776
  updated_credit_card = update_result.credit_card
778
- updated_credit_card.bin.should == Braintree::Test::CreditCardNumbers::MasterCard[0, 6]
779
- updated_credit_card.last_4.should == Braintree::Test::CreditCardNumbers::MasterCard[-4..-1]
780
- updated_credit_card.expiration_date.should == "06/2013"
781
- updated_credit_card.cardholder_name.should == "New Holder"
777
+ expect(updated_credit_card.bin).to eq(Braintree::Test::CreditCardNumbers::MasterCard[0, 6])
778
+ expect(updated_credit_card.last_4).to eq(Braintree::Test::CreditCardNumbers::MasterCard[-4..-1])
779
+ expect(updated_credit_card.expiration_date).to eq("06/2013")
780
+ expect(updated_credit_card.cardholder_name).to eq("New Holder")
782
781
  end
783
782
 
784
783
  it "validates presence of three_d_secure_version in 3ds pass thru params" do
@@ -793,7 +792,7 @@ describe Braintree::CreditCard do
793
792
  result = Braintree::CreditCard.update(credit_card.token,
794
793
  :payment_method_nonce => Braintree::Test::Nonce::Transactable,
795
794
  :three_d_secure_pass_thru => {
796
- :eci_flag => "02",
795
+ :eci_flag => "05",
797
796
  :cavv => "some_cavv",
798
797
  :xid => "some_xid",
799
798
  :authentication_response => "Y",
@@ -821,7 +820,7 @@ describe Braintree::CreditCard do
821
820
  result = Braintree::CreditCard.update(credit_card.token,
822
821
  :payment_method_nonce => Braintree::Test::Nonce::Transactable,
823
822
  :three_d_secure_pass_thru => {
824
- :eci_flag => "02",
823
+ :eci_flag => "05",
825
824
  :cavv => "some_cavv",
826
825
  :three_d_secure_version=> "2.1.0",
827
826
  :xid => "some_xid",
@@ -833,7 +832,7 @@ describe Braintree::CreditCard do
833
832
  :options => {:verify_card => true},
834
833
  )
835
834
 
836
- result.success?.should == true
835
+ expect(result.success?).to eq(true)
837
836
  end
838
837
 
839
838
  it "includes risk data when skip_advanced_fraud_checking is false" do
@@ -900,11 +899,11 @@ describe Braintree::CreditCard do
900
899
  :region => "IL"
901
900
  },
902
901
  )
903
- update_result.success?.should == true
902
+ expect(update_result.success?).to eq(true)
904
903
  updated_credit_card = update_result.credit_card
905
- updated_credit_card.billing_address.region.should == "IL"
906
- updated_credit_card.billing_address.street_address.should == nil
907
- updated_credit_card.billing_address.id.should_not == credit_card.billing_address.id
904
+ expect(updated_credit_card.billing_address.region).to eq("IL")
905
+ expect(updated_credit_card.billing_address.street_address).to eq(nil)
906
+ expect(updated_credit_card.billing_address.id).not_to eq(credit_card.billing_address.id)
908
907
  end
909
908
 
910
909
  it "updates the billing address if option is specified" do
@@ -923,11 +922,11 @@ describe Braintree::CreditCard do
923
922
  :options => {:update_existing => true}
924
923
  },
925
924
  )
926
- update_result.success?.should == true
925
+ expect(update_result.success?).to eq(true)
927
926
  updated_credit_card = update_result.credit_card
928
- updated_credit_card.billing_address.region.should == "IL"
929
- updated_credit_card.billing_address.street_address.should == "123 Nigeria Ave"
930
- updated_credit_card.billing_address.id.should == credit_card.billing_address.id
927
+ expect(updated_credit_card.billing_address.region).to eq("IL")
928
+ expect(updated_credit_card.billing_address.street_address).to eq("123 Nigeria Ave")
929
+ expect(updated_credit_card.billing_address.id).to eq(credit_card.billing_address.id)
931
930
  end
932
931
 
933
932
  it "updates the country via codes" do
@@ -949,12 +948,12 @@ describe Braintree::CreditCard do
949
948
  :options => {:update_existing => true}
950
949
  },
951
950
  )
952
- update_result.success?.should == true
951
+ expect(update_result.success?).to eq(true)
953
952
  updated_credit_card = update_result.credit_card
954
- updated_credit_card.billing_address.country_name.should == "American Samoa"
955
- updated_credit_card.billing_address.country_code_alpha2.should == "AS"
956
- updated_credit_card.billing_address.country_code_alpha3.should == "ASM"
957
- updated_credit_card.billing_address.country_code_numeric.should == "016"
953
+ expect(updated_credit_card.billing_address.country_name).to eq("American Samoa")
954
+ expect(updated_credit_card.billing_address.country_code_alpha2).to eq("AS")
955
+ expect(updated_credit_card.billing_address.country_code_alpha3).to eq("ASM")
956
+ expect(updated_credit_card.billing_address.country_code_numeric).to eq("016")
958
957
  end
959
958
  end
960
959
 
@@ -970,11 +969,11 @@ describe Braintree::CreditCard do
970
969
  :expiration_month => "07",
971
970
  :expiration_year => "2011",
972
971
  )
973
- update_result.success?.should == true
974
- update_result.credit_card.should == credit_card
975
- update_result.credit_card.expiration_month.should == "07"
976
- update_result.credit_card.expiration_year.should == "2011"
977
- update_result.credit_card.expiration_date.should == "07/2011"
972
+ expect(update_result.success?).to eq(true)
973
+ expect(update_result.credit_card).to eq(credit_card)
974
+ expect(update_result.credit_card.expiration_month).to eq("07")
975
+ expect(update_result.credit_card.expiration_year).to eq("2011")
976
+ expect(update_result.credit_card.expiration_date).to eq("07/2011")
978
977
  end
979
978
 
980
979
  it "verifies the update if options[verify_card]=true" do
@@ -993,9 +992,9 @@ describe Braintree::CreditCard do
993
992
  :expiration_date => "06/2013",
994
993
  :options => {:verify_card => true},
995
994
  )
996
- update_result.success?.should == false
997
- update_result.credit_card_verification.status.should == Braintree::CreditCardVerification::Status::ProcessorDeclined
998
- update_result.credit_card_verification.gateway_rejection_reason.should be_nil
995
+ expect(update_result.success?).to eq(false)
996
+ expect(update_result.credit_card_verification.status).to eq(Braintree::CreditCardVerification::Status::ProcessorDeclined)
997
+ expect(update_result.credit_card_verification.gateway_rejection_reason).to be_nil
999
998
  end
1000
999
 
1001
1000
  it "can update the billing address" do
@@ -1032,17 +1031,17 @@ describe Braintree::CreditCard do
1032
1031
  :country_name => "United States of America"
1033
1032
  },
1034
1033
  )
1035
- result.success?.should == true
1034
+ expect(result.success?).to eq(true)
1036
1035
  address = result.credit_card.billing_address
1037
- address.first_name.should == "New First Name"
1038
- address.last_name.should == "New Last Name"
1039
- address.company.should == "New Company"
1040
- address.street_address.should == "123 New St"
1041
- address.extended_address.should == "Apt New"
1042
- address.locality.should == "New City"
1043
- address.region.should == "New State"
1044
- address.postal_code.should == "56789"
1045
- address.country_name.should == "United States of America"
1036
+ expect(address.first_name).to eq("New First Name")
1037
+ expect(address.last_name).to eq("New Last Name")
1038
+ expect(address.company).to eq("New Company")
1039
+ expect(address.street_address).to eq("123 New St")
1040
+ expect(address.extended_address).to eq("Apt New")
1041
+ expect(address.locality).to eq("New City")
1042
+ expect(address.region).to eq("New State")
1043
+ expect(address.postal_code).to eq("56789")
1044
+ expect(address.country_name).to eq("United States of America")
1046
1045
  end
1047
1046
 
1048
1047
  it "returns an error response if invalid" do
@@ -1058,8 +1057,8 @@ describe Braintree::CreditCard do
1058
1057
  :number => "invalid",
1059
1058
  :expiration_date => "05/2014",
1060
1059
  )
1061
- update_result.success?.should == false
1062
- update_result.errors.for(:credit_card).on(:number)[0].message.should == "Credit card number must be 12-19 digits."
1060
+ expect(update_result.success?).to eq(false)
1061
+ expect(update_result.errors.for(:credit_card).on(:number)[0].message).to eq("Credit card number must be 12-19 digits.")
1063
1062
  end
1064
1063
 
1065
1064
  it "can update the default" do
@@ -1075,13 +1074,13 @@ describe Braintree::CreditCard do
1075
1074
  :expiration_date => "05/2009",
1076
1075
  ).credit_card
1077
1076
 
1078
- card1.should be_default
1079
- card2.should_not be_default
1077
+ expect(card1).to be_default
1078
+ expect(card2).not_to be_default
1080
1079
 
1081
1080
  Braintree::CreditCard.update(card2.token, :options => {:make_default => true})
1082
1081
 
1083
- Braintree::CreditCard.find(card1.token).should_not be_default
1084
- Braintree::CreditCard.find(card2.token).should be_default
1082
+ expect(Braintree::CreditCard.find(card1.token)).not_to be_default
1083
+ expect(Braintree::CreditCard.find(card2.token)).to be_default
1085
1084
  end
1086
1085
 
1087
1086
  context "verification_account_type" do
@@ -1137,12 +1136,12 @@ describe Braintree::CreditCard do
1137
1136
  :number => Braintree::Test::CreditCardNumbers::MasterCard,
1138
1137
  :expiration_date => "06/2013",
1139
1138
  )
1140
- updated_credit_card.token.should == credit_card.token
1141
- updated_credit_card.bin.should == Braintree::Test::CreditCardNumbers::MasterCard[0, 6]
1142
- updated_credit_card.last_4.should == Braintree::Test::CreditCardNumbers::MasterCard[-4..-1]
1143
- updated_credit_card.expiration_date.should == "06/2013"
1144
- updated_credit_card.cardholder_name.should == "New Holder"
1145
- updated_credit_card.updated_at.between?(Time.now - 60, Time.now).should == true
1139
+ expect(updated_credit_card.token).to eq(credit_card.token)
1140
+ expect(updated_credit_card.bin).to eq(Braintree::Test::CreditCardNumbers::MasterCard[0, 6])
1141
+ expect(updated_credit_card.last_4).to eq(Braintree::Test::CreditCardNumbers::MasterCard[-4..-1])
1142
+ expect(updated_credit_card.expiration_date).to eq("06/2013")
1143
+ expect(updated_credit_card.cardholder_name).to eq("New Holder")
1144
+ expect(updated_credit_card.updated_at.between?(Time.now - 60, Time.now)).to eq(true)
1146
1145
  end
1147
1146
 
1148
1147
  it "raises a ValidationsFailed if invalid" do
@@ -1172,9 +1171,9 @@ describe Braintree::CreditCard do
1172
1171
  :expiration_date => "05/2012",
1173
1172
  )
1174
1173
 
1175
- result.success?.should == true
1174
+ expect(result.success?).to eq(true)
1176
1175
  credit_card = result.credit_card
1177
- Braintree::CreditCard.delete(credit_card.token).should == true
1176
+ expect(Braintree::CreditCard.delete(credit_card.token)).to eq(true)
1178
1177
  expect do
1179
1178
  Braintree::CreditCard.find(credit_card.token)
1180
1179
  end.to raise_error(Braintree::NotFoundError)
@@ -1194,13 +1193,13 @@ describe Braintree::CreditCard do
1194
1193
  end
1195
1194
 
1196
1195
  collection = Braintree::CreditCard.expired
1197
- collection.maximum_size.should > 100
1196
+ expect(collection.maximum_size).to be > 100
1198
1197
 
1199
1198
  credit_card_ids = collection.map do |c|
1200
- c.expired?.should == true
1199
+ expect(c.expired?).to eq(true)
1201
1200
  c.token
1202
1201
  end.uniq.compact
1203
- credit_card_ids.size.should == collection.maximum_size
1202
+ expect(credit_card_ids.size).to eq(collection.maximum_size)
1204
1203
  end
1205
1204
  end
1206
1205
 
@@ -1208,9 +1207,9 @@ describe Braintree::CreditCard do
1208
1207
  it "finds payment methods expiring between the given dates" do
1209
1208
  next_year = Time.now.year + 1
1210
1209
  collection = Braintree::CreditCard.expiring_between(Time.mktime(next_year, 1), Time.mktime(next_year, 12))
1211
- collection.maximum_size.should > 0
1212
- collection.all? { |pm| pm.expired?.should == false }
1213
- collection.all? { |pm| pm.expiration_year.should == next_year.to_s }
1210
+ expect(collection.maximum_size).to be > 0
1211
+ collection.all? { |pm| expect(pm.expired?).to eq(false) }
1212
+ collection.all? { |pm| expect(pm.expiration_year).to eq(next_year.to_s) }
1214
1213
  end
1215
1214
 
1216
1215
  it "can iterate over all items" do
@@ -1225,10 +1224,10 @@ describe Braintree::CreditCard do
1225
1224
  end
1226
1225
 
1227
1226
  collection = Braintree::CreditCard.expiring_between(Time.mktime(2010, 1, 1), Time.mktime(2010,3, 1))
1228
- collection.maximum_size.should > 100
1227
+ expect(collection.maximum_size).to be > 100
1229
1228
 
1230
1229
  credit_card_ids = collection.map { |c| c.token }.uniq.compact
1231
- credit_card_ids.size.should == collection.maximum_size
1230
+ expect(credit_card_ids.size).to eq(collection.maximum_size)
1232
1231
  end
1233
1232
  end
1234
1233
 
@@ -1240,12 +1239,12 @@ describe Braintree::CreditCard do
1240
1239
  :number => Braintree::Test::CreditCardNumbers::Visa,
1241
1240
  :expiration_date => "05/2012",
1242
1241
  )
1243
- result.success?.should == true
1242
+ expect(result.success?).to eq(true)
1244
1243
  credit_card = Braintree::CreditCard.find(result.credit_card.token)
1245
- credit_card.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
1246
- credit_card.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
1247
- credit_card.token.should == result.credit_card.token
1248
- credit_card.expiration_date.should == "05/2012"
1244
+ expect(credit_card.bin).to eq(Braintree::Test::CreditCardNumbers::Visa[0, 6])
1245
+ expect(credit_card.last_4).to eq(Braintree::Test::CreditCardNumbers::Visa[-4..-1])
1246
+ expect(credit_card.token).to eq(result.credit_card.token)
1247
+ expect(credit_card.expiration_date).to eq("05/2012")
1249
1248
  end
1250
1249
 
1251
1250
  it "returns associated subscriptions with the credit card" do
@@ -1263,10 +1262,10 @@ describe Braintree::CreditCard do
1263
1262
  ).subscription
1264
1263
 
1265
1264
  found_card = Braintree::CreditCard.find(credit_card.token)
1266
- found_card.subscriptions.first.id.should == subscription.id
1267
- found_card.subscriptions.first.plan_id.should == "integration_trialless_plan"
1268
- found_card.subscriptions.first.payment_method_token.should == credit_card.token
1269
- found_card.subscriptions.first.price.should == BigDecimal("1.00")
1265
+ expect(found_card.subscriptions.first.id).to eq(subscription.id)
1266
+ expect(found_card.subscriptions.first.plan_id).to eq("integration_trialless_plan")
1267
+ expect(found_card.subscriptions.first.payment_method_token).to eq(credit_card.token)
1268
+ expect(found_card.subscriptions.first.price).to eq(BigDecimal("1.00"))
1270
1269
  end
1271
1270
 
1272
1271
  it "raises a NotFoundError exception if payment method cannot be found" do
@@ -1308,7 +1307,7 @@ describe Braintree::CreditCard do
1308
1307
 
1309
1308
  credit_card = Braintree::CreditCard.from_nonce(nonce)
1310
1309
  customer = Braintree::Customer.find(customer.id)
1311
- credit_card.should == customer.credit_cards.first
1310
+ expect(credit_card).to eq(customer.credit_cards.first)
1312
1311
  end
1313
1312
 
1314
1313
  it "does not find a payment method for an unlocked nonce that points to a shared credit card" do
@@ -1352,14 +1351,14 @@ describe Braintree::CreditCard do
1352
1351
  )
1353
1352
  result = Braintree::CreditCard.sale(customer.credit_cards[0].token, :amount => "100.00")
1354
1353
 
1355
- result.success?.should == true
1356
- result.transaction.amount.should == BigDecimal("100.00")
1357
- result.transaction.type.should == "sale"
1358
- result.transaction.customer_details.id.should == customer.id
1359
- result.transaction.credit_card_details.token.should == customer.credit_cards[0].token
1360
- result.transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
1361
- result.transaction.credit_card_details.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
1362
- result.transaction.credit_card_details.expiration_date.should == "05/2010"
1354
+ expect(result.success?).to eq(true)
1355
+ expect(result.transaction.amount).to eq(BigDecimal("100.00"))
1356
+ expect(result.transaction.type).to eq("sale")
1357
+ expect(result.transaction.customer_details.id).to eq(customer.id)
1358
+ expect(result.transaction.credit_card_details.token).to eq(customer.credit_cards[0].token)
1359
+ expect(result.transaction.credit_card_details.bin).to eq(Braintree::Test::CreditCardNumbers::Visa[0, 6])
1360
+ expect(result.transaction.credit_card_details.last_4).to eq(Braintree::Test::CreditCardNumbers::Visa[-4..-1])
1361
+ expect(result.transaction.credit_card_details.expiration_date).to eq("05/2010")
1363
1362
  end
1364
1363
 
1365
1364
  it "allows passing a cvv in addition to the token" do
@@ -1376,12 +1375,12 @@ describe Braintree::CreditCard do
1376
1375
  },
1377
1376
  )
1378
1377
 
1379
- result.success?.should == true
1380
- result.transaction.amount.should == BigDecimal("100.00")
1381
- result.transaction.type.should == "sale"
1382
- result.transaction.customer_details.id.should == customer.id
1383
- result.transaction.credit_card_details.token.should == customer.credit_cards[0].token
1384
- result.transaction.cvv_response_code.should == "S"
1378
+ expect(result.success?).to eq(true)
1379
+ expect(result.transaction.amount).to eq(BigDecimal("100.00"))
1380
+ expect(result.transaction.type).to eq("sale")
1381
+ expect(result.transaction.customer_details.id).to eq(customer.id)
1382
+ expect(result.transaction.credit_card_details.token).to eq(customer.credit_cards[0].token)
1383
+ expect(result.transaction.cvv_response_code).to eq("S")
1385
1384
  end
1386
1385
  end
1387
1386
 
@@ -1394,13 +1393,13 @@ describe Braintree::CreditCard do
1394
1393
  },
1395
1394
  )
1396
1395
  transaction = Braintree::CreditCard.sale!(customer.credit_cards[0].token, :amount => "100.00")
1397
- transaction.amount.should == BigDecimal("100.00")
1398
- transaction.type.should == "sale"
1399
- transaction.customer_details.id.should == customer.id
1400
- transaction.credit_card_details.token.should == customer.credit_cards[0].token
1401
- transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
1402
- transaction.credit_card_details.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
1403
- transaction.credit_card_details.expiration_date.should == "05/2010"
1396
+ expect(transaction.amount).to eq(BigDecimal("100.00"))
1397
+ expect(transaction.type).to eq("sale")
1398
+ expect(transaction.customer_details.id).to eq(customer.id)
1399
+ expect(transaction.credit_card_details.token).to eq(customer.credit_cards[0].token)
1400
+ expect(transaction.credit_card_details.bin).to eq(Braintree::Test::CreditCardNumbers::Visa[0, 6])
1401
+ expect(transaction.credit_card_details.last_4).to eq(Braintree::Test::CreditCardNumbers::Visa[-4..-1])
1402
+ expect(transaction.credit_card_details.expiration_date).to eq("05/2010")
1404
1403
  end
1405
1404
  end
1406
1405
 
@@ -1414,14 +1413,14 @@ describe Braintree::CreditCard do
1414
1413
  :expiration_date => "05/2012",
1415
1414
  )
1416
1415
 
1417
- credit_card.nonce.should_not be_nil
1416
+ expect(credit_card.nonce).not_to be_nil
1418
1417
  end
1419
1418
  end
1420
1419
 
1421
1420
  describe "card on file network tokenization" do
1422
1421
  it "should find a network tokenized credit card" do
1423
1422
  credit_card = Braintree::CreditCard.find("network_tokenized_credit_card")
1424
- credit_card.is_network_tokenized?.should == true
1423
+ expect(credit_card.is_network_tokenized?).to eq(true)
1425
1424
  end
1426
1425
 
1427
1426
  it "should find a non-network tokenized credit card" do
@@ -1432,7 +1431,7 @@ describe Braintree::CreditCard do
1432
1431
  :expiration_date => "05/2009",
1433
1432
  ).credit_card
1434
1433
  credit_card_vaulted = Braintree::CreditCard.find(credit_card.token)
1435
- credit_card_vaulted.is_network_tokenized?.should == false
1434
+ expect(credit_card_vaulted.is_network_tokenized?).to eq(false)
1436
1435
  end
1437
1436
  end
1438
1437
  end