braintree 4.24.0 → 4.25.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.
- checksums.yaml +4 -4
- data/lib/braintree/customer_session_gateway.rb +194 -0
- data/lib/braintree/error_result.rb +1 -1
- data/lib/braintree/errors.rb +2 -1
- data/lib/braintree/gateway.rb +4 -0
- data/lib/braintree/graphql/enums/recommendations.rb +7 -0
- data/lib/braintree/graphql/enums/recommended_payment_option.rb +8 -0
- data/lib/braintree/graphql/inputs/create_customer_session_input.rb +35 -0
- data/lib/braintree/graphql/inputs/customer_recommendations_input.rb +41 -0
- data/lib/braintree/graphql/inputs/customer_session_input.rb +39 -0
- data/lib/braintree/graphql/inputs/phone_input.rb +32 -0
- data/lib/braintree/graphql/inputs/update_customer_session_input.rb +37 -0
- data/lib/braintree/graphql/types/customer_recommendations_payload.rb +32 -0
- data/lib/braintree/graphql/types/payment_options.rb +33 -0
- data/lib/braintree/graphql/unions/customer_recommendations.rb +34 -0
- data/lib/braintree/graphql_client.rb +16 -0
- data/lib/braintree/successful_result.rb +2 -0
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree.rb +11 -0
- data/spec/integration/braintree/customer_session_spec.rb +143 -0
- data/spec/unit/braintree/customer_session_gateway_spec.rb +120 -0
- data/spec/unit/braintree/graphql/create_customer_session_input_spec.rb +81 -0
- data/spec/unit/braintree/graphql/customer_recommendations_input_spec.rb +110 -0
- data/spec/unit/braintree/graphql/customer_session_input_spec.rb +81 -0
- data/spec/unit/braintree/graphql/phone_input_spec.rb +51 -0
- data/spec/unit/braintree/graphql/update_customer_session_input_spec.rb +93 -0
- data/spec/unit/braintree/graphql_client_spec.rb +37 -0
- metadata +21 -2
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::GraphQLClient do
|
4
|
+
|
5
|
+
describe ".get_validation_errors" do
|
6
|
+
it "returns nil if no errors" do
|
7
|
+
expect(Braintree::GraphQLClient.get_validation_errors({})).to be_nil
|
8
|
+
end
|
9
|
+
|
10
|
+
it "returns nil if errors is not an array" do
|
11
|
+
expect(Braintree::GraphQLClient.get_validation_errors({:errors => "string"})).to be_nil
|
12
|
+
end
|
13
|
+
|
14
|
+
it "returns validation errors" do
|
15
|
+
response = {
|
16
|
+
:errors => [
|
17
|
+
{:message => "Invalid input", :extensions => {:legacyCode => "81803"}},
|
18
|
+
{:message => "Another error", :extensions => {:legacyCode => "91903"}}
|
19
|
+
]
|
20
|
+
}
|
21
|
+
expected_errors = {
|
22
|
+
:errors => [
|
23
|
+
{:attribute => "", :code => "81803", :message => "Invalid input"},
|
24
|
+
{:attribute => "", :code => "91903", :message => "Another error"}
|
25
|
+
]
|
26
|
+
}
|
27
|
+
expect(Braintree::GraphQLClient.get_validation_errors(response)).to eq(expected_errors)
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
it "handles missing legacyCode" do
|
32
|
+
response = {:errors => [{:message => "Invalid input"}]}
|
33
|
+
expected_errors = {:errors => [{:attribute => "", :code => nil, :message => "Invalid input"}]}
|
34
|
+
expect(Braintree::GraphQLClient.get_validation_errors(response)).to eq(expected_errors)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
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: 4.
|
4
|
+
version: 4.25.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Braintree
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- lib/braintree/customer.rb
|
78
78
|
- lib/braintree/customer_gateway.rb
|
79
79
|
- lib/braintree/customer_search.rb
|
80
|
+
- lib/braintree/customer_session_gateway.rb
|
80
81
|
- lib/braintree/descriptor.rb
|
81
82
|
- lib/braintree/digest.rb
|
82
83
|
- lib/braintree/disbursement.rb
|
@@ -108,6 +109,16 @@ files:
|
|
108
109
|
- lib/braintree/gateway.rb
|
109
110
|
- lib/braintree/google_pay_card.rb
|
110
111
|
- lib/braintree/granted_payment_instrument_update.rb
|
112
|
+
- lib/braintree/graphql/enums/recommendations.rb
|
113
|
+
- lib/braintree/graphql/enums/recommended_payment_option.rb
|
114
|
+
- lib/braintree/graphql/inputs/create_customer_session_input.rb
|
115
|
+
- lib/braintree/graphql/inputs/customer_recommendations_input.rb
|
116
|
+
- lib/braintree/graphql/inputs/customer_session_input.rb
|
117
|
+
- lib/braintree/graphql/inputs/phone_input.rb
|
118
|
+
- lib/braintree/graphql/inputs/update_customer_session_input.rb
|
119
|
+
- lib/braintree/graphql/types/customer_recommendations_payload.rb
|
120
|
+
- lib/braintree/graphql/types/payment_options.rb
|
121
|
+
- lib/braintree/graphql/unions/customer_recommendations.rb
|
111
122
|
- lib/braintree/graphql_client.rb
|
112
123
|
- lib/braintree/http.rb
|
113
124
|
- lib/braintree/local_payment_completed.rb
|
@@ -239,6 +250,7 @@ files:
|
|
239
250
|
- spec/integration/braintree/credit_card_verification_search_spec.rb
|
240
251
|
- spec/integration/braintree/credit_card_verification_spec.rb
|
241
252
|
- spec/integration/braintree/customer_search_spec.rb
|
253
|
+
- spec/integration/braintree/customer_session_spec.rb
|
242
254
|
- spec/integration/braintree/customer_spec.rb
|
243
255
|
- spec/integration/braintree/disbursement_spec.rb
|
244
256
|
- spec/integration/braintree/discount_spec.rb
|
@@ -290,6 +302,7 @@ files:
|
|
290
302
|
- spec/unit/braintree/credit_card_verification_gateway_spec.rb
|
291
303
|
- spec/unit/braintree/credit_card_verification_search_spec.rb
|
292
304
|
- spec/unit/braintree/credit_card_verification_spec.rb
|
305
|
+
- spec/unit/braintree/customer_session_gateway_spec.rb
|
293
306
|
- spec/unit/braintree/customer_spec.rb
|
294
307
|
- spec/unit/braintree/digest_spec.rb
|
295
308
|
- spec/unit/braintree/disbursement_spec.rb
|
@@ -304,6 +317,12 @@ files:
|
|
304
317
|
- spec/unit/braintree/exchange_rate_quote_response_spec.rb
|
305
318
|
- spec/unit/braintree/exchange_rate_quote_spec.rb
|
306
319
|
- spec/unit/braintree/exchange_rate_spec.rb
|
320
|
+
- spec/unit/braintree/graphql/create_customer_session_input_spec.rb
|
321
|
+
- spec/unit/braintree/graphql/customer_recommendations_input_spec.rb
|
322
|
+
- spec/unit/braintree/graphql/customer_session_input_spec.rb
|
323
|
+
- spec/unit/braintree/graphql/phone_input_spec.rb
|
324
|
+
- spec/unit/braintree/graphql/update_customer_session_input_spec.rb
|
325
|
+
- spec/unit/braintree/graphql_client_spec.rb
|
307
326
|
- spec/unit/braintree/http_spec.rb
|
308
327
|
- spec/unit/braintree/local_payment_completed_spec.rb
|
309
328
|
- spec/unit/braintree/local_payment_expired_spec.rb
|