braintree 3.1.0 → 4.1.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 (154) hide show
  1. checksums.yaml +4 -4
  2. data/braintree.gemspec +3 -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/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 +12 -4
  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 +11 -8
  43. data/lib/braintree/payment_method_nonce.rb +1 -1
  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/resource_collection.rb +8 -3
  50. data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
  51. data/lib/braintree/risk_data.rb +3 -1
  52. data/lib/braintree/samsung_pay_card.rb +1 -1
  53. data/lib/braintree/settlement_batch_summary.rb +2 -2
  54. data/lib/braintree/subscription.rb +6 -6
  55. data/lib/braintree/test/credit_card.rb +1 -0
  56. data/lib/braintree/three_d_secure_info.rb +22 -12
  57. data/lib/braintree/transaction.rb +40 -24
  58. data/lib/braintree/transaction/installment.rb +28 -0
  59. data/lib/braintree/transaction/installment/adjustment.rb +33 -0
  60. data/lib/braintree/transaction_gateway.rb +27 -6
  61. data/lib/braintree/transaction_line_item.rb +1 -1
  62. data/lib/braintree/transaction_search.rb +3 -1
  63. data/lib/braintree/unknown_payment_method.rb +1 -1
  64. data/lib/braintree/us_bank_account.rb +3 -3
  65. data/lib/braintree/us_bank_account_verification.rb +1 -1
  66. data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
  67. data/lib/braintree/util.rb +4 -4
  68. data/lib/braintree/venmo_account.rb +1 -1
  69. data/lib/braintree/version.rb +1 -1
  70. data/lib/braintree/visa_checkout_card.rb +2 -2
  71. data/lib/braintree/webhook_notification.rb +30 -20
  72. data/lib/braintree/webhook_notification_gateway.rb +5 -5
  73. data/lib/braintree/webhook_testing_gateway.rb +30 -0
  74. data/lib/braintree/xml/generator.rb +5 -4
  75. data/lib/braintree/xml/libxml.rb +0 -1
  76. data/lib/braintree/xml/parser.rb +22 -12
  77. data/lib/braintree/xml/rexml.rb +70 -0
  78. data/spec/integration/braintree/add_on_spec.rb +1 -1
  79. data/spec/integration/braintree/address_spec.rb +28 -24
  80. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  81. data/spec/integration/braintree/apple_pay_spec.rb +3 -3
  82. data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
  83. data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
  84. data/spec/integration/braintree/client_api/spec_helper.rb +5 -5
  85. data/spec/integration/braintree/credit_card_spec.rb +213 -122
  86. data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
  87. data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
  88. data/spec/integration/braintree/customer_search_spec.rb +8 -8
  89. data/spec/integration/braintree/customer_spec.rb +433 -149
  90. data/spec/integration/braintree/dispute_search_spec.rb +28 -3
  91. data/spec/integration/braintree/dispute_spec.rb +6 -6
  92. data/spec/integration/braintree/error_codes_spec.rb +1 -1
  93. data/spec/integration/braintree/http_spec.rb +2 -2
  94. data/spec/integration/braintree/merchant_account_spec.rb +25 -26
  95. data/spec/integration/braintree/merchant_spec.rb +14 -14
  96. data/spec/integration/braintree/oauth_spec.rb +11 -11
  97. data/spec/integration/braintree/payment_method_nonce_spec.rb +26 -35
  98. data/spec/integration/braintree/payment_method_spec.rb +430 -149
  99. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +17 -13
  100. data/spec/integration/braintree/paypal_account_spec.rb +28 -28
  101. data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
  102. data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
  103. data/spec/integration/braintree/subscription_spec.rb +133 -133
  104. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  105. data/spec/integration/braintree/test_transaction_spec.rb +10 -10
  106. data/spec/integration/braintree/transaction_search_spec.rb +93 -67
  107. data/spec/integration/braintree/transaction_spec.rb +752 -383
  108. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -26
  109. data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
  110. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
  111. data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
  112. data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
  113. data/spec/integration/spec_helper.rb +9 -3
  114. data/spec/oauth_test_helper.rb +1 -1
  115. data/spec/script/httpsd.rb +6 -6
  116. data/spec/spec_helper.rb +6 -3
  117. data/spec/unit/braintree/address_spec.rb +1 -1
  118. data/spec/unit/braintree/apple_pay_card_spec.rb +1 -1
  119. data/spec/unit/braintree/client_token_spec.rb +2 -2
  120. data/spec/unit/braintree/configuration_spec.rb +42 -42
  121. data/spec/unit/braintree/credit_card_spec.rb +13 -13
  122. data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
  123. data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
  124. data/spec/unit/braintree/customer_spec.rb +21 -10
  125. data/spec/unit/braintree/disbursement_spec.rb +7 -7
  126. data/spec/unit/braintree/dispute_search_spec.rb +1 -0
  127. data/spec/unit/braintree/dispute_spec.rb +34 -9
  128. data/spec/unit/braintree/error_result_spec.rb +5 -5
  129. data/spec/unit/braintree/errors_spec.rb +8 -8
  130. data/spec/unit/braintree/http_spec.rb +5 -5
  131. data/spec/unit/braintree/merchant_account_spec.rb +1 -1
  132. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
  133. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +43 -0
  134. data/spec/unit/braintree/payment_method_spec.rb +1 -1
  135. data/spec/unit/braintree/paypal_account_spec.rb +2 -2
  136. data/spec/unit/braintree/resource_collection_spec.rb +30 -1
  137. data/spec/unit/braintree/risk_data_spec.rb +9 -5
  138. data/spec/unit/braintree/subscription_search_spec.rb +1 -1
  139. data/spec/unit/braintree/successful_result_spec.rb +1 -1
  140. data/spec/unit/braintree/three_d_secure_info_spec.rb +32 -14
  141. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
  142. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  143. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  144. data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
  145. data/spec/unit/braintree/transaction/paypal_details_spec.rb +1 -1
  146. data/spec/unit/braintree/transaction_search_spec.rb +12 -12
  147. data/spec/unit/braintree/transaction_spec.rb +25 -17
  148. data/spec/unit/braintree/util_spec.rb +18 -18
  149. data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
  150. data/spec/unit/braintree/webhook_notification_spec.rb +88 -56
  151. data/spec/unit/braintree/xml/rexml_spec.rb +51 -0
  152. data/spec/unit/braintree/xml_spec.rb +31 -31
  153. metadata +18 -8
  154. 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.1.0
4
+ version: 4.1.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-11-09 00:00:00.000000000 Z
11
+ date: 2021-05-25 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
@@ -157,6 +160,8 @@ files:
157
160
  - lib/braintree/transaction/customer_details.rb
158
161
  - lib/braintree/transaction/disbursement_details.rb
159
162
  - lib/braintree/transaction/google_pay_details.rb
163
+ - lib/braintree/transaction/installment.rb
164
+ - lib/braintree/transaction/installment/adjustment.rb
160
165
  - lib/braintree/transaction/local_payment_details.rb
161
166
  - lib/braintree/transaction/paypal_details.rb
162
167
  - lib/braintree/transaction/paypal_here_details.rb
@@ -190,6 +195,7 @@ files:
190
195
  - lib/braintree/xml/generator.rb
191
196
  - lib/braintree/xml/libxml.rb
192
197
  - lib/braintree/xml/parser.rb
198
+ - lib/braintree/xml/rexml.rb
193
199
  - lib/ssl/api_braintreegateway_com.ca.crt
194
200
  - lib/ssl/securetrust_ca.crt
195
201
  - spec/fixtures/files/bt_logo.png
@@ -266,6 +272,8 @@ files:
266
272
  - spec/unit/braintree/local_payment_completed_spec.rb
267
273
  - spec/unit/braintree/merchant_account_spec.rb
268
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
269
277
  - spec/unit/braintree/payment_method_spec.rb
270
278
  - spec/unit/braintree/paypal_account_spec.rb
271
279
  - spec/unit/braintree/resource_collection_spec.rb
@@ -279,6 +287,7 @@ files:
279
287
  - spec/unit/braintree/transaction/credit_card_details_spec.rb
280
288
  - spec/unit/braintree/transaction/customer_details_spec.rb
281
289
  - spec/unit/braintree/transaction/deposit_details_spec.rb
290
+ - spec/unit/braintree/transaction/installment_spec.rb
282
291
  - spec/unit/braintree/transaction/paypal_details_spec.rb
283
292
  - spec/unit/braintree/transaction_search_spec.rb
284
293
  - spec/unit/braintree/transaction_spec.rb
@@ -292,6 +301,7 @@ files:
292
301
  - spec/unit/braintree/webhook_notification_spec.rb
293
302
  - spec/unit/braintree/xml/libxml_spec.rb
294
303
  - spec/unit/braintree/xml/parser_spec.rb
304
+ - spec/unit/braintree/xml/rexml_spec.rb
295
305
  - spec/unit/braintree/xml_spec.rb
296
306
  - spec/unit/braintree_spec.rb
297
307
  - spec/unit/spec_helper.rb
@@ -311,14 +321,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
311
321
  requirements:
312
322
  - - ">="
313
323
  - !ruby/object:Gem::Version
314
- version: 2.5.0
324
+ version: 2.6.0
315
325
  required_rubygems_version: !ruby/object:Gem::Requirement
316
326
  requirements:
317
327
  - - ">="
318
328
  - !ruby/object:Gem::Version
319
329
  version: '0'
320
330
  requirements: []
321
- rubygems_version: 3.0.8
331
+ rubygems_version: 3.2.18
322
332
  signing_key:
323
333
  specification_version: 4
324
334
  summary: Braintree Ruby Server SDK
File without changes