braintree 4.25.0 → 4.26.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 +1 -0
- data/lib/braintree/bin_data.rb +2 -1
- data/lib/braintree/credit_card.rb +6 -5
- data/lib/braintree/error_codes.rb +41 -0
- data/lib/braintree/gateway.rb +4 -0
- data/lib/braintree/google_pay_card.rb +1 -0
- data/lib/braintree/meta_checkout_card.rb +6 -5
- data/lib/braintree/meta_checkout_token.rb +6 -5
- data/lib/braintree/paypal_payment_resource.rb +22 -0
- data/lib/braintree/paypal_payment_resource_gateway.rb +36 -0
- data/lib/braintree/test/credit_card.rb +1 -0
- data/lib/braintree/transaction/apple_pay_details.rb +1 -0
- data/lib/braintree/transaction/credit_card_details.rb +12 -10
- data/lib/braintree/transaction/google_pay_details.rb +11 -10
- data/lib/braintree/transaction/meta_checkout_card_details.rb +5 -2
- data/lib/braintree/transaction/meta_checkout_token_details.rb +6 -2
- data/lib/braintree/transaction/visa_checkout_card_details.rb +5 -2
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/visa_checkout_card.rb +5 -5
- data/lib/braintree.rb +2 -0
- data/spec/integration/braintree/credit_card_spec.rb +12 -0
- data/spec/integration/braintree/credit_card_verification_spec.rb +24 -0
- data/spec/integration/braintree/customer_spec.rb +22 -6
- data/spec/integration/braintree/payment_method_nonce_spec.rb +11 -0
- data/spec/integration/braintree/paypal_payment_resource_spec.rb +141 -0
- data/spec/integration/braintree/transaction_spec.rb +15 -0
- data/spec/unit/braintree/apple_pay_card_spec.rb +1 -0
- data/spec/unit/braintree/credit_card_spec.rb +5 -0
- data/spec/unit/braintree/google_pay_card_spec.rb +8 -0
- data/spec/unit/braintree/meta_checkout_card_spec.rb +53 -51
- data/spec/unit/braintree/meta_checkout_token_spec.rb +3 -1
- data/spec/unit/braintree/payment_method_nonce_spec.rb +4 -1
- data/spec/unit/braintree/paypal_payment_resource_spec.rb +125 -0
- data/spec/unit/braintree/transaction/apple_pay_details_spec.rb +8 -0
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +2 -1
- data/spec/unit/braintree/transaction/google_pay_details_spec.rb +8 -0
- data/spec/unit/braintree/transaction/meta_checkout_card_details_spec.rb +8 -0
- data/spec/unit/braintree/transaction/meta_checkout_token_details_spec.rb +8 -0
- data/spec/unit/braintree/transaction/visa_checkout_card_details_spec.rb +8 -0
- data/spec/unit/braintree/transaction_spec.rb +2 -0
- data/spec/unit/braintree/visa_checkout_card_spec.rb +8 -0
- data/spec/unit/credit_card_details_spec.rb +8 -0
- metadata +14 -2
@@ -0,0 +1,141 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/client_api/spec_helper")
|
3
|
+
|
4
|
+
describe Braintree::PayPalPaymentResource do
|
5
|
+
|
6
|
+
describe "self.update" do
|
7
|
+
it "successfully updates a payment resource" do
|
8
|
+
nonce = nonce_for_paypal_account(
|
9
|
+
:intent => "order",
|
10
|
+
:payment_token => "fake-paypal-payment-token",
|
11
|
+
:payer_id => "fake-paypal-payer-id",
|
12
|
+
)
|
13
|
+
|
14
|
+
result = Braintree::PayPalPaymentResource.update(
|
15
|
+
:amount => BigDecimal("55.00"),
|
16
|
+
:amount_breakdown => {
|
17
|
+
:discount => BigDecimal("15.00"),
|
18
|
+
:handling => BigDecimal("0.00"),
|
19
|
+
:insurance => BigDecimal("5.00"),
|
20
|
+
:item_total => BigDecimal("45.00"),
|
21
|
+
:shipping => BigDecimal("10.00"),
|
22
|
+
:shipping_discount => BigDecimal("0.00"),
|
23
|
+
:tax_total => BigDecimal("10.00"),
|
24
|
+
},
|
25
|
+
:currency_iso_code => "USD",
|
26
|
+
:custom_field => "0437",
|
27
|
+
:description => "This is a test",
|
28
|
+
:line_items => [{
|
29
|
+
:description => "Shoes",
|
30
|
+
:image_url => "https://example.com/products/23434/pic.png",
|
31
|
+
:kind => "debit",
|
32
|
+
:name => "Name #1",
|
33
|
+
:product_code => "23434",
|
34
|
+
:quantity => "1",
|
35
|
+
:total_amount => BigDecimal("45.00"),
|
36
|
+
:unit_amount => BigDecimal("45.00"),
|
37
|
+
:unit_tax_amount => BigDecimal("10.00"),
|
38
|
+
:url => "https://example.com/products/23434",
|
39
|
+
}],
|
40
|
+
:order_id => "order-123456789",
|
41
|
+
:payee_email => "bt_buyer_us@paypal.com",
|
42
|
+
:payment_method_nonce => nonce,
|
43
|
+
:shipping => {
|
44
|
+
:country_name => "United States",
|
45
|
+
:country_code_alpha2 => "US",
|
46
|
+
:country_code_alpha3 => "USA",
|
47
|
+
:country_code_numeric => "484",
|
48
|
+
:extended_address => "Apt. #1",
|
49
|
+
:first_name => "John",
|
50
|
+
:international_phone => {
|
51
|
+
:country_code => "1",
|
52
|
+
:national_number => "4081111111",
|
53
|
+
},
|
54
|
+
:last_name => "Doe",
|
55
|
+
:locality => "Chicago",
|
56
|
+
:postal_code => "60618",
|
57
|
+
:region => "IL",
|
58
|
+
:street_address => "123 Division Street",
|
59
|
+
},
|
60
|
+
:shipping_options => [{
|
61
|
+
:amount => BigDecimal("10.00"),
|
62
|
+
:id => "option1",
|
63
|
+
:label => "fast",
|
64
|
+
:selected => true,
|
65
|
+
:type => "SHIPPING"
|
66
|
+
}],
|
67
|
+
)
|
68
|
+
|
69
|
+
expect(result.success?).to eq(true)
|
70
|
+
expect(result.payment_method_nonce).not_to be_nil
|
71
|
+
expect(result.payment_method_nonce.nonce).not_to be_nil
|
72
|
+
end
|
73
|
+
|
74
|
+
it "returns validation errors" do
|
75
|
+
nonce = nonce_for_paypal_account(
|
76
|
+
:intent => "order",
|
77
|
+
:payment_token => "fake-paypal-payment-token",
|
78
|
+
:payer_id => "fake-paypal-payer-id",
|
79
|
+
)
|
80
|
+
|
81
|
+
result = Braintree::PayPalPaymentResource.update(
|
82
|
+
:amount => BigDecimal("55.00"),
|
83
|
+
:amount_breakdown => {
|
84
|
+
:discount => BigDecimal("15.00"),
|
85
|
+
:handling => BigDecimal("0.00"),
|
86
|
+
:insurance => BigDecimal("5.00"),
|
87
|
+
:item_total => BigDecimal("45.00"),
|
88
|
+
:shipping => BigDecimal("10.00"),
|
89
|
+
:shipping_discount => BigDecimal("0.00"),
|
90
|
+
:tax_total => BigDecimal("10.00"),
|
91
|
+
},
|
92
|
+
:currency_iso_code => "USD",
|
93
|
+
:custom_field => "0437",
|
94
|
+
:description => "This is a test",
|
95
|
+
:line_items => [{
|
96
|
+
:description => "Shoes",
|
97
|
+
:image_url => "https://example.com/products/23434/pic.png",
|
98
|
+
:kind => "debit",
|
99
|
+
:name => "Name #1",
|
100
|
+
:product_code => "23434",
|
101
|
+
:quantity => "1",
|
102
|
+
:total_amount => BigDecimal("45.00"),
|
103
|
+
:unit_amount => BigDecimal("45.00"),
|
104
|
+
:unit_tax_amount => BigDecimal("10.00"),
|
105
|
+
:url => "https://example.com/products/23434",
|
106
|
+
}],
|
107
|
+
:order_id => "order-123456789",
|
108
|
+
:payee_email => "bt_buyer_us@paypal",
|
109
|
+
:payment_method_nonce => nonce,
|
110
|
+
:shipping => {
|
111
|
+
:country_name => "United States",
|
112
|
+
:country_code_alpha2 => "US",
|
113
|
+
:country_code_alpha3 => "USA",
|
114
|
+
:country_code_numeric => "484",
|
115
|
+
:extended_address => "Apt. #1",
|
116
|
+
:first_name => "John",
|
117
|
+
:international_phone => {
|
118
|
+
:country_code => "1",
|
119
|
+
:national_number => "4081111111",
|
120
|
+
},
|
121
|
+
:last_name => "Doe",
|
122
|
+
:locality => "Chicago",
|
123
|
+
:postal_code => "60618",
|
124
|
+
:region => "IL",
|
125
|
+
:street_address => "123 Division Street",
|
126
|
+
},
|
127
|
+
:shipping_options => [{
|
128
|
+
:amount => BigDecimal("10.00"),
|
129
|
+
:id => "option1",
|
130
|
+
:label => "fast",
|
131
|
+
:selected => true,
|
132
|
+
:type => "SHIPPING"
|
133
|
+
}],
|
134
|
+
)
|
135
|
+
|
136
|
+
expect(result.success?).to eq(false)
|
137
|
+
errors = result.errors.for(:paypal_payment_resource)
|
138
|
+
expect(errors.on(:payee_email)[0].code).to eq(Braintree::ErrorCodes::PayPalPaymentResource::InvalidEmail)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
@@ -267,6 +267,19 @@ describe Braintree::Transaction do
|
|
267
267
|
expect(result.transaction.credit_card_details.prepaid).to eq(Braintree::CreditCard::Prepaid::Yes)
|
268
268
|
expect(result.transaction.payment_instrument_type).to eq(Braintree::PaymentInstrumentType::CreditCard)
|
269
269
|
end
|
270
|
+
|
271
|
+
it "sets the prepaid_reloadable field if the card is prepaid reloadable" do
|
272
|
+
result = Braintree::Transaction.create(
|
273
|
+
:type => "sale",
|
274
|
+
:amount => 1_00,
|
275
|
+
:credit_card => {
|
276
|
+
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::PrepaidReloadable,
|
277
|
+
:expiration_date => "05/2009"
|
278
|
+
},
|
279
|
+
)
|
280
|
+
expect(result.transaction.credit_card_details.prepaid_reloadable).to eq(Braintree::CreditCard::PrepaidReloadable::Yes)
|
281
|
+
expect(result.transaction.payment_instrument_type).to eq(Braintree::PaymentInstrumentType::CreditCard)
|
282
|
+
end
|
270
283
|
end
|
271
284
|
|
272
285
|
describe "sca_exemption" do
|
@@ -2183,6 +2196,7 @@ describe Braintree::Transaction do
|
|
2183
2196
|
meta_checkout_card_details.last_4.should == "1881"
|
2184
2197
|
meta_checkout_card_details.masked_number.should == "401288******1881"
|
2185
2198
|
meta_checkout_card_details.prepaid.should == "No"
|
2199
|
+
meta_checkout_card_details.prepaid_reloadable.should == "Unknown"
|
2186
2200
|
end
|
2187
2201
|
|
2188
2202
|
it "can create a transaction with a fake meta checkout token nonce" do
|
@@ -2213,6 +2227,7 @@ describe Braintree::Transaction do
|
|
2213
2227
|
meta_checkout_token_details.last_4.should == "1881"
|
2214
2228
|
meta_checkout_token_details.masked_number.should == "401288******1881"
|
2215
2229
|
meta_checkout_token_details.prepaid.should == "No"
|
2230
|
+
meta_checkout_token_details.prepaid_reloadable.should == "Unknown"
|
2216
2231
|
end
|
2217
2232
|
|
2218
2233
|
it "can create a transaction with a fake apple pay nonce" do
|
@@ -266,4 +266,9 @@ describe Braintree::CreditCard do
|
|
266
266
|
end
|
267
267
|
end
|
268
268
|
end
|
269
|
+
|
270
|
+
it "initializes prepaid reloadable correctly" do
|
271
|
+
card = Braintree::CreditCard._new(:gateway, {:prepaid_reloadable => "No"})
|
272
|
+
expect(card.prepaid_reloadable).to eq("No")
|
273
|
+
end
|
269
274
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::GooglePayCard do
|
4
|
+
it "initializes prepaid reloadable correctly" do
|
5
|
+
card = Braintree::GooglePayCard._new(:gateway, {:prepaid_reloadable => "No"})
|
6
|
+
expect(card.prepaid_reloadable).to eq("No")
|
7
|
+
end
|
8
|
+
end
|
@@ -1,60 +1,62 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
2
|
|
3
3
|
describe Braintree::MetaCheckoutCard do
|
4
|
-
|
4
|
+
let(:attributes) do {
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
6
|
+
:bin => "abc1234",
|
7
|
+
:card_type => "Visa",
|
8
|
+
:cardholder_name => "Meta Checkout Card CardHolder",
|
9
|
+
:commercial => "NO",
|
10
|
+
:container_id => "a-container-id",
|
11
|
+
:country_of_issuance => "US",
|
12
|
+
:created_at => "2023-05-05T21:28:37Z",
|
13
|
+
:debit => "NO",
|
14
|
+
:durbin_regulated => "NO",
|
15
|
+
:expiration_month => "05",
|
16
|
+
:expiration_year => "2024",
|
17
|
+
:healthcare => "NO",
|
18
|
+
:last_4 => "1234",
|
19
|
+
:payroll => "NO",
|
20
|
+
:prepaid => "NO",
|
21
|
+
:prepaid_reloadable => "NO",
|
22
|
+
:token => "token1",
|
23
|
+
:unique_number_identifier => "abc1234",
|
24
|
+
:updated_at => "2023-05-05T21:28:37Z"
|
25
|
+
}
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
describe "unit tests" do
|
29
|
+
it "initializes with the correct attributes" do
|
30
|
+
card = Braintree::MetaCheckoutCard._new(:gateway, attributes)
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
32
|
+
card.bin.should == "abc1234"
|
33
|
+
card.card_type.should == "Visa"
|
34
|
+
card.cardholder_name.should == "Meta Checkout Card CardHolder"
|
35
|
+
card.commercial == "NO"
|
36
|
+
card.container_id.should == "a-container-id"
|
37
|
+
card.country_of_issuance == "US"
|
38
|
+
card.created_at == "2023-05-05T21:28:37Z"
|
39
|
+
card.debit == "NO"
|
40
|
+
card.expiration_month.should == "05"
|
41
|
+
card.expiration_year.should == "2024"
|
42
|
+
card.healthcare == "NO"
|
43
|
+
card.last_4.should == "1234"
|
44
|
+
card.payroll == "NO"
|
45
|
+
card.prepaid == "NO"
|
46
|
+
card.prepaid_reloadable == "NO"
|
47
|
+
card.token == "token1"
|
48
|
+
card.unique_number_identifier == "abc1234"
|
49
|
+
card.updated_at == "2023-05-05T21:28:37Z"
|
50
|
+
end
|
49
51
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
52
|
+
it "sets expiration date correctly" do
|
53
|
+
card = Braintree::MetaCheckoutCard._new(:gateway, attributes)
|
54
|
+
card.expiration_date.should == "05/2024"
|
55
|
+
end
|
54
56
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
57
|
+
it "masks the card number correctly" do
|
58
|
+
card = Braintree::MetaCheckoutCard._new(:gateway, attributes)
|
59
|
+
card.masked_number.should == "abc1234******1234"
|
59
60
|
end
|
60
|
-
end
|
61
|
+
end
|
62
|
+
end
|
@@ -17,6 +17,7 @@ describe Braintree::MetaCheckoutToken do
|
|
17
17
|
:last_4 => "1234",
|
18
18
|
:payroll => "NO",
|
19
19
|
:prepaid => "NO",
|
20
|
+
:prepaid_reloadable => "NO",
|
20
21
|
:token => "token1",
|
21
22
|
:unique_number_identifier => "abc1234",
|
22
23
|
:updated_at => "2023-05-05T21:28:37Z",
|
@@ -40,6 +41,7 @@ describe Braintree::MetaCheckoutToken do
|
|
40
41
|
card.debit == "NO"
|
41
42
|
card.payroll == "NO"
|
42
43
|
card.prepaid == "NO"
|
44
|
+
card.prepaid_reloadable == "NO"
|
43
45
|
card.healthcare == "NO"
|
44
46
|
card.token == "token1"
|
45
47
|
card.unique_number_identifier == "abc1234"
|
@@ -60,4 +62,4 @@ describe Braintree::MetaCheckoutToken do
|
|
60
62
|
card.masked_number.should == "abc1234******1234"
|
61
63
|
end
|
62
64
|
end
|
63
|
-
end
|
65
|
+
end
|
@@ -15,7 +15,8 @@ describe Braintree::PaymentMethodNonce do
|
|
15
15
|
:liability_shifted => false
|
16
16
|
},
|
17
17
|
:bin_data => {
|
18
|
-
:country_of_issuance => "USA"
|
18
|
+
:country_of_issuance => "USA",
|
19
|
+
:prepaid_reloadable => "Yes"
|
19
20
|
},
|
20
21
|
)
|
21
22
|
}
|
@@ -29,6 +30,8 @@ describe Braintree::PaymentMethodNonce do
|
|
29
30
|
expect(payment_method_nonce.three_d_secure_info.liability_shift_possible).to be false
|
30
31
|
expect(payment_method_nonce.three_d_secure_info.liability_shifted).to be false
|
31
32
|
expect(payment_method_nonce.bin_data.country_of_issuance).to eq("USA")
|
33
|
+
expect(payment_method_nonce.bin_data.prepaid_reloadable).to eq("Yes")
|
34
|
+
|
32
35
|
end
|
33
36
|
end
|
34
37
|
|
@@ -0,0 +1,125 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::PayPalPaymentResource do
|
4
|
+
|
5
|
+
describe "#update" do
|
6
|
+
it "successfully updates a paypal payment request" do
|
7
|
+
paypal_payment_resource_request = {
|
8
|
+
:amount => 55.00,
|
9
|
+
:amount_breakdown => {
|
10
|
+
:discount => 15_00,
|
11
|
+
:handling => 0,
|
12
|
+
:insurance => 5_00,
|
13
|
+
:item_total => 45_00,
|
14
|
+
:shipping => 10_00,
|
15
|
+
:shipping_discount => 0,
|
16
|
+
:tax_total => 10_00
|
17
|
+
},
|
18
|
+
:currency_iso_code => "USD",
|
19
|
+
:description => "This is a test",
|
20
|
+
:custom_field => "0437",
|
21
|
+
:line_items => [{
|
22
|
+
:description => "Shoes",
|
23
|
+
:image_url => "https://example.com/products/23434/pic.png",
|
24
|
+
:kind => "debit",
|
25
|
+
:name => "Name #1",
|
26
|
+
:product_code => "23434",
|
27
|
+
:quantity => 1_00,
|
28
|
+
:total_amount => 45_00,
|
29
|
+
:unit_amount => 45_00,
|
30
|
+
:unit_tax_amount => 10_00,
|
31
|
+
:url => "https://example.com/products/23434",
|
32
|
+
}],
|
33
|
+
:order_id => "order-123456789",
|
34
|
+
:payee_email => "bt_buyer_us@paypal.com",
|
35
|
+
:payment_method_nonce => "1234",
|
36
|
+
:shipping => {
|
37
|
+
:country_name => "United States",
|
38
|
+
:country_code_alpha2 => "US",
|
39
|
+
:country_code_alpha3 => "USA",
|
40
|
+
:country_code_numeric => "484",
|
41
|
+
:extended_address => "Apt. #1",
|
42
|
+
:first_name => "John",
|
43
|
+
:international_phone => {
|
44
|
+
:country_code => "1",
|
45
|
+
:national_number => "4081111111",
|
46
|
+
},
|
47
|
+
:last_name => "Doe",
|
48
|
+
:locality => "Chicago",
|
49
|
+
:postal_code => "60618",
|
50
|
+
:region => "IL",
|
51
|
+
:street_address => "123 Division Street",
|
52
|
+
},
|
53
|
+
:shipping_options => [{
|
54
|
+
:amount => "10.00",
|
55
|
+
:id => "option1",
|
56
|
+
:label => "fast",
|
57
|
+
:selected => true,
|
58
|
+
:type => "SHIPPING"
|
59
|
+
}]
|
60
|
+
}
|
61
|
+
|
62
|
+
unknown_response = {:payment_method_nonce => {}}
|
63
|
+
http_instance = double(:put => unknown_response)
|
64
|
+
allow(Braintree::Http).to receive(:new).and_return(http_instance)
|
65
|
+
result = Braintree::PayPalPaymentResource.update(paypal_payment_resource_request)
|
66
|
+
expect(result).to be_success
|
67
|
+
end
|
68
|
+
it "should match the update signature" do
|
69
|
+
expect(Braintree::PayPalPaymentResourceGateway._update_signature).to match([
|
70
|
+
:amount,
|
71
|
+
{:amount_breakdown => [
|
72
|
+
:discount,
|
73
|
+
:handling,
|
74
|
+
:insurance,
|
75
|
+
:item_total,
|
76
|
+
:shipping,
|
77
|
+
:shipping_discount,
|
78
|
+
:tax_total
|
79
|
+
]},
|
80
|
+
:currency_iso_code,
|
81
|
+
:custom_field,
|
82
|
+
:description,
|
83
|
+
{:line_items => [
|
84
|
+
:description,
|
85
|
+
:image_url,
|
86
|
+
:kind,
|
87
|
+
:name,
|
88
|
+
:product_code,
|
89
|
+
:quantity,
|
90
|
+
:total_amount,
|
91
|
+
:unit_amount,
|
92
|
+
:unit_tax_amount,
|
93
|
+
:url,
|
94
|
+
]},
|
95
|
+
:order_id,
|
96
|
+
:payee_email,
|
97
|
+
:payment_method_nonce,
|
98
|
+
{:shipping => [
|
99
|
+
:country_name,
|
100
|
+
:country_code_alpha2,
|
101
|
+
:country_code_alpha3,
|
102
|
+
:country_code_numeric,
|
103
|
+
:extended_address,
|
104
|
+
:first_name,
|
105
|
+
{:international_phone => [
|
106
|
+
:country_code,
|
107
|
+
:national_number]},
|
108
|
+
:last_name,
|
109
|
+
:locality,
|
110
|
+
:postal_code,
|
111
|
+
:region,
|
112
|
+
:street_address,
|
113
|
+
]},
|
114
|
+
{:shipping_options => [
|
115
|
+
:amount,
|
116
|
+
:id,
|
117
|
+
:label,
|
118
|
+
:selected,
|
119
|
+
:type
|
120
|
+
]},
|
121
|
+
],
|
122
|
+
)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::ApplePayDetails do
|
4
|
+
it "initializes prepaid reloadable correctly" do
|
5
|
+
card = Braintree::ApplePayDetails._new(:gateway, {:prepaid_reloadable => "No"})
|
6
|
+
expect(card.prepaid_reloadable).to eq("No")
|
7
|
+
end
|
8
|
+
end
|
@@ -24,6 +24,7 @@ describe Braintree::Transaction::CreditCardDetails do
|
|
24
24
|
:customer_location => "US",
|
25
25
|
:healthcare => "No",
|
26
26
|
:prepaid => "Yes",
|
27
|
+
:prepaid_reloadable => "Yes",
|
27
28
|
:durbin_regulated => "No",
|
28
29
|
:debit => "Yes",
|
29
30
|
:commercial => "Unknown",
|
@@ -34,7 +35,7 @@ describe Braintree::Transaction::CreditCardDetails do
|
|
34
35
|
:image_url => "example.com/visa.png",
|
35
36
|
:unique_number_identifier => "abc123",
|
36
37
|
)
|
37
|
-
expect(details.inspect).to eq(%(#<token: "token", bin: "123456", last_4: "6789", card_type: "Visa",
|
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">))
|
38
39
|
end
|
39
40
|
end
|
40
41
|
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::GooglePayDetails do
|
4
|
+
it "initializes prepaid reloadable correctly" do
|
5
|
+
card = Braintree::GooglePayDetails._new(:gateway, {:prepaid_reloadable => "No"})
|
6
|
+
expect(card.prepaid_reloadable).to eq("No")
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::MetaCheckoutCardDetails do
|
4
|
+
it "initializes prepaid reloadable correctly" do
|
5
|
+
card = Braintree::MetaCheckoutCardDetails._new(:gateway, {:prepaid_reloadable => "No"})
|
6
|
+
expect(card.prepaid_reloadable).to eq("No")
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::MetaCheckoutTokenDetails do
|
4
|
+
it "initializes prepaid reloadable correctly" do
|
5
|
+
card = Braintree::MetaCheckoutTokenDetails._new(:gateway, {:prepaid_reloadable => "No"})
|
6
|
+
expect(card.prepaid_reloadable).to eq("No")
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::VisaCheckoutCardDetails do
|
4
|
+
it "initializes prepaid reloadable correctly" do
|
5
|
+
card = Braintree::VisaCheckoutCardDetails._new(:gateway, {:prepaid_reloadable => "No"})
|
6
|
+
expect(card.prepaid_reloadable).to eq("No")
|
7
|
+
end
|
8
|
+
end
|
@@ -119,6 +119,7 @@ describe Braintree::Transaction do
|
|
119
119
|
:expiration_year => "2009",
|
120
120
|
:customer_location => "US",
|
121
121
|
:prepaid => "Yes",
|
122
|
+
:prepaid_reloadable => "Yes",
|
122
123
|
:healthcare => "Yes",
|
123
124
|
:durbin_regulated => "Yes",
|
124
125
|
:debit => "Yes",
|
@@ -137,6 +138,7 @@ describe Braintree::Transaction do
|
|
137
138
|
expect(transaction.credit_card_details.expiration_year).to eq("2009")
|
138
139
|
expect(transaction.credit_card_details.customer_location).to eq("US")
|
139
140
|
expect(transaction.credit_card_details.prepaid).to eq(Braintree::CreditCard::Prepaid::Yes)
|
141
|
+
expect(transaction.credit_card_details.prepaid_reloadable).to eq(Braintree::CreditCard::PrepaidReloadable::Yes)
|
140
142
|
expect(transaction.credit_card_details.healthcare).to eq(Braintree::CreditCard::Healthcare::Yes)
|
141
143
|
expect(transaction.credit_card_details.durbin_regulated).to eq(Braintree::CreditCard::DurbinRegulated::Yes)
|
142
144
|
expect(transaction.credit_card_details.debit).to eq(Braintree::CreditCard::Debit::Yes)
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::VisaCheckoutCard do
|
4
|
+
it "initializes prepaid reloadable correctly" do
|
5
|
+
card = Braintree::VisaCheckoutCard._new(:gateway, {:prepaid_reloadable => "No"})
|
6
|
+
expect(card.prepaid_reloadable).to eq("No")
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::CreditCardDetails do
|
4
|
+
it "initializes prepaid reloadable correctly" do
|
5
|
+
card = Braintree::CreditCardDetails._new(:gateway, {:prepaid_reloadable => "No"})
|
6
|
+
expect(card.prepaid_reloadable).to eq("No")
|
7
|
+
end
|
8
|
+
end
|