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
@@ -47,22 +47,39 @@ module Braintree
|
|
47
47
|
def self._create_signature
|
48
48
|
[
|
49
49
|
{:credit_card => [
|
50
|
-
:
|
51
|
-
:
|
50
|
+
{:billing_address => AddressGateway._shared_signature},
|
51
|
+
:cardholder_name,
|
52
|
+
:cvv,
|
53
|
+
:expiration_date,
|
54
|
+
:expiration_month,
|
55
|
+
:expiration_year,
|
56
|
+
:number,
|
57
|
+
]},
|
58
|
+
{:external_vault => [
|
59
|
+
:previous_network_transaction_id,
|
60
|
+
:status,
|
52
61
|
]},
|
53
62
|
:intended_transaction_source,
|
54
|
-
{:options => [
|
63
|
+
{:options => [
|
64
|
+
:account_type,
|
65
|
+
:amount,
|
66
|
+
:merchant_account_id,
|
67
|
+
]},
|
55
68
|
:payment_method_nonce,
|
69
|
+
{:risk_data => [
|
70
|
+
:customer_browser,
|
71
|
+
:customer_ip,
|
72
|
+
]},
|
56
73
|
:three_d_secure_authentication_id,
|
57
74
|
{:three_d_secure_pass_thru => [
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
75
|
+
:authentication_response,
|
76
|
+
:cavv,
|
77
|
+
:cavv_algorithm,
|
78
|
+
:directory_response,
|
79
|
+
:ds_transaction_id,
|
80
|
+
:eci_flag,
|
81
|
+
:three_d_secure_version,
|
82
|
+
:xid,
|
66
83
|
]},
|
67
84
|
]
|
68
85
|
end
|
data/lib/braintree/customer.rb
CHANGED
@@ -67,7 +67,6 @@ module Braintree
|
|
67
67
|
Configuration.gateway.customer.search(&block)
|
68
68
|
end
|
69
69
|
|
70
|
-
# Returns a ResourceCollection of transactions for the customer with the given +customer_id+.
|
71
70
|
def self.transactions(*args)
|
72
71
|
Configuration.gateway.customer.transactions(*args)
|
73
72
|
end
|
@@ -80,7 +79,7 @@ module Braintree
|
|
80
79
|
Configuration.gateway.customer.update!(*args)
|
81
80
|
end
|
82
81
|
|
83
|
-
def initialize(gateway, attributes)
|
82
|
+
def initialize(gateway, attributes)
|
84
83
|
@gateway = gateway
|
85
84
|
set_instance_variables_from_hash(attributes)
|
86
85
|
@credit_cards = (@credit_cards || []).map { |pm| CreditCard._new gateway, pm }
|
@@ -105,7 +104,6 @@ module Braintree
|
|
105
104
|
return_object_or_raise(:transaction) { credit(transaction_attributes) }
|
106
105
|
end
|
107
106
|
|
108
|
-
# Returns the customer's default payment method.
|
109
107
|
def default_payment_method
|
110
108
|
payment_methods.find { |payment_instrument| payment_instrument.default? }
|
111
109
|
end
|
@@ -114,7 +112,6 @@ module Braintree
|
|
114
112
|
@gateway.customer.delete(id)
|
115
113
|
end
|
116
114
|
|
117
|
-
# Returns the customer's payment methods
|
118
115
|
def payment_methods
|
119
116
|
@credit_cards +
|
120
117
|
@paypal_accounts +
|
@@ -127,7 +124,7 @@ module Braintree
|
|
127
124
|
@sepa_direct_debit_accounts
|
128
125
|
end
|
129
126
|
|
130
|
-
def inspect
|
127
|
+
def inspect
|
131
128
|
first = [:id]
|
132
129
|
last = [:addresses, :credit_cards, :paypal_accounts, :tax_identifiers]
|
133
130
|
order = first + (self.class._attributes - first - last) + last
|
@@ -137,7 +134,6 @@ module Braintree
|
|
137
134
|
"#<#{self.class} #{nice_attributes.join(', ')}>"
|
138
135
|
end
|
139
136
|
|
140
|
-
# Returns a ResourceCollection of transactions for the customer.
|
141
137
|
def transactions(options = {})
|
142
138
|
@gateway.customer.transactions(id, options)
|
143
139
|
end
|
@@ -146,18 +142,18 @@ module Braintree
|
|
146
142
|
protected :new
|
147
143
|
end
|
148
144
|
|
149
|
-
def self._new(*args)
|
145
|
+
def self._new(*args)
|
150
146
|
self.new(*args)
|
151
147
|
end
|
152
148
|
|
153
|
-
def self._attributes
|
149
|
+
def self._attributes
|
154
150
|
[
|
155
151
|
:addresses, :company, :credit_cards, :email, :fax, :first_name, :id, :last_name, :phone, :website,
|
156
152
|
:created_at, :updated_at, :tax_identifiers
|
157
153
|
]
|
158
154
|
end
|
159
155
|
|
160
|
-
def self._now_timestamp
|
156
|
+
def self._now_timestamp
|
161
157
|
Time.now.to_i
|
162
158
|
end
|
163
159
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class CustomerGateway
|
2
|
+
class CustomerGateway
|
3
3
|
include BaseModule
|
4
4
|
|
5
5
|
def initialize(gateway)
|
@@ -60,7 +60,7 @@ module Braintree
|
|
60
60
|
return_object_or_raise(:customer) { update(*args) }
|
61
61
|
end
|
62
62
|
|
63
|
-
def self._create_signature
|
63
|
+
def self._create_signature
|
64
64
|
credit_card_signature = CreditCardGateway._create_signature - [:customer_id]
|
65
65
|
paypal_account_signature = PayPalAccountGateway._create_nested_signature
|
66
66
|
paypal_options_shipping_signature = AddressGateway._shared_signature
|
@@ -86,7 +86,7 @@ module Braintree
|
|
86
86
|
]
|
87
87
|
end
|
88
88
|
|
89
|
-
def _do_create(path, params=nil)
|
89
|
+
def _do_create(path, params=nil)
|
90
90
|
response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
|
91
91
|
if response[:customer]
|
92
92
|
SuccessfulResult.new(:customer => Customer._new(@gateway, response[:customer]))
|
@@ -97,7 +97,7 @@ module Braintree
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
def _do_update(http_verb, path, params)
|
100
|
+
def _do_update(http_verb, path, params)
|
101
101
|
response = @config.http.send(http_verb, "#{@config.base_merchant_path}#{path}", params)
|
102
102
|
if response[:customer]
|
103
103
|
SuccessfulResult.new(:customer => Customer._new(@gateway, response[:customer]))
|
@@ -108,14 +108,14 @@ module Braintree
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
-
def _fetch_customers(search, ids)
|
111
|
+
def _fetch_customers(search, ids)
|
112
112
|
search.ids.in ids
|
113
113
|
response = @config.http.post("#{@config.base_merchant_path}/customers/advanced_search", {:search => search.to_hash})
|
114
114
|
attributes = response[:customers]
|
115
115
|
Util.extract_attribute_as_array(attributes, :customer).map { |attrs| Customer._new(@gateway, attrs) }
|
116
116
|
end
|
117
117
|
|
118
|
-
def _fetch_transactions(customer_id, ids)
|
118
|
+
def _fetch_transactions(customer_id, ids)
|
119
119
|
response = @config.http.post("#{@config.base_merchant_path}/customers/#{customer_id}/transactions", :search => {:ids => ids})
|
120
120
|
attributes = response[:credit_card_transactions]
|
121
121
|
Util.extract_attribute_as_array(attributes, :transaction).map do |transaction_attributes|
|
@@ -123,7 +123,7 @@ module Braintree
|
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
|
-
def self._update_signature
|
126
|
+
def self._update_signature
|
127
127
|
credit_card_signature = CreditCardGateway._update_signature - [:customer_id]
|
128
128
|
credit_card_options = credit_card_signature.find { |item| item.respond_to?(:keys) && item.keys == [:options] }
|
129
129
|
credit_card_options[:options] << :update_existing_token
|
data/lib/braintree/descriptor.rb
CHANGED
data/lib/braintree/digest.rb
CHANGED
@@ -20,7 +20,7 @@ module Braintree
|
|
20
20
|
|
21
21
|
alias_method :success?, :success
|
22
22
|
|
23
|
-
def initialize(gateway, attributes)
|
23
|
+
def initialize(gateway, attributes)
|
24
24
|
@gateway = gateway
|
25
25
|
set_instance_variables_from_hash(attributes)
|
26
26
|
@amount = Util.to_big_decimal(amount)
|
@@ -34,10 +34,10 @@ module Braintree
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
def inspect
|
37
|
+
def inspect
|
38
38
|
nice_attributes = self.class._inspect_attributes.map { |attr| "#{attr}: #{send(attr).inspect}" }
|
39
39
|
nice_attributes << "amount: #{self.amount.to_s("F").inspect}"
|
40
|
-
nice_attributes << "disbursement_date: #{self.disbursement_date
|
40
|
+
nice_attributes << "disbursement_date: #{self.disbursement_date}"
|
41
41
|
"#<#{self.class} #{nice_attributes.join(', ')}>"
|
42
42
|
end
|
43
43
|
|
@@ -51,12 +51,12 @@ module Braintree
|
|
51
51
|
|
52
52
|
class << self
|
53
53
|
protected :new
|
54
|
-
def _new(*args)
|
54
|
+
def _new(*args)
|
55
55
|
self.new(*args)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
def self._inspect_attributes
|
59
|
+
def self._inspect_attributes
|
60
60
|
[:id, :exception_message, :follow_up_action, :merchant_account, :transaction_ids, :retry, :success]
|
61
61
|
end
|
62
62
|
end
|
data/lib/braintree/dispute.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class Dispute
|
2
|
+
class Dispute
|
3
3
|
include BaseModule
|
4
4
|
include Braintree::Util::IdEquality
|
5
5
|
|
@@ -97,7 +97,7 @@ module Braintree
|
|
97
97
|
|
98
98
|
class << self
|
99
99
|
protected :new
|
100
|
-
def _new(*args)
|
100
|
+
def _new(*args)
|
101
101
|
self.new(*args)
|
102
102
|
end
|
103
103
|
end
|
@@ -130,7 +130,7 @@ module Braintree
|
|
130
130
|
Configuration.gateway.dispute.search(&block)
|
131
131
|
end
|
132
132
|
|
133
|
-
def initialize(attributes)
|
133
|
+
def initialize(attributes)
|
134
134
|
set_instance_variables_from_hash(attributes)
|
135
135
|
@date_opened = Date.parse(date_opened) unless date_opened.nil?
|
136
136
|
@date_won = Date.parse(date_won) unless date_won.nil?
|
@@ -23,13 +23,13 @@ module Braintree
|
|
23
23
|
Configuration.gateway.document_upload.create!(*args)
|
24
24
|
end
|
25
25
|
|
26
|
-
def initialize(attributes)
|
26
|
+
def initialize(attributes)
|
27
27
|
set_instance_variables_from_hash(attributes)
|
28
28
|
end
|
29
29
|
|
30
30
|
class << self
|
31
31
|
protected :new
|
32
|
-
def _new(*args)
|
32
|
+
def _new(*args)
|
33
33
|
self.new(*args)
|
34
34
|
end
|
35
35
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class DocumentUploadGateway
|
2
|
+
class DocumentUploadGateway
|
3
3
|
include BaseModule
|
4
4
|
|
5
5
|
def initialize(gateway)
|
@@ -17,14 +17,14 @@ module Braintree
|
|
17
17
|
return_object_or_raise(:document_upload) { create(*args) }
|
18
18
|
end
|
19
19
|
|
20
|
-
def self._create_signature
|
20
|
+
def self._create_signature
|
21
21
|
[
|
22
22
|
:kind,
|
23
23
|
:file
|
24
24
|
]
|
25
25
|
end
|
26
26
|
|
27
|
-
def _do_create(path, params, file)
|
27
|
+
def _do_create(path, params, file)
|
28
28
|
response = @config.http.post("#{@config.base_merchant_path}#{path}", params, file)
|
29
29
|
if response[:document_upload]
|
30
30
|
SuccessfulResult.new(:document_upload => DocumentUpload._new(response[:document_upload]))
|
@@ -5,7 +5,7 @@ module Braintree
|
|
5
5
|
attr_reader :fields_updated
|
6
6
|
attr_reader :profile_data
|
7
7
|
|
8
|
-
def initialize(attributes)
|
8
|
+
def initialize(attributes)
|
9
9
|
set_instance_variables_from_hash(attributes)
|
10
10
|
@profile_data = VenmoProfileData._new(attributes[:profile_data])
|
11
11
|
end
|
@@ -14,7 +14,7 @@ module Braintree
|
|
14
14
|
protected :new
|
15
15
|
end
|
16
16
|
|
17
|
-
def self._new(*args)
|
17
|
+
def self._new(*args)
|
18
18
|
self.new(*args)
|
19
19
|
end
|
20
20
|
end
|
@@ -10,7 +10,7 @@ module Braintree
|
|
10
10
|
attr_reader :transaction
|
11
11
|
attr_reader :verification
|
12
12
|
|
13
|
-
def initialize(gateway, data)
|
13
|
+
def initialize(gateway, data)
|
14
14
|
@gateway = gateway
|
15
15
|
@params = data[:params]
|
16
16
|
@credit_card_verification = CreditCardVerification._new(data[:verification]) if data[:verification]
|
@@ -22,7 +22,7 @@ module Braintree
|
|
22
22
|
@errors = Errors.new(data[:errors])
|
23
23
|
end
|
24
24
|
|
25
|
-
def inspect
|
25
|
+
def inspect
|
26
26
|
if @credit_card_verification
|
27
27
|
verification_inspect = " credit_card_verification: #{@credit_card_verification.inspect}"
|
28
28
|
end
|
@@ -32,7 +32,6 @@ module Braintree
|
|
32
32
|
"#<#{self.class} params:{...} errors:<#{@errors._inner_inspect}>#{verification_inspect}#{transaction_inspect}>"
|
33
33
|
end
|
34
34
|
|
35
|
-
# Always returns false.
|
36
35
|
def success?
|
37
36
|
false
|
38
37
|
end
|
data/lib/braintree/errors.rb
CHANGED
@@ -2,7 +2,7 @@ module Braintree
|
|
2
2
|
class Errors
|
3
3
|
include Enumerable
|
4
4
|
|
5
|
-
def initialize(data = {})
|
5
|
+
def initialize(data = {})
|
6
6
|
@errors = ValidationErrorCollection.new(data.merge(:errors => []))
|
7
7
|
end
|
8
8
|
|
@@ -14,7 +14,7 @@ module Braintree
|
|
14
14
|
@errors.for(scope)
|
15
15
|
end
|
16
16
|
|
17
|
-
def inspect
|
17
|
+
def inspect
|
18
18
|
"#<#{self.class} #{_inner_inspect}>"
|
19
19
|
end
|
20
20
|
|
@@ -25,7 +25,7 @@ module Braintree
|
|
25
25
|
@errors.deep_size
|
26
26
|
end
|
27
27
|
|
28
|
-
def _inner_inspect
|
28
|
+
def _inner_inspect
|
29
29
|
@errors._inner_inspect
|
30
30
|
end
|
31
31
|
end
|
data/lib/braintree/exceptions.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Braintree
|
2
2
|
class ExchangeRateQuote
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
|
5
5
|
attr_reader :attrs
|
6
6
|
attr_reader :base_amount
|
@@ -11,12 +11,12 @@ module Braintree
|
|
11
11
|
attr_reader :refreshes_at
|
12
12
|
attr_reader :trade_rate
|
13
13
|
|
14
|
-
def initialize(attributes)
|
14
|
+
def initialize(attributes)
|
15
15
|
@attrs = attributes.keys
|
16
16
|
set_instance_variables_from_hash(attributes)
|
17
17
|
end
|
18
18
|
|
19
|
-
def inspect
|
19
|
+
def inspect
|
20
20
|
inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
|
21
21
|
"#<#{self.class} #{inspected_attributes.join(" ")}>"
|
22
22
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Braintree
|
2
2
|
class ExchangeRateQuoteInput
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
|
5
5
|
attr_reader :attrs
|
6
6
|
attr_reader :base_currency
|
@@ -8,12 +8,12 @@ module Braintree
|
|
8
8
|
attr_reader :markup
|
9
9
|
attr_reader :quote_currency
|
10
10
|
|
11
|
-
def initialize(attributes)
|
11
|
+
def initialize(attributes)
|
12
12
|
@attrs = attributes.keys
|
13
13
|
set_instance_variables_from_hash(attributes)
|
14
14
|
end
|
15
15
|
|
16
|
-
def inspect
|
16
|
+
def inspect
|
17
17
|
inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
|
18
18
|
"#<#{self.class} #{inspected_attributes.join(" ")}>"
|
19
19
|
end
|
@@ -1,16 +1,16 @@
|
|
1
1
|
module Braintree
|
2
2
|
class ExchangeRateQuoteRequest
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
|
5
5
|
attr_reader :quotes
|
6
6
|
|
7
|
-
def initialize(attributes)
|
7
|
+
def initialize(attributes)
|
8
8
|
@attrs = attributes.keys
|
9
9
|
set_instance_variables_from_hash(attributes)
|
10
10
|
@quotes = (@quotes || []).map { |quote_hash| ExchangeRateQuoteInput.new(quote_hash) }
|
11
11
|
end
|
12
12
|
|
13
|
-
def inspect
|
13
|
+
def inspect
|
14
14
|
inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
|
15
15
|
"#<#{self.class} #{inspected_attributes.join(" ")}>"
|
16
16
|
end
|
@@ -1,16 +1,16 @@
|
|
1
1
|
module Braintree
|
2
2
|
class ExchangeRateQuoteResponse
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
|
5
5
|
attr_reader :quotes
|
6
6
|
|
7
|
-
def initialize(attributes)
|
7
|
+
def initialize(attributes)
|
8
8
|
@attrs = attributes.keys
|
9
9
|
set_instance_variables_from_hash(attributes)
|
10
10
|
@quotes = (@quotes || []).map { |quote_hash| ExchangeRateQuote.new(quote_hash) }
|
11
11
|
end
|
12
12
|
|
13
|
-
def inspect
|
13
|
+
def inspect
|
14
14
|
inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
|
15
15
|
"#<#{self.class} #{inspected_attributes.join(" ")}>"
|
16
16
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Braintree
|
2
2
|
class GooglePayCard
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
|
5
5
|
attr_reader :bin
|
6
6
|
attr_reader :commercial
|
@@ -28,7 +28,7 @@ module Braintree
|
|
28
28
|
attr_reader :virtual_card_last_4
|
29
29
|
attr_reader :virtual_card_type
|
30
30
|
|
31
|
-
def initialize(gateway, attributes)
|
31
|
+
def initialize(gateway, attributes)
|
32
32
|
@gateway = gateway
|
33
33
|
set_instance_variables_from_hash(attributes)
|
34
34
|
@subscriptions = (@subscriptions || []).map { |subscription_hash| Subscription._new(@gateway, subscription_hash) }
|
@@ -54,7 +54,7 @@ module Braintree
|
|
54
54
|
protected :new
|
55
55
|
end
|
56
56
|
|
57
|
-
def self._new(*args)
|
57
|
+
def self._new(*args)
|
58
58
|
self.new(*args)
|
59
59
|
end
|
60
60
|
end
|
data/lib/braintree/http.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class Http
|
2
|
+
class Http
|
3
3
|
|
4
4
|
LINE_FEED = "\r\n"
|
5
5
|
|
@@ -7,8 +7,8 @@ module Braintree
|
|
7
7
|
@config = config
|
8
8
|
end
|
9
9
|
|
10
|
-
def delete(
|
11
|
-
|
10
|
+
def delete(path, query_params = {})
|
11
|
+
full_path = path + _build_query_string(query_params)
|
12
12
|
response = _http_do Net::HTTP::Delete, path
|
13
13
|
if response.code.to_i == 200 || response.code.to_i == 204
|
14
14
|
true
|
@@ -19,8 +19,8 @@ module Braintree
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
def get(
|
23
|
-
|
22
|
+
def get(path, query_params = {})
|
23
|
+
full_path = path + _build_query_string(query_params)
|
24
24
|
response = _http_do Net::HTTP::Get, path
|
25
25
|
if response.code.to_i == 200 || response.code.to_i == 422
|
26
26
|
Xml.hash_from_xml(_body(response))
|