braintree 2.104.1 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/braintree.gemspec +7 -4
  4. data/lib/braintree.rb +7 -18
  5. data/lib/braintree/account_updater_daily_report.rb +1 -1
  6. data/lib/braintree/address.rb +1 -23
  7. data/lib/braintree/apple_pay.rb +1 -1
  8. data/lib/braintree/apple_pay_card.rb +1 -1
  9. data/lib/braintree/apple_pay_options.rb +1 -1
  10. data/lib/braintree/authorization_adjustment.rb +1 -1
  11. data/lib/braintree/base_module.rb +6 -0
  12. data/lib/braintree/bin_data.rb +9 -2
  13. data/lib/braintree/client_token.rb +1 -1
  14. data/lib/braintree/configuration.rb +12 -12
  15. data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
  16. data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
  17. data/lib/braintree/credit_card.rb +2 -77
  18. data/lib/braintree/credit_card_gateway.rb +7 -36
  19. data/lib/braintree/credit_card_verification.rb +18 -5
  20. data/lib/braintree/credit_card_verification_search.rb +1 -1
  21. data/lib/braintree/customer.rb +5 -76
  22. data/lib/braintree/customer_gateway.rb +0 -23
  23. data/lib/braintree/customer_search.rb +1 -1
  24. data/lib/braintree/disbursement.rb +1 -1
  25. data/lib/braintree/dispute.rb +2 -8
  26. data/lib/braintree/dispute/{history_event.rb → status_history.rb} +3 -1
  27. data/lib/braintree/dispute_gateway.rb +4 -9
  28. data/lib/braintree/dispute_search.rb +2 -2
  29. data/lib/braintree/document_upload.rb +1 -1
  30. data/lib/braintree/error_codes.rb +151 -170
  31. data/lib/braintree/exceptions.rb +5 -3
  32. data/lib/braintree/gateway.rb +0 -14
  33. data/lib/braintree/{android_pay_card.rb → google_pay_card.rb} +2 -3
  34. data/lib/braintree/granted_payment_instrument_update.rb +1 -1
  35. data/lib/braintree/graphql_client.rb +7 -7
  36. data/lib/braintree/http.rb +3 -3
  37. data/lib/braintree/local_payment_completed.rb +1 -1
  38. data/lib/braintree/local_payment_reversed.rb +19 -0
  39. data/lib/braintree/merchant.rb +1 -1
  40. data/lib/braintree/merchant_account.rb +1 -1
  41. data/lib/braintree/merchant_account_gateway.rb +3 -1
  42. data/lib/braintree/merchant_gateway.rb +1 -1
  43. data/lib/braintree/modification.rb +1 -1
  44. data/lib/braintree/oauth_credentials.rb +1 -1
  45. data/lib/braintree/oauth_gateway.rb +5 -5
  46. data/lib/braintree/payment_instrument_type.rb +10 -14
  47. data/lib/braintree/payment_method_gateway.rb +8 -13
  48. data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
  49. data/lib/braintree/payment_method_parser.rb +1 -8
  50. data/lib/braintree/plan.rb +1 -1
  51. data/lib/braintree/processor_response_types.rb +3 -3
  52. data/lib/braintree/resource_collection.rb +8 -3
  53. data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
  54. data/lib/braintree/risk_data.rb +3 -1
  55. data/lib/braintree/samsung_pay_card.rb +1 -1
  56. data/lib/braintree/settlement_batch_summary.rb +2 -2
  57. data/lib/braintree/subscription.rb +11 -11
  58. data/lib/braintree/successful_result.rb +0 -1
  59. data/lib/braintree/test/credit_card.rb +1 -0
  60. data/lib/braintree/test/nonce.rb +4 -23
  61. data/lib/braintree/three_d_secure_info.rb +22 -12
  62. data/lib/braintree/transaction.rb +44 -104
  63. data/lib/braintree/transaction/disbursement_details.rb +1 -0
  64. data/lib/braintree/transaction/{android_pay_details.rb → google_pay_details.rb} +1 -1
  65. data/lib/braintree/transaction/installment.rb +28 -0
  66. data/lib/braintree/transaction/installment/adjustment.rb +33 -0
  67. data/lib/braintree/transaction/paypal_details.rb +1 -0
  68. data/lib/braintree/transaction/subscription_details.rb +2 -0
  69. data/lib/braintree/transaction_gateway.rb +37 -25
  70. data/lib/braintree/transaction_line_item.rb +1 -1
  71. data/lib/braintree/transaction_search.rb +3 -2
  72. data/lib/braintree/unknown_payment_method.rb +1 -1
  73. data/lib/braintree/us_bank_account.rb +3 -3
  74. data/lib/braintree/us_bank_account_verification.rb +1 -1
  75. data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
  76. data/lib/braintree/util.rb +21 -6
  77. data/lib/braintree/venmo_account.rb +1 -1
  78. data/lib/braintree/version.rb +3 -3
  79. data/lib/braintree/visa_checkout_card.rb +2 -2
  80. data/lib/braintree/webhook_notification.rb +28 -29
  81. data/lib/braintree/webhook_notification_gateway.rb +5 -5
  82. data/lib/braintree/webhook_testing_gateway.rb +10 -43
  83. data/lib/braintree/xml/generator.rb +5 -4
  84. data/lib/braintree/xml/libxml.rb +1 -0
  85. data/lib/braintree/xml/parser.rb +21 -44
  86. data/spec/integration/braintree/add_on_spec.rb +1 -1
  87. data/spec/integration/braintree/address_spec.rb +26 -113
  88. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  89. data/spec/integration/braintree/apple_pay_spec.rb +3 -3
  90. data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
  91. data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
  92. data/spec/integration/braintree/client_api/spec_helper.rb +5 -31
  93. data/spec/integration/braintree/credit_card_spec.rb +130 -593
  94. data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
  95. data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
  96. data/spec/integration/braintree/customer_search_spec.rb +8 -8
  97. data/spec/integration/braintree/customer_spec.rb +336 -509
  98. data/spec/integration/braintree/dispute_search_spec.rb +6 -6
  99. data/spec/integration/braintree/dispute_spec.rb +6 -7
  100. data/spec/integration/braintree/error_codes_spec.rb +1 -1
  101. data/spec/integration/braintree/http_spec.rb +2 -2
  102. data/spec/integration/braintree/merchant_account_spec.rb +25 -26
  103. data/spec/integration/braintree/merchant_spec.rb +14 -14
  104. data/spec/integration/braintree/oauth_spec.rb +11 -11
  105. data/spec/integration/braintree/payment_method_nonce_spec.rb +12 -12
  106. data/spec/integration/braintree/payment_method_spec.rb +403 -269
  107. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +17 -13
  108. data/spec/integration/braintree/paypal_account_spec.rb +28 -28
  109. data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
  110. data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
  111. data/spec/integration/braintree/subscription_spec.rb +144 -149
  112. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  113. data/spec/integration/braintree/test_transaction_spec.rb +10 -10
  114. data/spec/integration/braintree/transaction_search_spec.rb +96 -70
  115. data/spec/integration/braintree/transaction_spec.rb +832 -904
  116. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -26
  117. data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
  118. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
  119. data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
  120. data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
  121. data/spec/integration/spec_helper.rb +10 -7
  122. data/spec/oauth_test_helper.rb +1 -1
  123. data/spec/script/httpsd.rb +6 -6
  124. data/spec/spec_helper.rb +6 -14
  125. data/spec/unit/braintree/address_spec.rb +1 -9
  126. data/spec/unit/braintree/apple_pay_card_spec.rb +1 -1
  127. data/spec/unit/braintree/client_token_spec.rb +2 -2
  128. data/spec/unit/braintree/configuration_spec.rb +42 -42
  129. data/spec/unit/braintree/credit_card_spec.rb +9 -28
  130. data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
  131. data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
  132. data/spec/unit/braintree/customer_spec.rb +5 -16
  133. data/spec/unit/braintree/disbursement_spec.rb +7 -7
  134. data/spec/unit/braintree/dispute_spec.rb +9 -20
  135. data/spec/unit/braintree/error_result_spec.rb +5 -5
  136. data/spec/unit/braintree/errors_spec.rb +8 -8
  137. data/spec/unit/braintree/http_spec.rb +8 -8
  138. data/spec/unit/braintree/merchant_account_spec.rb +1 -1
  139. data/spec/unit/braintree/payment_method_spec.rb +1 -1
  140. data/spec/unit/braintree/paypal_account_spec.rb +2 -2
  141. data/spec/unit/braintree/resource_collection_spec.rb +30 -1
  142. data/spec/unit/braintree/risk_data_spec.rb +9 -5
  143. data/spec/unit/braintree/subscription_search_spec.rb +1 -1
  144. data/spec/unit/braintree/successful_result_spec.rb +1 -1
  145. data/spec/unit/braintree/three_d_secure_info_spec.rb +32 -14
  146. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
  147. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  148. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  149. data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
  150. data/spec/unit/braintree/transaction/paypal_details_spec.rb +3 -1
  151. data/spec/unit/braintree/transaction_search_spec.rb +12 -12
  152. data/spec/unit/braintree/transaction_spec.rb +25 -51
  153. data/spec/unit/braintree/util_spec.rb +55 -21
  154. data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
  155. data/spec/unit/braintree/webhook_notification_spec.rb +73 -57
  156. data/spec/unit/braintree/xml/parser_spec.rb +21 -16
  157. data/spec/unit/braintree/xml_spec.rb +31 -31
  158. metadata +30 -31
  159. data/lib/braintree/amex_express_checkout_card.rb +0 -40
  160. data/lib/braintree/coinbase_account.rb +0 -34
  161. data/lib/braintree/europe_bank_account.rb +0 -36
  162. data/lib/braintree/europe_bank_account_gateway.rb +0 -17
  163. data/lib/braintree/ideal_payment.rb +0 -61
  164. data/lib/braintree/ideal_payment_gateway.rb +0 -19
  165. data/lib/braintree/masterpass_card.rb +0 -83
  166. data/lib/braintree/settlement_batch.rb +0 -0
  167. data/lib/braintree/transaction/amex_express_checkout_details.rb +0 -21
  168. data/lib/braintree/transaction/coinbase_details.rb +0 -16
  169. data/lib/braintree/transaction/ideal_payment_details.rb +0 -19
  170. data/lib/braintree/transaction/masterpass_card_details.rb +0 -49
  171. data/lib/braintree/transparent_redirect.rb +0 -40
  172. data/lib/braintree/transparent_redirect_gateway.rb +0 -105
  173. data/lib/braintree/xml/rexml.rb +0 -71
  174. data/spec/hacks/tcp_socket.rb +0 -18
  175. data/spec/integration/braintree/coinbase_spec.rb +0 -34
  176. data/spec/integration/braintree/masterpass_card_spec.rb +0 -97
  177. data/spec/integration/braintree/transparent_redirect_spec.rb +0 -268
  178. data/spec/unit/braintree/transparent_redirect_spec.rb +0 -223
  179. data/spec/unit/braintree/xml/rexml_spec.rb +0 -51
@@ -9,7 +9,7 @@ module Braintree
9
9
 
10
10
  lambda do
11
11
  search.credit_card_card_type.in(
12
- *Braintree::CreditCard::CardType::All
12
+ *Braintree::CreditCard::CardType::All,
13
13
  )
14
14
  end.should_not raise_error
15
15
  end
@@ -30,7 +30,7 @@ describe Braintree::CreditCardVerification do
30
30
  :cvv_response_code => "I",
31
31
  :processor_response_code => "2000",
32
32
  :processor_response_text => "Do Not Honor",
33
- :merchant_account_id => "some_id"
33
+ :merchant_account_id => "some_id",
34
34
  )
35
35
 
36
36
  verification.status.should == Braintree::CreditCardVerification::Status::Verified
@@ -44,7 +44,7 @@ describe Braintree::CreditCardVerification do
44
44
 
45
45
  it "accepts network_transaction_id" do
46
46
  verification = Braintree::CreditCardVerification._new(
47
- :network_transaction_id => "123456789012345"
47
+ :network_transaction_id => "123456789012345",
48
48
  )
49
49
  expect(verification.network_transaction_id).to eq "123456789012345"
50
50
  end
@@ -117,14 +117,18 @@ describe Braintree::CreditCardVerification do
117
117
  verification = Braintree::CreditCardVerification._new(:risk_data => {
118
118
  :id => "123",
119
119
  :decision => "WOO YOU WON $1000 dollars",
120
+ :decision_reasons => ["reason"],
120
121
  :device_data_captured => true,
121
- :fraud_service_provider => "kount"
122
+ :fraud_service_provider => "paypal_fraud_protection",
123
+ :transaction_risk_score => "12",
122
124
  })
123
125
 
124
126
  verification.risk_data.id.should == "123"
125
127
  verification.risk_data.decision.should == "WOO YOU WON $1000 dollars"
128
+ verification.risk_data.decision_reasons.should == ["reason"]
126
129
  verification.risk_data.device_data_captured.should == true
127
- verification.risk_data.fraud_service_provider.should == "kount"
130
+ verification.risk_data.fraud_service_provider.should == "paypal_fraud_protection"
131
+ verification.risk_data.transaction_risk_score.should == "12"
128
132
  end
129
133
 
130
134
  it "handles a nil risk_data" do
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
3
3
  describe Braintree::Customer do
4
4
  describe "inspect" do
5
5
  it "includes the id first" do
6
- output = Braintree::Customer._new(:gateway, {:first_name => 'Dan', :id => '1234'}).inspect
6
+ output = Braintree::Customer._new(:gateway, {:first_name => "Dan", :id => "1234"}).inspect
7
7
  output.should include("#<Braintree::Customer id: \"1234\",")
8
8
  end
9
9
 
@@ -18,7 +18,7 @@ describe Braintree::Customer do
18
18
  :phone => "802-483-5932",
19
19
  :website => "patrick.smith.com",
20
20
  :created_at => Time.now,
21
- :updated_at => Time.now
21
+ :updated_at => Time.now,
22
22
  )
23
23
  output = customer.inspect
24
24
  output.should include(%q(company: "Company"))
@@ -91,7 +91,6 @@ describe Braintree::Customer do
91
91
  :billing_address_id,
92
92
  :cardholder_name,
93
93
  :cvv,
94
- :device_session_id,
95
94
  :expiration_date,
96
95
  :expiration_month,
97
96
  :expiration_year,
@@ -99,10 +98,9 @@ describe Braintree::Customer do
99
98
  :token,
100
99
  :venmo_sdk_payment_method_code,
101
100
  :device_data,
102
- :fraud_merchant_id,
103
101
  :payment_method_nonce,
104
102
  {:external_vault=>[:network_transaction_id]},
105
- {:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type]},
103
+ {:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type, :verification_currency_iso_code]},
106
104
  {:billing_address => [
107
105
  :company,
108
106
  :country_code_alpha2,
@@ -182,7 +180,6 @@ describe Braintree::Customer do
182
180
  :billing_address_id,
183
181
  :cardholder_name,
184
182
  :cvv,
185
- :device_session_id,
186
183
  :expiration_date,
187
184
  :expiration_month,
188
185
  :expiration_year,
@@ -190,7 +187,6 @@ describe Braintree::Customer do
190
187
  :token,
191
188
  :venmo_sdk_payment_method_code,
192
189
  :device_data,
193
- :fraud_merchant_id,
194
190
  :payment_method_nonce,
195
191
  {:external_vault=>[:network_transaction_id]},
196
192
  {:options => [
@@ -201,6 +197,7 @@ describe Braintree::Customer do
201
197
  :venmo_sdk_session,
202
198
  :fail_on_duplicate_payment_method,
203
199
  :verification_account_type,
200
+ :verification_currency_iso_code,
204
201
  :update_existing_token
205
202
  ]},
206
203
  {:billing_address => [
@@ -259,14 +256,6 @@ describe Braintree::Customer do
259
256
  end
260
257
  end
261
258
 
262
- describe "self.create_from_transparent_redirect" do
263
- it "raises an exception if the query string is forged" do
264
- expect do
265
- Braintree::Customer.create_from_transparent_redirect("http_status=200&forged=query_string")
266
- end.to raise_error(Braintree::ForgedQueryString)
267
- end
268
- end
269
-
270
259
  describe "==" do
271
260
  it "returns true when given a customer with the same id" do
272
261
  first = Braintree::Customer._new(:gateway, :id => 123)
@@ -301,7 +290,7 @@ describe Braintree::Customer do
301
290
  :paypal_accounts => [
302
291
  {:token => "paypal_1"},
303
292
  {:token => "paypal_2"}
304
- ]
293
+ ],
305
294
  )
306
295
 
307
296
  customer.credit_cards.size.should == 2
@@ -28,18 +28,18 @@ describe Braintree::Disbursement do
28
28
  :exception_message => "invalid_account_number",
29
29
  :follow_up_action => "update",
30
30
  :retry => false,
31
- :success => false
31
+ :success => false,
32
32
  )
33
33
 
34
34
  disbursement.inspect.should include('id: "123456"')
35
35
  disbursement.inspect.should include('amount: "100.0"')
36
36
  disbursement.inspect.should include('exception_message: "invalid_account_number"')
37
- disbursement.inspect.should include('disbursement_date: 2013-04-10')
37
+ disbursement.inspect.should include("disbursement_date: 2013-04-10")
38
38
  disbursement.inspect.should include('follow_up_action: "update"')
39
- disbursement.inspect.should include('merchant_account: #<Braintree::MerchantAccount: ')
39
+ disbursement.inspect.should include("merchant_account: #<Braintree::MerchantAccount: ")
40
40
  disbursement.inspect.should include('transaction_ids: ["sub_merchant_transaction"]')
41
- disbursement.inspect.should include('retry: false')
42
- disbursement.inspect.should include('success: false')
41
+ disbursement.inspect.should include("retry: false")
42
+ disbursement.inspect.should include("success: false")
43
43
  end
44
44
  end
45
45
 
@@ -56,7 +56,7 @@ describe Braintree::Disbursement do
56
56
  :status => "active"
57
57
  },
58
58
  :success => false,
59
- :disbursement_date => "2013-04-10"
59
+ :disbursement_date => "2013-04-10",
60
60
  )
61
61
  disbursement.success?.should == false
62
62
 
@@ -71,7 +71,7 @@ describe Braintree::Disbursement do
71
71
  :status => "active"
72
72
  },
73
73
  :success => true,
74
- :disbursement_date => "2013-04-10"
74
+ :disbursement_date => "2013-04-10",
75
75
  )
76
76
  disbursement.success?.should == true
77
77
  end
@@ -137,13 +137,13 @@ describe Braintree::Dispute do
137
137
  it "does not raise an exception if the optional parameters are valid" do
138
138
  Braintree::Http.stub(:new).and_return double.as_null_object
139
139
  expect do
140
- Braintree::Dispute.add_file_evidence("dispute_id", { category: "GENERAL", document_id: "document_id" })
140
+ Braintree::Dispute.add_file_evidence("dispute_id", {category: "GENERAL", document_id: "document_id"})
141
141
  end.to_not raise_error
142
142
  end
143
143
 
144
144
  it "raises an exception if the optional params contain invalid keys" do
145
145
  expect do
146
- Braintree::Dispute.add_file_evidence("dispute_id", { random_param: "" })
146
+ Braintree::Dispute.add_file_evidence("dispute_id", {random_param: ""})
147
147
  end.to raise_error(ArgumentError)
148
148
  end
149
149
 
@@ -151,7 +151,7 @@ describe Braintree::Dispute do
151
151
  Braintree::Http.stub(:new).and_return double.as_null_object
152
152
 
153
153
  expect do
154
- Braintree::Dispute.add_file_evidence("dispute_id", { category: 3, document_id: "document_id" })
154
+ Braintree::Dispute.add_file_evidence("dispute_id", {category: 3, document_id: "document_id"})
155
155
  end.to raise_error(ArgumentError)
156
156
  end
157
157
  end
@@ -200,38 +200,31 @@ describe Braintree::Dispute do
200
200
  it "does not raise an exception if the optional parameters are valid" do
201
201
  Braintree::Http.stub(:new).and_return double.as_null_object
202
202
  expect do
203
- Braintree::Dispute.add_text_evidence("dispute_id", { content: "a", tag: "", sequence_number: 3 })
204
- end.to_not raise_error
205
- end
206
-
207
- it "does not raise an exception if the category parameter is provided" do
208
- Braintree::Http.stub(:new).and_return double.as_null_object
209
- expect do
210
- Braintree::Dispute.add_text_evidence("dispute_id", { content: "a", category: "", sequence_number: 3 })
203
+ Braintree::Dispute.add_text_evidence("dispute_id", {content: "a", category: "", sequence_number: 3})
211
204
  end.to_not raise_error
212
205
  end
213
206
 
214
207
  it "raises an exception if the optional params contain invalid keys" do
215
208
  expect do
216
- Braintree::Dispute.add_text_evidence("dispute_id", { random_param: "" })
209
+ Braintree::Dispute.add_text_evidence("dispute_id", {random_param: ""})
217
210
  end.to raise_error(ArgumentError)
218
211
  end
219
212
 
220
213
  it "raises an exception if sequence_number is provided and not an integer" do
221
214
  expect do
222
- Braintree::Dispute.add_text_evidence("dispute_id", { sequence_number: "abc" })
215
+ Braintree::Dispute.add_text_evidence("dispute_id", {sequence_number: "abc"})
223
216
  end.to raise_error(ArgumentError)
224
217
  end
225
218
 
226
219
  it "raises an exception if the param tag is not a string" do
227
220
  expect do
228
- Braintree::Dispute.add_text_evidence("dispute_id", { tag: 3 })
221
+ Braintree::Dispute.add_text_evidence("dispute_id", {tag: 3})
229
222
  end.to raise_error(ArgumentError)
230
223
  end
231
224
 
232
225
  it "raises an exception if the param category is not a string" do
233
226
  expect do
234
- Braintree::Dispute.add_text_evidence("dispute_id", { category: 3 })
227
+ Braintree::Dispute.add_text_evidence("dispute_id", {category: 3})
235
228
  end.to raise_error(ArgumentError)
236
229
  end
237
230
  end
@@ -327,7 +320,7 @@ describe Braintree::Dispute do
327
320
  dispute.transaction.payment_instrument_subtype.should == "Visa"
328
321
  end
329
322
 
330
- it "converts status_history hash into an array of Dispute::HistoryEvent objects" do
323
+ it "converts status_history hash into an array of Dispute::StatusHistory objects" do
331
324
  dispute = Braintree::Dispute._new(attributes)
332
325
 
333
326
  dispute.status_history.length.should == 1
@@ -398,10 +391,6 @@ describe Braintree::Dispute do
398
391
  describe "comments" do
399
392
  let(:dispute) { Braintree::Dispute._new(attributes) }
400
393
 
401
- it "#forwarded_comments returns `processor_comments`" do
402
- expect(dispute.forwarded_comments).to eq(dispute.processor_comments)
403
- end
404
-
405
394
  it "#processor_comments" do
406
395
  expect(dispute.processor_comments).to eq(attributes[:processor_comments])
407
396
  end
@@ -10,7 +10,7 @@ describe Braintree::ErrorResult do
10
10
  :params => "params",
11
11
  :errors => {:errors => []},
12
12
  :extra => "is ignored",
13
- :message => "foo bar"
13
+ :message => "foo bar",
14
14
  )
15
15
  end.to_not raise_error
16
16
  end
@@ -36,7 +36,7 @@ describe Braintree::ErrorResult do
36
36
  :params => "params",
37
37
  :errors => {},
38
38
  :verification => {},
39
- :transaction => nil
39
+ :transaction => nil,
40
40
  )
41
41
  result.inspect.should include("credit_card_verification: #<Braintree::CreditCardVerification status: ")
42
42
  end
@@ -47,7 +47,7 @@ describe Braintree::ErrorResult do
47
47
  :params => "params",
48
48
  :errors => {},
49
49
  :verification => nil,
50
- :transaction => nil
50
+ :transaction => nil,
51
51
  )
52
52
  result.inspect.should_not include("credit_card_verification")
53
53
  end
@@ -58,7 +58,7 @@ describe Braintree::ErrorResult do
58
58
  :params => "params",
59
59
  :errors => {},
60
60
  :verification => nil,
61
- :transaction => {}
61
+ :transaction => {},
62
62
  )
63
63
  result.inspect.should include("transaction: #<Braintree::Transaction id: ")
64
64
  end
@@ -69,7 +69,7 @@ describe Braintree::ErrorResult do
69
69
  :params => "params",
70
70
  :errors => {},
71
71
  :verification => nil,
72
- :transaction => nil
72
+ :transaction => nil,
73
73
  )
74
74
  result.inspect.should_not include("transaction")
75
75
  end
@@ -4,7 +4,7 @@ describe Braintree::Errors do
4
4
  describe "for" do
5
5
  it "accesses errors for the given scope" do
6
6
  errors = Braintree::Errors.new(
7
- :level1 => {:errors => [{:code => "code1", :attribute => "attr", :message => "message"}]}
7
+ :level1 => {:errors => [{:code => "code1", :attribute => "attr", :message => "message"}]},
8
8
  )
9
9
  errors.for(:level1).size.should == 1
10
10
  errors.for(:level1)[0].code.should == "code1"
@@ -12,7 +12,7 @@ describe Braintree::Errors do
12
12
 
13
13
  it "returns nil if there are no errors at the given scope" do
14
14
  errors = Braintree::Errors.new(
15
- :level1 => {:errors => [{:code => "code1", :attribute => "attr", :message => "message"}]}
15
+ :level1 => {:errors => [{:code => "code1", :attribute => "attr", :message => "message"}]},
16
16
  )
17
17
  errors.for(:no_errors_here).should == nil
18
18
  end
@@ -21,7 +21,7 @@ describe Braintree::Errors do
21
21
  describe "inspect" do
22
22
  it "is better than the default inspect" do
23
23
  errors = Braintree::Errors.new(
24
- :level1 => {:errors => [{:code => "code1", :attribute => "attr", :message => "message"}]}
24
+ :level1 => {:errors => [{:code => "code1", :attribute => "attr", :message => "message"}]},
25
25
  )
26
26
  errors.inspect.should == "#<Braintree::Errors level1:[(code1) message]>"
27
27
  end
@@ -33,7 +33,7 @@ describe Braintree::Errors do
33
33
  :level2 => {
34
34
  :errors => [{:code => "code2", :attribute => "attr2", :message => "message2"}],
35
35
  }
36
- }
36
+ },
37
37
  )
38
38
  errors.inspect.should == "#<Braintree::Errors level1:[(code1) message], level1/level2:[(code2) message2]>"
39
39
  end
@@ -48,7 +48,7 @@ describe Braintree::Errors do
48
48
  :errors => [{:code => "code3", :attribute => "attr3", :message => "message3"}],
49
49
  }
50
50
  }
51
- }
51
+ },
52
52
  )
53
53
  errors.inspect.should == "#<Braintree::Errors level1:[(code1) message], level1/level2:[(code2) message2], level1/level2/level3:[(code3) message3]>"
54
54
  end
@@ -65,7 +65,7 @@ describe Braintree::Errors do
65
65
  {:code => "3", :attribute => "attr3", :message => "message3"}
66
66
  ],
67
67
  }
68
- }
68
+ },
69
69
  )
70
70
  errors.map { |e| e.code }.sort.should == %w[1 2 3]
71
71
  end
@@ -74,7 +74,7 @@ describe Braintree::Errors do
74
74
  describe "size" do
75
75
  it "returns the number of validation errors at the first level if only has one level" do
76
76
  errors = Braintree::Errors.new(
77
- :level1 => {:errors => [{:code => "1", :attribute => "attr", :message => "message"}]}
77
+ :level1 => {:errors => [{:code => "1", :attribute => "attr", :message => "message"}]},
78
78
  )
79
79
  errors.size.should == 1
80
80
  end
@@ -89,7 +89,7 @@ describe Braintree::Errors do
89
89
  {:code => "3", :attribute => "attr3", :message => "message3"}
90
90
  ],
91
91
  }
92
- }
92
+ },
93
93
  )
94
94
  errors.size.should == 3
95
95
  end
@@ -67,7 +67,7 @@ END
67
67
  :proxy_address => "localhost",
68
68
  :proxy_port => 8080,
69
69
  :proxy_user => "user",
70
- :proxy_pass => "test"
70
+ :proxy_pass => "test",
71
71
  )
72
72
 
73
73
  http = Braintree::Http.new(config)
@@ -75,7 +75,7 @@ END
75
75
  "Net::HTTP",
76
76
  :open_timeout= => nil,
77
77
  :read_timeout= => nil,
78
- :start => nil
78
+ :start => nil,
79
79
  )
80
80
 
81
81
  Net::HTTP.should_receive(:new).with(nil, nil, "localhost", 8080, "user", "test").and_return(net_http_instance)
@@ -86,7 +86,7 @@ END
86
86
  it "accepts a partially specified proxy" do
87
87
  config = Braintree::Configuration.new(
88
88
  :proxy_address => "localhost",
89
- :proxy_port => 8080
89
+ :proxy_port => 8080,
90
90
  )
91
91
 
92
92
  http = Braintree::Http.new(config)
@@ -94,7 +94,7 @@ END
94
94
  "Net::HTTP",
95
95
  :open_timeout= => nil,
96
96
  :read_timeout= => nil,
97
- :start => nil
97
+ :start => nil,
98
98
  )
99
99
 
100
100
  Net::HTTP.should_receive(:new).with(nil, nil, "localhost", 8080, nil, nil).and_return(net_http_instance)
@@ -109,7 +109,7 @@ END
109
109
  "Net::HTTP",
110
110
  :open_timeout= => nil,
111
111
  :read_timeout= => nil,
112
- :start => nil
112
+ :start => nil,
113
113
  )
114
114
 
115
115
  Net::HTTP.should_receive(:new).with(nil, nil).and_return(net_http_instance)
@@ -130,7 +130,7 @@ END
130
130
  expect(default_headers["Accept-Encoding"]).to eq("gzip")
131
131
  expect(default_headers["Content-Type"]).to eq("application/xml")
132
132
  expect(default_headers["User-Agent"]).to match(/Braintree Ruby Gem .*/)
133
- expect(default_headers["X-ApiVersion"]).to eq("5")
133
+ expect(default_headers["X-ApiVersion"]).to eq("6")
134
134
  end
135
135
 
136
136
  it "overwrites defaults with override headers" do
@@ -144,7 +144,7 @@ END
144
144
  expect(headers["Authorization"]).to eq("token")
145
145
  expect(headers["Content-Type"]).to eq("application/xml")
146
146
  expect(headers["User-Agent"]).to match(/Braintree Ruby Gem .*/)
147
- expect(headers["X-ApiVersion"]).to eq("5")
147
+ expect(headers["X-ApiVersion"]).to eq("6")
148
148
  end
149
149
 
150
150
  it "extends default headers when new headers are specified" do
@@ -156,7 +156,7 @@ END
156
156
  expect(headers["Accept-Encoding"]).to eq("gzip")
157
157
  expect(headers["Content-Type"]).to eq("application/xml")
158
158
  expect(headers["User-Agent"]).to match(/Braintree Ruby Gem .*/)
159
- expect(headers["X-ApiVersion"]).to eq("5")
159
+ expect(headers["X-ApiVersion"]).to eq("6")
160
160
  expect(headers["New-Header"]).to eq("New Value")
161
161
  end
162
162
  end
@@ -13,7 +13,7 @@ describe Braintree::MerchantAccount do
13
13
  nil,
14
14
  :id => "merchant_account",
15
15
  :status => "active",
16
- :master_merchant_account => {:id => "master_merchant_account", :status => "active", :master_merchant_account => nil}
16
+ :master_merchant_account => {:id => "master_merchant_account", :status => "active", :master_merchant_account => nil},
17
17
  )
18
18
 
19
19
  master_merchant_account = "#<Braintree::MerchantAccount: id: \"master_merchant_account\", status: \"active\", master_merchant_account: nil>"