braintree 4.14.0 → 4.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/credit_card.rb +13 -0
  3. data/lib/braintree/credit_card_gateway.rb +15 -3
  4. data/lib/braintree/payment_method_gateway.rb +15 -3
  5. data/lib/braintree/test/nonce.rb +1 -0
  6. data/lib/braintree/test/venmo_sdk.rb +2 -0
  7. data/lib/braintree/transaction/credit_card_details.rb +3 -0
  8. data/lib/braintree/transaction/local_payment_details.rb +2 -0
  9. data/lib/braintree/transaction.rb +5 -4
  10. data/lib/braintree/transaction_gateway.rb +15 -3
  11. data/lib/braintree/transaction_search.rb +6 -5
  12. data/lib/braintree/version.rb +1 -1
  13. data/lib/braintree/webhook_notification.rb +1 -0
  14. data/lib/braintree/webhook_testing_gateway.rb +17 -0
  15. data/spec/integration/braintree/add_on_spec.rb +9 -9
  16. data/spec/integration/braintree/address_spec.rb +69 -69
  17. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  18. data/spec/integration/braintree/apple_pay_spec.rb +8 -8
  19. data/spec/integration/braintree/client_api/client_token_spec.rb +15 -15
  20. data/spec/integration/braintree/credit_card_spec.rb +223 -223
  21. data/spec/integration/braintree/credit_card_verification_search_spec.rb +16 -16
  22. data/spec/integration/braintree/credit_card_verification_spec.rb +52 -52
  23. data/spec/integration/braintree/customer_search_spec.rb +20 -20
  24. data/spec/integration/braintree/customer_spec.rb +313 -313
  25. data/spec/integration/braintree/disbursement_spec.rb +2 -2
  26. data/spec/integration/braintree/discount_spec.rb +9 -9
  27. data/spec/integration/braintree/dispute_spec.rb +87 -87
  28. data/spec/integration/braintree/document_upload_spec.rb +17 -17
  29. data/spec/integration/braintree/error_codes_spec.rb +2 -2
  30. data/spec/integration/braintree/http_spec.rb +28 -28
  31. data/spec/integration/braintree/merchant_account_spec.rb +127 -127
  32. data/spec/integration/braintree/merchant_spec.rb +103 -103
  33. data/spec/integration/braintree/oauth_spec.rb +61 -61
  34. data/spec/integration/braintree/payment_method_nonce_spec.rb +73 -73
  35. data/spec/integration/braintree/payment_method_spec.rb +389 -389
  36. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +78 -78
  37. data/spec/integration/braintree/paypal_account_spec.rb +38 -38
  38. data/spec/integration/braintree/plan_spec.rb +15 -15
  39. data/spec/integration/braintree/samsung_pay_card_spec.rb +65 -65
  40. data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +51 -51
  41. data/spec/integration/braintree/settlement_batch_summary_spec.rb +11 -11
  42. data/spec/integration/braintree/subscription_spec.rb +364 -364
  43. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  44. data/spec/integration/braintree/test_transaction_spec.rb +19 -19
  45. data/spec/integration/braintree/transaction_line_item_spec.rb +6 -6
  46. data/spec/integration/braintree/transaction_search_spec.rb +198 -165
  47. data/spec/integration/braintree/transaction_spec.rb +1315 -1149
  48. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -32
  49. data/spec/integration/braintree/us_bank_account_spec.rb +30 -30
  50. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +18 -18
  51. data/spec/integration/braintree/us_bank_account_verification_spec.rb +33 -33
  52. data/spec/integration/braintree/visa_checkout_card_spec.rb +57 -57
  53. data/spec/spec_helper.rb +9 -8
  54. data/spec/unit/braintree/address_spec.rb +8 -8
  55. data/spec/unit/braintree/base_module_spec.rb +4 -4
  56. data/spec/unit/braintree/client_token_spec.rb +2 -2
  57. data/spec/unit/braintree/configuration_spec.rb +57 -57
  58. data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
  59. data/spec/unit/braintree/credit_card_spec.rb +31 -29
  60. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +28 -28
  61. data/spec/unit/braintree/credit_card_verification_search_spec.rb +9 -9
  62. data/spec/unit/braintree/credit_card_verification_spec.rb +17 -17
  63. data/spec/unit/braintree/customer_spec.rb +41 -40
  64. data/spec/unit/braintree/digest_spec.rb +5 -5
  65. data/spec/unit/braintree/disbursement_spec.rb +11 -11
  66. data/spec/unit/braintree/dispute_search_spec.rb +2 -2
  67. data/spec/unit/braintree/dispute_spec.rb +56 -56
  68. data/spec/unit/braintree/document_upload_spec.rb +8 -8
  69. data/spec/unit/braintree/enriched_customer_data_spec.rb +2 -2
  70. data/spec/unit/braintree/error_result_spec.rb +5 -5
  71. data/spec/unit/braintree/errors_spec.rb +9 -9
  72. data/spec/unit/braintree/http_spec.rb +8 -8
  73. data/spec/unit/braintree/local_payment_completed_spec.rb +11 -11
  74. data/spec/unit/braintree/local_payment_expired_spec.rb +2 -2
  75. data/spec/unit/braintree/local_payment_funded_spec.rb +6 -6
  76. data/spec/unit/braintree/merchant_account_spec.rb +4 -4
  77. data/spec/unit/braintree/modification_spec.rb +1 -1
  78. data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +6 -6
  79. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +7 -7
  80. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +14 -14
  81. data/spec/unit/braintree/payment_method_spec.rb +19 -19
  82. data/spec/unit/braintree/paypal_account_spec.rb +4 -4
  83. data/spec/unit/braintree/resource_collection_spec.rb +7 -7
  84. data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +1 -1
  85. data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
  86. data/spec/unit/braintree/signature_service_spec.rb +2 -2
  87. data/spec/unit/braintree/subscription_search_spec.rb +17 -17
  88. data/spec/unit/braintree/subscription_spec.rb +8 -8
  89. data/spec/unit/braintree/successful_result_spec.rb +5 -5
  90. data/spec/unit/braintree/three_d_secure_info_spec.rb +20 -20
  91. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +5 -5
  92. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  93. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  94. data/spec/unit/braintree/transaction/local_payment_details_spec.rb +30 -0
  95. data/spec/unit/braintree/transaction_gateway_spec.rb +9 -6
  96. data/spec/unit/braintree/transaction_search_spec.rb +2 -2
  97. data/spec/unit/braintree/transaction_spec.rb +101 -93
  98. data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
  99. data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
  100. data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
  101. data/spec/unit/braintree/us_bank_account_verification_spec.rb +7 -7
  102. data/spec/unit/braintree/util_spec.rb +27 -27
  103. data/spec/unit/braintree/validation_error_collection_spec.rb +34 -34
  104. data/spec/unit/braintree/validation_error_spec.rb +4 -4
  105. data/spec/unit/braintree/venmo_profile_data_spec.rb +5 -5
  106. data/spec/unit/braintree/webhook_notification_spec.rb +206 -191
  107. data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
  108. data/spec/unit/braintree/xml/parser_spec.rb +8 -8
  109. data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
  110. data/spec/unit/braintree/xml_spec.rb +17 -17
  111. data/spec/unit/braintree_spec.rb +2 -2
  112. metadata +3 -2
@@ -23,22 +23,22 @@ describe Braintree::PaymentMethod do
23
23
  },
24
24
  )
25
25
 
26
- result.should be_success
26
+ expect(result).to be_success
27
27
  us_bank_account = result.payment_method
28
- us_bank_account.should be_a(Braintree::UsBankAccount)
29
- us_bank_account.routing_number.should == "021000021"
30
- us_bank_account.last_4.should == "0000"
31
- us_bank_account.account_type.should == "checking"
32
- us_bank_account.account_holder_name.should == "John Doe"
33
- us_bank_account.bank_name.should =~ /CHASE/
34
- us_bank_account.default.should == true
35
- us_bank_account.ach_mandate.text.should == "cl mandate text"
36
- us_bank_account.ach_mandate.accepted_at.should be_a Time
37
-
38
- us_bank_account.verifications.count.should == 0
39
- us_bank_account.verified.should == false
40
-
41
- Braintree::PaymentMethod.find(us_bank_account.token).should be_a(Braintree::UsBankAccount)
28
+ expect(us_bank_account).to be_a(Braintree::UsBankAccount)
29
+ expect(us_bank_account.routing_number).to eq("021000021")
30
+ expect(us_bank_account.last_4).to eq("0000")
31
+ expect(us_bank_account.account_type).to eq("checking")
32
+ expect(us_bank_account.account_holder_name).to eq("John Doe")
33
+ expect(us_bank_account.bank_name).to match(/CHASE/)
34
+ expect(us_bank_account.default).to eq(true)
35
+ expect(us_bank_account.ach_mandate.text).to eq("cl mandate text")
36
+ expect(us_bank_account.ach_mandate.accepted_at).to be_a Time
37
+
38
+ expect(us_bank_account.verifications.count).to eq(0)
39
+ expect(us_bank_account.verified).to eq(false)
40
+
41
+ expect(Braintree::PaymentMethod.find(us_bank_account.token)).to be_a(Braintree::UsBankAccount)
42
42
  end
43
43
 
44
44
  [
@@ -56,26 +56,26 @@ describe Braintree::PaymentMethod do
56
56
  },
57
57
  )
58
58
 
59
- result.should be_success
59
+ expect(result).to be_success
60
60
  us_bank_account = result.payment_method
61
- us_bank_account.should be_a(Braintree::UsBankAccount)
62
- us_bank_account.routing_number.should == "021000021"
63
- us_bank_account.last_4.should == "0000"
64
- us_bank_account.account_type.should == "checking"
65
- us_bank_account.account_holder_name.should == "John Doe"
66
- us_bank_account.bank_name.should =~ /CHASE/
67
- us_bank_account.default.should == true
68
- us_bank_account.ach_mandate.text.should == "cl mandate text"
69
- us_bank_account.ach_mandate.accepted_at.should be_a Time
70
-
71
- us_bank_account.verifications.count.should == 1
72
- us_bank_account.verifications.first.status.should == Braintree::UsBankAccountVerification::Status::Verified
73
- us_bank_account.verifications.first.verification_method.should == method
74
- us_bank_account.verifications.first.id.should_not be_empty
75
- us_bank_account.verifications.first.verification_determined_at.should be_a Time
76
- us_bank_account.verified.should == true
77
-
78
- Braintree::PaymentMethod.find(us_bank_account.token).should be_a(Braintree::UsBankAccount)
61
+ expect(us_bank_account).to be_a(Braintree::UsBankAccount)
62
+ expect(us_bank_account.routing_number).to eq("021000021")
63
+ expect(us_bank_account.last_4).to eq("0000")
64
+ expect(us_bank_account.account_type).to eq("checking")
65
+ expect(us_bank_account.account_holder_name).to eq("John Doe")
66
+ expect(us_bank_account.bank_name).to match(/CHASE/)
67
+ expect(us_bank_account.default).to eq(true)
68
+ expect(us_bank_account.ach_mandate.text).to eq("cl mandate text")
69
+ expect(us_bank_account.ach_mandate.accepted_at).to be_a Time
70
+
71
+ expect(us_bank_account.verifications.count).to eq(1)
72
+ expect(us_bank_account.verifications.first.status).to eq(Braintree::UsBankAccountVerification::Status::Verified)
73
+ expect(us_bank_account.verifications.first.verification_method).to eq(method)
74
+ expect(us_bank_account.verifications.first.id).not_to be_empty
75
+ expect(us_bank_account.verifications.first.verification_determined_at).to be_a Time
76
+ expect(us_bank_account.verified).to eq(true)
77
+
78
+ expect(Braintree::PaymentMethod.find(us_bank_account.token)).to be_a(Braintree::UsBankAccount)
79
79
  end
80
80
  end
81
81
  end
@@ -87,8 +87,8 @@ describe Braintree::PaymentMethod do
87
87
  :customer_id => customer.id,
88
88
  )
89
89
 
90
- result.should_not be_success
91
- result.errors.for(:payment_method).on(:payment_method_nonce)[0].code.should == Braintree::ErrorCodes::PaymentMethod::PaymentMethodNonceUnknown
90
+ expect(result).not_to be_success
91
+ expect(result.errors.for(:payment_method).on(:payment_method_nonce)[0].code).to eq(Braintree::ErrorCodes::PaymentMethod::PaymentMethodNonceUnknown)
92
92
  end
93
93
  end
94
94
 
@@ -100,8 +100,8 @@ describe Braintree::PaymentMethod do
100
100
  :customer_id => customer.id,
101
101
  )
102
102
 
103
- result.should_not be_success
104
- result.errors.for(:payment_method).on(:payment_method_nonce)[0].code.should == Braintree::ErrorCodes::PaymentMethod::PaymentMethodNonceUnknown
103
+ expect(result).not_to be_success
104
+ expect(result.errors.for(:payment_method).on(:payment_method_nonce)[0].code).to eq(Braintree::ErrorCodes::PaymentMethod::PaymentMethodNonceUnknown)
105
105
  end
106
106
  end
107
107
  end
@@ -139,27 +139,27 @@ describe Braintree::PaymentMethod do
139
139
  },
140
140
  )
141
141
 
142
- result.should be_success
142
+ expect(result).to be_success
143
143
 
144
144
  us_bank_account = result.payment_method
145
- us_bank_account.should be_a(Braintree::UsBankAccount)
146
- us_bank_account.routing_number.should == "021000021"
147
- us_bank_account.last_4.should == "0000"
148
- us_bank_account.account_type.should == "checking"
149
- us_bank_account.account_holder_name.should == "John Doe"
150
- us_bank_account.bank_name.should =~ /CHASE/
151
- us_bank_account.default.should == true
152
- us_bank_account.ach_mandate.text.should == "cl mandate text"
153
- us_bank_account.ach_mandate.accepted_at.should be_a Time
154
-
155
- us_bank_account.verifications.count.should == 1
156
- us_bank_account.verifications.first.status.should == Braintree::UsBankAccountVerification::Status::Verified
157
- us_bank_account.verifications.first.verification_method.should == method
158
- us_bank_account.verifications.first.id.should_not be_empty
159
- us_bank_account.verifications.first.verification_determined_at.should be_a Time
160
- us_bank_account.verified.should == true
161
-
162
- Braintree::PaymentMethod.find(us_bank_account.token).should be_a(Braintree::UsBankAccount)
145
+ expect(us_bank_account).to be_a(Braintree::UsBankAccount)
146
+ expect(us_bank_account.routing_number).to eq("021000021")
147
+ expect(us_bank_account.last_4).to eq("0000")
148
+ expect(us_bank_account.account_type).to eq("checking")
149
+ expect(us_bank_account.account_holder_name).to eq("John Doe")
150
+ expect(us_bank_account.bank_name).to match(/CHASE/)
151
+ expect(us_bank_account.default).to eq(true)
152
+ expect(us_bank_account.ach_mandate.text).to eq("cl mandate text")
153
+ expect(us_bank_account.ach_mandate.accepted_at).to be_a Time
154
+
155
+ expect(us_bank_account.verifications.count).to eq(1)
156
+ expect(us_bank_account.verifications.first.status).to eq(Braintree::UsBankAccountVerification::Status::Verified)
157
+ expect(us_bank_account.verifications.first.verification_method).to eq(method)
158
+ expect(us_bank_account.verifications.first.id).not_to be_empty
159
+ expect(us_bank_account.verifications.first.verification_determined_at).to be_a Time
160
+ expect(us_bank_account.verified).to eq(true)
161
+
162
+ expect(Braintree::PaymentMethod.find(us_bank_account.token)).to be_a(Braintree::UsBankAccount)
163
163
  end
164
164
  end
165
165
 
@@ -172,8 +172,8 @@ describe Braintree::PaymentMethod do
172
172
  },
173
173
  )
174
174
 
175
- result.should_not be_success
176
- result.errors.for(:options).first.code.should == Braintree::ErrorCodes::PaymentMethod::Options::UsBankAccountVerificationMethodIsInvalid
175
+ expect(result).not_to be_success
176
+ expect(result.errors.for(:options).first.code).to eq(Braintree::ErrorCodes::PaymentMethod::Options::UsBankAccountVerificationMethodIsInvalid)
177
177
  end
178
178
  end
179
179
  end
@@ -210,29 +210,29 @@ describe Braintree::PaymentMethod do
210
210
  },
211
211
  )
212
212
 
213
- result.should be_success
213
+ expect(result).to be_success
214
214
 
215
215
  us_bank_account = result.payment_method
216
- us_bank_account.should be_a(Braintree::UsBankAccount)
217
- us_bank_account.routing_number.should == "021000021"
218
- us_bank_account.last_4.should == "0000"
219
- us_bank_account.account_type.should == "checking"
220
- us_bank_account.account_holder_name.should == "John Doe"
221
- us_bank_account.bank_name.should =~ /CHASE/
222
- us_bank_account.default.should == true
223
- us_bank_account.ach_mandate.text.should == "cl mandate text"
224
- us_bank_account.ach_mandate.accepted_at.should be_a Time
225
-
226
- us_bank_account.verifications.count.should == 2
216
+ expect(us_bank_account).to be_a(Braintree::UsBankAccount)
217
+ expect(us_bank_account.routing_number).to eq("021000021")
218
+ expect(us_bank_account.last_4).to eq("0000")
219
+ expect(us_bank_account.account_type).to eq("checking")
220
+ expect(us_bank_account.account_holder_name).to eq("John Doe")
221
+ expect(us_bank_account.bank_name).to match(/CHASE/)
222
+ expect(us_bank_account.default).to eq(true)
223
+ expect(us_bank_account.ach_mandate.text).to eq("cl mandate text")
224
+ expect(us_bank_account.ach_mandate.accepted_at).to be_a Time
225
+
226
+ expect(us_bank_account.verifications.count).to eq(2)
227
227
  verification = us_bank_account.verifications.find do |verification|
228
228
  verification.verification_method == method
229
229
  end
230
- verification.status.should == Braintree::UsBankAccountVerification::Status::Verified
231
- verification.id.should_not be_empty
232
- verification.verification_determined_at.should be_a Time
233
- us_bank_account.verified.should == true
230
+ expect(verification.status).to eq(Braintree::UsBankAccountVerification::Status::Verified)
231
+ expect(verification.id).not_to be_empty
232
+ expect(verification.verification_determined_at).to be_a Time
233
+ expect(us_bank_account.verified).to eq(true)
234
234
 
235
- Braintree::PaymentMethod.find(us_bank_account.token).should be_a(Braintree::UsBankAccount)
235
+ expect(Braintree::PaymentMethod.find(us_bank_account.token)).to be_a(Braintree::UsBankAccount)
236
236
  end
237
237
  end
238
238
 
@@ -244,8 +244,8 @@ describe Braintree::PaymentMethod do
244
244
  },
245
245
  )
246
246
 
247
- result.should_not be_success
248
- result.errors.for(:options).first.code.should == Braintree::ErrorCodes::PaymentMethod::Options::UsBankAccountVerificationMethodIsInvalid
247
+ expect(result).not_to be_success
248
+ expect(result.errors.for(:options).first.code).to eq(Braintree::ErrorCodes::PaymentMethod::Options::UsBankAccountVerificationMethodIsInvalid)
249
249
  end
250
250
  end
251
251
  end
@@ -15,17 +15,17 @@ describe Braintree::PayPalAccount do
15
15
  :payment_method_nonce => nonce,
16
16
  :customer_id => customer.id,
17
17
  )
18
- result.should be_success
18
+ expect(result).to be_success
19
19
 
20
20
  paypal_account = Braintree::PayPalAccount.find(payment_method_token)
21
- paypal_account.should be_a(Braintree::PayPalAccount)
22
- paypal_account.token.should == payment_method_token
23
- paypal_account.email.should == "jane.doe@example.com"
24
- paypal_account.image_url.should_not be_nil
25
- paypal_account.created_at.should_not be_nil
26
- paypal_account.updated_at.should_not be_nil
27
- paypal_account.customer_id.should == customer.id
28
- paypal_account.revoked_at.should be_nil
21
+ expect(paypal_account).to be_a(Braintree::PayPalAccount)
22
+ expect(paypal_account.token).to eq(payment_method_token)
23
+ expect(paypal_account.email).to eq("jane.doe@example.com")
24
+ expect(paypal_account.image_url).not_to be_nil
25
+ expect(paypal_account.created_at).not_to be_nil
26
+ expect(paypal_account.updated_at).not_to be_nil
27
+ expect(paypal_account.customer_id).to eq(customer.id)
28
+ expect(paypal_account.revoked_at).to be_nil
29
29
  end
30
30
 
31
31
  it "returns a PayPalAccount with a billing agreement id" do
@@ -37,10 +37,10 @@ describe Braintree::PayPalAccount do
37
37
  :customer_id => customer.id,
38
38
  :token => payment_method_token,
39
39
  )
40
- result.should be_success
40
+ expect(result).to be_success
41
41
 
42
42
  paypal_account = Braintree::PayPalAccount.find(payment_method_token)
43
- paypal_account.billing_agreement_id.should_not be_nil
43
+ expect(paypal_account.billing_agreement_id).not_to be_nil
44
44
  end
45
45
 
46
46
  it "raises if the payment method token is not found" do
@@ -76,7 +76,7 @@ describe Braintree::PayPalAccount do
76
76
  :payment_method_nonce => nonce,
77
77
  :customer_id => customer.id,
78
78
  )
79
- result.should be_success
79
+ expect(result).to be_success
80
80
 
81
81
  token = result.payment_method.token
82
82
 
@@ -91,7 +91,7 @@ describe Braintree::PayPalAccount do
91
91
  ).subscription
92
92
 
93
93
  paypal_account = Braintree::PayPalAccount.find(token)
94
- paypal_account.subscriptions.map(&:id).sort.should == [subscription1.id, subscription2.id].sort
94
+ expect(paypal_account.subscriptions.map(&:id).sort).to eq([subscription1.id, subscription2.id].sort)
95
95
  end
96
96
  end
97
97
 
@@ -108,9 +108,9 @@ describe Braintree::PayPalAccount do
108
108
  },
109
109
  )
110
110
 
111
- result.should be_success
112
- result.paypal_account.billing_agreement_id.should == "some_billing_agreement_id"
113
- result.paypal_account.email.should == "some@example.com"
111
+ expect(result).to be_success
112
+ expect(result.paypal_account.billing_agreement_id).to eq("some_billing_agreement_id")
113
+ expect(result.paypal_account.email).to eq("some@example.com")
114
114
  end
115
115
 
116
116
  it "throws an error if customer id is not specified" do
@@ -119,8 +119,8 @@ describe Braintree::PayPalAccount do
119
119
  :email => "some@example.com",
120
120
  )
121
121
 
122
- result.success?.should == false
123
- result.errors.first.code.should == "82905"
122
+ expect(result.success?).to eq(false)
123
+ expect(result.errors.first.code).to eq("82905")
124
124
  end
125
125
 
126
126
  it "throws an error if billing agreement id is not specified" do
@@ -130,8 +130,8 @@ describe Braintree::PayPalAccount do
130
130
  :email => "some@example.com",
131
131
  )
132
132
 
133
- result.success?.should == false
134
- result.errors.map(&:code).should include("82902")
133
+ expect(result.success?).to eq(false)
134
+ expect(result.errors.map(&:code)).to include("82902")
135
135
  end
136
136
  end
137
137
 
@@ -143,7 +143,7 @@ describe Braintree::PayPalAccount do
143
143
  :billing_agreement_id => "first_billing_agreement_id",
144
144
  :email => "first@example.com",
145
145
  )
146
- create_result.success?.should == true
146
+ expect(create_result.success?).to eq(true)
147
147
 
148
148
  update_result = Braintree::PayPalAccount.update(
149
149
  create_result.paypal_account.token,
@@ -151,11 +151,11 @@ describe Braintree::PayPalAccount do
151
151
  :email => "second@example.com",
152
152
  )
153
153
 
154
- update_result.success?.should == true
154
+ expect(update_result.success?).to eq(true)
155
155
  paypal_account = update_result.paypal_account
156
156
 
157
- paypal_account.billing_agreement_id.should == "second_billing_agreement_id"
158
- paypal_account.email.should == "second@example.com"
157
+ expect(paypal_account.billing_agreement_id).to eq("second_billing_agreement_id")
158
+ expect(paypal_account.email).to eq("second@example.com")
159
159
  end
160
160
 
161
161
  it "updates a paypal account's token" do
@@ -177,7 +177,7 @@ describe Braintree::PayPalAccount do
177
177
  )
178
178
 
179
179
  updated_paypal_account = Braintree::PayPalAccount.find(updated_token)
180
- updated_paypal_account.email.should == original_result.payment_method.email
180
+ expect(updated_paypal_account.email).to eq(original_result.payment_method.email)
181
181
 
182
182
  expect do
183
183
  Braintree::PayPalAccount.find(original_token)
@@ -192,7 +192,7 @@ describe Braintree::PayPalAccount do
192
192
  :expiration_date => "05/2009",
193
193
  :options => {:make_default => true},
194
194
  )
195
- result.should be_success
195
+ expect(result).to be_success
196
196
 
197
197
  nonce = nonce_for_paypal_account(:consent_code => "consent-code")
198
198
  original_token = Braintree::PaymentMethod.create(
@@ -206,7 +206,7 @@ describe Braintree::PayPalAccount do
206
206
  )
207
207
 
208
208
  updated_paypal_account = Braintree::PayPalAccount.find(original_token)
209
- updated_paypal_account.should be_default
209
+ expect(updated_paypal_account).to be_default
210
210
  end
211
211
 
212
212
  it "returns an error if a token for account is used to attempt an update" do
@@ -237,8 +237,8 @@ describe Braintree::PayPalAccount do
237
237
  :token => second_token,
238
238
  )
239
239
 
240
- updated_result.should_not be_success
241
- updated_result.errors.first.code.should == "92906"
240
+ expect(updated_result).not_to be_success
241
+ expect(updated_result.errors.first.code).to eq("92906")
242
242
  end
243
243
  end
244
244
 
@@ -272,11 +272,11 @@ describe Braintree::PayPalAccount do
272
272
 
273
273
  result = Braintree::PayPalAccount.sale(customer.paypal_accounts[0].token, :amount => "100.00")
274
274
 
275
- result.success?.should == true
276
- result.transaction.amount.should == BigDecimal("100.00")
277
- result.transaction.type.should == "sale"
278
- result.transaction.customer_details.id.should == customer.id
279
- result.transaction.paypal_details.token.should == customer.paypal_accounts[0].token
275
+ expect(result.success?).to eq(true)
276
+ expect(result.transaction.amount).to eq(BigDecimal("100.00"))
277
+ expect(result.transaction.type).to eq("sale")
278
+ expect(result.transaction.customer_details.id).to eq(customer.id)
279
+ expect(result.transaction.paypal_details.token).to eq(customer.paypal_accounts[0].token)
280
280
  end
281
281
  end
282
282
 
@@ -288,10 +288,10 @@ describe Braintree::PayPalAccount do
288
288
 
289
289
  transaction = Braintree::PayPalAccount.sale!(customer.paypal_accounts[0].token, :amount => "100.00")
290
290
 
291
- transaction.amount.should == BigDecimal("100.00")
292
- transaction.type.should == "sale"
293
- transaction.customer_details.id.should == customer.id
294
- transaction.paypal_details.token.should == customer.paypal_accounts[0].token
291
+ expect(transaction.amount).to eq(BigDecimal("100.00"))
292
+ expect(transaction.type).to eq("sale")
293
+ expect(transaction.customer_details.id).to eq(customer.id)
294
+ expect(transaction.paypal_details.token).to eq(customer.paypal_accounts[0].token)
295
295
  end
296
296
  end
297
297
  end
@@ -26,26 +26,26 @@ describe Braintree::Plan do
26
26
 
27
27
  plans = Braintree::Plan.all
28
28
  plan = plans.select { |plan| plan.id == plan_token }.first
29
- plan.should_not be_nil
30
- plan.id.should == attributes[:id]
31
- plan.billing_day_of_month.should == attributes[:billing_day_of_month]
32
- plan.billing_frequency.should == attributes[:billing_frequency]
33
- plan.currency_iso_code.should == attributes[:currency_iso_code]
34
- plan.description.should == attributes[:description]
35
- plan.name.should == attributes[:name]
36
- plan.number_of_billing_cycles.should == attributes[:number_of_billing_cycles]
37
- plan.price.should == Braintree::Util.to_big_decimal("1.00")
38
- plan.trial_period.should == attributes[:trial_period]
39
- plan.created_at.should_not be_nil
40
- plan.updated_at.should_not be_nil
41
- plan.add_ons.first.name.should == add_on_name
42
- plan.discounts.first.name.should == discount_name
29
+ expect(plan).not_to be_nil
30
+ expect(plan.id).to eq(attributes[:id])
31
+ expect(plan.billing_day_of_month).to eq(attributes[:billing_day_of_month])
32
+ expect(plan.billing_frequency).to eq(attributes[:billing_frequency])
33
+ expect(plan.currency_iso_code).to eq(attributes[:currency_iso_code])
34
+ expect(plan.description).to eq(attributes[:description])
35
+ expect(plan.name).to eq(attributes[:name])
36
+ expect(plan.number_of_billing_cycles).to eq(attributes[:number_of_billing_cycles])
37
+ expect(plan.price).to eq(Braintree::Util.to_big_decimal("1.00"))
38
+ expect(plan.trial_period).to eq(attributes[:trial_period])
39
+ expect(plan.created_at).not_to be_nil
40
+ expect(plan.updated_at).not_to be_nil
41
+ expect(plan.add_ons.first.name).to eq(add_on_name)
42
+ expect(plan.discounts.first.name).to eq(discount_name)
43
43
  end
44
44
 
45
45
  it "returns an empty array if there are no plans" do
46
46
  gateway = Braintree::Gateway.new(SpecHelper::TestMerchantConfig)
47
47
  plans = gateway.plan.all
48
- plans.should == []
48
+ expect(plans).to eq([])
49
49
  end
50
50
  end
51
51
 
@@ -21,42 +21,42 @@ describe Braintree::SamsungPayCard do
21
21
  :country_name => "United States of America"
22
22
  },
23
23
  )
24
- result.should be_success
24
+ expect(result).to be_success
25
25
 
26
26
  samsung_pay_card = result.payment_method
27
- samsung_pay_card.should be_a(Braintree::SamsungPayCard)
28
- samsung_pay_card.billing_address.should_not be_nil
29
- samsung_pay_card.bin.should_not be_nil
30
- samsung_pay_card.cardholder_name.should_not be_nil
31
- samsung_pay_card.card_type.should_not be_nil
32
- samsung_pay_card.commercial.should_not be_nil
33
- samsung_pay_card.country_of_issuance.should_not be_nil
34
- samsung_pay_card.created_at.should_not be_nil
35
- samsung_pay_card.customer_id.should_not be_nil
36
- samsung_pay_card.customer_location.should_not be_nil
37
- samsung_pay_card.debit.should_not be_nil
38
- samsung_pay_card.default?.should_not be_nil
39
- samsung_pay_card.durbin_regulated.should_not be_nil
40
- samsung_pay_card.expiration_date.should_not be_nil
41
- samsung_pay_card.expiration_month.should_not be_nil
42
- samsung_pay_card.expiration_year.should_not be_nil
43
- samsung_pay_card.expired?.should_not be_nil
44
- samsung_pay_card.healthcare.should_not be_nil
45
- samsung_pay_card.image_url.should_not be_nil
46
- samsung_pay_card.issuing_bank.should_not be_nil
47
- samsung_pay_card.last_4.should_not be_nil
48
- samsung_pay_card.payroll.should_not be_nil
49
- samsung_pay_card.prepaid.should_not be_nil
50
- samsung_pay_card.product_id.should_not be_nil
51
- samsung_pay_card.source_card_last_4.should_not be_nil
52
- samsung_pay_card.subscriptions.should_not be_nil
53
- samsung_pay_card.token.should_not be_nil
54
- samsung_pay_card.unique_number_identifier.should_not be_nil
55
- samsung_pay_card.updated_at.should_not be_nil
27
+ expect(samsung_pay_card).to be_a(Braintree::SamsungPayCard)
28
+ expect(samsung_pay_card.billing_address).not_to be_nil
29
+ expect(samsung_pay_card.bin).not_to be_nil
30
+ expect(samsung_pay_card.cardholder_name).not_to be_nil
31
+ expect(samsung_pay_card.card_type).not_to be_nil
32
+ expect(samsung_pay_card.commercial).not_to be_nil
33
+ expect(samsung_pay_card.country_of_issuance).not_to be_nil
34
+ expect(samsung_pay_card.created_at).not_to be_nil
35
+ expect(samsung_pay_card.customer_id).not_to be_nil
36
+ expect(samsung_pay_card.customer_location).not_to be_nil
37
+ expect(samsung_pay_card.debit).not_to be_nil
38
+ expect(samsung_pay_card.default?).not_to be_nil
39
+ expect(samsung_pay_card.durbin_regulated).not_to be_nil
40
+ expect(samsung_pay_card.expiration_date).not_to be_nil
41
+ expect(samsung_pay_card.expiration_month).not_to be_nil
42
+ expect(samsung_pay_card.expiration_year).not_to be_nil
43
+ expect(samsung_pay_card.expired?).not_to be_nil
44
+ expect(samsung_pay_card.healthcare).not_to be_nil
45
+ expect(samsung_pay_card.image_url).not_to be_nil
46
+ expect(samsung_pay_card.issuing_bank).not_to be_nil
47
+ expect(samsung_pay_card.last_4).not_to be_nil
48
+ expect(samsung_pay_card.payroll).not_to be_nil
49
+ expect(samsung_pay_card.prepaid).not_to be_nil
50
+ expect(samsung_pay_card.product_id).not_to be_nil
51
+ expect(samsung_pay_card.source_card_last_4).not_to be_nil
52
+ expect(samsung_pay_card.subscriptions).not_to be_nil
53
+ expect(samsung_pay_card.token).not_to be_nil
54
+ expect(samsung_pay_card.unique_number_identifier).not_to be_nil
55
+ expect(samsung_pay_card.updated_at).not_to be_nil
56
56
 
57
57
  customer = Braintree::Customer.find(customer.id)
58
- customer.samsung_pay_cards.size.should == 1
59
- customer.samsung_pay_cards.first.should == samsung_pay_card
58
+ expect(customer.samsung_pay_cards.size).to eq(1)
59
+ expect(customer.samsung_pay_cards.first).to eq(samsung_pay_card)
60
60
  end
61
61
 
62
62
  it "returns cardholder_name and billing_address" do
@@ -79,18 +79,18 @@ describe Braintree::SamsungPayCard do
79
79
  },
80
80
  )
81
81
 
82
- result.should be_success
83
- result.payment_method.cardholder_name.should == "Jenny Block"
82
+ expect(result).to be_success
83
+ expect(result.payment_method.cardholder_name).to eq("Jenny Block")
84
84
 
85
85
  address = result.payment_method.billing_address
86
- address.first_name.should == "New First Name"
87
- address.last_name.should == "New Last Name"
88
- address.company.should == "New Company"
89
- address.street_address.should == "123 New St"
90
- address.extended_address.should == "Apt New"
91
- address.locality.should == "New City"
92
- address.region.should == "New State"
93
- address.postal_code.should == "56789"
86
+ expect(address.first_name).to eq("New First Name")
87
+ expect(address.last_name).to eq("New Last Name")
88
+ expect(address.company).to eq("New Company")
89
+ expect(address.street_address).to eq("123 New St")
90
+ expect(address.extended_address).to eq("Apt New")
91
+ expect(address.locality).to eq("New City")
92
+ expect(address.region).to eq("New State")
93
+ expect(address.postal_code).to eq("56789")
94
94
  end
95
95
 
96
96
  it "can search for transactions" do
@@ -98,14 +98,14 @@ describe Braintree::SamsungPayCard do
98
98
  :payment_method_nonce => Braintree::Test::Nonce::SamsungPayDiscover,
99
99
  :amount => "47.00",
100
100
  )
101
- transaction_create_result.should be_success
101
+ expect(transaction_create_result).to be_success
102
102
  transaction_id = transaction_create_result.transaction.id
103
103
 
104
104
  search_results = Braintree::Transaction.search do |search|
105
105
  search.id.is transaction_id
106
106
  search.payment_instrument_type.is Braintree::PaymentInstrumentType::SamsungPayCard
107
107
  end
108
- search_results.first.id.should == transaction_id
108
+ expect(search_results.first.id).to eq(transaction_id)
109
109
  end
110
110
 
111
111
  it "can create transaction from nonce and vault" do
@@ -117,28 +117,28 @@ describe Braintree::SamsungPayCard do
117
117
  :amount => "47.00",
118
118
  :options => {:store_in_vault => true},
119
119
  )
120
- result.should be_success
120
+ expect(result).to be_success
121
121
 
122
122
  samsung_pay_card_details = result.transaction.samsung_pay_card_details
123
- samsung_pay_card_details.bin.should_not be_nil
124
- samsung_pay_card_details.card_type.should_not be_nil
125
- samsung_pay_card_details.commercial.should_not be_nil
126
- samsung_pay_card_details.country_of_issuance.should_not be_nil
127
- samsung_pay_card_details.customer_location.should_not be_nil
128
- samsung_pay_card_details.debit.should_not be_nil
129
- samsung_pay_card_details.durbin_regulated.should_not be_nil
130
- samsung_pay_card_details.expiration_date.should_not be_nil
131
- samsung_pay_card_details.expiration_month.should_not be_nil
132
- samsung_pay_card_details.expiration_year.should_not be_nil
133
- samsung_pay_card_details.healthcare.should_not be_nil
134
- samsung_pay_card_details.image_url.should_not be_nil
135
- samsung_pay_card_details.issuing_bank.should_not be_nil
136
- samsung_pay_card_details.last_4.should_not be_nil
137
- samsung_pay_card_details.payroll.should_not be_nil
138
- samsung_pay_card_details.prepaid.should_not be_nil
139
- samsung_pay_card_details.product_id.should_not be_nil
140
- samsung_pay_card_details.source_card_last_4.should_not be_nil
141
- samsung_pay_card_details.source_card_last_4.should == "3333"
142
- samsung_pay_card_details.token.should_not be_nil
123
+ expect(samsung_pay_card_details.bin).not_to be_nil
124
+ expect(samsung_pay_card_details.card_type).not_to be_nil
125
+ expect(samsung_pay_card_details.commercial).not_to be_nil
126
+ expect(samsung_pay_card_details.country_of_issuance).not_to be_nil
127
+ expect(samsung_pay_card_details.customer_location).not_to be_nil
128
+ expect(samsung_pay_card_details.debit).not_to be_nil
129
+ expect(samsung_pay_card_details.durbin_regulated).not_to be_nil
130
+ expect(samsung_pay_card_details.expiration_date).not_to be_nil
131
+ expect(samsung_pay_card_details.expiration_month).not_to be_nil
132
+ expect(samsung_pay_card_details.expiration_year).not_to be_nil
133
+ expect(samsung_pay_card_details.healthcare).not_to be_nil
134
+ expect(samsung_pay_card_details.image_url).not_to be_nil
135
+ expect(samsung_pay_card_details.issuing_bank).not_to be_nil
136
+ expect(samsung_pay_card_details.last_4).not_to be_nil
137
+ expect(samsung_pay_card_details.payroll).not_to be_nil
138
+ expect(samsung_pay_card_details.prepaid).not_to be_nil
139
+ expect(samsung_pay_card_details.product_id).not_to be_nil
140
+ expect(samsung_pay_card_details.source_card_last_4).not_to be_nil
141
+ expect(samsung_pay_card_details.source_card_last_4).to eq("3333")
142
+ expect(samsung_pay_card_details.token).not_to be_nil
143
143
  end
144
144
  end