braintree 4.15.0 → 4.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/braintree/account_updater_daily_report.rb +3 -3
- data/lib/braintree/ach_mandate.rb +1 -1
- data/lib/braintree/add_on_gateway.rb +1 -1
- data/lib/braintree/address.rb +4 -4
- data/lib/braintree/address_gateway.rb +5 -5
- data/lib/braintree/advanced_search.rb +10 -10
- data/lib/braintree/apple_pay.rb +3 -3
- data/lib/braintree/apple_pay_card.rb +3 -3
- data/lib/braintree/apple_pay_options.rb +3 -3
- data/lib/braintree/authorization_adjustment.rb +3 -3
- data/lib/braintree/base_module.rb +1 -1
- data/lib/braintree/bin_data.rb +2 -2
- data/lib/braintree/client_token_gateway.rb +1 -1
- data/lib/braintree/configuration.rb +22 -22
- data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
- data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
- data/lib/braintree/credit_card.rb +9 -9
- data/lib/braintree/credit_card_gateway.rb +8 -8
- data/lib/braintree/credit_card_verification.rb +3 -3
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +5 -9
- data/lib/braintree/customer_gateway.rb +7 -7
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/descriptor.rb +1 -1
- data/lib/braintree/digest.rb +1 -1
- data/lib/braintree/disbursement.rb +5 -5
- data/lib/braintree/discount_gateway.rb +1 -1
- data/lib/braintree/dispute/evidence.rb +1 -1
- data/lib/braintree/dispute/paypal_message.rb +1 -1
- data/lib/braintree/dispute/status_history.rb +1 -1
- data/lib/braintree/dispute/transaction.rb +1 -1
- data/lib/braintree/dispute/transaction_details.rb +1 -1
- data/lib/braintree/dispute.rb +3 -3
- data/lib/braintree/dispute_gateway.rb +1 -1
- data/lib/braintree/dispute_search.rb +1 -1
- data/lib/braintree/document_upload.rb +2 -2
- data/lib/braintree/document_upload_gateway.rb +3 -3
- data/lib/braintree/enriched_customer_data.rb +2 -2
- data/lib/braintree/error_result.rb +2 -3
- data/lib/braintree/errors.rb +3 -3
- data/lib/braintree/exceptions.rb +1 -2
- data/lib/braintree/exchange_rate.rb +2 -2
- data/lib/braintree/exchange_rate_quote.rb +3 -3
- data/lib/braintree/exchange_rate_quote_gateway.rb +1 -1
- data/lib/braintree/exchange_rate_quote_input.rb +3 -3
- data/lib/braintree/exchange_rate_quote_request.rb +3 -3
- data/lib/braintree/exchange_rate_quote_response.rb +3 -3
- data/lib/braintree/facilitated_details.rb +1 -1
- data/lib/braintree/facilitator_details.rb +1 -1
- data/lib/braintree/google_pay_card.rb +3 -3
- data/lib/braintree/granted_payment_instrument_update.rb +1 -1
- data/lib/braintree/graphql_client.rb +1 -1
- data/lib/braintree/http.rb +1 -1
- data/lib/braintree/local_payment_completed.rb +2 -2
- data/lib/braintree/local_payment_expired.rb +2 -2
- data/lib/braintree/local_payment_funded.rb +2 -2
- data/lib/braintree/local_payment_reversed.rb +2 -2
- data/lib/braintree/merchant.rb +3 -3
- data/lib/braintree/merchant_account.rb +2 -2
- data/lib/braintree/merchant_account_gateway.rb +9 -9
- data/lib/braintree/meta_checkout_card.rb +89 -0
- data/lib/braintree/meta_checkout_token.rb +88 -0
- data/lib/braintree/modification.rb +3 -3
- data/lib/braintree/oauth_credentials.rb +3 -3
- data/lib/braintree/paginated_collection.rb +2 -2
- data/lib/braintree/paginated_result.rb +1 -1
- data/lib/braintree/payment_instrument_type.rb +2 -0
- data/lib/braintree/payment_method_customer_data_updated_metadata.rb +2 -2
- data/lib/braintree/payment_method_gateway.rb +8 -7
- data/lib/braintree/payment_method_nonce.rb +4 -4
- data/lib/braintree/payment_method_nonce_details.rb +1 -1
- data/lib/braintree/payment_method_nonce_details_payer_info.rb +1 -1
- data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
- data/lib/braintree/paypal_account.rb +1 -2
- data/lib/braintree/paypal_account_gateway.rb +5 -5
- data/lib/braintree/plan.rb +1 -1
- data/lib/braintree/plan_gateway.rb +2 -2
- data/lib/braintree/resource_collection.rb +2 -2
- data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
- data/lib/braintree/risk_data.rb +1 -1
- data/lib/braintree/samsung_pay_card.rb +5 -5
- data/lib/braintree/sepa_direct_debit_account.rb +2 -2
- data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +1 -1
- data/lib/braintree/settlement_batch_summary_gateway.rb +1 -1
- data/lib/braintree/sha256_digest.rb +1 -1
- data/lib/braintree/subscription/status_details.rb +1 -1
- data/lib/braintree/subscription.rb +2 -2
- data/lib/braintree/subscription_gateway.rb +6 -6
- data/lib/braintree/subscription_search.rb +1 -1
- data/lib/braintree/successful_result.rb +2 -2
- data/lib/braintree/test/credit_card.rb +7 -10
- data/lib/braintree/test/merchant_account.rb +1 -1
- data/lib/braintree/test/nonce.rb +3 -0
- data/lib/braintree/test/transaction_amounts.rb +2 -3
- data/lib/braintree/testing_gateway.rb +1 -1
- data/lib/braintree/three_d_secure_info.rb +1 -1
- data/lib/braintree/transaction/address_details.rb +1 -1
- data/lib/braintree/transaction/credit_card_details.rb +1 -1
- data/lib/braintree/transaction/customer_details.rb +1 -1
- data/lib/braintree/transaction/disbursement_details.rb +1 -1
- data/lib/braintree/transaction/meta_checkout_card_details.rb +52 -0
- data/lib/braintree/transaction/meta_checkout_token_details.rb +54 -0
- data/lib/braintree/transaction/samsung_pay_card_details.rb +1 -1
- data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +1 -1
- data/lib/braintree/transaction/status_details.rb +1 -1
- data/lib/braintree/transaction/subscription_details.rb +1 -1
- data/lib/braintree/transaction/us_bank_account_details.rb +1 -1
- data/lib/braintree/transaction/visa_checkout_card_details.rb +1 -1
- data/lib/braintree/transaction.rb +22 -16
- data/lib/braintree/transaction_gateway.rb +9 -10
- data/lib/braintree/transaction_line_item.rb +2 -2
- data/lib/braintree/transaction_line_item_gateway.rb +1 -1
- data/lib/braintree/transaction_review.rb +1 -1
- data/lib/braintree/transaction_search.rb +1 -1
- data/lib/braintree/unknown_payment_method.rb +1 -1
- data/lib/braintree/us_bank_account.rb +2 -2
- data/lib/braintree/us_bank_account_verification.rb +23 -15
- data/lib/braintree/us_bank_account_verification_search.rb +1 -1
- data/lib/braintree/util.rb +3 -3
- data/lib/braintree/validation_error.rb +1 -1
- data/lib/braintree/validation_error_collection.rb +3 -3
- data/lib/braintree/venmo_account.rb +3 -3
- data/lib/braintree/venmo_profile_data.rb +6 -4
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/visa_checkout_card.rb +7 -7
- data/lib/braintree/webhook_notification.rb +2 -2
- data/lib/braintree/webhook_notification_gateway.rb +3 -3
- data/lib/braintree/webhook_testing.rb +1 -1
- data/lib/braintree/webhook_testing_gateway.rb +1 -1
- data/lib/braintree/xml/generator.rb +1 -1
- data/lib/braintree/xml/libxml.rb +1 -1
- data/lib/braintree/xml/parser.rb +2 -2
- data/lib/braintree/xml/rexml.rb +2 -2
- data/lib/braintree/xml.rb +1 -1
- data/lib/braintree.rb +4 -1
- data/spec/integration/braintree/dispute_search_spec.rb +0 -1
- data/spec/integration/braintree/payment_method_nonce_spec.rb +20 -0
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +72 -0
- data/spec/integration/braintree/transaction_search_spec.rb +27 -0
- data/spec/integration/braintree/transaction_spec.rb +192 -66
- data/spec/unit/braintree/enriched_customer_data_spec.rb +9 -0
- data/spec/unit/braintree/http_spec.rb +1 -1
- data/spec/unit/braintree/meta_checkout_card_details_spec.rb +60 -0
- data/spec/unit/braintree/meta_checkout_card_spec.rb +60 -0
- data/spec/unit/braintree/meta_checkout_token_details_spec.rb +63 -0
- data/spec/unit/braintree/meta_checkout_token_spec.rb +63 -0
- data/spec/unit/braintree/transaction_gateway_spec.rb +30 -1
- data/spec/unit/braintree/us_bank_account_verification_spec.rb +5 -0
- data/spec/unit/braintree/venmo_profile_data_spec.rb +11 -0
- metadata +10 -2
@@ -14,7 +14,7 @@ module Braintree
|
|
14
14
|
attr_reader :verifications
|
15
15
|
attr_reader :verified
|
16
16
|
|
17
|
-
def initialize(gateway, attributes)
|
17
|
+
def initialize(gateway, attributes)
|
18
18
|
@gateway = gateway
|
19
19
|
set_instance_variables_from_hash(attributes)
|
20
20
|
@ach_mandate = AchMandate.new(attributes[:ach_mandate]) if attributes[:ach_mandate]
|
@@ -34,7 +34,7 @@ module Braintree
|
|
34
34
|
protected :new
|
35
35
|
end
|
36
36
|
|
37
|
-
def self._new(*args)
|
37
|
+
def self._new(*args)
|
38
38
|
self.new(*args)
|
39
39
|
end
|
40
40
|
|
@@ -22,33 +22,41 @@ module Braintree
|
|
22
22
|
All = [IndependentCheck, NetworkCheck, TokenizedCheck, MicroTransfers]
|
23
23
|
end
|
24
24
|
|
25
|
+
module VerificationAddOns
|
26
|
+
CustomerVerification = "customer_verification"
|
27
|
+
|
28
|
+
All = [CustomerVerification]
|
29
|
+
end
|
30
|
+
|
31
|
+
attr_reader :additional_processor_response
|
32
|
+
attr_reader :created_at
|
33
|
+
attr_reader :gateway_rejection_reason
|
25
34
|
attr_reader :id
|
26
|
-
attr_reader :
|
27
|
-
attr_reader :verification_determined_at
|
28
|
-
attr_reader :verification_method
|
35
|
+
attr_reader :merchant_account_id
|
29
36
|
attr_reader :processor_response_code
|
30
37
|
attr_reader :processor_response_text
|
31
|
-
attr_reader :
|
32
|
-
attr_reader :gateway_rejection_reason
|
38
|
+
attr_reader :status
|
33
39
|
attr_reader :us_bank_account
|
34
|
-
attr_reader :
|
40
|
+
attr_reader :verification_determined_at
|
41
|
+
attr_reader :verification_method
|
35
42
|
|
36
|
-
def initialize(attributes)
|
43
|
+
def initialize(attributes)
|
37
44
|
set_instance_variables_from_hash(attributes)
|
38
45
|
end
|
39
46
|
|
40
|
-
def inspect
|
47
|
+
def inspect
|
41
48
|
attr_order = [
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:processor_response_text,
|
45
|
-
:merchant_account_id,
|
49
|
+
:additional_processor_response,
|
50
|
+
:created_at,
|
46
51
|
:gateway_rejection_reason,
|
47
52
|
:id,
|
53
|
+
:merchant_account_id,
|
54
|
+
:processor_response_code,
|
55
|
+
:processor_response_text,
|
56
|
+
:status,
|
48
57
|
:us_bank_account,
|
49
|
-
:verification_method,
|
50
58
|
:verification_determined_at,
|
51
|
-
:
|
59
|
+
:verification_method
|
52
60
|
]
|
53
61
|
|
54
62
|
formatted_attrs = attr_order.map do |attr|
|
@@ -62,7 +70,7 @@ module Braintree
|
|
62
70
|
protected :new
|
63
71
|
end
|
64
72
|
|
65
|
-
def self._new(*args)
|
73
|
+
def self._new(*args)
|
66
74
|
self.new(*args)
|
67
75
|
end
|
68
76
|
|
data/lib/braintree/util.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
module Util
|
2
|
+
module Util
|
3
3
|
def self.extract_attribute_as_array(hash, attribute)
|
4
4
|
raise UnexpectedError.new("Unprocessable entity due to an invalid request") if hash.nil?
|
5
5
|
value = hash.has_key?(attribute) ? hash.delete(attribute) : []
|
@@ -195,14 +195,14 @@ module Braintree
|
|
195
195
|
end
|
196
196
|
|
197
197
|
module IdEquality
|
198
|
-
def ==(other)
|
198
|
+
def ==(other)
|
199
199
|
return false unless other.is_a?(self.class)
|
200
200
|
id == other.id
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
204
204
|
module TokenEquality
|
205
|
-
def ==(other)
|
205
|
+
def ==(other)
|
206
206
|
return false unless other.is_a?(self.class)
|
207
207
|
token == other.token
|
208
208
|
end
|
@@ -2,7 +2,7 @@ module Braintree
|
|
2
2
|
class ValidationErrorCollection
|
3
3
|
include Enumerable
|
4
4
|
|
5
|
-
def initialize(data)
|
5
|
+
def initialize(data)
|
6
6
|
return if !data.is_a? Hash
|
7
7
|
@errors = (data[:errors] || {}).map { |hash| Braintree::ValidationError.new(hash) }
|
8
8
|
@nested = {}
|
@@ -42,7 +42,7 @@ module Braintree
|
|
42
42
|
self.for("index_#{index}".to_sym)
|
43
43
|
end
|
44
44
|
|
45
|
-
def inspect
|
45
|
+
def inspect
|
46
46
|
"#<#{self.class} errors#{_inner_inspect}>"
|
47
47
|
end
|
48
48
|
|
@@ -61,7 +61,7 @@ module Braintree
|
|
61
61
|
@errors.size
|
62
62
|
end
|
63
63
|
|
64
|
-
def _inner_inspect(scope = [])
|
64
|
+
def _inner_inspect(scope = [])
|
65
65
|
all = []
|
66
66
|
scope_string = scope.join("/")
|
67
67
|
if @errors.any?
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Braintree
|
2
2
|
class VenmoAccount
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
|
5
5
|
attr_reader :created_at
|
6
6
|
attr_reader :customer_id
|
@@ -13,7 +13,7 @@ module Braintree
|
|
13
13
|
attr_reader :username
|
14
14
|
attr_reader :venmo_user_id
|
15
15
|
|
16
|
-
def initialize(gateway, attributes)
|
16
|
+
def initialize(gateway, attributes)
|
17
17
|
@gateway = gateway
|
18
18
|
set_instance_variables_from_hash(attributes)
|
19
19
|
@subscriptions = (@subscriptions || []).map { |subscription_hash| Subscription._new(@gateway, subscription_hash) }
|
@@ -27,7 +27,7 @@ module Braintree
|
|
27
27
|
protected :new
|
28
28
|
end
|
29
29
|
|
30
|
-
def self._new(*args)
|
30
|
+
def self._new(*args)
|
31
31
|
self.new(*args)
|
32
32
|
end
|
33
33
|
end
|
@@ -2,13 +2,15 @@ module Braintree
|
|
2
2
|
class VenmoProfileData
|
3
3
|
include BaseModule
|
4
4
|
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :billing_address
|
6
|
+
attr_reader :email
|
6
7
|
attr_reader :first_name
|
7
8
|
attr_reader :last_name
|
8
9
|
attr_reader :phone_number
|
9
|
-
attr_reader :
|
10
|
+
attr_reader :shipping_address
|
11
|
+
attr_reader :username
|
10
12
|
|
11
|
-
def initialize(attributes)
|
13
|
+
def initialize(attributes)
|
12
14
|
set_instance_variables_from_hash(attributes)
|
13
15
|
end
|
14
16
|
|
@@ -16,7 +18,7 @@ module Braintree
|
|
16
18
|
protected :new
|
17
19
|
end
|
18
20
|
|
19
|
-
def self._new(*args)
|
21
|
+
def self._new(*args)
|
20
22
|
self.new(*args)
|
21
23
|
end
|
22
24
|
end
|
data/lib/braintree/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Braintree
|
2
2
|
class VisaCheckoutCard
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
include Braintree::Util::TokenEquality
|
5
5
|
|
6
6
|
attr_reader :billing_address
|
@@ -30,7 +30,7 @@ module Braintree
|
|
30
30
|
attr_reader :updated_at
|
31
31
|
attr_reader :verification
|
32
32
|
|
33
|
-
def initialize(gateway, attributes)
|
33
|
+
def initialize(gateway, attributes)
|
34
34
|
@gateway = gateway
|
35
35
|
set_instance_variables_from_hash(attributes)
|
36
36
|
@billing_address = attributes[:billing_address] ? Address._new(@gateway, attributes[:billing_address]) : nil
|
@@ -39,8 +39,8 @@ module Braintree
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def _most_recent_verification(attributes)
|
42
|
-
|
43
|
-
CreditCardVerification._new(
|
42
|
+
sorted_verifications = (attributes[:verifications] || []).sort_by { |verification| verification[:created_at] }.reverse.first
|
43
|
+
CreditCardVerification._new(sorted_verifications) if sorted_verifications
|
44
44
|
end
|
45
45
|
|
46
46
|
def default?
|
@@ -56,7 +56,7 @@ module Braintree
|
|
56
56
|
@expired
|
57
57
|
end
|
58
58
|
|
59
|
-
def inspect
|
59
|
+
def inspect
|
60
60
|
first = [:token]
|
61
61
|
order = first + (self.class._attributes - first)
|
62
62
|
nice_attributes = order.map do |attr|
|
@@ -73,7 +73,7 @@ module Braintree
|
|
73
73
|
protected :new
|
74
74
|
end
|
75
75
|
|
76
|
-
def self._attributes
|
76
|
+
def self._attributes
|
77
77
|
[
|
78
78
|
:billing_address, :bin, :card_type, :cardholder_name, :created_at,
|
79
79
|
:customer_id, :customer_location, :expiration_month, :expiration_year,
|
@@ -83,7 +83,7 @@ module Braintree
|
|
83
83
|
]
|
84
84
|
end
|
85
85
|
|
86
|
-
def self._new(*args)
|
86
|
+
def self._new(*args)
|
87
87
|
self.new(*args)
|
88
88
|
end
|
89
89
|
end
|
@@ -92,7 +92,7 @@ module Braintree
|
|
92
92
|
Configuration.gateway.webhook_notification.verify(*args)
|
93
93
|
end
|
94
94
|
|
95
|
-
def initialize(gateway, attributes)
|
95
|
+
def initialize(gateway, attributes)
|
96
96
|
@gateway = gateway
|
97
97
|
set_instance_variables_from_hash(attributes)
|
98
98
|
@error_result = ErrorResult.new(gateway, @subject[:api_error_response]) if @subject.has_key?(:api_error_response)
|
@@ -135,7 +135,7 @@ module Braintree
|
|
135
135
|
|
136
136
|
class << self
|
137
137
|
protected :new
|
138
|
-
def _new(*args)
|
138
|
+
def _new(*args)
|
139
139
|
self.new(*args)
|
140
140
|
end
|
141
141
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class WebhookNotificationGateway
|
2
|
+
class WebhookNotificationGateway
|
3
3
|
def initialize(gateway)
|
4
4
|
@gateway = gateway
|
5
5
|
@config = gateway.config
|
@@ -36,8 +36,8 @@ module Braintree
|
|
36
36
|
public_key, signature = _matching_signature_pair(signature_string)
|
37
37
|
raise InvalidSignature, "no matching public key" if public_key.nil?
|
38
38
|
|
39
|
-
signature_matches = [payload, payload + "\n"].any? do |
|
40
|
-
payload_signature = Braintree::Digest.hexdigest(@config.private_key,
|
39
|
+
signature_matches = [payload, payload + "\n"].any? do |_payload|
|
40
|
+
payload_signature = Braintree::Digest.hexdigest(@config.private_key, _payload)
|
41
41
|
Braintree::Digest.secure_compare(signature, payload_signature)
|
42
42
|
end
|
43
43
|
raise InvalidSignature, "signature does not match payload - one has been modified" unless signature_matches
|
data/lib/braintree/xml/libxml.rb
CHANGED
data/lib/braintree/xml/parser.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# Portions of this code were copied and modified from Ruby on Rails, released
|
2
2
|
# under the MIT license, copyright (c) 2005-2009 David Heinemeier Hansson
|
3
3
|
module Braintree
|
4
|
-
module Xml
|
4
|
+
module Xml
|
5
5
|
CONTENT_ROOT = "__content__"
|
6
6
|
|
7
|
-
module Parser
|
7
|
+
module Parser
|
8
8
|
XML_PARSING = {
|
9
9
|
"datetime" => Proc.new { |time| ::Time.parse(time).utc },
|
10
10
|
"integer" => Proc.new { |integer| integer.to_i },
|
data/lib/braintree/xml/rexml.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Portions of this code were copied and modified from Ruby on Rails, released
|
2
2
|
# under the MIT license, copyright (c) 2005-2009 David Heinemeier Hansson
|
3
3
|
module Braintree
|
4
|
-
module Xml
|
5
|
-
module Rexml
|
4
|
+
module Xml
|
5
|
+
module Rexml
|
6
6
|
|
7
7
|
CONTENT_KEY = "__content__".freeze
|
8
8
|
|
data/lib/braintree/xml.rb
CHANGED
data/lib/braintree.rb
CHANGED
@@ -3,7 +3,6 @@ require "bigdecimal"
|
|
3
3
|
require "cgi"
|
4
4
|
require "date"
|
5
5
|
require "digest/sha1"
|
6
|
-
require "enumerator"
|
7
6
|
require "forwardable"
|
8
7
|
require "logger"
|
9
8
|
require "net/http"
|
@@ -91,6 +90,8 @@ require "braintree/merchant_account/individual_details"
|
|
91
90
|
require "braintree/merchant_account/business_details"
|
92
91
|
require "braintree/merchant_account/funding_details"
|
93
92
|
require "braintree/merchant_account/address_details"
|
93
|
+
require "braintree/meta_checkout_card"
|
94
|
+
require "braintree/meta_checkout_token"
|
94
95
|
require "braintree/oauth_gateway"
|
95
96
|
require "braintree/oauth_credentials"
|
96
97
|
require "braintree/payment_instrument_type"
|
@@ -153,6 +154,8 @@ require "braintree/transaction/installment/adjustment"
|
|
153
154
|
require "braintree/transaction/payment_receipt"
|
154
155
|
require "braintree/transaction/payment_receipt/card_present_data.rb"
|
155
156
|
require "braintree/transaction/payment_receipt/merchant_address.rb"
|
157
|
+
require "braintree/transaction/meta_checkout_card_details"
|
158
|
+
require "braintree/transaction/meta_checkout_token_details"
|
156
159
|
require "braintree/transaction/paypal_details"
|
157
160
|
require "braintree/transaction/paypal_here_details"
|
158
161
|
require "braintree/transaction/samsung_pay_card_details"
|
@@ -91,6 +91,26 @@ describe Braintree::PaymentMethodNonce do
|
|
91
91
|
expect(nonce.details.payer_info).to be_nil
|
92
92
|
end
|
93
93
|
|
94
|
+
it "return meta_checkout_card_details nonce if exist" do
|
95
|
+
result = Braintree::PaymentMethodNonce.find(Braintree::Test::Nonce::MetaCheckoutCard)
|
96
|
+
nonce = result.payment_method_nonce
|
97
|
+
nonce.details.bin.should == "401288"
|
98
|
+
nonce.details.last_two.should == "81"
|
99
|
+
nonce.details.card_type.should == "Visa"
|
100
|
+
nonce.details.expiration_year.should == "2024"
|
101
|
+
nonce.details.expiration_month.should == "12"
|
102
|
+
end
|
103
|
+
|
104
|
+
it "return meta_checkout_token_details nonce if exist" do
|
105
|
+
result = Braintree::PaymentMethodNonce.find(Braintree::Test::Nonce::MetaCheckoutToken)
|
106
|
+
nonce = result.payment_method_nonce
|
107
|
+
nonce.details.bin.should == "401288"
|
108
|
+
nonce.details.last_two.should == "81"
|
109
|
+
nonce.details.card_type.should == "Visa"
|
110
|
+
nonce.details.expiration_year.should == "2024"
|
111
|
+
nonce.details.expiration_month.should == "12"
|
112
|
+
end
|
113
|
+
|
94
114
|
it "return paypal details if details exist" do
|
95
115
|
result = Braintree::PaymentMethodNonce.find("fake-paypal-one-time-nonce")
|
96
116
|
nonce = result.payment_method_nonce
|
@@ -78,6 +78,78 @@ describe Braintree::PaymentMethod do
|
|
78
78
|
expect(Braintree::PaymentMethod.find(us_bank_account.token)).to be_a(Braintree::UsBankAccount)
|
79
79
|
end
|
80
80
|
end
|
81
|
+
|
82
|
+
it "succeeds and verifies with verification_add_ons for NetworkCheck with fake nonce" do
|
83
|
+
customer = Braintree::Customer.create.customer
|
84
|
+
result = Braintree::PaymentMethod.create(
|
85
|
+
:payment_method_nonce => Braintree::Test::Nonce::UsBankAccount,
|
86
|
+
:customer_id => customer.id,
|
87
|
+
:options => {
|
88
|
+
:us_bank_account_verification_method => Braintree::UsBankAccountVerification::VerificationMethod::NetworkCheck,
|
89
|
+
:verification_add_ons => Braintree::UsBankAccountVerification::VerificationAddOns::CustomerVerification,
|
90
|
+
:verification_merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
|
91
|
+
},
|
92
|
+
)
|
93
|
+
|
94
|
+
expect(result).to be_success
|
95
|
+
us_bank_account = result.payment_method
|
96
|
+
expect(us_bank_account).to be_a(Braintree::UsBankAccount)
|
97
|
+
expect(us_bank_account.routing_number).to eq("123456789")
|
98
|
+
expect(us_bank_account.last_4).to eq("0000")
|
99
|
+
expect(us_bank_account.account_type).to eq("checking")
|
100
|
+
expect(us_bank_account.account_holder_name).to eq("Dan Schulman")
|
101
|
+
expect(us_bank_account.bank_name).to match(/Wells Fargo/)
|
102
|
+
expect(us_bank_account.default).to eq(true)
|
103
|
+
expect(us_bank_account.ach_mandate.text).to eq("example mandate text")
|
104
|
+
expect(us_bank_account.ach_mandate.accepted_at).to be_a Time
|
105
|
+
|
106
|
+
expect(us_bank_account.verifications.count).to eq(1)
|
107
|
+
expect(us_bank_account.verifications.first.status).to eq(Braintree::UsBankAccountVerification::Status::Verified)
|
108
|
+
expect(us_bank_account.verifications.first.verification_method).to eq(Braintree::UsBankAccountVerification::VerificationMethod::NetworkCheck)
|
109
|
+
expect(us_bank_account.verifications.first.id).not_to be_empty
|
110
|
+
expect(us_bank_account.verifications.first.verification_determined_at).to be_a Time
|
111
|
+
expect(us_bank_account.verifications.first.processor_response_code).to eq("1000")
|
112
|
+
expect(us_bank_account.verified).to eq(true)
|
113
|
+
|
114
|
+
expect(Braintree::PaymentMethod.find(us_bank_account.token)).to be_a(Braintree::UsBankAccount)
|
115
|
+
end
|
116
|
+
|
117
|
+
it "returns additional processor response for failed NetworkCheck" do
|
118
|
+
customer = Braintree::Customer.create.customer
|
119
|
+
invalid_nonce = generate_non_plaid_us_bank_account_nonce(account_number = "1000000005")
|
120
|
+
result = Braintree::PaymentMethod.create(
|
121
|
+
:payment_method_nonce => invalid_nonce,
|
122
|
+
:customer_id => customer.id,
|
123
|
+
:options => {
|
124
|
+
:us_bank_account_verification_method => Braintree::UsBankAccountVerification::VerificationMethod::NetworkCheck,
|
125
|
+
:verification_merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
|
126
|
+
},
|
127
|
+
)
|
128
|
+
|
129
|
+
expect(result).to be_success
|
130
|
+
us_bank_account = result.payment_method
|
131
|
+
expect(us_bank_account).to be_a(Braintree::UsBankAccount)
|
132
|
+
expect(us_bank_account.routing_number).to eq("021000021")
|
133
|
+
expect(us_bank_account.last_4).to eq("0005")
|
134
|
+
expect(us_bank_account.account_type).to eq("checking")
|
135
|
+
expect(us_bank_account.account_holder_name).to eq("John Doe")
|
136
|
+
expect(us_bank_account.bank_name).to match(/CHASE/)
|
137
|
+
expect(us_bank_account.default).to eq(true)
|
138
|
+
expect(us_bank_account.ach_mandate.text).to eq("cl mandate text")
|
139
|
+
expect(us_bank_account.ach_mandate.accepted_at).to be_a Time
|
140
|
+
|
141
|
+
expect(us_bank_account.verifications.count).to eq(1)
|
142
|
+
expect(us_bank_account.verifications.first.status).to eq(Braintree::UsBankAccountVerification::Status::ProcessorDeclined)
|
143
|
+
expect(us_bank_account.verifications.first.verification_method).to eq(Braintree::UsBankAccountVerification::VerificationMethod::NetworkCheck)
|
144
|
+
expect(us_bank_account.verifications.first.id).not_to be_empty
|
145
|
+
expect(us_bank_account.verifications.first.verification_determined_at).to be_a Time
|
146
|
+
expect(us_bank_account.verifications.first.processor_response_code).to eq("2061")
|
147
|
+
expect(us_bank_account.verifications.first.additional_processor_response).to eq("Invalid routing number")
|
148
|
+
|
149
|
+
expect(us_bank_account.verified).to eq(false)
|
150
|
+
|
151
|
+
expect(Braintree::PaymentMethod.find(us_bank_account.token)).to be_a(Braintree::UsBankAccount)
|
152
|
+
end
|
81
153
|
end
|
82
154
|
|
83
155
|
it "fails with invalid nonce" do
|
@@ -1494,6 +1494,33 @@ describe Braintree::Transaction, "search" do
|
|
1494
1494
|
}.to raise_error(Braintree::UnexpectedError)
|
1495
1495
|
end
|
1496
1496
|
end
|
1497
|
+
|
1498
|
+
it "searches by payment instrument type meta checkout" do
|
1499
|
+
meta_checkout_card_transaction = Braintree::Transaction.sale!(
|
1500
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1501
|
+
:options => {
|
1502
|
+
:submit_for_settlement => true
|
1503
|
+
},
|
1504
|
+
:payment_method_nonce => Braintree::Test::Nonce::MetaCheckoutCard,
|
1505
|
+
)
|
1506
|
+
|
1507
|
+
meta_checkout_token_transaction = Braintree::Transaction.sale!(
|
1508
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1509
|
+
:options => {
|
1510
|
+
:submit_for_settlement => true
|
1511
|
+
},
|
1512
|
+
:payment_method_nonce => Braintree::Test::Nonce::MetaCheckoutToken,
|
1513
|
+
)
|
1514
|
+
|
1515
|
+
collection = Braintree::Transaction.search do |search|
|
1516
|
+
search.payment_instrument_type.in ["MetaCheckout"]
|
1517
|
+
end
|
1518
|
+
|
1519
|
+
collection.maximum_size.should == 2
|
1520
|
+
txn_ids = collection.map(&:id)
|
1521
|
+
expect(txn_ids).to include(meta_checkout_card_transaction.id)
|
1522
|
+
expect(txn_ids).to include(meta_checkout_token_transaction.id)
|
1523
|
+
end
|
1497
1524
|
end
|
1498
1525
|
|
1499
1526
|
context "pagination" do
|