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
@@ -10,9 +10,9 @@ describe Braintree::WebhookNotification do
10
10
 
11
11
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
12
12
 
13
- notification.kind.should == Braintree::WebhookNotification::Kind::SubscriptionWentPastDue
14
- notification.subscription.id.should == "my_id"
15
- notification.timestamp.should be_within(10).of(Time.now.utc)
13
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::SubscriptionWentPastDue)
14
+ expect(notification.subscription.id).to eq("my_id")
15
+ expect(notification.timestamp).to be_within(10).of(Time.now.utc)
16
16
  end
17
17
 
18
18
  it "builds a sample notification for a partner merchant connected webhook" do
@@ -23,13 +23,13 @@ describe Braintree::WebhookNotification do
23
23
 
24
24
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
25
25
 
26
- notification.kind.should == Braintree::WebhookNotification::Kind::PartnerMerchantConnected
27
- notification.partner_merchant.merchant_public_id.should == "public_id"
28
- notification.partner_merchant.public_key.should == "public_key"
29
- notification.partner_merchant.private_key.should == "private_key"
30
- notification.partner_merchant.partner_merchant_id.should == "abc123"
31
- notification.partner_merchant.client_side_encryption_key.should == "cse_key"
32
- notification.timestamp.should be_within(10).of(Time.now.utc)
26
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::PartnerMerchantConnected)
27
+ expect(notification.partner_merchant.merchant_public_id).to eq("public_id")
28
+ expect(notification.partner_merchant.public_key).to eq("public_key")
29
+ expect(notification.partner_merchant.private_key).to eq("private_key")
30
+ expect(notification.partner_merchant.partner_merchant_id).to eq("abc123")
31
+ expect(notification.partner_merchant.client_side_encryption_key).to eq("cse_key")
32
+ expect(notification.timestamp).to be_within(10).of(Time.now.utc)
33
33
  end
34
34
 
35
35
  it "builds a sample notification for a partner merchant disconnected webhook" do
@@ -40,9 +40,9 @@ describe Braintree::WebhookNotification do
40
40
 
41
41
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
42
42
 
43
- notification.kind.should == Braintree::WebhookNotification::Kind::PartnerMerchantDisconnected
44
- notification.partner_merchant.partner_merchant_id.should == "abc123"
45
- notification.timestamp.should be_within(10).of(Time.now.utc)
43
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::PartnerMerchantDisconnected)
44
+ expect(notification.partner_merchant.partner_merchant_id).to eq("abc123")
45
+ expect(notification.timestamp).to be_within(10).of(Time.now.utc)
46
46
  end
47
47
 
48
48
  it "builds a sample notification for a partner merchant declined webhook" do
@@ -53,9 +53,9 @@ describe Braintree::WebhookNotification do
53
53
 
54
54
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
55
55
 
56
- notification.kind.should == Braintree::WebhookNotification::Kind::PartnerMerchantDeclined
57
- notification.partner_merchant.partner_merchant_id.should == "abc123"
58
- notification.timestamp.should be_within(10).of(Time.now.utc)
56
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::PartnerMerchantDeclined)
57
+ expect(notification.partner_merchant.partner_merchant_id).to eq("abc123")
58
+ expect(notification.timestamp).to be_within(10).of(Time.now.utc)
59
59
  end
60
60
 
61
61
  it "builds a sample notification with a source merchant ID" do
@@ -67,7 +67,7 @@ describe Braintree::WebhookNotification do
67
67
 
68
68
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
69
69
 
70
- notification.source_merchant_id.should == "my_source_merchant_id"
70
+ expect(notification.source_merchant_id).to eq("my_source_merchant_id")
71
71
  end
72
72
 
73
73
  it "doesn't include source merchant IDs if not supplied" do
@@ -78,7 +78,7 @@ describe Braintree::WebhookNotification do
78
78
 
79
79
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
80
80
 
81
- notification.source_merchant_id.should be_nil
81
+ expect(notification.source_merchant_id).to be_nil
82
82
  end
83
83
 
84
84
  context "auth" do
@@ -90,13 +90,13 @@ describe Braintree::WebhookNotification do
90
90
 
91
91
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
92
92
 
93
- notification.kind.should == Braintree::WebhookNotification::Kind::ConnectedMerchantStatusTransitioned
93
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::ConnectedMerchantStatusTransitioned)
94
94
 
95
95
  status_transitioned = notification.connected_merchant_status_transitioned
96
- status_transitioned.merchant_public_id.should == "my_id"
97
- status_transitioned.merchant_id.should == "my_id"
98
- status_transitioned.oauth_application_client_id.should == "oauth_application_client_id"
99
- status_transitioned.status.should == "new_status"
96
+ expect(status_transitioned.merchant_public_id).to eq("my_id")
97
+ expect(status_transitioned.merchant_id).to eq("my_id")
98
+ expect(status_transitioned.oauth_application_client_id).to eq("oauth_application_client_id")
99
+ expect(status_transitioned.status).to eq("new_status")
100
100
  end
101
101
 
102
102
  it "builds a sample notification for a paypal status changed webhook" do
@@ -107,13 +107,13 @@ describe Braintree::WebhookNotification do
107
107
 
108
108
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
109
109
 
110
- notification.kind.should == Braintree::WebhookNotification::Kind::ConnectedMerchantPayPalStatusChanged
110
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::ConnectedMerchantPayPalStatusChanged)
111
111
 
112
112
  paypal_status_changed = notification.connected_merchant_paypal_status_changed
113
- paypal_status_changed.merchant_public_id.should == "my_id"
114
- paypal_status_changed.merchant_id.should == "my_id"
115
- paypal_status_changed.oauth_application_client_id.should == "oauth_application_client_id"
116
- paypal_status_changed.action.should == "link"
113
+ expect(paypal_status_changed.merchant_public_id).to eq("my_id")
114
+ expect(paypal_status_changed.merchant_id).to eq("my_id")
115
+ expect(paypal_status_changed.oauth_application_client_id).to eq("oauth_application_client_id")
116
+ expect(paypal_status_changed.action).to eq("link")
117
117
  end
118
118
 
119
119
  it "builds a sample notification for OAuth application revocation" do
@@ -124,10 +124,10 @@ describe Braintree::WebhookNotification do
124
124
 
125
125
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
126
126
 
127
- notification.kind.should == Braintree::WebhookNotification::Kind::OAuthAccessRevoked
128
- notification.oauth_access_revocation.merchant_id.should == "my_id"
129
- notification.oauth_access_revocation.oauth_application_client_id.should == "oauth_application_client_id"
130
- notification.timestamp.should be_within(10).of(Time.now.utc)
127
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::OAuthAccessRevoked)
128
+ expect(notification.oauth_access_revocation.merchant_id).to eq("my_id")
129
+ expect(notification.oauth_access_revocation.oauth_application_client_id).to eq("oauth_application_client_id")
130
+ expect(notification.timestamp).to be_within(10).of(Time.now.utc)
131
131
  end
132
132
 
133
133
  end
@@ -144,12 +144,12 @@ describe Braintree::WebhookNotification do
144
144
 
145
145
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
146
146
 
147
- notification.kind.should == Braintree::WebhookNotification::Kind::DisputeOpened
147
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::DisputeOpened)
148
148
 
149
149
  dispute = notification.dispute
150
- dispute.status.should == Braintree::Dispute::Status::Open
151
- dispute.id.should == dispute_id
152
- dispute.kind.should == Braintree::Dispute::Kind::Chargeback
150
+ expect(dispute.status).to eq(Braintree::Dispute::Status::Open)
151
+ expect(dispute.id).to eq(dispute_id)
152
+ expect(dispute.kind).to eq(Braintree::Dispute::Kind::Chargeback)
153
153
  end
154
154
 
155
155
  it "builds a sample notification for a dispute lost webhook" do
@@ -160,12 +160,12 @@ describe Braintree::WebhookNotification do
160
160
 
161
161
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
162
162
 
163
- notification.kind.should == Braintree::WebhookNotification::Kind::DisputeLost
163
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::DisputeLost)
164
164
 
165
165
  dispute = notification.dispute
166
- dispute.status.should == Braintree::Dispute::Status::Lost
167
- dispute.id.should == dispute_id
168
- dispute.kind.should == Braintree::Dispute::Kind::Chargeback
166
+ expect(dispute.status).to eq(Braintree::Dispute::Status::Lost)
167
+ expect(dispute.id).to eq(dispute_id)
168
+ expect(dispute.kind).to eq(Braintree::Dispute::Kind::Chargeback)
169
169
  end
170
170
 
171
171
  it "builds a sample notification for a dispute won webhook" do
@@ -176,12 +176,12 @@ describe Braintree::WebhookNotification do
176
176
 
177
177
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
178
178
 
179
- notification.kind.should == Braintree::WebhookNotification::Kind::DisputeWon
179
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::DisputeWon)
180
180
 
181
181
  dispute = notification.dispute
182
- dispute.status.should == Braintree::Dispute::Status::Won
183
- dispute.id.should == dispute_id
184
- dispute.kind.should == Braintree::Dispute::Kind::Chargeback
182
+ expect(dispute.status).to eq(Braintree::Dispute::Status::Won)
183
+ expect(dispute.id).to eq(dispute_id)
184
+ expect(dispute.kind).to eq(Braintree::Dispute::Kind::Chargeback)
185
185
  end
186
186
 
187
187
  it "builds a sample notification for a dispute accepted webhook" do
@@ -192,12 +192,12 @@ describe Braintree::WebhookNotification do
192
192
 
193
193
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
194
194
 
195
- notification.kind.should == Braintree::WebhookNotification::Kind::DisputeAccepted
195
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::DisputeAccepted)
196
196
 
197
197
  dispute = notification.dispute
198
- dispute.status.should == Braintree::Dispute::Status::Accepted
199
- dispute.id.should == dispute_id
200
- dispute.kind.should == Braintree::Dispute::Kind::Chargeback
198
+ expect(dispute.status).to eq(Braintree::Dispute::Status::Accepted)
199
+ expect(dispute.id).to eq(dispute_id)
200
+ expect(dispute.kind).to eq(Braintree::Dispute::Kind::Chargeback)
201
201
  end
202
202
 
203
203
  it "builds a sample notification for a dispute auto_accepted webhook" do
@@ -208,12 +208,12 @@ describe Braintree::WebhookNotification do
208
208
 
209
209
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
210
210
 
211
- notification.kind.should == Braintree::WebhookNotification::Kind::DisputeAutoAccepted
211
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::DisputeAutoAccepted)
212
212
 
213
213
  dispute = notification.dispute
214
- dispute.status.should == Braintree::Dispute::Status::AutoAccepted
215
- dispute.id.should == dispute_id
216
- dispute.kind.should == Braintree::Dispute::Kind::Chargeback
214
+ expect(dispute.status).to eq(Braintree::Dispute::Status::AutoAccepted)
215
+ expect(dispute.id).to eq(dispute_id)
216
+ expect(dispute.kind).to eq(Braintree::Dispute::Kind::Chargeback)
217
217
  end
218
218
 
219
219
  it "builds a sample notification for a dispute disputed webhook" do
@@ -224,12 +224,12 @@ describe Braintree::WebhookNotification do
224
224
 
225
225
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
226
226
 
227
- notification.kind.should == Braintree::WebhookNotification::Kind::DisputeDisputed
227
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::DisputeDisputed)
228
228
 
229
229
  dispute = notification.dispute
230
- dispute.status.should == Braintree::Dispute::Status::Disputed
231
- dispute.id.should == dispute_id
232
- dispute.kind.should == Braintree::Dispute::Kind::Chargeback
230
+ expect(dispute.status).to eq(Braintree::Dispute::Status::Disputed)
231
+ expect(dispute.id).to eq(dispute_id)
232
+ expect(dispute.kind).to eq(Braintree::Dispute::Kind::Chargeback)
233
233
  end
234
234
 
235
235
  it "builds a sample notification for a dispute expired webhook" do
@@ -240,12 +240,12 @@ describe Braintree::WebhookNotification do
240
240
 
241
241
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
242
242
 
243
- notification.kind.should == Braintree::WebhookNotification::Kind::DisputeExpired
243
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::DisputeExpired)
244
244
 
245
245
  dispute = notification.dispute
246
- dispute.status.should == Braintree::Dispute::Status::Expired
247
- dispute.id.should == dispute_id
248
- dispute.kind.should == Braintree::Dispute::Kind::Chargeback
246
+ expect(dispute.status).to eq(Braintree::Dispute::Status::Expired)
247
+ expect(dispute.id).to eq(dispute_id)
248
+ expect(dispute.kind).to eq(Braintree::Dispute::Kind::Chargeback)
249
249
  end
250
250
 
251
251
  it "is compatible with the previous dispute won webhook interface" do
@@ -256,15 +256,15 @@ describe Braintree::WebhookNotification do
256
256
 
257
257
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
258
258
 
259
- notification.kind.should == Braintree::WebhookNotification::Kind::DisputeWon
259
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::DisputeWon)
260
260
 
261
261
  dispute = notification.dispute
262
- dispute.amount.should == 100.00
263
- dispute.id.should == dispute_id
264
- dispute.date_opened.should == Date.new(2014, 3, 21)
265
- dispute.date_won.should == Date.new(2014, 3, 22)
266
- dispute.transaction_details.amount.should == 100.00
267
- dispute.transaction_details.id.should == dispute_id
262
+ expect(dispute.amount).to eq(100.00)
263
+ expect(dispute.id).to eq(dispute_id)
264
+ expect(dispute.date_opened).to eq(Date.new(2014, 3, 21))
265
+ expect(dispute.date_won).to eq(Date.new(2014, 3, 22))
266
+ expect(dispute.transaction_details.amount).to eq(100.00)
267
+ expect(dispute.transaction_details.id).to eq(dispute_id)
268
268
  end
269
269
  end
270
270
 
@@ -288,10 +288,10 @@ describe Braintree::WebhookNotification do
288
288
 
289
289
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
290
290
 
291
- notification.kind.should == Braintree::WebhookNotification::Kind::TransactionDisbursed
292
- notification.transaction.id.should == "my_id"
293
- notification.transaction.amount.should == 1_00
294
- notification.transaction.disbursement_details.disbursement_date.should == Date.parse("2013-07-09")
291
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::TransactionDisbursed)
292
+ expect(notification.transaction.id).to eq("my_id")
293
+ expect(notification.transaction.amount).to eq(1_00)
294
+ expect(notification.transaction.disbursement_details.disbursement_date).to eq(Date.parse("2013-07-09"))
295
295
  end
296
296
 
297
297
  it "builds a sample notification for a disbursement_exception webhook" do
@@ -302,15 +302,15 @@ describe Braintree::WebhookNotification do
302
302
 
303
303
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
304
304
 
305
- notification.kind.should == Braintree::WebhookNotification::Kind::DisbursementException
306
- notification.disbursement.id.should == "my_id"
307
- notification.disbursement.transaction_ids.should == %W{ afv56j kj8hjk }
308
- notification.disbursement.retry.should be(false)
309
- notification.disbursement.success.should be(false)
310
- notification.disbursement.exception_message.should == "bank_rejected"
311
- notification.disbursement.disbursement_date.should == Date.parse("2014-02-10")
312
- notification.disbursement.follow_up_action.should == "update_funding_information"
313
- notification.disbursement.merchant_account.id.should == "merchant_account_token"
305
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::DisbursementException)
306
+ expect(notification.disbursement.id).to eq("my_id")
307
+ expect(notification.disbursement.transaction_ids).to eq(%W{ afv56j kj8hjk })
308
+ expect(notification.disbursement.retry).to be(false)
309
+ expect(notification.disbursement.success).to be(false)
310
+ expect(notification.disbursement.exception_message).to eq("bank_rejected")
311
+ expect(notification.disbursement.disbursement_date).to eq(Date.parse("2014-02-10"))
312
+ expect(notification.disbursement.follow_up_action).to eq("update_funding_information")
313
+ expect(notification.disbursement.merchant_account.id).to eq("merchant_account_token")
314
314
  end
315
315
 
316
316
  it "builds a sample notification for a disbursement webhook" do
@@ -321,15 +321,15 @@ describe Braintree::WebhookNotification do
321
321
 
322
322
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
323
323
 
324
- notification.kind.should == Braintree::WebhookNotification::Kind::Disbursement
325
- notification.disbursement.id.should == "my_id"
326
- notification.disbursement.transaction_ids.should == %W{ afv56j kj8hjk }
327
- notification.disbursement.retry.should be(false)
328
- notification.disbursement.success.should be(true)
329
- notification.disbursement.exception_message.should be_nil
330
- notification.disbursement.disbursement_date.should == Date.parse("2014-02-10")
331
- notification.disbursement.follow_up_action.should be_nil
332
- notification.disbursement.merchant_account.id.should == "merchant_account_token"
324
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::Disbursement)
325
+ expect(notification.disbursement.id).to eq("my_id")
326
+ expect(notification.disbursement.transaction_ids).to eq(%W{ afv56j kj8hjk })
327
+ expect(notification.disbursement.retry).to be(false)
328
+ expect(notification.disbursement.success).to be(true)
329
+ expect(notification.disbursement.exception_message).to be_nil
330
+ expect(notification.disbursement.disbursement_date).to eq(Date.parse("2014-02-10"))
331
+ expect(notification.disbursement.follow_up_action).to be_nil
332
+ expect(notification.disbursement.merchant_account.id).to eq("merchant_account_token")
333
333
  end
334
334
  end
335
335
 
@@ -360,13 +360,13 @@ describe Braintree::WebhookNotification do
360
360
 
361
361
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
362
362
 
363
- notification.kind.should == Braintree::WebhookNotification::Kind::TransactionSettled
363
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::TransactionSettled)
364
364
 
365
- notification.transaction.status.should == "settled"
366
- notification.transaction.us_bank_account_details.account_type.should == "checking"
367
- notification.transaction.us_bank_account_details.account_holder_name.should == "Dan Schulman"
368
- notification.transaction.us_bank_account_details.routing_number.should == "123456789"
369
- notification.transaction.us_bank_account_details.last_4.should == "1234"
365
+ expect(notification.transaction.status).to eq("settled")
366
+ expect(notification.transaction.us_bank_account_details.account_type).to eq("checking")
367
+ expect(notification.transaction.us_bank_account_details.account_holder_name).to eq("Dan Schulman")
368
+ expect(notification.transaction.us_bank_account_details.routing_number).to eq("123456789")
369
+ expect(notification.transaction.us_bank_account_details.last_4).to eq("1234")
370
370
  end
371
371
 
372
372
  it "builds a sample notification for a settlement declined webhook" do
@@ -377,13 +377,13 @@ describe Braintree::WebhookNotification do
377
377
 
378
378
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
379
379
 
380
- notification.kind.should == Braintree::WebhookNotification::Kind::TransactionSettlementDeclined
380
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::TransactionSettlementDeclined)
381
381
 
382
- notification.transaction.status.should == "settlement_declined"
383
- notification.transaction.us_bank_account_details.account_type.should == "checking"
384
- notification.transaction.us_bank_account_details.account_holder_name.should == "Dan Schulman"
385
- notification.transaction.us_bank_account_details.routing_number.should == "123456789"
386
- notification.transaction.us_bank_account_details.last_4.should == "1234"
382
+ expect(notification.transaction.status).to eq("settlement_declined")
383
+ expect(notification.transaction.us_bank_account_details.account_type).to eq("checking")
384
+ expect(notification.transaction.us_bank_account_details.account_holder_name).to eq("Dan Schulman")
385
+ expect(notification.transaction.us_bank_account_details.routing_number).to eq("123456789")
386
+ expect(notification.transaction.us_bank_account_details.last_4).to eq("1234")
387
387
  end
388
388
  end
389
389
 
@@ -396,11 +396,11 @@ describe Braintree::WebhookNotification do
396
396
 
397
397
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
398
398
 
399
- notification.kind.should == Braintree::WebhookNotification::Kind::SubMerchantAccountApproved
400
- notification.merchant_account.id.should == "my_id"
401
- notification.merchant_account.status.should == Braintree::MerchantAccount::Status::Active
402
- notification.merchant_account.master_merchant_account.id.should == "master_ma_for_my_id"
403
- notification.merchant_account.master_merchant_account.status.should == Braintree::MerchantAccount::Status::Active
399
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::SubMerchantAccountApproved)
400
+ expect(notification.merchant_account.id).to eq("my_id")
401
+ expect(notification.merchant_account.status).to eq(Braintree::MerchantAccount::Status::Active)
402
+ expect(notification.merchant_account.master_merchant_account.id).to eq("master_ma_for_my_id")
403
+ expect(notification.merchant_account.master_merchant_account.status).to eq(Braintree::MerchantAccount::Status::Active)
404
404
  end
405
405
 
406
406
  it "builds a sample notification for a merchant account declined webhook" do
@@ -411,17 +411,32 @@ describe Braintree::WebhookNotification do
411
411
 
412
412
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
413
413
 
414
- notification.kind.should == Braintree::WebhookNotification::Kind::SubMerchantAccountDeclined
415
- notification.merchant_account.id.should == "my_id"
416
- notification.merchant_account.status.should == Braintree::MerchantAccount::Status::Suspended
417
- notification.merchant_account.master_merchant_account.id.should == "master_ma_for_my_id"
418
- notification.merchant_account.master_merchant_account.status.should == Braintree::MerchantAccount::Status::Suspended
419
- notification.message.should == "Credit score is too low"
420
- notification.errors.for(:merchant_account).on(:base).first.code.should == Braintree::ErrorCodes::MerchantAccount::DeclinedOFAC
414
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::SubMerchantAccountDeclined)
415
+ expect(notification.merchant_account.id).to eq("my_id")
416
+ expect(notification.merchant_account.status).to eq(Braintree::MerchantAccount::Status::Suspended)
417
+ expect(notification.merchant_account.master_merchant_account.id).to eq("master_ma_for_my_id")
418
+ expect(notification.merchant_account.master_merchant_account.status).to eq(Braintree::MerchantAccount::Status::Suspended)
419
+ expect(notification.message).to eq("Credit score is too low")
420
+ expect(notification.errors.for(:merchant_account).on(:base).first.code).to eq(Braintree::ErrorCodes::MerchantAccount::DeclinedOFAC)
421
421
  end
422
422
  end
423
423
 
424
424
  context "subscription" do
425
+ it "builds a sample notification for a subscription billing skipped webhook" do
426
+ sample_notification = Braintree::WebhookTesting.sample_notification(
427
+ Braintree::WebhookNotification::Kind::SubscriptionBillingSkipped,
428
+ "my_id",
429
+ )
430
+
431
+ notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
432
+
433
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::SubscriptionBillingSkipped)
434
+ expect(notification.subscription.id).to eq("my_id")
435
+ expect(notification.subscription.transactions.size).to eq(0)
436
+ expect(notification.subscription.discounts.size).to eq(0)
437
+ expect(notification.subscription.add_ons.size).to eq(0)
438
+ end
439
+
425
440
  it "builds a sample notification for a subscription charged successfully webhook" do
426
441
  sample_notification = Braintree::WebhookTesting.sample_notification(
427
442
  Braintree::WebhookNotification::Kind::SubscriptionChargedSuccessfully,
@@ -430,11 +445,11 @@ describe Braintree::WebhookNotification do
430
445
 
431
446
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
432
447
 
433
- notification.kind.should == Braintree::WebhookNotification::Kind::SubscriptionChargedSuccessfully
434
- notification.subscription.id.should == "my_id"
435
- notification.subscription.transactions.size.should == 1
436
- notification.subscription.transactions.first.status.should == Braintree::Transaction::Status::SubmittedForSettlement
437
- notification.subscription.transactions.first.amount.should == BigDecimal("49.99")
448
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::SubscriptionChargedSuccessfully)
449
+ expect(notification.subscription.id).to eq("my_id")
450
+ expect(notification.subscription.transactions.size).to eq(1)
451
+ expect(notification.subscription.transactions.first.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
452
+ expect(notification.subscription.transactions.first.amount).to eq(BigDecimal("49.99"))
438
453
  end
439
454
 
440
455
  it "builds a sample notification for a subscription charged unsuccessfully webhook" do
@@ -445,11 +460,11 @@ describe Braintree::WebhookNotification do
445
460
 
446
461
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
447
462
 
448
- notification.kind.should == Braintree::WebhookNotification::Kind::SubscriptionChargedUnsuccessfully
449
- notification.subscription.id.should == "my_id"
450
- notification.subscription.transactions.size.should == 1
451
- notification.subscription.transactions.first.status.should == Braintree::Transaction::Status::Failed
452
- notification.subscription.transactions.first.amount.should == BigDecimal("49.99")
463
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::SubscriptionChargedUnsuccessfully)
464
+ expect(notification.subscription.id).to eq("my_id")
465
+ expect(notification.subscription.transactions.size).to eq(1)
466
+ expect(notification.subscription.transactions.first.status).to eq(Braintree::Transaction::Status::Failed)
467
+ expect(notification.subscription.transactions.first.amount).to eq(BigDecimal("49.99"))
453
468
  end
454
469
  end
455
470
 
@@ -460,7 +475,7 @@ describe Braintree::WebhookNotification do
460
475
  )
461
476
  expected_signature = Braintree::Digest.hexdigest(Braintree::Configuration.private_key, sample_notification[:bt_payload])
462
477
 
463
- sample_notification[:bt_signature].should == "#{Braintree::Configuration.public_key}|#{expected_signature}"
478
+ expect(sample_notification[:bt_signature]).to eq("#{Braintree::Configuration.public_key}|#{expected_signature}")
464
479
  end
465
480
  end
466
481
 
@@ -473,9 +488,9 @@ describe Braintree::WebhookNotification do
473
488
 
474
489
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
475
490
 
476
- notification.kind.should == Braintree::WebhookNotification::Kind::AccountUpdaterDailyReport
477
- notification.account_updater_daily_report.report_url.should == "link-to-csv-report"
478
- notification.account_updater_daily_report.report_date.should == Date.parse("2016-01-14")
491
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::AccountUpdaterDailyReport)
492
+ expect(notification.account_updater_daily_report.report_url).to eq("link-to-csv-report")
493
+ expect(notification.account_updater_daily_report.report_date).to eq(Date.parse("2016-01-14"))
479
494
  end
480
495
  end
481
496
 
@@ -489,12 +504,12 @@ describe Braintree::WebhookNotification do
489
504
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
490
505
  update = notification.granted_payment_instrument_update
491
506
 
492
- notification.kind.should == Braintree::WebhookNotification::Kind::GrantorUpdatedGrantedPaymentMethod
493
- update.grant_owner_merchant_id.should == "vczo7jqrpwrsi2px"
494
- update.grant_recipient_merchant_id.should == "cf0i8wgarszuy6hc"
495
- update.payment_method_nonce.should == "ee257d98-de40-47e8-96b3-a6954ea7a9a4"
496
- update.token.should == "abc123z"
497
- update.updated_fields.should == ["expiration-month", "expiration-year"]
507
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::GrantorUpdatedGrantedPaymentMethod)
508
+ expect(update.grant_owner_merchant_id).to eq("vczo7jqrpwrsi2px")
509
+ expect(update.grant_recipient_merchant_id).to eq("cf0i8wgarszuy6hc")
510
+ expect(update.payment_method_nonce).to eq("ee257d98-de40-47e8-96b3-a6954ea7a9a4")
511
+ expect(update.token).to eq("abc123z")
512
+ expect(update.updated_fields).to eq(["expiration-month", "expiration-year"])
498
513
  end
499
514
 
500
515
  it "builds a sample notification for a RecipientUpdatedGrantedPaymentMethod webhook" do
@@ -506,12 +521,12 @@ describe Braintree::WebhookNotification do
506
521
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
507
522
  update = notification.granted_payment_instrument_update
508
523
 
509
- notification.kind.should == Braintree::WebhookNotification::Kind::RecipientUpdatedGrantedPaymentMethod
510
- update.grant_owner_merchant_id.should == "vczo7jqrpwrsi2px"
511
- update.grant_recipient_merchant_id.should == "cf0i8wgarszuy6hc"
512
- update.payment_method_nonce.should == "ee257d98-de40-47e8-96b3-a6954ea7a9a4"
513
- update.token.should == "abc123z"
514
- update.updated_fields.should == ["expiration-month", "expiration-year"]
524
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::RecipientUpdatedGrantedPaymentMethod)
525
+ expect(update.grant_owner_merchant_id).to eq("vczo7jqrpwrsi2px")
526
+ expect(update.grant_recipient_merchant_id).to eq("cf0i8wgarszuy6hc")
527
+ expect(update.payment_method_nonce).to eq("ee257d98-de40-47e8-96b3-a6954ea7a9a4")
528
+ expect(update.token).to eq("abc123z")
529
+ expect(update.updated_fields).to eq(["expiration-month", "expiration-year"])
515
530
  end
516
531
  end
517
532
 
@@ -570,10 +585,10 @@ describe Braintree::WebhookNotification do
570
585
  notification = Braintree::WebhookNotification._new(gateway, attributes[:notification])
571
586
  metadata = notification.revoked_payment_method_metadata
572
587
 
573
- notification.kind.should == Braintree::WebhookNotification::Kind::GrantedPaymentInstrumentRevoked
574
- metadata.customer_id.should == "credit_card_customer_id"
575
- metadata.token.should == "credit_card_token"
576
- metadata.revoked_payment_method.class.should == Braintree::CreditCard
588
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::GrantedPaymentInstrumentRevoked)
589
+ expect(metadata.customer_id).to eq("credit_card_customer_id")
590
+ expect(metadata.token).to eq("credit_card_token")
591
+ expect(metadata.revoked_payment_method.class).to eq(Braintree::CreditCard)
577
592
  end
578
593
  end
579
594
 
@@ -605,10 +620,10 @@ describe Braintree::WebhookNotification do
605
620
  notification = Braintree::WebhookNotification._new(gateway, attributes[:notification])
606
621
  metadata = notification.revoked_payment_method_metadata
607
622
 
608
- notification.kind.should == Braintree::WebhookNotification::Kind::GrantedPaymentInstrumentRevoked
609
- metadata.customer_id.should == "paypal_customer_id"
610
- metadata.token.should == "paypal_token"
611
- metadata.revoked_payment_method.class.should == Braintree::PayPalAccount
623
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::GrantedPaymentInstrumentRevoked)
624
+ expect(metadata.customer_id).to eq("paypal_customer_id")
625
+ expect(metadata.token).to eq("paypal_token")
626
+ expect(metadata.revoked_payment_method.class).to eq(Braintree::PayPalAccount)
612
627
  end
613
628
  end
614
629
 
@@ -640,10 +655,10 @@ describe Braintree::WebhookNotification do
640
655
  notification = Braintree::WebhookNotification._new(gateway, attributes[:notification])
641
656
  metadata = notification.revoked_payment_method_metadata
642
657
 
643
- notification.kind.should == Braintree::WebhookNotification::Kind::GrantedPaymentInstrumentRevoked
644
- metadata.customer_id.should == "venmo_customer_id"
645
- metadata.token.should == "venmo_token"
646
- metadata.revoked_payment_method.class.should == Braintree::VenmoAccount
658
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::GrantedPaymentInstrumentRevoked)
659
+ expect(metadata.customer_id).to eq("venmo_customer_id")
660
+ expect(metadata.token).to eq("venmo_token")
661
+ expect(metadata.revoked_payment_method.class).to eq(Braintree::VenmoAccount)
647
662
  end
648
663
 
649
664
  it "builds a sample notification for a GrantedPaymentMethodRevoked webhook" do
@@ -672,12 +687,12 @@ describe Braintree::WebhookNotification do
672
687
  )
673
688
 
674
689
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
675
- notification.kind.should == Braintree::WebhookNotification::Kind::PaymentMethodRevokedByCustomer
690
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::PaymentMethodRevokedByCustomer)
676
691
 
677
692
  metadata = notification.revoked_payment_method_metadata
678
- metadata.token.should == "my_payment_method_token"
679
- metadata.revoked_payment_method.class.should == Braintree::PayPalAccount
680
- metadata.revoked_payment_method.revoked_at.should_not be_nil
693
+ expect(metadata.token).to eq("my_payment_method_token")
694
+ expect(metadata.revoked_payment_method.class).to eq(Braintree::PayPalAccount)
695
+ expect(metadata.revoked_payment_method.revoked_at).not_to be_nil
681
696
  end
682
697
  end
683
698
 
@@ -689,16 +704,16 @@ describe Braintree::WebhookNotification do
689
704
  )
690
705
 
691
706
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
692
- notification.kind.should == Braintree::WebhookNotification::Kind::LocalPaymentCompleted
707
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::LocalPaymentCompleted)
693
708
 
694
709
  local_payment_completed = notification.local_payment_completed
695
- local_payment_completed.payment_id.should == "PAY-XYZ123"
696
- local_payment_completed.payer_id.should == "ABCPAYER"
697
- local_payment_completed.payment_method_nonce.should == "ee257d98-de40-47e8-96b3-a6954ea7a9a4"
698
- local_payment_completed.transaction.id.should == "my_id"
699
- local_payment_completed.transaction.status.should == Braintree::Transaction::Status::Authorized
700
- local_payment_completed.transaction.amount.should == 49.99
701
- local_payment_completed.transaction.order_id.should == "order4567"
710
+ expect(local_payment_completed.payment_id).to eq("PAY-XYZ123")
711
+ expect(local_payment_completed.payer_id).to eq("ABCPAYER")
712
+ expect(local_payment_completed.payment_method_nonce).to eq("ee257d98-de40-47e8-96b3-a6954ea7a9a4")
713
+ expect(local_payment_completed.transaction.id).to eq("my_id")
714
+ expect(local_payment_completed.transaction.status).to eq(Braintree::Transaction::Status::Authorized)
715
+ expect(local_payment_completed.transaction.amount).to eq(49.99)
716
+ expect(local_payment_completed.transaction.order_id).to eq("order4567")
702
717
  end
703
718
  end
704
719
 
@@ -710,11 +725,11 @@ describe Braintree::WebhookNotification do
710
725
  )
711
726
 
712
727
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
713
- notification.kind.should == Braintree::WebhookNotification::Kind::LocalPaymentExpired
728
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::LocalPaymentExpired)
714
729
 
715
730
  local_payment_expired = notification.local_payment_expired
716
- local_payment_expired.payment_id.should == "PAY-XYZ123"
717
- local_payment_expired.payment_context_id.should == "cG5b="
731
+ expect(local_payment_expired.payment_id).to eq("PAY-XYZ123")
732
+ expect(local_payment_expired.payment_context_id).to eq("cG5b=")
718
733
  end
719
734
  end
720
735
 
@@ -725,15 +740,15 @@ describe Braintree::WebhookNotification do
725
740
  "my_id",
726
741
  )
727
742
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
728
- notification.kind.should == Braintree::WebhookNotification::Kind::LocalPaymentFunded
743
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::LocalPaymentFunded)
729
744
 
730
745
  local_payment_funded = notification.local_payment_funded
731
- local_payment_funded.payment_id.should == "PAY-XYZ123"
732
- local_payment_funded.payment_context_id.should == "cG5b="
733
- local_payment_funded.transaction.id.should == "my_id"
734
- local_payment_funded.transaction.status.should == Braintree::Transaction::Status::Settled
735
- local_payment_funded.transaction.amount.should == 49.99
736
- local_payment_funded.transaction.order_id.should == "order4567"
746
+ expect(local_payment_funded.payment_id).to eq("PAY-XYZ123")
747
+ expect(local_payment_funded.payment_context_id).to eq("cG5b=")
748
+ expect(local_payment_funded.transaction.id).to eq("my_id")
749
+ expect(local_payment_funded.transaction.status).to eq(Braintree::Transaction::Status::Settled)
750
+ expect(local_payment_funded.transaction.amount).to eq(49.99)
751
+ expect(local_payment_funded.transaction.order_id).to eq("order4567")
737
752
  end
738
753
  end
739
754
 
@@ -744,10 +759,10 @@ describe Braintree::WebhookNotification do
744
759
  "my_id",
745
760
  )
746
761
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
747
- notification.kind.should == Braintree::WebhookNotification::Kind::LocalPaymentReversed
762
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::LocalPaymentReversed)
748
763
 
749
764
  local_payment_reversed = notification.local_payment_reversed
750
- local_payment_reversed.payment_id.should == "PAY-XYZ123"
765
+ expect(local_payment_reversed.payment_id).to eq("PAY-XYZ123")
751
766
  end
752
767
  end
753
768
 
@@ -758,22 +773,22 @@ describe Braintree::WebhookNotification do
758
773
  "my_id",
759
774
  )
760
775
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
761
- notification.kind.should == Braintree::WebhookNotification::Kind::PaymentMethodCustomerDataUpdated
776
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::PaymentMethodCustomerDataUpdated)
762
777
 
763
778
  payment_method_customer_data_updated = notification.payment_method_customer_data_updated_metadata
764
779
 
765
- payment_method_customer_data_updated.token.should eq("TOKEN-12345")
766
- payment_method_customer_data_updated.datetime_updated.should eq("2022-01-01T21:28:37Z")
780
+ expect(payment_method_customer_data_updated.token).to eq("TOKEN-12345")
781
+ expect(payment_method_customer_data_updated.datetime_updated).to eq("2022-01-01T21:28:37Z")
767
782
 
768
783
  enriched_customer_data = payment_method_customer_data_updated.enriched_customer_data
769
- enriched_customer_data.fields_updated.should eq(["username"])
784
+ expect(enriched_customer_data.fields_updated).to eq(["username"])
770
785
 
771
786
  profile_data = enriched_customer_data.profile_data
772
- profile_data.first_name.should eq("John")
773
- profile_data.last_name.should eq("Doe")
774
- profile_data.username.should eq("venmo_username")
775
- profile_data.phone_number.should eq("1231231234")
776
- profile_data.email.should eq("john.doe@paypal.com")
787
+ expect(profile_data.first_name).to eq("John")
788
+ expect(profile_data.last_name).to eq("Doe")
789
+ expect(profile_data.username).to eq("venmo_username")
790
+ expect(profile_data.phone_number).to eq("1231231234")
791
+ expect(profile_data.email).to eq("john.doe@paypal.com")
777
792
  end
778
793
  end
779
794
 
@@ -855,7 +870,7 @@ describe Braintree::WebhookNotification do
855
870
  exception = e
856
871
  end
857
872
 
858
- exception.message.should_not match(/payload contains illegal characters/)
873
+ expect(exception.message).not_to match(/payload contains illegal characters/)
859
874
  end
860
875
 
861
876
  it "retries a payload with a newline" do
@@ -866,9 +881,9 @@ describe Braintree::WebhookNotification do
866
881
 
867
882
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload].rstrip)
868
883
 
869
- notification.kind.should == Braintree::WebhookNotification::Kind::SubscriptionWentPastDue
870
- notification.subscription.id.should == "my_id"
871
- notification.timestamp.should be_within(10).of(Time.now.utc)
884
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::SubscriptionWentPastDue)
885
+ expect(notification.subscription.id).to eq("my_id")
886
+ expect(notification.timestamp).to be_within(10).of(Time.now.utc)
872
887
  end
873
888
  end
874
889
 
@@ -881,7 +896,7 @@ describe Braintree::WebhookNotification do
881
896
 
882
897
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload].rstrip)
883
898
 
884
- notification.check?.should == true
899
+ expect(notification.check?).to eq(true)
885
900
  end
886
901
 
887
902
  it "returns false for non-check webhook kinds" do
@@ -892,14 +907,14 @@ describe Braintree::WebhookNotification do
892
907
 
893
908
  notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload].rstrip)
894
909
 
895
- notification.check?.should == false
910
+ expect(notification.check?).to eq(false)
896
911
  end
897
912
  end
898
913
 
899
914
  describe "self.verify" do
900
915
  it "creates a verification string" do
901
916
  response = Braintree::WebhookNotification.verify("20f9f8ed05f77439fe955c977e4c8a53")
902
- response.should == "integration_public_key|d9b899556c966b3f06945ec21311865d35df3ce4"
917
+ expect(response).to eq("integration_public_key|d9b899556c966b3f06945ec21311865d35df3ce4")
903
918
  end
904
919
 
905
920
  it "raises InvalidChallenge error with a message complaining about invalid characters" do