braintree 3.0.1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/braintree.gemspec +2 -3
  3. data/lib/braintree.rb +8 -1
  4. data/lib/braintree/account_updater_daily_report.rb +1 -1
  5. data/lib/braintree/address.rb +2 -1
  6. data/lib/braintree/apple_pay.rb +1 -1
  7. data/lib/braintree/apple_pay_card.rb +1 -1
  8. data/lib/braintree/apple_pay_options.rb +1 -1
  9. data/lib/braintree/authorization_adjustment.rb +1 -1
  10. data/lib/braintree/bin_data.rb +9 -2
  11. data/lib/braintree/client_token.rb +1 -1
  12. data/lib/braintree/configuration.rb +11 -11
  13. data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
  14. data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
  15. data/lib/braintree/credit_card.rb +2 -2
  16. data/lib/braintree/credit_card_gateway.rb +4 -4
  17. data/lib/braintree/credit_card_verification.rb +5 -5
  18. data/lib/braintree/credit_card_verification_search.rb +1 -1
  19. data/lib/braintree/customer.rb +6 -4
  20. data/lib/braintree/customer_gateway.rb +2 -0
  21. data/lib/braintree/customer_search.rb +1 -1
  22. data/lib/braintree/disbursement.rb +1 -1
  23. data/lib/braintree/dispute.rb +15 -1
  24. data/lib/braintree/dispute/paypal_message.rb +15 -0
  25. data/lib/braintree/dispute_gateway.rb +2 -2
  26. data/lib/braintree/dispute_search.rb +3 -2
  27. data/lib/braintree/document_upload.rb +1 -1
  28. data/lib/braintree/error_codes.rb +10 -2
  29. data/lib/braintree/google_pay_card.rb +1 -1
  30. data/lib/braintree/granted_payment_instrument_update.rb +1 -1
  31. data/lib/braintree/graphql_client.rb +7 -7
  32. data/lib/braintree/http.rb +3 -3
  33. data/lib/braintree/local_payment_completed.rb +1 -1
  34. data/lib/braintree/local_payment_reversed.rb +19 -0
  35. data/lib/braintree/merchant.rb +1 -1
  36. data/lib/braintree/merchant_account.rb +1 -1
  37. data/lib/braintree/merchant_account_gateway.rb +1 -1
  38. data/lib/braintree/merchant_gateway.rb +1 -1
  39. data/lib/braintree/modification.rb +1 -1
  40. data/lib/braintree/oauth_credentials.rb +1 -1
  41. data/lib/braintree/oauth_gateway.rb +5 -5
  42. data/lib/braintree/payment_instrument_type.rb +10 -10
  43. data/lib/braintree/payment_method_gateway.rb +4 -6
  44. data/lib/braintree/payment_method_nonce.rb +1 -1
  45. data/lib/braintree/payment_method_nonce_details.rb +37 -0
  46. data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
  47. data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
  48. data/lib/braintree/plan.rb +1 -1
  49. data/lib/braintree/processor_response_types.rb +3 -3
  50. data/lib/braintree/resource_collection.rb +8 -3
  51. data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
  52. data/lib/braintree/risk_data.rb +3 -1
  53. data/lib/braintree/samsung_pay_card.rb +1 -1
  54. data/lib/braintree/settlement_batch_summary.rb +2 -2
  55. data/lib/braintree/subscription.rb +6 -6
  56. data/lib/braintree/test/credit_card.rb +1 -0
  57. data/lib/braintree/three_d_secure_info.rb +22 -12
  58. data/lib/braintree/transaction.rb +43 -26
  59. data/lib/braintree/transaction/installment.rb +28 -0
  60. data/lib/braintree/transaction/installment/adjustment.rb +33 -0
  61. data/lib/braintree/transaction/paypal_details.rb +1 -0
  62. data/lib/braintree/transaction_gateway.rb +26 -5
  63. data/lib/braintree/transaction_line_item.rb +1 -1
  64. data/lib/braintree/transaction_search.rb +3 -1
  65. data/lib/braintree/unknown_payment_method.rb +1 -1
  66. data/lib/braintree/us_bank_account.rb +3 -3
  67. data/lib/braintree/us_bank_account_verification.rb +1 -1
  68. data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
  69. data/lib/braintree/util.rb +4 -4
  70. data/lib/braintree/venmo_account.rb +1 -1
  71. data/lib/braintree/version.rb +2 -2
  72. data/lib/braintree/visa_checkout_card.rb +2 -2
  73. data/lib/braintree/webhook_notification.rb +28 -19
  74. data/lib/braintree/webhook_notification_gateway.rb +5 -5
  75. data/lib/braintree/webhook_testing_gateway.rb +10 -0
  76. data/lib/braintree/xml/generator.rb +5 -4
  77. data/lib/braintree/xml/libxml.rb +0 -1
  78. data/lib/braintree/xml/parser.rb +22 -12
  79. data/lib/braintree/xml/rexml.rb +70 -0
  80. data/spec/integration/braintree/add_on_spec.rb +1 -1
  81. data/spec/integration/braintree/address_spec.rb +28 -24
  82. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  83. data/spec/integration/braintree/apple_pay_spec.rb +3 -3
  84. data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
  85. data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
  86. data/spec/integration/braintree/client_api/spec_helper.rb +5 -5
  87. data/spec/integration/braintree/credit_card_spec.rb +124 -122
  88. data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
  89. data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
  90. data/spec/integration/braintree/customer_search_spec.rb +8 -8
  91. data/spec/integration/braintree/customer_spec.rb +343 -149
  92. data/spec/integration/braintree/dispute_search_spec.rb +29 -4
  93. data/spec/integration/braintree/dispute_spec.rb +6 -6
  94. data/spec/integration/braintree/error_codes_spec.rb +1 -1
  95. data/spec/integration/braintree/http_spec.rb +2 -2
  96. data/spec/integration/braintree/merchant_account_spec.rb +25 -26
  97. data/spec/integration/braintree/merchant_spec.rb +14 -14
  98. data/spec/integration/braintree/oauth_spec.rb +11 -11
  99. data/spec/integration/braintree/payment_method_nonce_spec.rb +26 -35
  100. data/spec/integration/braintree/payment_method_spec.rb +326 -149
  101. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +17 -13
  102. data/spec/integration/braintree/paypal_account_spec.rb +28 -28
  103. data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
  104. data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
  105. data/spec/integration/braintree/subscription_spec.rb +133 -133
  106. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  107. data/spec/integration/braintree/test_transaction_spec.rb +10 -10
  108. data/spec/integration/braintree/transaction_search_spec.rb +93 -67
  109. data/spec/integration/braintree/transaction_spec.rb +736 -380
  110. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -26
  111. data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
  112. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
  113. data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
  114. data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
  115. data/spec/integration/spec_helper.rb +9 -3
  116. data/spec/oauth_test_helper.rb +1 -1
  117. data/spec/script/httpsd.rb +6 -6
  118. data/spec/spec_helper.rb +6 -3
  119. data/spec/unit/braintree/address_spec.rb +1 -1
  120. data/spec/unit/braintree/apple_pay_card_spec.rb +1 -1
  121. data/spec/unit/braintree/client_token_spec.rb +2 -2
  122. data/spec/unit/braintree/configuration_spec.rb +42 -42
  123. data/spec/unit/braintree/credit_card_spec.rb +9 -9
  124. data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
  125. data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
  126. data/spec/unit/braintree/customer_spec.rb +14 -4
  127. data/spec/unit/braintree/disbursement_spec.rb +7 -7
  128. data/spec/unit/braintree/dispute_search_spec.rb +1 -0
  129. data/spec/unit/braintree/dispute_spec.rb +34 -9
  130. data/spec/unit/braintree/error_result_spec.rb +5 -5
  131. data/spec/unit/braintree/errors_spec.rb +8 -8
  132. data/spec/unit/braintree/http_spec.rb +5 -5
  133. data/spec/unit/braintree/merchant_account_spec.rb +1 -1
  134. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
  135. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +43 -0
  136. data/spec/unit/braintree/payment_method_spec.rb +1 -1
  137. data/spec/unit/braintree/paypal_account_spec.rb +2 -2
  138. data/spec/unit/braintree/resource_collection_spec.rb +30 -1
  139. data/spec/unit/braintree/risk_data_spec.rb +9 -5
  140. data/spec/unit/braintree/subscription_search_spec.rb +1 -1
  141. data/spec/unit/braintree/successful_result_spec.rb +1 -1
  142. data/spec/unit/braintree/three_d_secure_info_spec.rb +32 -14
  143. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
  144. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  145. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  146. data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
  147. data/spec/unit/braintree/transaction/paypal_details_spec.rb +3 -1
  148. data/spec/unit/braintree/transaction_search_spec.rb +12 -12
  149. data/spec/unit/braintree/transaction_spec.rb +25 -17
  150. data/spec/unit/braintree/util_spec.rb +18 -18
  151. data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
  152. data/spec/unit/braintree/webhook_notification_spec.rb +72 -56
  153. data/spec/unit/braintree/xml/rexml_spec.rb +51 -0
  154. data/spec/unit/braintree/xml_spec.rb +31 -31
  155. metadata +15 -19
  156. data/lib/braintree/settlement_batch.rb +0 -0
@@ -0,0 +1,51 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
2
+
3
+ describe Braintree::Xml::Rexml do
4
+ describe "self.parse" do
5
+ it "typecasts integers" do
6
+ xml = "<root><foo type=\"integer\">123</foo></root>"
7
+ Braintree::Xml::Rexml.parse(xml).should == {"root"=>{"foo"=>{"__content__"=>"123", "type"=>"integer"}}}
8
+ end
9
+
10
+ it "works with dashes or underscores" do
11
+ xml = <<-END
12
+ <root>
13
+ <dash-es />
14
+ <under_scores />
15
+ </root>
16
+ END
17
+ Braintree::Xml::Rexml.parse(xml).should == {"root"=>{"dash-es"=>{}, "under_scores"=>{}}}
18
+ end
19
+
20
+ it "uses nil if nil=true, otherwise uses empty string" do
21
+ xml = <<-END
22
+ <root>
23
+ <a_nil_value nil="true"></a_nil_value>
24
+ <an_empty_string></an_empty_string>
25
+ </root>
26
+ END
27
+ Braintree::Xml::Rexml.parse(xml).should == {"root"=>{"a_nil_value"=>{"nil"=>"true"}, "an_empty_string"=>{}}}
28
+ end
29
+
30
+ it "typecasts dates and times" do
31
+ xml = <<-END
32
+ <root>
33
+ <created-at type="datetime">2009-10-28T10:19:49Z</created-at>
34
+ </root>
35
+ END
36
+ Braintree::Xml::Rexml.parse(xml).should == {"root"=>{"created-at"=>{"__content__"=>"2009-10-28T10:19:49Z", "type"=>"datetime"}}}
37
+ end
38
+
39
+ it "builds an array if type=array" do
40
+ xml = <<-END
41
+ <root>
42
+ <customers type="array">
43
+ <customer><name>Adam</name></customer>
44
+ <customer><name>Ben</name></customer>
45
+ </customers>
46
+ </root>
47
+ END
48
+ Braintree::Xml::Rexml.parse(xml).should == {"root"=>{"customers"=>{"type"=>"array", "customer"=>[{"name"=>{"__content__"=>"Adam"}}, {"name"=>{"__content__"=>"Ben"}}]}}}
49
+ end
50
+ end
51
+ end
@@ -99,34 +99,34 @@ describe Braintree::Xml do
99
99
  verify_to_xml_and_back hash
100
100
  end
101
101
 
102
- context "Integer" do
103
- it "works for integers" do
104
- hash = { :root => {:foo => 1 } }
105
- Braintree::Xml.hash_to_xml(hash).should include("<foo type=\"integer\">1</foo>")
106
- end
107
- end
108
-
109
- context "BigDecimal" do
110
- it "works for BigDecimals" do
111
- hash = {:root => {:foo => BigDecimal("123.45")}}
112
- Braintree::Xml.hash_to_xml(hash).should include("<foo>123.45</foo>")
113
- end
114
-
115
- it "works for BigDecimals with fewer than 2 digits" do
116
- hash = {:root => {:foo => BigDecimal("1000.0")}}
117
- Braintree::Xml.hash_to_xml(hash).should include("<foo>1000.00</foo>")
118
- end
119
-
120
- it "works for BigDecimals with more than 2 digits" do
121
- hash = {:root => {:foo => BigDecimal("12.345")}}
122
- Braintree::Xml.hash_to_xml(hash).should include("<foo>12.345</foo>")
123
- end
124
- end
125
-
126
- it "works for symbols" do
127
- hash = {:root => {:foo => :bar}}
128
- Braintree::Xml.hash_to_xml(hash).should include("<foo>bar</foo>")
129
- end
102
+ context "Integer" do
103
+ it "works for integers" do
104
+ hash = {:root => {:foo => 1}}
105
+ Braintree::Xml.hash_to_xml(hash).should include("<foo type=\"integer\">1</foo>")
106
+ end
107
+ end
108
+
109
+ context "BigDecimal" do
110
+ it "works for BigDecimals" do
111
+ hash = {:root => {:foo => BigDecimal("123.45")}}
112
+ Braintree::Xml.hash_to_xml(hash).should include("<foo>123.45</foo>")
113
+ end
114
+
115
+ it "works for BigDecimals with fewer than 2 digits" do
116
+ hash = {:root => {:foo => BigDecimal("1000.0")}}
117
+ Braintree::Xml.hash_to_xml(hash).should include("<foo>1000.00</foo>")
118
+ end
119
+
120
+ it "works for BigDecimals with more than 2 digits" do
121
+ hash = {:root => {:foo => BigDecimal("12.345")}}
122
+ Braintree::Xml.hash_to_xml(hash).should include("<foo>12.345</foo>")
123
+ end
124
+ end
125
+
126
+ it "works for symbols" do
127
+ hash = {:root => {:foo => :bar}}
128
+ Braintree::Xml.hash_to_xml(hash).should include("<foo>bar</foo>")
129
+ end
130
130
 
131
131
  it "type casts booleans" do
132
132
  hash = {:root => {:string_true => "true", :bool_true => true, :bool_false => false, :string_false => "false"}}
@@ -154,13 +154,13 @@ describe Braintree::Xml do
154
154
  end
155
155
 
156
156
  it "escapes keys and values" do
157
- hash = { "ke<y" => "val>ue" }
157
+ hash = {"ke<y" => "val>ue"}
158
158
  Braintree::Xml.hash_to_xml(hash).should include("<ke&lt;y>val&gt;ue</ke&lt;y>")
159
159
  end
160
160
 
161
161
  it "escapes nested keys and values" do
162
- hash = { "top<" => { "ke<y" => "val>ue" } }
163
- Braintree::Xml.hash_to_xml(hash).gsub(/\s/, '').should include("<top&lt;><ke&lt;y>val&gt;ue</ke&lt;y></top&lt;>")
162
+ hash = {"top<" => {"ke<y" => "val>ue"}}
163
+ Braintree::Xml.hash_to_xml(hash).gsub(/\s/, "").should include("<top&lt;><ke&lt;y>val&gt;ue</ke&lt;y></top&lt;>")
164
164
  end
165
165
  end
166
166
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braintree
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braintree
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-19 00:00:00.000000000 Z
11
+ date: 2021-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.2.4
27
- - !ruby/object:Gem::Dependency
28
- name: libxml-ruby
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 3.2.0
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: 3.2.0
41
27
  description: Resources and tools for developers to integrate Braintree's global payments
42
28
  platform.
43
29
  email: code@getbraintree.com
@@ -84,6 +70,7 @@ files:
84
70
  - lib/braintree/discount_gateway.rb
85
71
  - lib/braintree/dispute.rb
86
72
  - lib/braintree/dispute/evidence.rb
73
+ - lib/braintree/dispute/paypal_message.rb
87
74
  - lib/braintree/dispute/status_history.rb
88
75
  - lib/braintree/dispute/transaction.rb
89
76
  - lib/braintree/dispute/transaction_details.rb
@@ -103,6 +90,7 @@ files:
103
90
  - lib/braintree/graphql_client.rb
104
91
  - lib/braintree/http.rb
105
92
  - lib/braintree/local_payment_completed.rb
93
+ - lib/braintree/local_payment_reversed.rb
106
94
  - lib/braintree/merchant.rb
107
95
  - lib/braintree/merchant_account.rb
108
96
  - lib/braintree/merchant_account/address_details.rb
@@ -120,6 +108,8 @@ files:
120
108
  - lib/braintree/payment_method.rb
121
109
  - lib/braintree/payment_method_gateway.rb
122
110
  - lib/braintree/payment_method_nonce.rb
111
+ - lib/braintree/payment_method_nonce_details.rb
112
+ - lib/braintree/payment_method_nonce_details_payer_info.rb
123
113
  - lib/braintree/payment_method_nonce_gateway.rb
124
114
  - lib/braintree/payment_method_parser.rb
125
115
  - lib/braintree/paypal_account.rb
@@ -131,7 +121,6 @@ files:
131
121
  - lib/braintree/revoked_payment_method_metadata.rb
132
122
  - lib/braintree/risk_data.rb
133
123
  - lib/braintree/samsung_pay_card.rb
134
- - lib/braintree/settlement_batch.rb
135
124
  - lib/braintree/settlement_batch_summary.rb
136
125
  - lib/braintree/settlement_batch_summary_gateway.rb
137
126
  - lib/braintree/sha256_digest.rb
@@ -157,6 +146,8 @@ files:
157
146
  - lib/braintree/transaction/customer_details.rb
158
147
  - lib/braintree/transaction/disbursement_details.rb
159
148
  - lib/braintree/transaction/google_pay_details.rb
149
+ - lib/braintree/transaction/installment.rb
150
+ - lib/braintree/transaction/installment/adjustment.rb
160
151
  - lib/braintree/transaction/local_payment_details.rb
161
152
  - lib/braintree/transaction/paypal_details.rb
162
153
  - lib/braintree/transaction/paypal_here_details.rb
@@ -190,6 +181,7 @@ files:
190
181
  - lib/braintree/xml/generator.rb
191
182
  - lib/braintree/xml/libxml.rb
192
183
  - lib/braintree/xml/parser.rb
184
+ - lib/braintree/xml/rexml.rb
193
185
  - lib/ssl/api_braintreegateway_com.ca.crt
194
186
  - lib/ssl/securetrust_ca.crt
195
187
  - spec/fixtures/files/bt_logo.png
@@ -266,6 +258,8 @@ files:
266
258
  - spec/unit/braintree/local_payment_completed_spec.rb
267
259
  - spec/unit/braintree/merchant_account_spec.rb
268
260
  - spec/unit/braintree/modification_spec.rb
261
+ - spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb
262
+ - spec/unit/braintree/payment_method_nonce_details_spec.rb
269
263
  - spec/unit/braintree/payment_method_spec.rb
270
264
  - spec/unit/braintree/paypal_account_spec.rb
271
265
  - spec/unit/braintree/resource_collection_spec.rb
@@ -279,6 +273,7 @@ files:
279
273
  - spec/unit/braintree/transaction/credit_card_details_spec.rb
280
274
  - spec/unit/braintree/transaction/customer_details_spec.rb
281
275
  - spec/unit/braintree/transaction/deposit_details_spec.rb
276
+ - spec/unit/braintree/transaction/installment_spec.rb
282
277
  - spec/unit/braintree/transaction/paypal_details_spec.rb
283
278
  - spec/unit/braintree/transaction_search_spec.rb
284
279
  - spec/unit/braintree/transaction_spec.rb
@@ -292,6 +287,7 @@ files:
292
287
  - spec/unit/braintree/webhook_notification_spec.rb
293
288
  - spec/unit/braintree/xml/libxml_spec.rb
294
289
  - spec/unit/braintree/xml/parser_spec.rb
290
+ - spec/unit/braintree/xml/rexml_spec.rb
295
291
  - spec/unit/braintree/xml_spec.rb
296
292
  - spec/unit/braintree_spec.rb
297
293
  - spec/unit/spec_helper.rb
@@ -311,14 +307,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
311
307
  requirements:
312
308
  - - ">="
313
309
  - !ruby/object:Gem::Version
314
- version: 2.5.0
310
+ version: 2.6.0
315
311
  required_rubygems_version: !ruby/object:Gem::Requirement
316
312
  requirements:
317
313
  - - ">="
318
314
  - !ruby/object:Gem::Version
319
315
  version: '0'
320
316
  requirements: []
321
- rubygems_version: 3.0.8
317
+ rubygems_version: 3.2.17
322
318
  signing_key:
323
319
  specification_version: 4
324
320
  summary: Braintree Ruby Server SDK
File without changes