braintree 4.15.0 → 4.17.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_gateway.rb +28 -11
- 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 +5 -5
- 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 +2 -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 +4 -4
- 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 +3 -3
- 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/client_api/spec_helper.rb +2 -2
- data/spec/integration/braintree/credit_card_verification_spec.rb +45 -0
- 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/base_module_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +13 -8
- 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
@@ -7,7 +7,7 @@ module Braintree
|
|
7
7
|
attr_reader :payment_method_nonce
|
8
8
|
attr_reader :transaction
|
9
9
|
|
10
|
-
def initialize(attributes)
|
10
|
+
def initialize(attributes)
|
11
11
|
set_instance_variables_from_hash(attributes)
|
12
12
|
@transaction = Transaction._new(Configuration.gateway, transaction) unless transaction.nil?
|
13
13
|
end
|
@@ -16,7 +16,7 @@ module Braintree
|
|
16
16
|
protected :new
|
17
17
|
end
|
18
18
|
|
19
|
-
def self._new(*args)
|
19
|
+
def self._new(*args)
|
20
20
|
self.new(*args)
|
21
21
|
end
|
22
22
|
end
|
@@ -5,7 +5,7 @@ module Braintree
|
|
5
5
|
attr_reader :payment_id
|
6
6
|
attr_reader :payment_context_id
|
7
7
|
|
8
|
-
def initialize(attributes)
|
8
|
+
def initialize(attributes)
|
9
9
|
set_instance_variables_from_hash(attributes)
|
10
10
|
end
|
11
11
|
|
@@ -13,7 +13,7 @@ module Braintree
|
|
13
13
|
protected :new
|
14
14
|
end
|
15
15
|
|
16
|
-
def self._new(*args)
|
16
|
+
def self._new(*args)
|
17
17
|
self.new(*args)
|
18
18
|
end
|
19
19
|
end
|
@@ -6,7 +6,7 @@ module Braintree
|
|
6
6
|
attr_reader :payment_context_id
|
7
7
|
attr_reader :transaction
|
8
8
|
|
9
|
-
def initialize(attributes)
|
9
|
+
def initialize(attributes)
|
10
10
|
set_instance_variables_from_hash(attributes)
|
11
11
|
@transaction = Transaction._new(Configuration.gateway, transaction)
|
12
12
|
end
|
@@ -15,7 +15,7 @@ module Braintree
|
|
15
15
|
protected :new
|
16
16
|
end
|
17
17
|
|
18
|
-
def self._new(*args)
|
18
|
+
def self._new(*args)
|
19
19
|
self.new(*args)
|
20
20
|
end
|
21
21
|
end
|
@@ -4,7 +4,7 @@ module Braintree
|
|
4
4
|
|
5
5
|
attr_reader :payment_id
|
6
6
|
|
7
|
-
def initialize(attributes)
|
7
|
+
def initialize(attributes)
|
8
8
|
set_instance_variables_from_hash(attributes)
|
9
9
|
end
|
10
10
|
|
@@ -12,7 +12,7 @@ module Braintree
|
|
12
12
|
protected :new
|
13
13
|
end
|
14
14
|
|
15
|
-
def self._new(*args)
|
15
|
+
def self._new(*args)
|
16
16
|
self.new(*args)
|
17
17
|
end
|
18
18
|
end
|
data/lib/braintree/merchant.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Braintree
|
2
2
|
class Merchant
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
|
5
5
|
attr_reader :company_name
|
6
6
|
attr_reader :country_code_alpha2
|
@@ -11,7 +11,7 @@ module Braintree
|
|
11
11
|
attr_reader :id
|
12
12
|
attr_reader :merchant_accounts
|
13
13
|
|
14
|
-
def initialize(gateway, attributes)
|
14
|
+
def initialize(gateway, attributes)
|
15
15
|
@merchant_accounts = attributes.delete(:merchant_accounts).map do |merchant_account|
|
16
16
|
MerchantAccount._new(gateway, merchant_account)
|
17
17
|
end
|
@@ -23,7 +23,7 @@ module Braintree
|
|
23
23
|
protected :new
|
24
24
|
end
|
25
25
|
|
26
|
-
def self._new(*args)
|
26
|
+
def self._new(*args)
|
27
27
|
self.new(*args)
|
28
28
|
end
|
29
29
|
|
@@ -49,7 +49,7 @@ module Braintree
|
|
49
49
|
Configuration.gateway.merchant_account.update!(*args)
|
50
50
|
end
|
51
51
|
|
52
|
-
def initialize(gateway, attributes)
|
52
|
+
def initialize(gateway, attributes)
|
53
53
|
@gateway = gateway
|
54
54
|
set_instance_variables_from_hash(attributes)
|
55
55
|
@individual_details = IndividualDetails.new(@individual)
|
@@ -60,7 +60,7 @@ module Braintree
|
|
60
60
|
|
61
61
|
class << self
|
62
62
|
protected :new
|
63
|
-
def _new(*args)
|
63
|
+
def _new(*args)
|
64
64
|
self.new(*args)
|
65
65
|
end
|
66
66
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class MerchantAccountGateway
|
2
|
+
class MerchantAccountGateway
|
3
3
|
include BaseModule
|
4
4
|
|
5
5
|
def initialize(gateway)
|
@@ -51,7 +51,7 @@ module Braintree
|
|
51
51
|
_create_for_currency(params)
|
52
52
|
end
|
53
53
|
|
54
|
-
def _do_create(path, params=nil)
|
54
|
+
def _do_create(path, params=nil)
|
55
55
|
response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
|
56
56
|
if response[:api_error_response]
|
57
57
|
ErrorResult.new(@gateway, response[:api_error_response])
|
@@ -60,7 +60,7 @@ module Braintree
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
def _do_update(path, params=nil)
|
63
|
+
def _do_update(path, params=nil)
|
64
64
|
response = @config.http.put("#{@config.base_merchant_path}#{path}", params)
|
65
65
|
if response[:api_error_response]
|
66
66
|
ErrorResult.new(@gateway, response[:api_error_response])
|
@@ -83,7 +83,7 @@ module Braintree
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
-
# this is part of Marketplace and shouldn't be removed unless we're removing all Marketplace code
|
86
|
+
# NEXT_MAJOR_VERSION this is part of Marketplace and shouldn't be removed unless we're removing all Marketplace code
|
87
87
|
def self._detect_signature(attributes)
|
88
88
|
if attributes.has_key?(:applicant_details)
|
89
89
|
warn "[DEPRECATED] Passing :applicant_details to create is deprecated. Please use :individual, :business, and :funding."
|
@@ -93,8 +93,8 @@ module Braintree
|
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
|
-
# this is part of Marketplace and shouldn't be removed unless we're removing all Marketplace code
|
97
|
-
def self._deprecated_create_signature
|
96
|
+
# NEXT_MAJOR_VERSION this is part of Marketplace and shouldn't be removed unless we're removing all Marketplace code
|
97
|
+
def self._deprecated_create_signature
|
98
98
|
[
|
99
99
|
{:applicant_details => [
|
100
100
|
:first_name, :last_name, :email, :date_of_birth, :ssn, :routing_number,
|
@@ -105,7 +105,7 @@ module Braintree
|
|
105
105
|
]
|
106
106
|
end
|
107
107
|
|
108
|
-
def self._signature
|
108
|
+
def self._signature
|
109
109
|
[
|
110
110
|
{:individual => [
|
111
111
|
:first_name, :last_name, :email, :date_of_birth, :ssn, :phone,
|
@@ -119,11 +119,11 @@ module Braintree
|
|
119
119
|
]
|
120
120
|
end
|
121
121
|
|
122
|
-
def self._create_signature
|
122
|
+
def self._create_signature
|
123
123
|
_signature + [:tos_accepted, :master_merchant_account_id, :id]
|
124
124
|
end
|
125
125
|
|
126
|
-
def self._update_signature
|
126
|
+
def self._update_signature
|
127
127
|
_signature
|
128
128
|
end
|
129
129
|
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module Braintree
|
2
|
+
class MetaCheckoutCard
|
3
|
+
include BaseModule # :nodoc:
|
4
|
+
include Braintree::Util::TokenEquality
|
5
|
+
|
6
|
+
attr_reader :bin
|
7
|
+
attr_reader :container_id
|
8
|
+
attr_reader :card_type
|
9
|
+
attr_reader :cardholder_name
|
10
|
+
attr_reader :commercial
|
11
|
+
attr_reader :country_of_issuance
|
12
|
+
attr_reader :created_at
|
13
|
+
attr_reader :customer_id
|
14
|
+
attr_reader :customer_location
|
15
|
+
attr_reader :debit
|
16
|
+
attr_reader :durbin_regulated
|
17
|
+
attr_reader :expiration_month
|
18
|
+
attr_reader :expiration_year
|
19
|
+
attr_reader :healthcare
|
20
|
+
attr_reader :image_url
|
21
|
+
attr_reader :issuing_bank
|
22
|
+
attr_reader :last_4
|
23
|
+
attr_reader :payroll
|
24
|
+
attr_reader :prepaid
|
25
|
+
attr_reader :product_id
|
26
|
+
attr_reader :subscriptions
|
27
|
+
attr_reader :token
|
28
|
+
attr_reader :unique_number_identifier
|
29
|
+
attr_reader :updated_at
|
30
|
+
attr_reader :verification
|
31
|
+
|
32
|
+
|
33
|
+
def initialize(gateway, attributes) # :nodoc:
|
34
|
+
@gateway = gateway
|
35
|
+
set_instance_variables_from_hash(attributes)
|
36
|
+
@subscriptions = (@subscriptions || []).map { |subscription_hash| Subscription._new(@gateway, subscription_hash) }
|
37
|
+
@verification = _most_recent_verification(attributes)
|
38
|
+
end
|
39
|
+
|
40
|
+
def _most_recent_verification(attributes)
|
41
|
+
verification = (attributes[:verifications] || []).sort_by { |v| v[:created_at] }.reverse.first
|
42
|
+
CreditCardVerification._new(verification) if verification
|
43
|
+
end
|
44
|
+
|
45
|
+
def default?
|
46
|
+
@default
|
47
|
+
end
|
48
|
+
|
49
|
+
# Expiration date formatted as MM/YYYY
|
50
|
+
def expiration_date
|
51
|
+
"#{expiration_month}/#{expiration_year}"
|
52
|
+
end
|
53
|
+
|
54
|
+
def expired?
|
55
|
+
@expired
|
56
|
+
end
|
57
|
+
|
58
|
+
def inspect # :nodoc:
|
59
|
+
first = [:token]
|
60
|
+
order = first + (self.class._attributes - first)
|
61
|
+
nice_attributes = order.map do |attr|
|
62
|
+
"#{attr}: #{send(attr).inspect}"
|
63
|
+
end
|
64
|
+
"#<#{self.class} #{nice_attributes.join(', ')}>"
|
65
|
+
end
|
66
|
+
|
67
|
+
def masked_number
|
68
|
+
"#{bin}******#{last_4}"
|
69
|
+
end
|
70
|
+
|
71
|
+
class << self
|
72
|
+
protected :new
|
73
|
+
end
|
74
|
+
|
75
|
+
def self._attributes # :nodoc:
|
76
|
+
[
|
77
|
+
:bin, :card_type, :cardholder_name, :created_at,
|
78
|
+
:customer_id, :customer_location, :expiration_month, :expiration_year,
|
79
|
+
:last_4, :token, :updated_at, :prepaid, :payroll, :product_id,
|
80
|
+
:commercial, :debit, :durbin_regulated, :healthcare,
|
81
|
+
:country_of_issuance, :issuing_bank, :image_url, :container_id
|
82
|
+
]
|
83
|
+
end
|
84
|
+
|
85
|
+
def self._new(*args) # :nodoc:
|
86
|
+
self.new(*args)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module Braintree
|
2
|
+
class MetaCheckoutToken
|
3
|
+
include BaseModule # :nodoc:
|
4
|
+
include Braintree::Util::TokenEquality
|
5
|
+
|
6
|
+
attr_reader :bin
|
7
|
+
attr_reader :container_id
|
8
|
+
attr_reader :card_type
|
9
|
+
attr_reader :cardholder_name
|
10
|
+
attr_reader :commercial
|
11
|
+
attr_reader :country_of_issuance
|
12
|
+
attr_reader :created_at
|
13
|
+
attr_reader :cryptogram
|
14
|
+
attr_reader :customer_id
|
15
|
+
attr_reader :customer_location
|
16
|
+
attr_reader :debit
|
17
|
+
attr_reader :durbin_regulated
|
18
|
+
attr_reader :ecommerce_indicator
|
19
|
+
attr_reader :expiration_month
|
20
|
+
attr_reader :expiration_year
|
21
|
+
attr_reader :healthcare
|
22
|
+
attr_reader :image_url
|
23
|
+
attr_reader :issuing_bank
|
24
|
+
attr_reader :last_4
|
25
|
+
attr_reader :payroll
|
26
|
+
attr_reader :prepaid
|
27
|
+
attr_reader :product_id
|
28
|
+
attr_reader :token
|
29
|
+
attr_reader :unique_number_identifier
|
30
|
+
attr_reader :updated_at
|
31
|
+
attr_reader :verification
|
32
|
+
|
33
|
+
def initialize(gateway, attributes) # :nodoc:
|
34
|
+
@gateway = gateway
|
35
|
+
set_instance_variables_from_hash(attributes)
|
36
|
+
@verification = _most_recent_verification(attributes)
|
37
|
+
end
|
38
|
+
|
39
|
+
def _most_recent_verification(attributes)
|
40
|
+
verification = (attributes[:verifications] || []).sort_by { |v| v[:created_at] }.reverse.first
|
41
|
+
CreditCardVerification._new(verification) if verification
|
42
|
+
end
|
43
|
+
|
44
|
+
def default?
|
45
|
+
@default
|
46
|
+
end
|
47
|
+
|
48
|
+
# Expiration date formatted as MM/YYYY
|
49
|
+
def expiration_date
|
50
|
+
"#{expiration_month}/#{expiration_year}"
|
51
|
+
end
|
52
|
+
|
53
|
+
def expired?
|
54
|
+
@expired
|
55
|
+
end
|
56
|
+
|
57
|
+
def inspect # :nodoc:
|
58
|
+
first = [:token]
|
59
|
+
order = first + (self.class._attributes - first)
|
60
|
+
nice_attributes = order.map do |attr|
|
61
|
+
"#{attr}: #{send(attr).inspect}"
|
62
|
+
end
|
63
|
+
"#<#{self.class} #{nice_attributes.join(', ')}>"
|
64
|
+
end
|
65
|
+
|
66
|
+
def masked_number
|
67
|
+
"#{bin}******#{last_4}"
|
68
|
+
end
|
69
|
+
|
70
|
+
class << self
|
71
|
+
protected :new
|
72
|
+
end
|
73
|
+
|
74
|
+
def self._attributes # :nodoc:
|
75
|
+
[
|
76
|
+
:bin, :card_type, :cardholder_name, :created_at,
|
77
|
+
:customer_id, :customer_location, :expiration_month, :expiration_year,
|
78
|
+
:last_4, :token, :updated_at, :prepaid, :payroll, :product_id,
|
79
|
+
:commercial, :debit, :durbin_regulated, :healthcare, :ecommerce_indicator,
|
80
|
+
:country_of_issuance, :issuing_bank, :image_url, :container_id, :cryptogram
|
81
|
+
]
|
82
|
+
end
|
83
|
+
|
84
|
+
def self._new(*args) # :nodoc:
|
85
|
+
self.new(*args)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class Modification
|
2
|
+
class Modification
|
3
3
|
include BaseModule
|
4
4
|
|
5
5
|
attr_reader :amount
|
@@ -17,12 +17,12 @@ module Braintree
|
|
17
17
|
|
18
18
|
class << self
|
19
19
|
protected :new
|
20
|
-
def _new(*args)
|
20
|
+
def _new(*args)
|
21
21
|
self.new(*args)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def initialize(attributes)
|
25
|
+
def initialize(attributes)
|
26
26
|
set_instance_variables_from_hash(attributes)
|
27
27
|
@amount = Util.to_big_decimal(amount)
|
28
28
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module Braintree
|
2
2
|
class OAuthCredentials
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
|
5
5
|
attr_reader :access_token
|
6
6
|
attr_reader :expires_at
|
7
7
|
attr_reader :refresh_token
|
8
8
|
attr_reader :token_type
|
9
9
|
|
10
|
-
def initialize(attributes)
|
10
|
+
def initialize(attributes)
|
11
11
|
set_instance_variables_from_hash(attributes)
|
12
12
|
end
|
13
13
|
|
@@ -15,7 +15,7 @@ module Braintree
|
|
15
15
|
protected :new
|
16
16
|
end
|
17
17
|
|
18
|
-
def self._new(*args)
|
18
|
+
def self._new(*args)
|
19
19
|
self.new(*args)
|
20
20
|
end
|
21
21
|
end
|
@@ -6,7 +6,7 @@ module Braintree
|
|
6
6
|
attr_reader :page_size
|
7
7
|
attr_reader :total_items
|
8
8
|
|
9
|
-
def initialize(total_items, page_size, current_page)
|
9
|
+
def initialize(total_items, page_size, current_page)
|
10
10
|
@total_items = total_items
|
11
11
|
@current_page = current_page
|
12
12
|
@page_size = page_size
|
@@ -4,6 +4,8 @@ module Braintree
|
|
4
4
|
CreditCard = "credit_card"
|
5
5
|
GooglePayCard = "android_pay_card"
|
6
6
|
LocalPayment = "local_payment"
|
7
|
+
MetaCheckoutCard = "meta_checkout_card"
|
8
|
+
MetaCheckoutToken = "meta_checkout_token"
|
7
9
|
PayPalAccount = "paypal_account"
|
8
10
|
PayPalHere = "paypal_here"
|
9
11
|
SamsungPayCard = "samsung_pay_card"
|
@@ -7,7 +7,7 @@ module Braintree
|
|
7
7
|
attr_reader :datetime_updated
|
8
8
|
attr_reader :enriched_customer_data
|
9
9
|
|
10
|
-
def initialize(gateway, attributes)
|
10
|
+
def initialize(gateway, attributes)
|
11
11
|
set_instance_variables_from_hash(attributes)
|
12
12
|
@payment_method = PaymentMethodParser.parse_payment_method(gateway, attributes[:payment_method])
|
13
13
|
@enriched_customer_data = EnrichedCustomerData._new(enriched_customer_data) if enriched_customer_data
|
@@ -17,7 +17,7 @@ module Braintree
|
|
17
17
|
protected :new
|
18
18
|
end
|
19
19
|
|
20
|
-
def self._new(*args)
|
20
|
+
def self._new(*args)
|
21
21
|
self.new(*args)
|
22
22
|
end
|
23
23
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class PaymentMethodGateway
|
2
|
+
class PaymentMethodGateway
|
3
3
|
include BaseModule
|
4
4
|
|
5
5
|
def initialize(gateway)
|
@@ -21,7 +21,7 @@ module Braintree
|
|
21
21
|
return_object_or_raise(:payment_method) { create(*args) }
|
22
22
|
end
|
23
23
|
|
24
|
-
def _do_create(path, params=nil)
|
24
|
+
def _do_create(path, params=nil)
|
25
25
|
response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
|
26
26
|
if response[:api_error_response]
|
27
27
|
ErrorResult.new(@gateway, response[:api_error_response])
|
@@ -76,7 +76,7 @@ module Braintree
|
|
76
76
|
return_object_or_raise(:payment_method) { update(*args) }
|
77
77
|
end
|
78
78
|
|
79
|
-
def _do_update(http_verb, path, params)
|
79
|
+
def _do_update(http_verb, path, params)
|
80
80
|
response = @config.http.send(http_verb, "#{@config.base_merchant_path}#{path}", params)
|
81
81
|
if response[:api_error_response]
|
82
82
|
ErrorResult.new(@gateway, response[:api_error_response])
|
@@ -142,19 +142,19 @@ module Braintree
|
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
|
-
def self._create_signature
|
145
|
+
def self._create_signature
|
146
146
|
_signature(:create)
|
147
147
|
end
|
148
148
|
|
149
|
-
def self._update_signature
|
149
|
+
def self._update_signature
|
150
150
|
_signature(:update)
|
151
151
|
end
|
152
152
|
|
153
|
-
def self._delete_signature
|
153
|
+
def self._delete_signature
|
154
154
|
[:revoke_all_grants]
|
155
155
|
end
|
156
156
|
|
157
|
-
def self._signature(type)
|
157
|
+
def self._signature(type)
|
158
158
|
billing_address_params = AddressGateway._shared_signature
|
159
159
|
paypal_options_shipping_signature = AddressGateway._shared_signature
|
160
160
|
# NEXT_MAJOR_VERSION Remove venmo_sdk_session
|
@@ -165,6 +165,7 @@ module Braintree
|
|
165
165
|
:us_bank_account_verification_method,
|
166
166
|
:venmo_sdk_session, # Deprecated
|
167
167
|
:verification_account_type,
|
168
|
+
:verification_add_ons,
|
168
169
|
:verification_amount,
|
169
170
|
:verification_currency_iso_code,
|
170
171
|
:verification_merchant_account_id,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Braintree
|
2
2
|
class PaymentMethodNonce
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
|
5
5
|
def self.create(*args)
|
6
6
|
Configuration.gateway.payment_method_nonce.create(*args)
|
@@ -22,7 +22,7 @@ module Braintree
|
|
22
22
|
attr_reader :type
|
23
23
|
attr_reader :authentication_insight
|
24
24
|
|
25
|
-
def initialize(gateway, attributes)
|
25
|
+
def initialize(gateway, attributes)
|
26
26
|
@gateway = gateway
|
27
27
|
set_instance_variables_from_hash(attributes)
|
28
28
|
@details = PaymentMethodNonceDetails.new(attributes[:details]) if attributes[:details]
|
@@ -34,7 +34,7 @@ module Braintree
|
|
34
34
|
@default
|
35
35
|
end
|
36
36
|
|
37
|
-
def to_s
|
37
|
+
def to_s
|
38
38
|
nonce
|
39
39
|
end
|
40
40
|
|
@@ -42,7 +42,7 @@ module Braintree
|
|
42
42
|
protected :new
|
43
43
|
end
|
44
44
|
|
45
|
-
def self._new(gateway, attributes)
|
45
|
+
def self._new(gateway, attributes)
|
46
46
|
new(gateway, attributes)
|
47
47
|
end
|
48
48
|
end
|
@@ -13,7 +13,7 @@ module Braintree
|
|
13
13
|
attr_reader :token
|
14
14
|
attr_reader :updated_at
|
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) }
|
@@ -51,7 +51,6 @@ module Braintree
|
|
51
51
|
return_object_or_raise(:transaction) { sale(token, transaction_attributes) }
|
52
52
|
end
|
53
53
|
|
54
|
-
# Returns true if this paypal account is the customer's default payment method.
|
55
54
|
def default?
|
56
55
|
@default
|
57
56
|
end
|
@@ -28,7 +28,7 @@ module Braintree
|
|
28
28
|
@config.http.delete("#{@config.base_merchant_path}/payment_methods/paypal_account/#{token}")
|
29
29
|
end
|
30
30
|
|
31
|
-
def _do_create(path, params)
|
31
|
+
def _do_create(path, params)
|
32
32
|
response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
|
33
33
|
if response[:paypal_account]
|
34
34
|
SuccessfulResult.new(:paypal_account => PayPalAccount._new(@gateway, response[:paypal_account]))
|
@@ -39,7 +39,7 @@ module Braintree
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
def _do_update(http_verb, path, params)
|
42
|
+
def _do_update(http_verb, path, params)
|
43
43
|
response = @config.http.send(http_verb, "#{@config.base_merchant_path}#{path}", params)
|
44
44
|
if response[:paypal_account]
|
45
45
|
SuccessfulResult.new(:paypal_account => PayPalAccount._new(@gateway, response[:paypal_account]))
|
@@ -50,7 +50,7 @@ module Braintree
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
def self._create_signature
|
53
|
+
def self._create_signature
|
54
54
|
options = [:fail_on_duplicate_payment_method, :make_default]
|
55
55
|
[
|
56
56
|
:email, :token, :billing_agreement_id, :customer_id,
|
@@ -58,14 +58,14 @@ module Braintree
|
|
58
58
|
]
|
59
59
|
end
|
60
60
|
|
61
|
-
def self._create_nested_signature
|
61
|
+
def self._create_nested_signature
|
62
62
|
[
|
63
63
|
:email, :token, :billing_agreement_id,
|
64
64
|
{:options => [:make_default]}
|
65
65
|
]
|
66
66
|
end
|
67
67
|
|
68
|
-
def self._update_signature
|
68
|
+
def self._update_signature
|
69
69
|
options = [:fail_on_duplicate_payment_method, :make_default]
|
70
70
|
[:email, :token, :billing_agreement_id, {:options => options}]
|
71
71
|
end
|
data/lib/braintree/plan.rb
CHANGED
@@ -23,7 +23,7 @@ module Braintree
|
|
23
23
|
Configuration.gateway.plan.all
|
24
24
|
end
|
25
25
|
|
26
|
-
def initialize(gateway, attributes)
|
26
|
+
def initialize(gateway, attributes)
|
27
27
|
@gateway = gateway
|
28
28
|
set_instance_variables_from_hash(attributes)
|
29
29
|
add_ons.map! { |attrs| AddOn._new(attrs) }
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class PlanGateway
|
2
|
+
class PlanGateway
|
3
3
|
include BaseModule
|
4
4
|
|
5
5
|
def initialize(gateway)
|
@@ -102,7 +102,7 @@ module Braintree
|
|
102
102
|
]
|
103
103
|
end
|
104
104
|
|
105
|
-
def _do_create(path, params)
|
105
|
+
def _do_create(path, params)
|
106
106
|
response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
|
107
107
|
if response[:plan]
|
108
108
|
SuccessfulResult.new(:plan => Plan._new(@gateway, response[:plan]))
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Braintree
|
2
|
-
class ResourceCollection
|
2
|
+
class ResourceCollection
|
3
3
|
include Enumerable
|
4
4
|
|
5
5
|
attr_reader :ids
|
6
6
|
|
7
|
-
def initialize(response, &block)
|
7
|
+
def initialize(response, &block)
|
8
8
|
@ids = Util.extract_attribute_as_array(response[:search_results], :ids)
|
9
9
|
@page_size = response[:search_results][:page_size]
|
10
10
|
@paging_block = block
|