braintree 3.2.0 → 4.2.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 (150) hide show
  1. checksums.yaml +4 -4
  2. data/braintree.gemspec +3 -3
  3. data/lib/braintree.rb +6 -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/client_token.rb +1 -1
  11. data/lib/braintree/configuration.rb +11 -11
  12. data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
  13. data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
  14. data/lib/braintree/credit_card.rb +2 -2
  15. data/lib/braintree/credit_card_gateway.rb +14 -4
  16. data/lib/braintree/credit_card_verification.rb +5 -5
  17. data/lib/braintree/credit_card_verification_search.rb +1 -1
  18. data/lib/braintree/customer.rb +6 -4
  19. data/lib/braintree/customer_gateway.rb +2 -0
  20. data/lib/braintree/customer_search.rb +1 -1
  21. data/lib/braintree/disbursement.rb +1 -1
  22. data/lib/braintree/dispute.rb +15 -1
  23. data/lib/braintree/dispute/paypal_message.rb +15 -0
  24. data/lib/braintree/dispute_gateway.rb +2 -2
  25. data/lib/braintree/dispute_search.rb +3 -2
  26. data/lib/braintree/document_upload.rb +1 -1
  27. data/lib/braintree/error_codes.rb +10 -6
  28. data/lib/braintree/google_pay_card.rb +1 -1
  29. data/lib/braintree/granted_payment_instrument_update.rb +1 -1
  30. data/lib/braintree/graphql_client.rb +7 -7
  31. data/lib/braintree/http.rb +3 -3
  32. data/lib/braintree/local_payment_completed.rb +1 -1
  33. data/lib/braintree/local_payment_reversed.rb +19 -0
  34. data/lib/braintree/merchant.rb +1 -1
  35. data/lib/braintree/merchant_account.rb +1 -1
  36. data/lib/braintree/merchant_account_gateway.rb +1 -1
  37. data/lib/braintree/merchant_gateway.rb +1 -1
  38. data/lib/braintree/modification.rb +1 -1
  39. data/lib/braintree/oauth_credentials.rb +1 -1
  40. data/lib/braintree/oauth_gateway.rb +5 -5
  41. data/lib/braintree/payment_instrument_type.rb +10 -10
  42. data/lib/braintree/payment_method_gateway.rb +10 -7
  43. data/lib/braintree/payment_method_nonce.rb +7 -4
  44. data/lib/braintree/payment_method_nonce_details.rb +37 -0
  45. data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
  46. data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
  47. data/lib/braintree/plan.rb +1 -1
  48. data/lib/braintree/processor_response_types.rb +3 -3
  49. data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
  50. data/lib/braintree/risk_data.rb +3 -1
  51. data/lib/braintree/samsung_pay_card.rb +1 -1
  52. data/lib/braintree/settlement_batch_summary.rb +2 -2
  53. data/lib/braintree/subscription.rb +6 -6
  54. data/lib/braintree/three_d_secure_info.rb +22 -12
  55. data/lib/braintree/transaction.rb +32 -24
  56. data/lib/braintree/transaction_gateway.rb +24 -5
  57. data/lib/braintree/transaction_line_item.rb +1 -1
  58. data/lib/braintree/transaction_search.rb +3 -1
  59. data/lib/braintree/unknown_payment_method.rb +1 -1
  60. data/lib/braintree/us_bank_account.rb +3 -3
  61. data/lib/braintree/us_bank_account_verification.rb +1 -1
  62. data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
  63. data/lib/braintree/util.rb +4 -4
  64. data/lib/braintree/venmo_account.rb +1 -1
  65. data/lib/braintree/version.rb +1 -1
  66. data/lib/braintree/visa_checkout_card.rb +2 -2
  67. data/lib/braintree/webhook_notification.rb +30 -20
  68. data/lib/braintree/webhook_notification_gateway.rb +5 -5
  69. data/lib/braintree/webhook_testing_gateway.rb +30 -0
  70. data/lib/braintree/xml/generator.rb +5 -4
  71. data/lib/braintree/xml/libxml.rb +0 -1
  72. data/lib/braintree/xml/parser.rb +22 -12
  73. data/lib/braintree/xml/rexml.rb +70 -0
  74. data/spec/integration/braintree/add_on_spec.rb +1 -1
  75. data/spec/integration/braintree/address_spec.rb +28 -24
  76. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  77. data/spec/integration/braintree/apple_pay_spec.rb +3 -3
  78. data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
  79. data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
  80. data/spec/integration/braintree/client_api/spec_helper.rb +5 -5
  81. data/spec/integration/braintree/credit_card_spec.rb +213 -122
  82. data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
  83. data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
  84. data/spec/integration/braintree/customer_search_spec.rb +8 -8
  85. data/spec/integration/braintree/customer_spec.rb +282 -165
  86. data/spec/integration/braintree/dispute_search_spec.rb +28 -3
  87. data/spec/integration/braintree/dispute_spec.rb +6 -6
  88. data/spec/integration/braintree/error_codes_spec.rb +1 -1
  89. data/spec/integration/braintree/http_spec.rb +2 -2
  90. data/spec/integration/braintree/merchant_account_spec.rb +25 -26
  91. data/spec/integration/braintree/merchant_spec.rb +14 -14
  92. data/spec/integration/braintree/oauth_spec.rb +11 -11
  93. data/spec/integration/braintree/payment_method_nonce_spec.rb +28 -35
  94. data/spec/integration/braintree/payment_method_spec.rb +269 -165
  95. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +9 -9
  96. data/spec/integration/braintree/paypal_account_spec.rb +28 -28
  97. data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
  98. data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
  99. data/spec/integration/braintree/subscription_spec.rb +133 -133
  100. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  101. data/spec/integration/braintree/test_transaction_spec.rb +10 -10
  102. data/spec/integration/braintree/transaction_search_spec.rb +93 -67
  103. data/spec/integration/braintree/transaction_spec.rb +574 -360
  104. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +20 -20
  105. data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
  106. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
  107. data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
  108. data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
  109. data/spec/integration/spec_helper.rb +9 -3
  110. data/spec/oauth_test_helper.rb +1 -1
  111. data/spec/script/httpsd.rb +6 -6
  112. data/spec/spec_helper.rb +6 -3
  113. data/spec/unit/braintree/address_spec.rb +1 -1
  114. data/spec/unit/braintree/apple_pay_card_spec.rb +1 -1
  115. data/spec/unit/braintree/client_token_spec.rb +2 -2
  116. data/spec/unit/braintree/configuration_spec.rb +42 -42
  117. data/spec/unit/braintree/credit_card_spec.rb +13 -13
  118. data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
  119. data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
  120. data/spec/unit/braintree/customer_spec.rb +20 -10
  121. data/spec/unit/braintree/disbursement_spec.rb +7 -7
  122. data/spec/unit/braintree/dispute_search_spec.rb +1 -0
  123. data/spec/unit/braintree/dispute_spec.rb +34 -9
  124. data/spec/unit/braintree/error_result_spec.rb +5 -5
  125. data/spec/unit/braintree/errors_spec.rb +8 -8
  126. data/spec/unit/braintree/http_spec.rb +5 -5
  127. data/spec/unit/braintree/merchant_account_spec.rb +1 -1
  128. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
  129. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +43 -0
  130. data/spec/unit/braintree/payment_method_nonce_spec.rb +40 -0
  131. data/spec/unit/braintree/payment_method_spec.rb +1 -1
  132. data/spec/unit/braintree/paypal_account_spec.rb +2 -2
  133. data/spec/unit/braintree/resource_collection_spec.rb +9 -9
  134. data/spec/unit/braintree/risk_data_spec.rb +9 -5
  135. data/spec/unit/braintree/subscription_search_spec.rb +1 -1
  136. data/spec/unit/braintree/successful_result_spec.rb +1 -1
  137. data/spec/unit/braintree/three_d_secure_info_spec.rb +32 -14
  138. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
  139. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  140. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  141. data/spec/unit/braintree/transaction/paypal_details_spec.rb +1 -1
  142. data/spec/unit/braintree/transaction_search_spec.rb +12 -12
  143. data/spec/unit/braintree/transaction_spec.rb +25 -17
  144. data/spec/unit/braintree/util_spec.rb +18 -18
  145. data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
  146. data/spec/unit/braintree/webhook_notification_spec.rb +88 -56
  147. data/spec/unit/braintree/xml/rexml_spec.rb +51 -0
  148. data/spec/unit/braintree/xml_spec.rb +31 -31
  149. metadata +16 -8
  150. 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.2.0
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braintree
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-25 00:00:00.000000000 Z
11
+ date: 2021-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.2.4
27
27
  - !ruby/object:Gem::Dependency
28
- name: libxml-ruby
28
+ name: rexml
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 3.2.0
33
+ version: 3.1.9
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 3.2.0
40
+ version: 3.1.9
41
41
  description: Resources and tools for developers to integrate Braintree's global payments
42
42
  platform.
43
43
  email: code@getbraintree.com
@@ -84,6 +84,7 @@ files:
84
84
  - lib/braintree/discount_gateway.rb
85
85
  - lib/braintree/dispute.rb
86
86
  - lib/braintree/dispute/evidence.rb
87
+ - lib/braintree/dispute/paypal_message.rb
87
88
  - lib/braintree/dispute/status_history.rb
88
89
  - lib/braintree/dispute/transaction.rb
89
90
  - lib/braintree/dispute/transaction_details.rb
@@ -103,6 +104,7 @@ files:
103
104
  - lib/braintree/graphql_client.rb
104
105
  - lib/braintree/http.rb
105
106
  - lib/braintree/local_payment_completed.rb
107
+ - lib/braintree/local_payment_reversed.rb
106
108
  - lib/braintree/merchant.rb
107
109
  - lib/braintree/merchant_account.rb
108
110
  - lib/braintree/merchant_account/address_details.rb
@@ -120,6 +122,8 @@ files:
120
122
  - lib/braintree/payment_method.rb
121
123
  - lib/braintree/payment_method_gateway.rb
122
124
  - lib/braintree/payment_method_nonce.rb
125
+ - lib/braintree/payment_method_nonce_details.rb
126
+ - lib/braintree/payment_method_nonce_details_payer_info.rb
123
127
  - lib/braintree/payment_method_nonce_gateway.rb
124
128
  - lib/braintree/payment_method_parser.rb
125
129
  - lib/braintree/paypal_account.rb
@@ -131,7 +135,6 @@ files:
131
135
  - lib/braintree/revoked_payment_method_metadata.rb
132
136
  - lib/braintree/risk_data.rb
133
137
  - lib/braintree/samsung_pay_card.rb
134
- - lib/braintree/settlement_batch.rb
135
138
  - lib/braintree/settlement_batch_summary.rb
136
139
  - lib/braintree/settlement_batch_summary_gateway.rb
137
140
  - lib/braintree/sha256_digest.rb
@@ -192,6 +195,7 @@ files:
192
195
  - lib/braintree/xml/generator.rb
193
196
  - lib/braintree/xml/libxml.rb
194
197
  - lib/braintree/xml/parser.rb
198
+ - lib/braintree/xml/rexml.rb
195
199
  - lib/ssl/api_braintreegateway_com.ca.crt
196
200
  - lib/ssl/securetrust_ca.crt
197
201
  - spec/fixtures/files/bt_logo.png
@@ -268,6 +272,9 @@ files:
268
272
  - spec/unit/braintree/local_payment_completed_spec.rb
269
273
  - spec/unit/braintree/merchant_account_spec.rb
270
274
  - spec/unit/braintree/modification_spec.rb
275
+ - spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb
276
+ - spec/unit/braintree/payment_method_nonce_details_spec.rb
277
+ - spec/unit/braintree/payment_method_nonce_spec.rb
271
278
  - spec/unit/braintree/payment_method_spec.rb
272
279
  - spec/unit/braintree/paypal_account_spec.rb
273
280
  - spec/unit/braintree/resource_collection_spec.rb
@@ -295,6 +302,7 @@ files:
295
302
  - spec/unit/braintree/webhook_notification_spec.rb
296
303
  - spec/unit/braintree/xml/libxml_spec.rb
297
304
  - spec/unit/braintree/xml/parser_spec.rb
305
+ - spec/unit/braintree/xml/rexml_spec.rb
298
306
  - spec/unit/braintree/xml_spec.rb
299
307
  - spec/unit/braintree_spec.rb
300
308
  - spec/unit/spec_helper.rb
@@ -314,14 +322,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
314
322
  requirements:
315
323
  - - ">="
316
324
  - !ruby/object:Gem::Version
317
- version: 2.5.0
325
+ version: 2.6.0
318
326
  required_rubygems_version: !ruby/object:Gem::Requirement
319
327
  requirements:
320
328
  - - ">="
321
329
  - !ruby/object:Gem::Version
322
330
  version: '0'
323
331
  requirements: []
324
- rubygems_version: 3.0.8
332
+ rubygems_version: 3.2.20
325
333
  signing_key:
326
334
  specification_version: 4
327
335
  summary: Braintree Ruby Server SDK
File without changes