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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca8e969e0988757df5800a440fdc36293b48bc0c72cc8c56b1175d74d79f309b
|
4
|
+
data.tar.gz: b44530a7eb4a73728fd4c79292633fc7d7ca0d6476c26b7277c1a3051d29fcaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d985f754fa864774601dad717587b5d5d7f1e75a9579286100559e9cd4ab1819fd856b5c90c6d59870149b6d7bfd0cc5d2865f2d96362a208c037854b9ab312
|
7
|
+
data.tar.gz: 2ab4e8c0f48d76e10f4854e3e32fe55c154c8bdd40730625409f4259921268788c9bd2baf3152724a6d665ed5d0bf53dc7b540570f2f9777ced5dc53be6aeaa8
|
data/lib/braintree/bin_data.rb
CHANGED
@@ -10,6 +10,7 @@ module Braintree
|
|
10
10
|
attr_reader :issuing_bank
|
11
11
|
attr_reader :payroll
|
12
12
|
attr_reader :prepaid
|
13
|
+
attr_reader :prepaid_reloadable
|
13
14
|
attr_reader :product_id
|
14
15
|
|
15
16
|
def initialize(attributes)
|
@@ -26,7 +27,7 @@ module Braintree
|
|
26
27
|
def self._attributes
|
27
28
|
[
|
28
29
|
:commercial, :country_of_issuance, :debit, :durbin_regulated, :healthcare,
|
29
|
-
:issuing_bank, :payroll, :prepaid, :product_id
|
30
|
+
:issuing_bank, :payroll, :prepaid, :prepaid_reloadable, :product_id
|
30
31
|
]
|
31
32
|
end
|
32
33
|
end
|
@@ -45,8 +45,8 @@ module Braintree
|
|
45
45
|
Unknown = "Unknown"
|
46
46
|
end
|
47
47
|
|
48
|
-
Commercial = Debit = DurbinRegulated = Healthcare =
|
49
|
-
IssuingBank =
|
48
|
+
Commercial = CountryOfIssuance = Debit = DurbinRegulated = Healthcare =
|
49
|
+
IssuingBank = Payroll = Prepaid = PrepaidReloadable = ProductId = CardTypeIndicator
|
50
50
|
|
51
51
|
attr_reader :billing_address
|
52
52
|
attr_reader :bin
|
@@ -66,6 +66,7 @@ module Braintree
|
|
66
66
|
attr_reader :last_4
|
67
67
|
attr_reader :payroll
|
68
68
|
attr_reader :prepaid
|
69
|
+
attr_reader :prepaid_reloadable
|
69
70
|
attr_reader :product_id
|
70
71
|
attr_reader :subscriptions
|
71
72
|
attr_reader :token
|
@@ -199,9 +200,9 @@ module Braintree
|
|
199
200
|
|
200
201
|
def self._attributes
|
201
202
|
[
|
202
|
-
:billing_address, :bin, :card_type, :cardholder_name, :
|
203
|
-
:
|
204
|
-
:
|
203
|
+
:billing_address, :bin, :card_type, :cardholder_name, :commercial, :country_of_issuance, :created_at, :customer_id,
|
204
|
+
:debit, :durbin_regulated, :expiration_month, :expiration_year, :healthcare, :image_url, :is_network_tokenized?,
|
205
|
+
:issuing_bank, :last_4, :payroll, :prepaid, :prepaid_reloadable, :product_id, :token, :updated_at
|
205
206
|
]
|
206
207
|
end
|
207
208
|
|
@@ -210,6 +210,47 @@ module Braintree
|
|
210
210
|
TokenIsInUse = "92906"
|
211
211
|
end
|
212
212
|
|
213
|
+
module PayPalPaymentResource
|
214
|
+
NonceExpired = "97301"
|
215
|
+
IdNotSupported = "97302"
|
216
|
+
NonceRequired = "97303"
|
217
|
+
InvalidEmail = "97304"
|
218
|
+
EmailTooLong = "97305"
|
219
|
+
ExpectedLineItemCollection = "97306"
|
220
|
+
ExpectedLineItemHash = "97307"
|
221
|
+
ExpectedLineItemDebit = "97308"
|
222
|
+
InvalidUnitAmount = "97309"
|
223
|
+
InvalidUnitTaxAmount = "97310"
|
224
|
+
IsoCodeRequired = "97311"
|
225
|
+
IsoCodeUnsupported = "97312"
|
226
|
+
ShippingFieldsMissing = "97313"
|
227
|
+
InvalidAmountBreakdown = "97314"
|
228
|
+
ExpectedShippingOptionCollection = "97315"
|
229
|
+
ShippingOptionsRequired = "97316"
|
230
|
+
ShippingOptionFieldsMissing = "97317"
|
231
|
+
InvalidShippingOptionType = "97318"
|
232
|
+
ShippingOptionIdReused = "97319"
|
233
|
+
TooManyShippingOptionsSelected = "97320"
|
234
|
+
ShippingOptionMustMatchBreakdown = "97321"
|
235
|
+
LineItemsShouldMatchTotal = "97322"
|
236
|
+
LineItemsTaxShouldMatchTotal = "97323"
|
237
|
+
PatchCallFailed = "97324"
|
238
|
+
InvalidAmount = "97325"
|
239
|
+
ShippingIdTooLong = "97326"
|
240
|
+
ShippingLabelTooLong = "97327"
|
241
|
+
ShippingFullNameTooLong = "97328"
|
242
|
+
ShippingAddressTooLong = "97329"
|
243
|
+
ShippingExtendedAddressTooLong = "97330"
|
244
|
+
ShippingLocalityTooLong = "97331"
|
245
|
+
ShippingRegionTooLong = "97332"
|
246
|
+
CountryCodeTooLong = "97333"
|
247
|
+
NationalNumberTooLong = "97334"
|
248
|
+
PostalCodeTooLong = "97335"
|
249
|
+
DescriptionTooLong = "97336"
|
250
|
+
CustomFieldTooLong = "97337"
|
251
|
+
OrderIdTooLong = "97338"
|
252
|
+
end
|
253
|
+
|
213
254
|
module SepaDirectDebitAccount
|
214
255
|
SepaDebitAccountPaymentMethodMandateTypeIsNotSupported = "87115"
|
215
256
|
SepaDebitAccountPaymentMethodCustomerIdIsInvalid = "87116"
|
data/lib/braintree/gateway.rb
CHANGED
@@ -22,6 +22,7 @@ module Braintree
|
|
22
22
|
attr_reader :last_4
|
23
23
|
attr_reader :payroll
|
24
24
|
attr_reader :prepaid
|
25
|
+
attr_reader :prepaid_reloadable
|
25
26
|
attr_reader :product_id
|
26
27
|
attr_reader :subscriptions
|
27
28
|
attr_reader :token
|
@@ -74,11 +75,11 @@ module Braintree
|
|
74
75
|
|
75
76
|
def self._attributes # :nodoc:
|
76
77
|
[
|
77
|
-
:bin, :card_type, :cardholder_name, :
|
78
|
-
:
|
79
|
-
:
|
80
|
-
:
|
81
|
-
:
|
78
|
+
:bin, :card_type, :cardholder_name, :commercial,
|
79
|
+
:container_id, :country_of_issuance, :created_at, :customer_id,
|
80
|
+
:customer_location, :debit, :durbin_regulated, :expiration_month,
|
81
|
+
:expiration_year, :healthcare, :image_url, :issuing_bank, :last_4, :payroll, :prepaid,
|
82
|
+
:prepaid_reloadable, :product_id, :token, :updated_at
|
82
83
|
]
|
83
84
|
end
|
84
85
|
|
@@ -24,6 +24,7 @@ module Braintree
|
|
24
24
|
attr_reader :last_4
|
25
25
|
attr_reader :payroll
|
26
26
|
attr_reader :prepaid
|
27
|
+
attr_reader :prepaid_reloadable
|
27
28
|
attr_reader :product_id
|
28
29
|
attr_reader :token
|
29
30
|
attr_reader :unique_number_identifier
|
@@ -73,11 +74,11 @@ module Braintree
|
|
73
74
|
|
74
75
|
def self._attributes # :nodoc:
|
75
76
|
[
|
76
|
-
:bin, :card_type, :cardholder_name, :
|
77
|
-
:customer_id, :customer_location, :
|
78
|
-
:
|
79
|
-
:
|
80
|
-
:
|
77
|
+
:bin, :card_type, :cardholder_name, :commercial, :container_id, :country_of_issuance,
|
78
|
+
:created_at, :cryptogram, :customer_id, :customer_location, :debit, :durbin_regulated,
|
79
|
+
:ecommerce_indicator, :expiration_month, :expiration_year, :healthcare, :image_url,
|
80
|
+
:issuing_bank, :last_4, :payroll, :prepaid, :prepaid_reloadable, :product_id, :token,
|
81
|
+
:updated_at
|
81
82
|
]
|
82
83
|
end
|
83
84
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Braintree
|
2
|
+
class PayPalPaymentResource
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
def self.update(*args)
|
6
|
+
Configuration.gateway.paypal_payment_resource.update(*args)
|
7
|
+
end
|
8
|
+
|
9
|
+
class << self
|
10
|
+
protected :new
|
11
|
+
def _new(*args)
|
12
|
+
self.new(*args)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(gateway, attributes)
|
17
|
+
@gateway = gateway
|
18
|
+
set_instance_variables_from_hash(attributes)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Braintree
|
2
|
+
class PayPalPaymentResourceGateway
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
def initialize(gateway)
|
6
|
+
@gateway = gateway
|
7
|
+
@config = gateway.config
|
8
|
+
@config.assert_has_access_token_or_keys
|
9
|
+
end
|
10
|
+
|
11
|
+
def update(attributes)
|
12
|
+
Util.verify_keys(PayPalPaymentResourceGateway._update_signature, attributes)
|
13
|
+
response = @config.http.put("#{@config.base_merchant_path}/paypal/payment_resource", :paypal_payment_resource => attributes)
|
14
|
+
if response[:payment_method_nonce]
|
15
|
+
SuccessfulResult.new(:payment_method_nonce => PaymentMethodNonce._new(@gateway, response[:payment_method_nonce]))
|
16
|
+
elsif response[:api_error_response]
|
17
|
+
ErrorResult.new(@gateway, response[:api_error_response])
|
18
|
+
else
|
19
|
+
raise UnexpectedError, "expected :paypal_payment_resource or :api_error_response"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def self._update_signature
|
24
|
+
[
|
25
|
+
:amount,
|
26
|
+
{:amount_breakdown => [:discount, :handling, :insurance, :item_total, :shipping, :shipping_discount, :tax_total]},
|
27
|
+
:currency_iso_code, :custom_field, :description,
|
28
|
+
{:line_items => [:description, :image_url, :kind, :name, :product_code, :quantity, :total_amount, :unit_amount, :unit_tax_amount, :url]},
|
29
|
+
:order_id, :payee_email, :payment_method_nonce,
|
30
|
+
{:shipping => [:country_name, :country_code_alpha2, :country_code_alpha3, :country_code_numeric, :extended_address, :first_name, {:international_phone => [:country_code, :national_number]},
|
31
|
+
:last_name, :locality, :postal_code, :region, :street_address]},
|
32
|
+
{:shipping_options => [:amount, :id, :label, :selected, :type]}
|
33
|
+
]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -20,6 +20,7 @@ module Braintree
|
|
20
20
|
attr_reader :last_4
|
21
21
|
attr_reader :payroll
|
22
22
|
attr_reader :prepaid
|
23
|
+
attr_reader :prepaid_reloadable
|
23
24
|
attr_reader :product_id
|
24
25
|
attr_reader :token
|
25
26
|
attr_reader :unique_number_identifier
|
@@ -34,23 +35,24 @@ module Braintree
|
|
34
35
|
|
35
36
|
def inspect
|
36
37
|
attr_order = [
|
37
|
-
:token,
|
38
38
|
:bin,
|
39
|
-
:last_4,
|
40
39
|
:card_type,
|
41
|
-
:expiration_date,
|
42
40
|
:cardholder_name,
|
41
|
+
:commercial,
|
42
|
+
:country_of_issuance,
|
43
43
|
:customer_location,
|
44
|
-
:prepaid,
|
45
|
-
:healthcare,
|
46
|
-
:durbin_regulated,
|
47
44
|
:debit,
|
48
|
-
:
|
45
|
+
:durbin_regulated,
|
46
|
+
:expiration_date,
|
47
|
+
:healthcare,
|
48
|
+
:image_url,
|
49
|
+
:issuing_bank,
|
50
|
+
:last_4,
|
49
51
|
:payroll,
|
52
|
+
:prepaid,
|
53
|
+
:prepaid_reloadable,
|
50
54
|
:product_id,
|
51
|
-
:
|
52
|
-
:issuing_bank,
|
53
|
-
:image_url,
|
55
|
+
:token,
|
54
56
|
:unique_number_identifier,
|
55
57
|
]
|
56
58
|
|
@@ -5,27 +5,28 @@ module Braintree
|
|
5
5
|
|
6
6
|
attr_reader :bin
|
7
7
|
attr_reader :card_type
|
8
|
+
attr_reader :commercial
|
9
|
+
attr_reader :country_of_issuance
|
10
|
+
attr_reader :debit
|
11
|
+
attr_reader :durbin_regulated
|
8
12
|
attr_reader :expiration_month
|
9
13
|
attr_reader :expiration_year
|
14
|
+
attr_reader :global_id
|
10
15
|
attr_reader :google_transaction_id
|
16
|
+
attr_reader :healthcare
|
11
17
|
attr_reader :image_url
|
18
|
+
attr_reader :issuing_bank
|
12
19
|
attr_reader :last_4
|
20
|
+
attr_reader :payroll
|
21
|
+
attr_reader :prepaid
|
22
|
+
attr_reader :prepaid_reloadable
|
23
|
+
attr_reader :product_id
|
13
24
|
attr_reader :source_card_last_4
|
14
25
|
attr_reader :source_card_type
|
15
26
|
attr_reader :source_description
|
16
27
|
attr_reader :token
|
17
28
|
attr_reader :virtual_card_last_4
|
18
29
|
attr_reader :virtual_card_type
|
19
|
-
attr_reader :prepaid
|
20
|
-
attr_reader :healthcare
|
21
|
-
attr_reader :debit
|
22
|
-
attr_reader :durbin_regulated
|
23
|
-
attr_reader :commercial
|
24
|
-
attr_reader :payroll
|
25
|
-
attr_reader :issuing_bank
|
26
|
-
attr_reader :country_of_issuance
|
27
|
-
attr_reader :product_id
|
28
|
-
attr_reader :global_id
|
29
30
|
|
30
31
|
def initialize(attributes)
|
31
32
|
set_instance_variables_from_hash attributes unless attributes.nil?
|
@@ -22,6 +22,7 @@ module Braintree
|
|
22
22
|
attr_reader :last_4
|
23
23
|
attr_reader :payroll
|
24
24
|
attr_reader :prepaid
|
25
|
+
attr_reader :prepaid_reloadable
|
25
26
|
attr_reader :product_id
|
26
27
|
attr_reader :token
|
27
28
|
attr_reader :unique_number_identifier
|
@@ -36,8 +37,10 @@ module Braintree
|
|
36
37
|
end
|
37
38
|
|
38
39
|
def inspect
|
39
|
-
attr_order = [
|
40
|
-
|
40
|
+
attr_order = [
|
41
|
+
:bin, :card_type, :cardholder_name, :commercial, :container_id, :country_of_issuance,
|
42
|
+
:customer_location, :debit, :durbin_regulated, :expiration_date, :healthcare, :image_url,
|
43
|
+
:issuing_bank, :last_4, :payroll, :prepaid, :prepaid_reloadable, :product_id, :token]
|
41
44
|
formatted_attrs = attr_order.map do |attr|
|
42
45
|
"#{attr}: #{send(attr).inspect}"
|
43
46
|
end
|
@@ -24,6 +24,7 @@ module Braintree
|
|
24
24
|
attr_reader :last_4
|
25
25
|
attr_reader :payroll
|
26
26
|
attr_reader :prepaid
|
27
|
+
attr_reader :prepaid_reloadable
|
27
28
|
attr_reader :product_id
|
28
29
|
attr_reader :token
|
29
30
|
attr_reader :unique_number_identifier
|
@@ -38,8 +39,11 @@ module Braintree
|
|
38
39
|
end
|
39
40
|
|
40
41
|
def inspect
|
41
|
-
attr_order = [
|
42
|
-
|
42
|
+
attr_order = [
|
43
|
+
:bin, :card_type, :cardholder_name, :commercial, :container_id, :country_of_issuance,
|
44
|
+
:cryptogram, :customer_location, :debit, :durbin_regulated, :ecommerce_indicator,
|
45
|
+
:expiration_date, :healthcare, :image_url, :is_network_tokenized, :issuing_bank, :last_4,
|
46
|
+
:payroll, :prepaid, :prepaid_reloadable, :product_id, :token]
|
43
47
|
formatted_attrs = attr_order.map do |attr|
|
44
48
|
"#{attr}: #{send(attr).inspect}"
|
45
49
|
end
|
@@ -20,6 +20,7 @@ module Braintree
|
|
20
20
|
attr_reader :last_4
|
21
21
|
attr_reader :payroll
|
22
22
|
attr_reader :prepaid
|
23
|
+
attr_reader :prepaid_reloadable
|
23
24
|
attr_reader :product_id
|
24
25
|
attr_reader :token
|
25
26
|
|
@@ -32,8 +33,10 @@ module Braintree
|
|
32
33
|
end
|
33
34
|
|
34
35
|
def inspect
|
35
|
-
attr_order = [
|
36
|
-
|
36
|
+
attr_order = [
|
37
|
+
:bin, :call_id, :card_type, :cardholder_name, :commercial, :country_of_issuance, :customer_location,
|
38
|
+
:debit, :durbin_regulated, :expiration_date, :healthcare, :image_url, :issuing_bank, :last_4, :payroll,
|
39
|
+
:prepaid, :prepaid_reloadable, :product_id, :token]
|
37
40
|
formatted_attrs = attr_order.map do |attr|
|
38
41
|
"#{attr}: #{send(attr).inspect}"
|
39
42
|
end
|
data/lib/braintree/version.rb
CHANGED
@@ -23,6 +23,7 @@ module Braintree
|
|
23
23
|
attr_reader :last_4
|
24
24
|
attr_reader :payroll
|
25
25
|
attr_reader :prepaid
|
26
|
+
attr_reader :prepaid_reloadable
|
26
27
|
attr_reader :product_id
|
27
28
|
attr_reader :subscriptions
|
28
29
|
attr_reader :token
|
@@ -75,11 +76,10 @@ module Braintree
|
|
75
76
|
|
76
77
|
def self._attributes
|
77
78
|
[
|
78
|
-
:
|
79
|
-
:customer_id, :customer_location, :
|
80
|
-
:
|
81
|
-
:
|
82
|
-
:country_of_issuance, :issuing_bank, :image_url, :call_id
|
79
|
+
:bin, :billing_address, :card_type, :cardholder_name, :commercial, :container_id, :country_of_issuance,
|
80
|
+
:created_at, :customer_id, :customer_location, :debit, :durbin_regulated, :expiration_month,
|
81
|
+
:expiration_year, :healthcare, :image_url, :issuing_bank, :last_4, :payroll, :prepaid,
|
82
|
+
:prepaid_reloadable, :product_id, :token, :updated_at
|
83
83
|
]
|
84
84
|
end
|
85
85
|
|
data/lib/braintree.rb
CHANGED
@@ -117,6 +117,8 @@ require "braintree/payment_method_nonce_gateway"
|
|
117
117
|
require "braintree/payment_method_parser"
|
118
118
|
require "braintree/paypal_account"
|
119
119
|
require "braintree/paypal_account_gateway"
|
120
|
+
require "braintree/paypal_payment_resource"
|
121
|
+
require "braintree/paypal_payment_resource_gateway"
|
120
122
|
require "braintree/plan"
|
121
123
|
require "braintree/plan_gateway"
|
122
124
|
require "braintree/processor_response_types"
|
@@ -449,6 +449,18 @@ describe Braintree::CreditCard do
|
|
449
449
|
expect(credit_card.prepaid).to eq(Braintree::CreditCard::Prepaid::Yes)
|
450
450
|
end
|
451
451
|
|
452
|
+
it "sets the prepaid reloadable field if the card is prepaid reloadable" do
|
453
|
+
customer = Braintree::Customer.create!
|
454
|
+
result = Braintree::CreditCard.create(
|
455
|
+
:customer_id => customer.id,
|
456
|
+
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::PrepaidReloadable,
|
457
|
+
:expiration_date => "05/2014",
|
458
|
+
:options => {:verify_card => true},
|
459
|
+
)
|
460
|
+
credit_card = result.credit_card
|
461
|
+
expect(credit_card.prepaid_reloadable).to eq(Braintree::CreditCard::PrepaidReloadable::Yes)
|
462
|
+
end
|
463
|
+
|
452
464
|
it "sets the healthcare field if the card is healthcare" do
|
453
465
|
customer = Braintree::Customer.create!
|
454
466
|
result = Braintree::CreditCard.create(
|
@@ -322,6 +322,30 @@ describe Braintree::CreditCardVerification, "search" do
|
|
322
322
|
found_verification = Braintree::CreditCardVerification.find(verification_id)
|
323
323
|
expect(found_verification.credit_card[:prepaid]).to eq(Braintree::CreditCard::Prepaid::Yes)
|
324
324
|
end
|
325
|
+
|
326
|
+
it "returns prepaid_reloadable on a prepaid card" do
|
327
|
+
cardholder_name = "Tom #{rand(1_000_000)} Smith"
|
328
|
+
|
329
|
+
Braintree::Customer.create(
|
330
|
+
:credit_card => {
|
331
|
+
:cardholder_name => cardholder_name,
|
332
|
+
:expiration_date => "05/2012",
|
333
|
+
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::PrepaidReloadable,
|
334
|
+
:cvv => "200",
|
335
|
+
:options => {
|
336
|
+
:verify_card => true
|
337
|
+
}
|
338
|
+
})
|
339
|
+
|
340
|
+
search_results = Braintree::CreditCardVerification.search do |search|
|
341
|
+
search.credit_card_cardholder_name.is cardholder_name
|
342
|
+
end
|
343
|
+
|
344
|
+
verification_id = search_results.first.id
|
345
|
+
|
346
|
+
found_verification = Braintree::CreditCardVerification.find(verification_id)
|
347
|
+
expect(found_verification.credit_card[:prepaid_reloadable]).to eq(Braintree::CreditCard::PrepaidReloadable::Yes)
|
348
|
+
end
|
325
349
|
end
|
326
350
|
end
|
327
351
|
|
@@ -991,18 +991,19 @@ describe Braintree::Customer do
|
|
991
991
|
expect(found_customer.apple_pay_cards).not_to be_nil
|
992
992
|
apple_pay_card = found_customer.apple_pay_cards.first
|
993
993
|
expect(apple_pay_card).to be_a Braintree::ApplePayCard
|
994
|
-
expect(apple_pay_card.token).not_to be_nil
|
995
|
-
expect(apple_pay_card.expiration_year).not_to be_nil
|
996
|
-
expect(apple_pay_card.payment_instrument_name).to eq("AmEx 41002")
|
997
994
|
expect(apple_pay_card.commercial).not_to be_nil
|
998
995
|
expect(apple_pay_card.country_of_issuance).not_to be_nil
|
999
996
|
expect(apple_pay_card.debit).not_to be_nil
|
1000
997
|
expect(apple_pay_card.durbin_regulated).not_to be_nil
|
998
|
+
expect(apple_pay_card.expiration_year).not_to be_nil
|
1001
999
|
expect(apple_pay_card.healthcare).not_to be_nil
|
1002
1000
|
expect(apple_pay_card.issuing_bank).not_to be_nil
|
1001
|
+
expect(apple_pay_card.payment_instrument_name).to eq("AmEx 41002")
|
1003
1002
|
expect(apple_pay_card.payroll).not_to be_nil
|
1004
1003
|
expect(apple_pay_card.prepaid).not_to be_nil
|
1004
|
+
expect(apple_pay_card.prepaid_reloadable).not_to be_nil
|
1005
1005
|
expect(apple_pay_card.product_id).not_to be_nil
|
1006
|
+
expect(apple_pay_card.token).not_to be_nil
|
1006
1007
|
end
|
1007
1008
|
|
1008
1009
|
it "returns associated google pay proxy cards" do
|
@@ -1016,18 +1017,19 @@ describe Braintree::Customer do
|
|
1016
1017
|
expect(found_customer.payment_methods.size).to eq(1)
|
1017
1018
|
google_pay_card = found_customer.google_pay_cards.first
|
1018
1019
|
expect(google_pay_card).to be_a Braintree::GooglePayCard
|
1019
|
-
expect(google_pay_card.token).not_to be_nil
|
1020
|
-
expect(google_pay_card.expiration_year).not_to be_nil
|
1021
|
-
expect(google_pay_card.is_network_tokenized?).to eq(false)
|
1022
1020
|
expect(google_pay_card.commercial).not_to be_nil
|
1023
1021
|
expect(google_pay_card.country_of_issuance).not_to be_nil
|
1024
1022
|
expect(google_pay_card.debit).not_to be_nil
|
1025
1023
|
expect(google_pay_card.durbin_regulated).not_to be_nil
|
1024
|
+
expect(google_pay_card.expiration_year).not_to be_nil
|
1026
1025
|
expect(google_pay_card.healthcare).not_to be_nil
|
1026
|
+
expect(google_pay_card.is_network_tokenized?).to eq(false)
|
1027
1027
|
expect(google_pay_card.issuing_bank).not_to be_nil
|
1028
1028
|
expect(google_pay_card.payroll).not_to be_nil
|
1029
1029
|
expect(google_pay_card.prepaid).not_to be_nil
|
1030
|
+
expect(google_pay_card.prepaid_reloadable).not_to be_nil
|
1030
1031
|
expect(google_pay_card.product_id).not_to be_nil
|
1032
|
+
expect(google_pay_card.token).not_to be_nil
|
1031
1033
|
end
|
1032
1034
|
|
1033
1035
|
it "returns associated google pay network tokens" do
|
@@ -1052,6 +1054,7 @@ describe Braintree::Customer do
|
|
1052
1054
|
expect(google_pay_card.issuing_bank).not_to be_nil
|
1053
1055
|
expect(google_pay_card.payroll).not_to be_nil
|
1054
1056
|
expect(google_pay_card.prepaid).not_to be_nil
|
1057
|
+
expect(google_pay_card.prepaid_reloadable).not_to be_nil
|
1055
1058
|
expect(google_pay_card.product_id).not_to be_nil
|
1056
1059
|
end
|
1057
1060
|
|
@@ -1912,4 +1915,17 @@ describe Braintree::Customer do
|
|
1912
1915
|
end
|
1913
1916
|
end
|
1914
1917
|
end
|
1918
|
+
|
1919
|
+
it "returns prepaid_reloadable from VisaCheckoutCard" do
|
1920
|
+
result = Braintree::Customer.create(
|
1921
|
+
:payment_method_nonce => Braintree::Test::Nonce::VisaCheckoutVisa,
|
1922
|
+
)
|
1923
|
+
expect(result.success?).to eq(true)
|
1924
|
+
|
1925
|
+
found_customer = Braintree::Customer.find(result.customer.id)
|
1926
|
+
expect(found_customer.visa_checkout_cards).not_to be_nil
|
1927
|
+
visa_checkout_card = found_customer.visa_checkout_cards.first
|
1928
|
+
expect(visa_checkout_card).to be_a Braintree::VisaCheckoutCard
|
1929
|
+
expect(visa_checkout_card.prepaid_reloadable).not_to be_nil
|
1930
|
+
end
|
1915
1931
|
end
|
@@ -230,6 +230,16 @@ describe Braintree::PaymentMethodNonce do
|
|
230
230
|
expect(nonce.bin_data.prepaid).to eq(Braintree::CreditCard::Prepaid::Yes)
|
231
231
|
end
|
232
232
|
|
233
|
+
it "returns bin_data with prepaid_reloadable set to Yes" do
|
234
|
+
result = Braintree::PaymentMethodNonce.find("fake-valid-prepaid-reloadable-nonce")
|
235
|
+
|
236
|
+
nonce = result.payment_method_nonce
|
237
|
+
|
238
|
+
expect(result).to be_success
|
239
|
+
expect(nonce.bin_data).not_to be_nil
|
240
|
+
expect(nonce.bin_data.prepaid_reloadable).to eq(Braintree::CreditCard::PrepaidReloadable::Yes)
|
241
|
+
end
|
242
|
+
|
233
243
|
it "returns bin_data with unknown indicators" do
|
234
244
|
result = Braintree::PaymentMethodNonce.find("fake-valid-unknown-indicators-nonce")
|
235
245
|
|
@@ -245,6 +255,7 @@ describe Braintree::PaymentMethodNonce do
|
|
245
255
|
expect(nonce.bin_data.issuing_bank).to eq(Braintree::CreditCard::IssuingBank::Unknown)
|
246
256
|
expect(nonce.bin_data.payroll).to eq(Braintree::CreditCard::Payroll::Unknown)
|
247
257
|
expect(nonce.bin_data.prepaid).to eq(Braintree::CreditCard::Prepaid::Unknown)
|
258
|
+
expect(nonce.bin_data.prepaid_reloadable).to eq(Braintree::CreditCard::PrepaidReloadable::Unknown)
|
248
259
|
expect(nonce.bin_data.product_id).to eq(Braintree::CreditCard::ProductId::Unknown)
|
249
260
|
end
|
250
261
|
|