braintree 4.26.0 → 4.28.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/apple_pay_card.rb +4 -0
- data/lib/braintree/bin_data.rb +7 -2
- data/lib/braintree/configuration.rb +1 -1
- data/lib/braintree/credit_card.rb +11 -5
- data/lib/braintree/credit_card_gateway.rb +1 -0
- data/lib/braintree/credit_card_verification_gateway.rb +1 -0
- data/lib/braintree/customer_session_gateway.rb +11 -10
- data/lib/braintree/error_codes.rb +5 -104
- data/lib/braintree/google_pay_card.rb +4 -0
- data/lib/braintree/graphql/enums/recommendations.rb +2 -0
- data/lib/braintree/graphql/enums/recommended_payment_option.rb +2 -0
- data/lib/braintree/graphql/inputs/create_customer_session_input.rb +10 -1
- data/lib/braintree/graphql/inputs/customer_recommendations_input.rb +7 -8
- data/lib/braintree/graphql/inputs/customer_session_input.rb +6 -0
- data/lib/braintree/graphql/inputs/monetary_amount_input.rb +28 -0
- data/lib/braintree/graphql/inputs/paypal_payee_input.rb +28 -0
- data/lib/braintree/graphql/inputs/paypal_purchase_unit_input.rb +31 -0
- data/lib/braintree/graphql/inputs/phone_input.rb +2 -0
- data/lib/braintree/graphql/inputs/update_customer_session_input.rb +5 -0
- data/lib/braintree/graphql/types/customer_recommendations_payload.rb +112 -18
- data/lib/braintree/graphql/types/payment_options.rb +2 -0
- data/lib/braintree/graphql/types/payment_recommendations.rb +35 -0
- data/lib/braintree/graphql/unions/customer_recommendations.rb +38 -25
- data/lib/braintree/merchant_account.rb +1 -25
- data/lib/braintree/merchant_account_gateway.rb +0 -81
- data/lib/braintree/meta_checkout_card.rb +8 -4
- data/lib/braintree/meta_checkout_token.rb +10 -6
- data/lib/braintree/payment_method_gateway.rb +3 -0
- data/lib/braintree/test/credit_card.rb +4 -0
- data/lib/braintree/transaction/apple_pay_details.rb +4 -0
- data/lib/braintree/transaction/credit_card_details.rb +8 -0
- data/lib/braintree/transaction/google_pay_details.rb +4 -0
- data/lib/braintree/transaction/meta_checkout_card_details.rb +9 -3
- data/lib/braintree/transaction/meta_checkout_token_details.rb +11 -5
- data/lib/braintree/transaction/visa_checkout_card_details.rb +8 -3
- data/lib/braintree/transaction.rb +0 -26
- data/lib/braintree/transaction_gateway.rb +9 -20
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/visa_checkout_card.rb +9 -4
- data/lib/braintree/webhook_notification.rb +0 -4
- data/lib/braintree/webhook_testing_gateway.rb +0 -33
- data/lib/braintree.rb +4 -3
- data/spec/integration/braintree/credit_card_spec.rb +101 -0
- data/spec/integration/braintree/credit_card_verification_spec.rb +118 -0
- data/spec/integration/braintree/customer_session_spec.rb +59 -49
- data/spec/integration/braintree/customer_spec.rb +71 -4
- data/spec/integration/braintree/disbursement_spec.rb +1 -1
- data/spec/integration/braintree/merchant_account_spec.rb +0 -342
- data/spec/integration/braintree/payment_method_nonce_spec.rb +44 -0
- data/spec/integration/braintree/payment_method_spec.rb +50 -3
- data/spec/integration/braintree/transaction_payment_facilitator_spec.rb +119 -0
- data/spec/integration/braintree/transaction_spec.rb +60 -328
- data/spec/spec_helper.rb +1 -1
- data/spec/unit/braintree/apple_pay_card_spec.rb +4 -0
- data/spec/unit/braintree/configuration_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_spec.rb +22 -2
- data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +1 -0
- data/spec/unit/braintree/customer_session_gateway_spec.rb +10 -9
- data/spec/unit/braintree/customer_spec.rb +2 -1
- data/spec/unit/braintree/google_pay_card_spec.rb +20 -0
- data/spec/unit/braintree/graphql/create_customer_session_input_spec.rb +25 -4
- data/spec/unit/braintree/graphql/customer_recommendations_input_spec.rb +21 -51
- data/spec/unit/braintree/graphql/customer_recommendations_spec.rb +40 -0
- data/spec/unit/braintree/graphql/update_customer_session_input_spec.rb +21 -7
- data/spec/unit/braintree/meta_checkout_card_spec.rb +8 -0
- data/spec/unit/braintree/meta_checkout_token_spec.rb +4 -0
- data/spec/unit/braintree/payment_method_nonce_spec.rb +9 -2
- data/spec/unit/braintree/payment_method_spec.rb +12 -0
- data/spec/unit/braintree/transaction/apple_pay_details_spec.rb +20 -0
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +5 -1
- data/spec/unit/braintree/transaction/google_pay_details_spec.rb +20 -0
- data/spec/unit/braintree/transaction/meta_checkout_card_details_spec.rb +20 -0
- data/spec/unit/braintree/transaction/meta_checkout_token_details_spec.rb +20 -0
- data/spec/unit/braintree/transaction/visa_checkout_card_details_spec.rb +20 -0
- data/spec/unit/braintree/transaction_gateway_spec.rb +19 -0
- data/spec/unit/braintree/transaction_spec.rb +8 -0
- data/spec/unit/braintree/visa_checkout_card_spec.rb +20 -0
- data/spec/unit/braintree/webhook_notification_spec.rb +0 -53
- data/spec/unit/credit_card_details_spec.rb +20 -0
- metadata +8 -7
- data/lib/braintree/merchant_account/business_details.rb +0 -17
- data/lib/braintree/merchant_account/funding_details.rb +0 -18
- data/lib/braintree/merchant_account/individual_details.rb +0 -20
- data/spec/unit/braintree/disbursement_spec.rb +0 -131
- data/spec/unit/braintree/merchant_account_spec.rb +0 -33
@@ -9,7 +9,19 @@ describe Braintree::CreateCustomerSessionInput do
|
|
9
9
|
customer: {
|
10
10
|
email: "test@example.com" ,
|
11
11
|
},
|
12
|
-
domain: "example.com"
|
12
|
+
domain: "example.com",
|
13
|
+
purchase_units: [
|
14
|
+
{
|
15
|
+
amount: {
|
16
|
+
value: "100.00",
|
17
|
+
currency_code: "USD"
|
18
|
+
},
|
19
|
+
payee: {
|
20
|
+
email_address: "merchant@example.com",
|
21
|
+
client_id: "client-123"
|
22
|
+
}
|
23
|
+
}
|
24
|
+
]
|
13
25
|
}
|
14
26
|
end
|
15
27
|
|
@@ -23,6 +35,10 @@ describe Braintree::CreateCustomerSessionInput do
|
|
23
35
|
expect(input.customer).to be_a(Braintree::CustomerSessionInput)
|
24
36
|
expect(input.customer.email).to eq("test@example.com")
|
25
37
|
expect(input.domain).to eq("example.com")
|
38
|
+
expect(input.purchase_units).to be_a(Array)
|
39
|
+
expect(input.purchase_units.first).to be_a(Braintree::PayPalPurchaseUnitInput)
|
40
|
+
expect(input.purchase_units.first.amount.value).to eq("100.00")
|
41
|
+
expect(input.purchase_units.first.payee.email_address).to eq("merchant@example.com")
|
26
42
|
end
|
27
43
|
|
28
44
|
it "handles nil customer" do
|
@@ -36,9 +52,8 @@ describe Braintree::CreateCustomerSessionInput do
|
|
36
52
|
describe "#inspect" do
|
37
53
|
it "returns a string representation of the object" do
|
38
54
|
input = Braintree::CreateCustomerSessionInput.new(input_data)
|
39
|
-
expected_string = "#<Braintree::CreateCustomerSessionInput merchant_account_id:\"merchant-account-id\" session_id:\"session-id\" customer:#<Braintree::CustomerSessionInput email:\"test@example.com\"> domain:\"example.com\">"
|
55
|
+
expected_string = "#<Braintree::CreateCustomerSessionInput merchant_account_id:\"merchant-account-id\" session_id:\"session-id\" customer:#<Braintree::CustomerSessionInput email:\"test@example.com\"> domain:\"example.com\" purchase_units:[#<Braintree::PayPalPurchaseUnitInput amount:#<Braintree::MonetaryAmountInput value:\"100.00\" currency_code:\"USD\"> payee:#<Braintree::PayPalPayeeInput email_address:\"merchant@example.com\" client_id:\"client-123\">>]>"
|
40
56
|
expect(input.inspect).to eq(expected_string)
|
41
|
-
|
42
57
|
end
|
43
58
|
|
44
59
|
it "handles nil values" do
|
@@ -62,7 +77,13 @@ describe Braintree::CreateCustomerSessionInput do
|
|
62
77
|
"merchantAccountId" => "merchant-account-id",
|
63
78
|
"sessionId" => "session-id",
|
64
79
|
"domain" => "example.com",
|
65
|
-
"customer" => {"email" => "test@example.com"}
|
80
|
+
"customer" => {"email" => "test@example.com"},
|
81
|
+
"purchaseUnits" => [
|
82
|
+
{
|
83
|
+
"amount" => {"value" => "100.00", "currencyCode" => "USD"},
|
84
|
+
"payee" => {"emailAddress" => "merchant@example.com", "clientId" => "client-123"}
|
85
|
+
}
|
86
|
+
]
|
66
87
|
}
|
67
88
|
|
68
89
|
expect(input.to_graphql_variables).to eq(expected_variables)
|
@@ -6,8 +6,20 @@ describe Braintree::CustomerRecommendationsInput do
|
|
6
6
|
{
|
7
7
|
merchant_account_id: "merchant-account-id",
|
8
8
|
session_id: "session-id",
|
9
|
-
|
10
|
-
|
9
|
+
customer: {email: "test@example.com"},
|
10
|
+
purchase_units: [
|
11
|
+
{
|
12
|
+
amount: {
|
13
|
+
value: "100.00",
|
14
|
+
currency_code: "USD"
|
15
|
+
},
|
16
|
+
payee: {
|
17
|
+
email_address: "merchant@example.com",
|
18
|
+
client_id: "client-123"
|
19
|
+
}
|
20
|
+
}
|
21
|
+
],
|
22
|
+
domain: "example.com"
|
11
23
|
}
|
12
24
|
end
|
13
25
|
describe "#initialize" do
|
@@ -18,34 +30,12 @@ describe Braintree::CustomerRecommendationsInput do
|
|
18
30
|
expect(input.merchant_account_id).to eq("merchant-account-id")
|
19
31
|
expect(input.session_id).to eq("session-id")
|
20
32
|
expect(input.customer).to be_a(Braintree::CustomerSessionInput)
|
21
|
-
expect(input.recommendations[0]).to eq("PAYMENT_RECOMMENDATIONS")
|
22
|
-
end
|
23
|
-
|
24
|
-
it "disallows nil session id" do
|
25
|
-
attributes = {
|
26
|
-
merchant_account_id: "merchant-account-id",
|
27
|
-
recommendations: ["PAYMENT_RECOMMENDATIONS"],
|
28
|
-
}
|
29
|
-
expect do
|
30
|
-
Braintree::CustomerRecommendationsInput.new(attributes)
|
31
|
-
end.to raise_error(ArgumentError, "Expected hash to contain a :session_id")
|
32
|
-
end
|
33
|
-
|
34
|
-
it "disallows nil recommendations" do
|
35
|
-
attributes = {
|
36
|
-
merchant_account_id: "merchant-account-id",
|
37
|
-
session_id: "session-id",
|
38
|
-
}
|
39
|
-
expect do
|
40
|
-
Braintree::CustomerRecommendationsInput.new(attributes)
|
41
|
-
end.to raise_error(ArgumentError, "Expected hash to contain a :recommendations")
|
42
33
|
end
|
43
34
|
|
44
35
|
it "handles nil customer" do
|
45
36
|
attributes = {
|
46
37
|
merchant_account_id: "merchant-account-id",
|
47
|
-
session_id: "session-id"
|
48
|
-
recommendations: ["PAYMENT_RECOMMENDATIONS"],
|
38
|
+
session_id: "session-id"
|
49
39
|
}
|
50
40
|
input = Braintree::CustomerRecommendationsInput.new(attributes)
|
51
41
|
|
@@ -53,23 +43,20 @@ describe Braintree::CustomerRecommendationsInput do
|
|
53
43
|
end
|
54
44
|
end
|
55
45
|
|
56
|
-
|
57
46
|
describe "#inspect" do
|
58
47
|
it "returns a string representation of the object" do
|
59
48
|
input = Braintree::CustomerRecommendationsInput.new(input_data)
|
60
|
-
expected_string = "#<Braintree::CustomerRecommendationsInput merchant_account_id:\"merchant-account-id\" session_id:\"session-id\"
|
49
|
+
expected_string = "#<Braintree::CustomerRecommendationsInput merchant_account_id:\"merchant-account-id\" session_id:\"session-id\" customer:#<Braintree::CustomerSessionInput email:\"test@example.com\"> purchase_units:[#<Braintree::PayPalPurchaseUnitInput amount:#<Braintree::MonetaryAmountInput value:\"100.00\" currency_code:\"USD\"> payee:#<Braintree::PayPalPayeeInput email_address:\"merchant@example.com\" client_id:\"client-123\">>] domain:\"example.com\">"
|
61
50
|
expect(input.inspect).to eq(expected_string)
|
62
|
-
|
63
51
|
end
|
64
52
|
|
65
|
-
it "handles nil values" do
|
53
|
+
it "handles nil values and returns a string representation" do
|
66
54
|
attributes = {
|
67
55
|
merchant_account_id: "merchant-account-id",
|
68
|
-
session_id: "session-id"
|
69
|
-
recommendations: ["PAYMENT_RECOMMENDATIONS"],
|
56
|
+
session_id: "session-id"
|
70
57
|
}
|
71
58
|
input = Braintree::CustomerRecommendationsInput.new(attributes)
|
72
|
-
expected_string = "#<Braintree::CustomerRecommendationsInput merchant_account_id:\"merchant-account-id\" session_id:\"session-id\"
|
59
|
+
expected_string = "#<Braintree::CustomerRecommendationsInput merchant_account_id:\"merchant-account-id\" session_id:\"session-id\">"
|
73
60
|
|
74
61
|
expect(input.inspect).to eq(expected_string)
|
75
62
|
end
|
@@ -83,28 +70,11 @@ describe Braintree::CustomerRecommendationsInput do
|
|
83
70
|
"merchantAccountId" => "merchant-account-id",
|
84
71
|
"sessionId" => "session-id",
|
85
72
|
"customer" => {"email" => "test@example.com"},
|
86
|
-
"
|
87
|
-
|
88
|
-
|
89
|
-
expect(input.to_graphql_variables).to eq(expected_variables)
|
90
|
-
end
|
91
|
-
|
92
|
-
it "handles nil values" do
|
93
|
-
attributes = {
|
94
|
-
merchant_account_id: "merchant-account-id",
|
95
|
-
session_id: "session-id",
|
96
|
-
recommendations: ["PAYMENT_RECOMMENDATIONS"],
|
97
|
-
}
|
98
|
-
input = Braintree::CustomerRecommendationsInput.new(attributes)
|
99
|
-
|
100
|
-
expected_variables = {
|
101
|
-
"merchantAccountId" => "merchant-account-id",
|
102
|
-
"sessionId" => "session-id",
|
103
|
-
"recommendations" => ["PAYMENT_RECOMMENDATIONS"],
|
73
|
+
"purchaseUnits" => [{"amount"=>{"currencyCode"=>"USD", "value"=>"100.00"}, "payee"=>{"clientId"=>"client-123", "emailAddress"=>"merchant@example.com"}}],
|
74
|
+
"domain" => "example.com"
|
104
75
|
}
|
105
76
|
|
106
77
|
expect(input.to_graphql_variables).to eq(expected_variables)
|
107
78
|
end
|
108
79
|
end
|
109
|
-
|
110
80
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::CustomerRecommendations do
|
4
|
+
let(:recommendation_data) do
|
5
|
+
[
|
6
|
+
{
|
7
|
+
paymentOption: "PAYPAL",
|
8
|
+
recommendedPriority: 1
|
9
|
+
},
|
10
|
+
{
|
11
|
+
paymentOption: "VENMO",
|
12
|
+
recommendedPriority: 2
|
13
|
+
}
|
14
|
+
]
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#initialize" do
|
18
|
+
it "creates payment_recommendations correctly" do
|
19
|
+
recs = Braintree::CustomerRecommendations.new(payment_recommendations: recommendation_data)
|
20
|
+
expect(recs.payment_recommendations.size).to eq(2)
|
21
|
+
expect(recs.payment_recommendations.first).to be_a(Braintree::PaymentRecommendations)
|
22
|
+
expect(recs.payment_recommendations.first.payment_option).to eq("PAYPAL")
|
23
|
+
expect(recs.payment_recommendations.last.payment_option).to eq("VENMO")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "creates payment_options from payment_recommendations" do
|
27
|
+
recs = Braintree::CustomerRecommendations.new(payment_recommendations: recommendation_data)
|
28
|
+
expect(recs.payment_options.size).to eq(2)
|
29
|
+
expect(recs.payment_options.first).to be_a(Braintree::PaymentOptions)
|
30
|
+
expect(recs.payment_options.first.payment_option).to eq("PAYPAL")
|
31
|
+
expect(recs.payment_options.last.payment_option).to eq("VENMO")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "is null safe if no recommendations are passed in" do
|
35
|
+
recs = Braintree::CustomerRecommendations.new
|
36
|
+
expect(recs.payment_recommendations).to eq([])
|
37
|
+
expect(recs.payment_options).to eq([])
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -3,11 +3,25 @@ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
|
|
3
3
|
|
4
4
|
describe Braintree::UpdateCustomerSessionInput do
|
5
5
|
let(:input_data) do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
{
|
7
|
+
merchant_account_id: "merchant-account-id",
|
8
|
+
session_id: "session-id",
|
9
|
+
customer: {
|
10
|
+
email: "test@example.com"
|
11
|
+
},
|
12
|
+
purchase_units: [
|
13
|
+
{
|
14
|
+
amount: {
|
15
|
+
value: "100.00",
|
16
|
+
currency_code: "USD"
|
17
|
+
},
|
18
|
+
payee: {
|
19
|
+
email_address: "merchant@example.com",
|
20
|
+
client_id: "client-123"
|
21
|
+
}
|
22
|
+
}
|
23
|
+
]
|
24
|
+
}
|
11
25
|
end
|
12
26
|
describe "#initialize" do
|
13
27
|
it "initializes with attributes" do
|
@@ -44,9 +58,8 @@ describe Braintree::UpdateCustomerSessionInput do
|
|
44
58
|
describe "#inspect" do
|
45
59
|
it "returns a string representation of the object" do
|
46
60
|
input = Braintree::UpdateCustomerSessionInput.new(input_data)
|
47
|
-
expected_string = "#<Braintree::UpdateCustomerSessionInput merchant_account_id:\"merchant-account-id\" session_id:\"session-id\" customer:#<Braintree::CustomerSessionInput email:\"test@example.com\">>"
|
61
|
+
expected_string = "#<Braintree::UpdateCustomerSessionInput merchant_account_id:\"merchant-account-id\" session_id:\"session-id\" customer:#<Braintree::CustomerSessionInput email:\"test@example.com\"> purchase_units:[#<Braintree::PayPalPurchaseUnitInput amount:#<Braintree::MonetaryAmountInput value:\"100.00\" currency_code:\"USD\"> payee:#<Braintree::PayPalPayeeInput email_address:\"merchant@example.com\" client_id:\"client-123\">>]>"
|
48
62
|
expect(input.inspect).to eq(expected_string)
|
49
|
-
|
50
63
|
end
|
51
64
|
|
52
65
|
it "handles nil values" do
|
@@ -69,6 +82,7 @@ describe Braintree::UpdateCustomerSessionInput do
|
|
69
82
|
"merchantAccountId" => "merchant-account-id",
|
70
83
|
"sessionId" => "session-id",
|
71
84
|
"customer" => {"email" => "test@example.com"},
|
85
|
+
"purchaseUnits" => [{"amount"=>{"currencyCode"=>"USD", "value"=>"100.00"}, "payee"=>{"clientId"=>"client-123", "emailAddress"=>"merchant@example.com"}}],
|
72
86
|
}
|
73
87
|
|
74
88
|
expect(input.to_graphql_variables).to eq(expected_variables)
|
@@ -4,10 +4,13 @@ describe Braintree::MetaCheckoutCard do
|
|
4
4
|
let(:attributes) do {
|
5
5
|
|
6
6
|
:bin => "abc1234",
|
7
|
+
:business => "NO",
|
7
8
|
:card_type => "Visa",
|
8
9
|
:cardholder_name => "Meta Checkout Card CardHolder",
|
9
10
|
:commercial => "NO",
|
11
|
+
:consumer => "NO",
|
10
12
|
:container_id => "a-container-id",
|
13
|
+
:corporate => "NO",
|
11
14
|
:country_of_issuance => "US",
|
12
15
|
:created_at => "2023-05-05T21:28:37Z",
|
13
16
|
:debit => "NO",
|
@@ -19,6 +22,7 @@ describe Braintree::MetaCheckoutCard do
|
|
19
22
|
:payroll => "NO",
|
20
23
|
:prepaid => "NO",
|
21
24
|
:prepaid_reloadable => "NO",
|
25
|
+
:purchase => "NO",
|
22
26
|
:token => "token1",
|
23
27
|
:unique_number_identifier => "abc1234",
|
24
28
|
:updated_at => "2023-05-05T21:28:37Z"
|
@@ -30,10 +34,13 @@ describe Braintree::MetaCheckoutCard do
|
|
30
34
|
card = Braintree::MetaCheckoutCard._new(:gateway, attributes)
|
31
35
|
|
32
36
|
card.bin.should == "abc1234"
|
37
|
+
card.business.should == "NO"
|
33
38
|
card.card_type.should == "Visa"
|
34
39
|
card.cardholder_name.should == "Meta Checkout Card CardHolder"
|
35
40
|
card.commercial == "NO"
|
41
|
+
card.consumer == "NO"
|
36
42
|
card.container_id.should == "a-container-id"
|
43
|
+
card.corporate == "NO"
|
37
44
|
card.country_of_issuance == "US"
|
38
45
|
card.created_at == "2023-05-05T21:28:37Z"
|
39
46
|
card.debit == "NO"
|
@@ -44,6 +51,7 @@ describe Braintree::MetaCheckoutCard do
|
|
44
51
|
card.payroll == "NO"
|
45
52
|
card.prepaid == "NO"
|
46
53
|
card.prepaid_reloadable == "NO"
|
54
|
+
card.purchase == "NO"
|
47
55
|
card.token == "token1"
|
48
56
|
card.unique_number_identifier == "abc1234"
|
49
57
|
card.updated_at == "2023-05-05T21:28:37Z"
|
@@ -3,10 +3,13 @@ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
|
3
3
|
describe Braintree::MetaCheckoutToken do
|
4
4
|
let(:attributes) do {
|
5
5
|
:bin => "abc1234",
|
6
|
+
:business => "NO",
|
6
7
|
:container_id => "a-container-id",
|
7
8
|
:card_type => "Visa",
|
8
9
|
:cardholder_name => "Meta Checkout Card CardHolder",
|
9
10
|
:commercial => "NO",
|
11
|
+
:consumer => "NO",
|
12
|
+
:corporate => "NO",
|
10
13
|
:country_of_issuance => "US",
|
11
14
|
:created_at => "2023-05-05T21:28:37Z",
|
12
15
|
:debit => "NO",
|
@@ -18,6 +21,7 @@ describe Braintree::MetaCheckoutToken do
|
|
18
21
|
:payroll => "NO",
|
19
22
|
:prepaid => "NO",
|
20
23
|
:prepaid_reloadable => "NO",
|
24
|
+
:purchase => "NO",
|
21
25
|
:token => "token1",
|
22
26
|
:unique_number_identifier => "abc1234",
|
23
27
|
:updated_at => "2023-05-05T21:28:37Z",
|
@@ -15,8 +15,12 @@ describe Braintree::PaymentMethodNonce do
|
|
15
15
|
:liability_shifted => false
|
16
16
|
},
|
17
17
|
:bin_data => {
|
18
|
+
:business => "No",
|
19
|
+
:consumer => "No",
|
20
|
+
:corporate => "No",
|
18
21
|
:country_of_issuance => "USA",
|
19
|
-
:prepaid_reloadable => "Yes"
|
22
|
+
:prepaid_reloadable => "Yes",
|
23
|
+
:purchase => "No",
|
20
24
|
},
|
21
25
|
)
|
22
26
|
}
|
@@ -29,9 +33,12 @@ describe Braintree::PaymentMethodNonce do
|
|
29
33
|
expect(payment_method_nonce.details.bin).to eq("some-bin")
|
30
34
|
expect(payment_method_nonce.three_d_secure_info.liability_shift_possible).to be false
|
31
35
|
expect(payment_method_nonce.three_d_secure_info.liability_shifted).to be false
|
36
|
+
expect(payment_method_nonce.bin_data.business).to eq("No")
|
37
|
+
expect(payment_method_nonce.bin_data.consumer).to eq("No")
|
38
|
+
expect(payment_method_nonce.bin_data.corporate).to eq("No")
|
32
39
|
expect(payment_method_nonce.bin_data.country_of_issuance).to eq("USA")
|
33
40
|
expect(payment_method_nonce.bin_data.prepaid_reloadable).to eq("Yes")
|
34
|
-
|
41
|
+
expect(payment_method_nonce.bin_data.purchase).to eq("No")
|
35
42
|
end
|
36
43
|
end
|
37
44
|
|
@@ -25,6 +25,18 @@ describe Braintree::PaymentMethod do
|
|
25
25
|
expect(result.payment_method.token).to eq(1234)
|
26
26
|
expect(result.payment_method).to be_instance_of(Braintree::UnknownPaymentMethod)
|
27
27
|
end
|
28
|
+
|
29
|
+
it "handles an payment method type for account information inquiry" do
|
30
|
+
unknown_response = {:unknown_payment_method => {:token => 1234, :default => true}}
|
31
|
+
http_instance = double(:put => unknown_response)
|
32
|
+
allow(Braintree::Http).to receive(:new).and_return(http_instance)
|
33
|
+
result = Braintree::PaymentMethod.update(:unknown,
|
34
|
+
{:options => {:verify_card => true, :accountInformationInquiry => "send_data"}})
|
35
|
+
|
36
|
+
expect(result).to be_success
|
37
|
+
expect(result.payment_method.token).to eq(1234)
|
38
|
+
expect(result.payment_method).to be_instance_of(Braintree::UnknownPaymentMethod)
|
39
|
+
end
|
28
40
|
end
|
29
41
|
|
30
42
|
describe "delete" do
|
@@ -5,4 +5,24 @@ describe Braintree::ApplePayDetails do
|
|
5
5
|
card = Braintree::ApplePayDetails._new(:gateway, {:prepaid_reloadable => "No"})
|
6
6
|
expect(card.prepaid_reloadable).to eq("No")
|
7
7
|
end
|
8
|
+
|
9
|
+
it "initializes business correctly" do
|
10
|
+
card = Braintree::ApplePayDetails._new(:gateway, {:business => "No"})
|
11
|
+
expect(card.business).to eq("No")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "initializes consumer correctly" do
|
15
|
+
card = Braintree::ApplePayDetails._new(:gateway, {:consumer => "No"})
|
16
|
+
expect(card.consumer).to eq("No")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "initializes corporate correctly" do
|
20
|
+
card = Braintree::ApplePayDetails._new(:gateway, {:corporate => "No"})
|
21
|
+
expect(card.corporate).to eq("No")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "initializes purchase correctly" do
|
25
|
+
card = Braintree::ApplePayDetails._new(:gateway, {:purchase => "No"})
|
26
|
+
expect(card.purchase).to eq("No")
|
27
|
+
end
|
8
28
|
end
|
@@ -15,6 +15,7 @@ describe Braintree::Transaction::CreditCardDetails do
|
|
15
15
|
it "inspects" do
|
16
16
|
details = Braintree::Transaction::CreditCardDetails.new(
|
17
17
|
:bin => "123456",
|
18
|
+
:business => "No",
|
18
19
|
:card_type => "Visa",
|
19
20
|
:cardholder_name => "The Cardholder",
|
20
21
|
:expiration_month => "05",
|
@@ -28,14 +29,17 @@ describe Braintree::Transaction::CreditCardDetails do
|
|
28
29
|
:durbin_regulated => "No",
|
29
30
|
:debit => "Yes",
|
30
31
|
:commercial => "Unknown",
|
32
|
+
:consumer => "Unknown",
|
33
|
+
:corporate => "Unknown",
|
31
34
|
:payroll => "Unknown",
|
35
|
+
:purchase => "Unknown",
|
32
36
|
:product_id => "Unknown",
|
33
37
|
:country_of_issuance => "Lilliput",
|
34
38
|
:issuing_bank => "Gulliver Bank",
|
35
39
|
:image_url => "example.com/visa.png",
|
36
40
|
:unique_number_identifier => "abc123",
|
37
41
|
)
|
38
|
-
expect(details.inspect).to eq(%(#<token: "token", bin: "123456", last_4: "6789", card_type: "Visa", commercial: "Unknown", country_of_issuance: "Lilliput", customer_location: "US", debit: "Yes", durbin_regulated: "No", expiration_date: "05/2012", healthcare: "No", image_url: "example.com/visa.png", issuing_bank: "Gulliver Bank", payroll: "Unknown", prepaid: "Yes", prepaid_reloadable: "Yes", product_id: "Unknown", cardholder_name: "The Cardholder", unique_number_identifier: "abc123">))
|
42
|
+
expect(details.inspect).to eq(%(#<token: "token", bin: "123456", business: "No", last_4: "6789", card_type: "Visa", commercial: "Unknown", consumer: "Unknown", corporate: "Unknown", country_of_issuance: "Lilliput", customer_location: "US", debit: "Yes", durbin_regulated: "No", expiration_date: "05/2012", healthcare: "No", image_url: "example.com/visa.png", issuing_bank: "Gulliver Bank", payroll: "Unknown", prepaid: "Yes", prepaid_reloadable: "Yes", product_id: "Unknown", purchase: "Unknown", cardholder_name: "The Cardholder", unique_number_identifier: "abc123">))
|
39
43
|
end
|
40
44
|
end
|
41
45
|
|
@@ -5,4 +5,24 @@ describe Braintree::GooglePayDetails do
|
|
5
5
|
card = Braintree::GooglePayDetails._new(:gateway, {:prepaid_reloadable => "No"})
|
6
6
|
expect(card.prepaid_reloadable).to eq("No")
|
7
7
|
end
|
8
|
+
|
9
|
+
it "initializes business correctly" do
|
10
|
+
card = Braintree::GooglePayDetails._new(:gateway, {:business => "No"})
|
11
|
+
expect(card.business).to eq("No")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "initializes consumer correctly" do
|
15
|
+
card = Braintree::GooglePayDetails._new(:gateway, {:consumer => "No"})
|
16
|
+
expect(card.consumer).to eq("No")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "initializes corporate correctly" do
|
20
|
+
card = Braintree::GooglePayDetails._new(:gateway, {:corporate => "No"})
|
21
|
+
expect(card.corporate).to eq("No")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "initializes purchase correctly" do
|
25
|
+
card = Braintree::GooglePayDetails._new(:gateway, {:purchase => "No"})
|
26
|
+
expect(card.purchase).to eq("No")
|
27
|
+
end
|
8
28
|
end
|
@@ -5,4 +5,24 @@ describe Braintree::MetaCheckoutCardDetails do
|
|
5
5
|
card = Braintree::MetaCheckoutCardDetails._new(:gateway, {:prepaid_reloadable => "No"})
|
6
6
|
expect(card.prepaid_reloadable).to eq("No")
|
7
7
|
end
|
8
|
+
|
9
|
+
it "initializes business correctly" do
|
10
|
+
card = Braintree::MetaCheckoutCardDetails._new(:gateway, {:business => "No"})
|
11
|
+
expect(card.business).to eq("No")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "initializes consumer correctly" do
|
15
|
+
card = Braintree::MetaCheckoutCardDetails._new(:gateway, {:consumer => "No"})
|
16
|
+
expect(card.consumer).to eq("No")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "initializes corporate correctly" do
|
20
|
+
card = Braintree::MetaCheckoutCardDetails._new(:gateway, {:corporate => "No"})
|
21
|
+
expect(card.corporate).to eq("No")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "initializes purchase correctly" do
|
25
|
+
card = Braintree::MetaCheckoutCardDetails._new(:gateway, {:purchase => "No"})
|
26
|
+
expect(card.purchase).to eq("No")
|
27
|
+
end
|
8
28
|
end
|
@@ -5,4 +5,24 @@ describe Braintree::MetaCheckoutTokenDetails do
|
|
5
5
|
card = Braintree::MetaCheckoutTokenDetails._new(:gateway, {:prepaid_reloadable => "No"})
|
6
6
|
expect(card.prepaid_reloadable).to eq("No")
|
7
7
|
end
|
8
|
+
|
9
|
+
it "initializes business correctly" do
|
10
|
+
card = Braintree::MetaCheckoutTokenDetails._new(:gateway, {:business => "No"})
|
11
|
+
expect(card.business).to eq("No")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "initializes consumer correctly" do
|
15
|
+
card = Braintree::MetaCheckoutTokenDetails._new(:gateway, {:consumer => "No"})
|
16
|
+
expect(card.consumer).to eq("No")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "initializes corporate correctly" do
|
20
|
+
card = Braintree::MetaCheckoutTokenDetails._new(:gateway, {:corporate => "No"})
|
21
|
+
expect(card.corporate).to eq("No")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "initializes purchase correctly" do
|
25
|
+
card = Braintree::MetaCheckoutTokenDetails._new(:gateway, {:purchase => "No"})
|
26
|
+
expect(card.purchase).to eq("No")
|
27
|
+
end
|
8
28
|
end
|
@@ -5,4 +5,24 @@ describe Braintree::VisaCheckoutCardDetails do
|
|
5
5
|
card = Braintree::VisaCheckoutCardDetails._new(:gateway, {:prepaid_reloadable => "No"})
|
6
6
|
expect(card.prepaid_reloadable).to eq("No")
|
7
7
|
end
|
8
|
+
|
9
|
+
it "initializes business correctly" do
|
10
|
+
card = Braintree::VisaCheckoutCardDetails._new(:gateway, {:business => "No"})
|
11
|
+
expect(card.business).to eq("No")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "initializes consumer correctly" do
|
15
|
+
card = Braintree::VisaCheckoutCardDetails._new(:gateway, {:consumer => "No"})
|
16
|
+
expect(card.consumer).to eq("No")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "initializes corporate correctly" do
|
20
|
+
card = Braintree::VisaCheckoutCardDetails._new(:gateway, {:corporate => "No"})
|
21
|
+
expect(card.corporate).to eq("No")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "initializes purchase correctly" do
|
25
|
+
card = Braintree::VisaCheckoutCardDetails._new(:gateway, {:purchase => "No"})
|
26
|
+
expect(card.purchase).to eq("No")
|
27
|
+
end
|
8
28
|
end
|
@@ -94,6 +94,25 @@ describe Braintree::TransactionGateway do
|
|
94
94
|
]
|
95
95
|
},
|
96
96
|
{:paypal_account => [:email, :token, :paypal_data, :payee_id, :payee_email, :payer_id, :payment_id]},
|
97
|
+
{:payment_facilitator => [
|
98
|
+
:payment_facilitator_id,
|
99
|
+
{:sub_merchant => [
|
100
|
+
:reference_number,
|
101
|
+
:tax_id,
|
102
|
+
:legal_name,
|
103
|
+
{:address => [
|
104
|
+
:street_address,
|
105
|
+
:locality,
|
106
|
+
:region,
|
107
|
+
:country_code_alpha2,
|
108
|
+
:postal_code,
|
109
|
+
{:international_phone => [
|
110
|
+
:country_code,
|
111
|
+
:national_number
|
112
|
+
]}
|
113
|
+
]}
|
114
|
+
]}
|
115
|
+
]},
|
97
116
|
{:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
|
98
117
|
{
|
99
118
|
:shipping => Braintree::AddressGateway._shared_signature + [:shipping_method],
|
@@ -123,9 +123,13 @@ describe Braintree::Transaction do
|
|
123
123
|
:healthcare => "Yes",
|
124
124
|
:durbin_regulated => "Yes",
|
125
125
|
:debit => "Yes",
|
126
|
+
:business => "Yes",
|
126
127
|
:commercial => "No",
|
128
|
+
:consumer => "No",
|
129
|
+
:corporate => "No",
|
127
130
|
:payroll => "Unknown",
|
128
131
|
:product_id => "Unknown",
|
132
|
+
:purchase => "No",
|
129
133
|
:country_of_issuance => "Narnia",
|
130
134
|
:issuing_bank => "Mr Tumnus"
|
131
135
|
},
|
@@ -142,9 +146,13 @@ describe Braintree::Transaction do
|
|
142
146
|
expect(transaction.credit_card_details.healthcare).to eq(Braintree::CreditCard::Healthcare::Yes)
|
143
147
|
expect(transaction.credit_card_details.durbin_regulated).to eq(Braintree::CreditCard::DurbinRegulated::Yes)
|
144
148
|
expect(transaction.credit_card_details.debit).to eq(Braintree::CreditCard::Debit::Yes)
|
149
|
+
expect(transaction.credit_card_details.business).to eq(Braintree::CreditCard::Business::Yes)
|
145
150
|
expect(transaction.credit_card_details.commercial).to eq(Braintree::CreditCard::Commercial::No)
|
151
|
+
expect(transaction.credit_card_details.consumer).to eq(Braintree::CreditCard::Consumer::No)
|
152
|
+
expect(transaction.credit_card_details.corporate).to eq(Braintree::CreditCard::Corporate::No)
|
146
153
|
expect(transaction.credit_card_details.payroll).to eq(Braintree::CreditCard::Payroll::Unknown)
|
147
154
|
expect(transaction.credit_card_details.product_id).to eq(Braintree::CreditCard::ProductId::Unknown)
|
155
|
+
expect(transaction.credit_card_details.purchase).to eq(Braintree::CreditCard::Purchase::No)
|
148
156
|
expect(transaction.credit_card_details.country_of_issuance).to eq("Narnia")
|
149
157
|
expect(transaction.credit_card_details.issuing_bank).to eq("Mr Tumnus")
|
150
158
|
end
|
@@ -5,4 +5,24 @@ describe Braintree::VisaCheckoutCard do
|
|
5
5
|
card = Braintree::VisaCheckoutCard._new(:gateway, {:prepaid_reloadable => "No"})
|
6
6
|
expect(card.prepaid_reloadable).to eq("No")
|
7
7
|
end
|
8
|
+
|
9
|
+
it "initializes business correctly" do
|
10
|
+
card = Braintree::VisaCheckoutCard._new(:gateway, {:business => "No"})
|
11
|
+
expect(card.business).to eq("No")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "initializes consumer correctly" do
|
15
|
+
card = Braintree::VisaCheckoutCard._new(:gateway, {:consumer => "No"})
|
16
|
+
expect(card.consumer).to eq("No")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "initializes corporate correctly" do
|
20
|
+
card = Braintree::VisaCheckoutCard._new(:gateway, {:corporate => "No"})
|
21
|
+
expect(card.corporate).to eq("No")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "initializes purchase correctly" do
|
25
|
+
card = Braintree::VisaCheckoutCard._new(:gateway, {:purchase => "No"})
|
26
|
+
expect(card.purchase).to eq("No")
|
27
|
+
end
|
8
28
|
end
|