braintree 4.14.0 → 4.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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
@@ -21,19 +21,19 @@ describe Braintree::PaymentMethodNonce do
21
21
  :customer_id => customer.id,
22
22
  )
23
23
 
24
- result.should be_success
25
- result.payment_method.should be_a(Braintree::CreditCard)
24
+ expect(result).to be_success
25
+ expect(result.payment_method).to be_a(Braintree::CreditCard)
26
26
  token = result.payment_method.token
27
27
 
28
28
  found_credit_card = Braintree::CreditCard.find(token)
29
- found_credit_card.should_not be_nil
29
+ expect(found_credit_card).not_to be_nil
30
30
 
31
31
  result = Braintree::PaymentMethodNonce.create(found_credit_card.token)
32
- result.should be_success
33
- result.payment_method_nonce.should_not be_nil
34
- result.payment_method_nonce.nonce.should_not be_nil
35
- result.payment_method_nonce.details.should_not be_nil
36
- result.payment_method_nonce.default?.should be_truthy
32
+ expect(result).to be_success
33
+ expect(result.payment_method_nonce).not_to be_nil
34
+ expect(result.payment_method_nonce.nonce).not_to be_nil
35
+ expect(result.payment_method_nonce.details).not_to be_nil
36
+ expect(result.payment_method_nonce.default?).to be_truthy
37
37
  end
38
38
 
39
39
  it "correctly raises and exception for a non existent token" do
@@ -59,17 +59,17 @@ describe Braintree::PaymentMethodNonce do
59
59
  :customer_id => customer.id,
60
60
  )
61
61
 
62
- payment_method.should be_a(Braintree::CreditCard)
62
+ expect(payment_method).to be_a(Braintree::CreditCard)
63
63
  token = payment_method.token
64
64
 
65
65
  found_credit_card = Braintree::CreditCard.find(token)
66
- found_credit_card.should_not be_nil
66
+ expect(found_credit_card).not_to be_nil
67
67
 
68
68
  payment_method_nonce = Braintree::PaymentMethodNonce.create!(found_credit_card.token)
69
- payment_method_nonce.should_not be_nil
70
- payment_method_nonce.nonce.should_not be_nil
71
- payment_method_nonce.details.should_not be_nil
72
- payment_method_nonce.default?.should be_truthy
69
+ expect(payment_method_nonce).not_to be_nil
70
+ expect(payment_method_nonce.nonce).not_to be_nil
71
+ expect(payment_method_nonce.details).not_to be_nil
72
+ expect(payment_method_nonce.default?).to be_truthy
73
73
  end
74
74
  end
75
75
 
@@ -79,27 +79,27 @@ describe Braintree::PaymentMethodNonce do
79
79
 
80
80
  nonce = result.payment_method_nonce
81
81
 
82
- result.should be_success
83
- nonce.nonce.should == "fake-valid-nonce"
84
- nonce.type.should == "CreditCard"
85
- nonce.details.bin.should == "401288"
86
- nonce.details.card_type.should == "Visa"
87
- nonce.details.expiration_month.should == "12"
88
- nonce.details.expiration_year.should == Date.today.next_year.year.to_s
89
- nonce.details.is_network_tokenized?.should be_nil
90
- nonce.details.last_two.should == "81"
91
- nonce.details.payer_info.should be_nil
82
+ expect(result).to be_success
83
+ expect(nonce.nonce).to eq("fake-valid-nonce")
84
+ expect(nonce.type).to eq("CreditCard")
85
+ expect(nonce.details.bin).to eq("401288")
86
+ expect(nonce.details.card_type).to eq("Visa")
87
+ expect(nonce.details.expiration_month).to eq("12")
88
+ expect(nonce.details.expiration_year).to eq(Date.today.next_year.year.to_s)
89
+ expect(nonce.details.is_network_tokenized?).to be_nil
90
+ expect(nonce.details.last_two).to eq("81")
91
+ expect(nonce.details.payer_info).to be_nil
92
92
  end
93
93
 
94
94
  it "return paypal details if details exist" do
95
95
  result = Braintree::PaymentMethodNonce.find("fake-paypal-one-time-nonce")
96
96
  nonce = result.payment_method_nonce
97
- nonce.details.payer_info.billing_agreement_id.should be_nil
98
- nonce.details.payer_info.country_code.should be_nil
99
- nonce.details.payer_info.email.should_not be_nil
100
- nonce.details.payer_info.first_name.should_not be_nil
101
- nonce.details.payer_info.last_name.should_not be_nil
102
- nonce.details.payer_info.payer_id.should_not be_nil
97
+ expect(nonce.details.payer_info.billing_agreement_id).to be_nil
98
+ expect(nonce.details.payer_info.country_code).to be_nil
99
+ expect(nonce.details.payer_info.email).not_to be_nil
100
+ expect(nonce.details.payer_info.first_name).not_to be_nil
101
+ expect(nonce.details.payer_info.last_name).not_to be_nil
102
+ expect(nonce.details.payer_info.payer_id).not_to be_nil
103
103
  end
104
104
 
105
105
  it "returns null 3ds_info if there isn't any" do
@@ -115,17 +115,17 @@ describe Braintree::PaymentMethodNonce do
115
115
 
116
116
  nonce = result.payment_method_nonce
117
117
 
118
- result.should be_success
119
- nonce.three_d_secure_info.should be_nil
118
+ expect(result).to be_success
119
+ expect(nonce.three_d_secure_info).to be_nil
120
120
  end
121
121
 
122
122
  it "returns the bin" do
123
123
  result = Braintree::PaymentMethodNonce.find("fake-valid-visa-nonce")
124
124
 
125
125
  nonce = result.payment_method_nonce
126
- result.should be_success
127
- nonce.details.should_not be_nil
128
- nonce.details.bin.should == "401288"
126
+ expect(result).to be_success
127
+ expect(nonce.details).not_to be_nil
128
+ expect(nonce.details.bin).to eq("401288")
129
129
  end
130
130
 
131
131
  it "returns bin_data with commercial set to Yes" do
@@ -133,9 +133,9 @@ describe Braintree::PaymentMethodNonce do
133
133
 
134
134
  nonce = result.payment_method_nonce
135
135
 
136
- result.should be_success
137
- nonce.bin_data.should_not be_nil
138
- nonce.bin_data.commercial.should == Braintree::CreditCard::Commercial::Yes
136
+ expect(result).to be_success
137
+ expect(nonce.bin_data).not_to be_nil
138
+ expect(nonce.bin_data.commercial).to eq(Braintree::CreditCard::Commercial::Yes)
139
139
  end
140
140
 
141
141
  it "returns bin_data with country_of_issuance set to CAN" do
@@ -143,9 +143,9 @@ describe Braintree::PaymentMethodNonce do
143
143
 
144
144
  nonce = result.payment_method_nonce
145
145
 
146
- result.should be_success
147
- nonce.bin_data.should_not be_nil
148
- nonce.bin_data.country_of_issuance.should == "CAN"
146
+ expect(result).to be_success
147
+ expect(nonce.bin_data).not_to be_nil
148
+ expect(nonce.bin_data.country_of_issuance).to eq("CAN")
149
149
  end
150
150
 
151
151
  it "returns bin_data with debit set to Yes" do
@@ -153,9 +153,9 @@ describe Braintree::PaymentMethodNonce do
153
153
 
154
154
  nonce = result.payment_method_nonce
155
155
 
156
- result.should be_success
157
- nonce.bin_data.should_not be_nil
158
- nonce.bin_data.debit.should == Braintree::CreditCard::Debit::Yes
156
+ expect(result).to be_success
157
+ expect(nonce.bin_data).not_to be_nil
158
+ expect(nonce.bin_data.debit).to eq(Braintree::CreditCard::Debit::Yes)
159
159
  end
160
160
 
161
161
  it "returns bin_data with durbin_regulated set to Yes" do
@@ -163,9 +163,9 @@ describe Braintree::PaymentMethodNonce do
163
163
 
164
164
  nonce = result.payment_method_nonce
165
165
 
166
- result.should be_success
167
- nonce.bin_data.should_not be_nil
168
- nonce.bin_data.durbin_regulated.should == Braintree::CreditCard::DurbinRegulated::Yes
166
+ expect(result).to be_success
167
+ expect(nonce.bin_data).not_to be_nil
168
+ expect(nonce.bin_data.durbin_regulated).to eq(Braintree::CreditCard::DurbinRegulated::Yes)
169
169
  end
170
170
 
171
171
  it "returns bin_data with healthcare set to Yes" do
@@ -173,10 +173,10 @@ describe Braintree::PaymentMethodNonce do
173
173
 
174
174
  nonce = result.payment_method_nonce
175
175
 
176
- result.should be_success
177
- nonce.bin_data.should_not be_nil
178
- nonce.bin_data.healthcare.should == Braintree::CreditCard::Healthcare::Yes
179
- nonce.bin_data.product_id.should == "J3"
176
+ expect(result).to be_success
177
+ expect(nonce.bin_data).not_to be_nil
178
+ expect(nonce.bin_data.healthcare).to eq(Braintree::CreditCard::Healthcare::Yes)
179
+ expect(nonce.bin_data.product_id).to eq("J3")
180
180
  end
181
181
 
182
182
  it "returns bin_data with issuing_bank set to Network Only" do
@@ -184,9 +184,9 @@ describe Braintree::PaymentMethodNonce do
184
184
 
185
185
  nonce = result.payment_method_nonce
186
186
 
187
- result.should be_success
188
- nonce.bin_data.should_not be_nil
189
- nonce.bin_data.issuing_bank.should == "NETWORK ONLY"
187
+ expect(result).to be_success
188
+ expect(nonce.bin_data).not_to be_nil
189
+ expect(nonce.bin_data.issuing_bank).to eq("NETWORK ONLY")
190
190
  end
191
191
 
192
192
  it "returns bin_data with payroll set to Yes" do
@@ -194,10 +194,10 @@ describe Braintree::PaymentMethodNonce do
194
194
 
195
195
  nonce = result.payment_method_nonce
196
196
 
197
- result.should be_success
198
- nonce.bin_data.should_not be_nil
199
- nonce.bin_data.payroll.should == Braintree::CreditCard::Payroll::Yes
200
- nonce.bin_data.product_id.should == "MSA"
197
+ expect(result).to be_success
198
+ expect(nonce.bin_data).not_to be_nil
199
+ expect(nonce.bin_data.payroll).to eq(Braintree::CreditCard::Payroll::Yes)
200
+ expect(nonce.bin_data.product_id).to eq("MSA")
201
201
  end
202
202
 
203
203
  it "returns bin_data with prepaid set to Yes" do
@@ -205,9 +205,9 @@ describe Braintree::PaymentMethodNonce do
205
205
 
206
206
  nonce = result.payment_method_nonce
207
207
 
208
- result.should be_success
209
- nonce.bin_data.should_not be_nil
210
- nonce.bin_data.prepaid.should == Braintree::CreditCard::Prepaid::Yes
208
+ expect(result).to be_success
209
+ expect(nonce.bin_data).not_to be_nil
210
+ expect(nonce.bin_data.prepaid).to eq(Braintree::CreditCard::Prepaid::Yes)
211
211
  end
212
212
 
213
213
  it "returns bin_data with unknown indicators" do
@@ -215,17 +215,17 @@ describe Braintree::PaymentMethodNonce do
215
215
 
216
216
  nonce = result.payment_method_nonce
217
217
 
218
- result.should be_success
219
- nonce.bin_data.should_not be_nil
220
- nonce.bin_data.commercial.should == Braintree::CreditCard::Commercial::Unknown
221
- nonce.bin_data.country_of_issuance.should == Braintree::CreditCard::CountryOfIssuance::Unknown
222
- nonce.bin_data.debit.should == Braintree::CreditCard::Debit::Unknown
223
- nonce.bin_data.durbin_regulated.should == Braintree::CreditCard::DurbinRegulated::Unknown
224
- nonce.bin_data.healthcare.should == Braintree::CreditCard::Healthcare::Unknown
225
- nonce.bin_data.issuing_bank.should == Braintree::CreditCard::IssuingBank::Unknown
226
- nonce.bin_data.payroll.should == Braintree::CreditCard::Payroll::Unknown
227
- nonce.bin_data.prepaid.should == Braintree::CreditCard::Prepaid::Unknown
228
- nonce.bin_data.product_id.should == Braintree::CreditCard::ProductId::Unknown
218
+ expect(result).to be_success
219
+ expect(nonce.bin_data).not_to be_nil
220
+ expect(nonce.bin_data.commercial).to eq(Braintree::CreditCard::Commercial::Unknown)
221
+ expect(nonce.bin_data.country_of_issuance).to eq(Braintree::CreditCard::CountryOfIssuance::Unknown)
222
+ expect(nonce.bin_data.debit).to eq(Braintree::CreditCard::Debit::Unknown)
223
+ expect(nonce.bin_data.durbin_regulated).to eq(Braintree::CreditCard::DurbinRegulated::Unknown)
224
+ expect(nonce.bin_data.healthcare).to eq(Braintree::CreditCard::Healthcare::Unknown)
225
+ expect(nonce.bin_data.issuing_bank).to eq(Braintree::CreditCard::IssuingBank::Unknown)
226
+ expect(nonce.bin_data.payroll).to eq(Braintree::CreditCard::Payroll::Unknown)
227
+ expect(nonce.bin_data.prepaid).to eq(Braintree::CreditCard::Prepaid::Unknown)
228
+ expect(nonce.bin_data.product_id).to eq(Braintree::CreditCard::ProductId::Unknown)
229
229
  end
230
230
 
231
231
  it "correctly raises and exception for a non existent token" do
@@ -305,7 +305,7 @@ describe Braintree::PaymentMethodNonce do
305
305
  payment_method_token,
306
306
  payment_method_nonce: nonce_request,
307
307
  )
308
- result.should be_success
308
+ expect(result).to be_success
309
309
 
310
310
  return result.payment_method_nonce.authentication_insight
311
311
  end