braintree 2.104.1 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/braintree.gemspec +7 -4
- data/lib/braintree.rb +7 -18
- data/lib/braintree/account_updater_daily_report.rb +1 -1
- data/lib/braintree/address.rb +1 -23
- data/lib/braintree/apple_pay.rb +1 -1
- data/lib/braintree/apple_pay_card.rb +1 -1
- data/lib/braintree/apple_pay_options.rb +1 -1
- data/lib/braintree/authorization_adjustment.rb +1 -1
- data/lib/braintree/base_module.rb +6 -0
- data/lib/braintree/bin_data.rb +9 -2
- data/lib/braintree/client_token.rb +1 -1
- data/lib/braintree/configuration.rb +12 -12
- 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 +2 -77
- data/lib/braintree/credit_card_gateway.rb +7 -36
- data/lib/braintree/credit_card_verification.rb +18 -5
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +5 -76
- data/lib/braintree/customer_gateway.rb +0 -23
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/disbursement.rb +1 -1
- data/lib/braintree/dispute.rb +2 -8
- data/lib/braintree/dispute/{history_event.rb → status_history.rb} +3 -1
- data/lib/braintree/dispute_gateway.rb +4 -9
- data/lib/braintree/dispute_search.rb +2 -2
- data/lib/braintree/document_upload.rb +1 -1
- data/lib/braintree/error_codes.rb +151 -170
- data/lib/braintree/exceptions.rb +5 -3
- data/lib/braintree/gateway.rb +0 -14
- data/lib/braintree/{android_pay_card.rb → google_pay_card.rb} +2 -3
- data/lib/braintree/granted_payment_instrument_update.rb +1 -1
- data/lib/braintree/graphql_client.rb +7 -7
- data/lib/braintree/http.rb +3 -3
- data/lib/braintree/local_payment_completed.rb +1 -1
- data/lib/braintree/local_payment_reversed.rb +19 -0
- data/lib/braintree/merchant.rb +1 -1
- data/lib/braintree/merchant_account.rb +1 -1
- data/lib/braintree/merchant_account_gateway.rb +3 -1
- data/lib/braintree/merchant_gateway.rb +1 -1
- data/lib/braintree/modification.rb +1 -1
- data/lib/braintree/oauth_credentials.rb +1 -1
- data/lib/braintree/oauth_gateway.rb +5 -5
- data/lib/braintree/payment_instrument_type.rb +10 -14
- data/lib/braintree/payment_method_gateway.rb +8 -13
- data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
- data/lib/braintree/payment_method_parser.rb +1 -8
- data/lib/braintree/plan.rb +1 -1
- data/lib/braintree/processor_response_types.rb +3 -3
- data/lib/braintree/resource_collection.rb +8 -3
- data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
- data/lib/braintree/risk_data.rb +3 -1
- data/lib/braintree/samsung_pay_card.rb +1 -1
- data/lib/braintree/settlement_batch_summary.rb +2 -2
- data/lib/braintree/subscription.rb +11 -11
- data/lib/braintree/successful_result.rb +0 -1
- data/lib/braintree/test/credit_card.rb +1 -0
- data/lib/braintree/test/nonce.rb +4 -23
- data/lib/braintree/three_d_secure_info.rb +22 -12
- data/lib/braintree/transaction.rb +44 -104
- data/lib/braintree/transaction/disbursement_details.rb +1 -0
- data/lib/braintree/transaction/{android_pay_details.rb → google_pay_details.rb} +1 -1
- data/lib/braintree/transaction/installment.rb +28 -0
- data/lib/braintree/transaction/installment/adjustment.rb +33 -0
- data/lib/braintree/transaction/paypal_details.rb +1 -0
- data/lib/braintree/transaction/subscription_details.rb +2 -0
- data/lib/braintree/transaction_gateway.rb +37 -25
- data/lib/braintree/transaction_line_item.rb +1 -1
- data/lib/braintree/transaction_search.rb +3 -2
- data/lib/braintree/unknown_payment_method.rb +1 -1
- data/lib/braintree/us_bank_account.rb +3 -3
- data/lib/braintree/us_bank_account_verification.rb +1 -1
- data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
- data/lib/braintree/util.rb +21 -6
- data/lib/braintree/venmo_account.rb +1 -1
- data/lib/braintree/version.rb +3 -3
- data/lib/braintree/visa_checkout_card.rb +2 -2
- data/lib/braintree/webhook_notification.rb +28 -29
- data/lib/braintree/webhook_notification_gateway.rb +5 -5
- data/lib/braintree/webhook_testing_gateway.rb +10 -43
- data/lib/braintree/xml/generator.rb +5 -4
- data/lib/braintree/xml/libxml.rb +1 -0
- data/lib/braintree/xml/parser.rb +21 -44
- data/spec/integration/braintree/add_on_spec.rb +1 -1
- data/spec/integration/braintree/address_spec.rb +26 -113
- data/spec/integration/braintree/advanced_search_spec.rb +45 -45
- data/spec/integration/braintree/apple_pay_spec.rb +3 -3
- data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
- data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
- data/spec/integration/braintree/client_api/spec_helper.rb +5 -31
- data/spec/integration/braintree/credit_card_spec.rb +130 -593
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
- data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
- data/spec/integration/braintree/customer_search_spec.rb +8 -8
- data/spec/integration/braintree/customer_spec.rb +336 -509
- data/spec/integration/braintree/dispute_search_spec.rb +6 -6
- data/spec/integration/braintree/dispute_spec.rb +6 -7
- data/spec/integration/braintree/error_codes_spec.rb +1 -1
- data/spec/integration/braintree/http_spec.rb +2 -2
- data/spec/integration/braintree/merchant_account_spec.rb +25 -26
- data/spec/integration/braintree/merchant_spec.rb +14 -14
- data/spec/integration/braintree/oauth_spec.rb +11 -11
- data/spec/integration/braintree/payment_method_nonce_spec.rb +12 -12
- data/spec/integration/braintree/payment_method_spec.rb +403 -269
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +17 -13
- data/spec/integration/braintree/paypal_account_spec.rb +28 -28
- data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
- data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
- data/spec/integration/braintree/subscription_spec.rb +144 -149
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
- data/spec/integration/braintree/test_transaction_spec.rb +10 -10
- data/spec/integration/braintree/transaction_search_spec.rb +96 -70
- data/spec/integration/braintree/transaction_spec.rb +832 -904
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -26
- data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
- data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
- data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
- data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
- data/spec/integration/spec_helper.rb +10 -7
- data/spec/oauth_test_helper.rb +1 -1
- data/spec/script/httpsd.rb +6 -6
- data/spec/spec_helper.rb +6 -14
- data/spec/unit/braintree/address_spec.rb +1 -9
- data/spec/unit/braintree/apple_pay_card_spec.rb +1 -1
- data/spec/unit/braintree/client_token_spec.rb +2 -2
- data/spec/unit/braintree/configuration_spec.rb +42 -42
- data/spec/unit/braintree/credit_card_spec.rb +9 -28
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
- data/spec/unit/braintree/customer_spec.rb +5 -16
- data/spec/unit/braintree/disbursement_spec.rb +7 -7
- data/spec/unit/braintree/dispute_spec.rb +9 -20
- data/spec/unit/braintree/error_result_spec.rb +5 -5
- data/spec/unit/braintree/errors_spec.rb +8 -8
- data/spec/unit/braintree/http_spec.rb +8 -8
- data/spec/unit/braintree/merchant_account_spec.rb +1 -1
- data/spec/unit/braintree/payment_method_spec.rb +1 -1
- data/spec/unit/braintree/paypal_account_spec.rb +2 -2
- data/spec/unit/braintree/resource_collection_spec.rb +30 -1
- data/spec/unit/braintree/risk_data_spec.rb +9 -5
- data/spec/unit/braintree/subscription_search_spec.rb +1 -1
- data/spec/unit/braintree/successful_result_spec.rb +1 -1
- data/spec/unit/braintree/three_d_secure_info_spec.rb +32 -14
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
- data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
- data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +3 -1
- data/spec/unit/braintree/transaction_search_spec.rb +12 -12
- data/spec/unit/braintree/transaction_spec.rb +25 -51
- data/spec/unit/braintree/util_spec.rb +55 -21
- data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
- data/spec/unit/braintree/webhook_notification_spec.rb +73 -57
- data/spec/unit/braintree/xml/parser_spec.rb +21 -16
- data/spec/unit/braintree/xml_spec.rb +31 -31
- metadata +30 -31
- data/lib/braintree/amex_express_checkout_card.rb +0 -40
- data/lib/braintree/coinbase_account.rb +0 -34
- data/lib/braintree/europe_bank_account.rb +0 -36
- data/lib/braintree/europe_bank_account_gateway.rb +0 -17
- data/lib/braintree/ideal_payment.rb +0 -61
- data/lib/braintree/ideal_payment_gateway.rb +0 -19
- data/lib/braintree/masterpass_card.rb +0 -83
- data/lib/braintree/settlement_batch.rb +0 -0
- data/lib/braintree/transaction/amex_express_checkout_details.rb +0 -21
- data/lib/braintree/transaction/coinbase_details.rb +0 -16
- data/lib/braintree/transaction/ideal_payment_details.rb +0 -19
- data/lib/braintree/transaction/masterpass_card_details.rb +0 -49
- data/lib/braintree/transparent_redirect.rb +0 -40
- data/lib/braintree/transparent_redirect_gateway.rb +0 -105
- data/lib/braintree/xml/rexml.rb +0 -71
- data/spec/hacks/tcp_socket.rb +0 -18
- data/spec/integration/braintree/coinbase_spec.rb +0 -34
- data/spec/integration/braintree/masterpass_card_spec.rb +0 -97
- data/spec/integration/braintree/transparent_redirect_spec.rb +0 -268
- data/spec/unit/braintree/transparent_redirect_spec.rb +0 -223
- data/spec/unit/braintree/xml/rexml_spec.rb +0 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85d22ee560b343f4bbd3f71272f4e9d5cfaa83672ddc36fceb9fc383b25772e3
|
4
|
+
data.tar.gz: 8d29ee6fcd9b7f6ccbab6680029b66c70e53867448b369af806feb454cfdb18c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d35fdc8ebf0d555649b08e401b4b16f6ac58ee52ca3fdb6a0ce899b10a4c7b2db94873fdb940649941c105cf9ca44686a415a9760619be4e7f5d7d9b33883e81
|
7
|
+
data.tar.gz: 687c698cd56953bc23694112256bfe422b53e0a0f0697e5c6626567933ecaab332a1fc6732f4085747ef68178a1d76d6f76a372ec070feb365c8557db8301f51
|
data/LICENSE
CHANGED
data/braintree.gemspec
CHANGED
@@ -1,21 +1,24 @@
|
|
1
1
|
$:.push File.expand_path("../lib", __FILE__)
|
2
|
-
require
|
2
|
+
require "braintree/version"
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "braintree"
|
6
|
-
s.summary = "Braintree
|
7
|
-
s.description = "
|
6
|
+
s.summary = "Braintree Ruby Server SDK"
|
7
|
+
s.description = "Resources and tools for developers to integrate Braintree's global payments platform."
|
8
8
|
s.version = Braintree::Version::String
|
9
9
|
s.license = "MIT"
|
10
10
|
s.author = "Braintree"
|
11
11
|
s.email = "code@getbraintree.com"
|
12
12
|
s.homepage = "https://www.braintreepayments.com/"
|
13
13
|
s.files = Dir.glob ["README.rdoc", "LICENSE", "lib/**/*.{rb,crt}", "spec/**/*", "*.gemspec"]
|
14
|
-
s.add_dependency "builder", ">= 2.
|
14
|
+
s.add_dependency "builder", ">= 3.2.4"
|
15
|
+
s.add_dependency "libxml-ruby", ">= 3.2.0"
|
16
|
+
s.required_ruby_version = ">=2.5.0"
|
15
17
|
s.metadata = {
|
16
18
|
"bug_tracker_uri" => "https://github.com/braintree/braintree_ruby/issues",
|
17
19
|
"changelog_uri" => "https://github.com/braintree/braintree_ruby/blob/master/CHANGELOG.md",
|
18
20
|
"source_code_uri" => "https://github.com/braintree/braintree_ruby",
|
21
|
+
"documentation_uri" => "https://developers.braintreepayments.com/"
|
19
22
|
}
|
20
23
|
end
|
21
24
|
|
data/lib/braintree.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "base64"
|
2
2
|
require "bigdecimal"
|
3
3
|
require "cgi"
|
4
4
|
require "date"
|
@@ -31,8 +31,6 @@ require "braintree/address"
|
|
31
31
|
require "braintree/address/country_names"
|
32
32
|
require "braintree/address_gateway"
|
33
33
|
require "braintree/advanced_search"
|
34
|
-
require "braintree/android_pay_card"
|
35
|
-
require "braintree/amex_express_checkout_card"
|
36
34
|
require "braintree/apple_pay"
|
37
35
|
require "braintree/apple_pay_card"
|
38
36
|
require "braintree/apple_pay_gateway"
|
@@ -41,7 +39,6 @@ require "braintree/authorization_adjustment"
|
|
41
39
|
require "braintree/bin_data"
|
42
40
|
require "braintree/client_token"
|
43
41
|
require "braintree/client_token_gateway"
|
44
|
-
require "braintree/coinbase_account"
|
45
42
|
require "braintree/configuration"
|
46
43
|
require "braintree/connected_merchant_status_transitioned"
|
47
44
|
require "braintree/connected_merchant_paypal_status_changed"
|
@@ -62,7 +59,7 @@ require "braintree/discount_gateway"
|
|
62
59
|
require "braintree/dispute"
|
63
60
|
require "braintree/dispute_gateway"
|
64
61
|
require "braintree/dispute/evidence"
|
65
|
-
require "braintree/dispute/
|
62
|
+
require "braintree/dispute/status_history"
|
66
63
|
require "braintree/dispute/transaction"
|
67
64
|
require "braintree/dispute/transaction_details"
|
68
65
|
require "braintree/document_upload"
|
@@ -72,10 +69,9 @@ require "braintree/error_result"
|
|
72
69
|
require "braintree/errors"
|
73
70
|
require "braintree/gateway"
|
74
71
|
require "braintree/graphql_client"
|
75
|
-
require "braintree/
|
76
|
-
require "braintree/ideal_payment_gateway"
|
77
|
-
require "braintree/transaction/ideal_payment_details"
|
72
|
+
require "braintree/google_pay_card"
|
78
73
|
require "braintree/local_payment_completed"
|
74
|
+
require "braintree/local_payment_reversed"
|
79
75
|
require "braintree/transaction/local_payment_details"
|
80
76
|
require "braintree/merchant"
|
81
77
|
require "braintree/merchant_gateway"
|
@@ -108,8 +104,6 @@ require "braintree/resource_collection"
|
|
108
104
|
require "braintree/revoked_payment_method_metadata"
|
109
105
|
require "braintree/paginated_collection"
|
110
106
|
require "braintree/paginated_result"
|
111
|
-
require "braintree/europe_bank_account"
|
112
|
-
require "braintree/europe_bank_account_gateway"
|
113
107
|
require "braintree/us_bank_account"
|
114
108
|
require "braintree/us_bank_account_verification"
|
115
109
|
require "braintree/us_bank_account_verification_gateway"
|
@@ -134,12 +128,10 @@ require "braintree/transaction_line_item"
|
|
134
128
|
require "braintree/test_transaction"
|
135
129
|
require "braintree/transaction/address_details"
|
136
130
|
require "braintree/transaction/apple_pay_details"
|
137
|
-
require "braintree/transaction/android_pay_details"
|
138
|
-
require "braintree/transaction/amex_express_checkout_details"
|
139
|
-
require "braintree/transaction/coinbase_details"
|
140
131
|
require "braintree/transaction/credit_card_details"
|
141
132
|
require "braintree/transaction/customer_details"
|
142
133
|
require "braintree/transaction/disbursement_details"
|
134
|
+
require "braintree/transaction/google_pay_details"
|
143
135
|
require "braintree/transaction/paypal_details"
|
144
136
|
require "braintree/transaction/paypal_here_details"
|
145
137
|
require "braintree/transaction/subscription_details"
|
@@ -149,19 +141,17 @@ require "braintree/transaction_search"
|
|
149
141
|
require "braintree/transaction/status_details"
|
150
142
|
require "braintree/transaction/venmo_account_details"
|
151
143
|
require "braintree/transaction/visa_checkout_card_details"
|
152
|
-
require "braintree/transaction/masterpass_card_details"
|
153
144
|
require "braintree/transaction/samsung_pay_card_details"
|
145
|
+
require "braintree/transaction/installment"
|
146
|
+
require "braintree/transaction/installment/adjustment"
|
154
147
|
require "braintree/unknown_payment_method"
|
155
148
|
require "braintree/disbursement"
|
156
149
|
require "braintree/dispute_search"
|
157
|
-
require "braintree/transparent_redirect"
|
158
|
-
require "braintree/transparent_redirect_gateway"
|
159
150
|
require "braintree/validation_error"
|
160
151
|
require "braintree/validation_error_collection"
|
161
152
|
require "braintree/venmo_account"
|
162
153
|
require "braintree/version"
|
163
154
|
require "braintree/visa_checkout_card"
|
164
|
-
require "braintree/masterpass_card"
|
165
155
|
require "braintree/samsung_pay_card"
|
166
156
|
require "braintree/webhook_notification"
|
167
157
|
require "braintree/webhook_notification_gateway"
|
@@ -170,5 +160,4 @@ require "braintree/webhook_testing_gateway"
|
|
170
160
|
require "braintree/xml"
|
171
161
|
require "braintree/xml/generator"
|
172
162
|
require "braintree/xml/libxml"
|
173
|
-
require "braintree/xml/rexml"
|
174
163
|
require "braintree/xml/parser"
|
data/lib/braintree/address.rb
CHANGED
@@ -53,34 +53,12 @@ module Braintree
|
|
53
53
|
id == other.id && customer_id == other.customer_id
|
54
54
|
end
|
55
55
|
|
56
|
-
# Deprecated. Use Braintree::Address.delete
|
57
|
-
def delete
|
58
|
-
warn "[DEPRECATED] delete as an instance method is deprecated. Please use Address.delete"
|
59
|
-
@gateway.address.delete(customer_id, self.id)
|
60
|
-
end
|
61
|
-
|
62
|
-
# Deprecated. Use Braintree::Address.update
|
63
|
-
def update(attributes)
|
64
|
-
warn "[DEPRECATED] update as an instance method is deprecated. Please use Address.update"
|
65
|
-
result = @gateway.address.update(customer_id, id, attributes)
|
66
|
-
if result.success?
|
67
|
-
copy_instance_variables_from_object result.address
|
68
|
-
end
|
69
|
-
result
|
70
|
-
end
|
71
|
-
|
72
|
-
# Deprecated. Use Braintree::Address.update!
|
73
|
-
def update!(attributes)
|
74
|
-
warn "[DEPRECATED] update! as an instance method is deprecated. Please use Address.update!"
|
75
|
-
return_object_or_raise(:address) { update(attributes) }
|
76
|
-
end
|
77
|
-
|
78
56
|
class << self
|
79
57
|
protected :new
|
80
58
|
end
|
81
59
|
|
82
60
|
def self._new(*args) # :nodoc:
|
83
|
-
self.new
|
61
|
+
self.new(*args)
|
84
62
|
end
|
85
63
|
end
|
86
64
|
end
|
data/lib/braintree/apple_pay.rb
CHANGED
@@ -20,6 +20,12 @@ module Braintree
|
|
20
20
|
hash.each do |key, value|
|
21
21
|
if key == :global_id
|
22
22
|
instance_variable_set "@graphql_id", value
|
23
|
+
elsif key == :android_pay_cards
|
24
|
+
instance_variable_set "@google_pay_cards", value
|
25
|
+
elsif key == :android_pay_card
|
26
|
+
instance_variable_set "@google_pay_card", value
|
27
|
+
elsif key == :android_pay_details
|
28
|
+
instance_variable_set "@google_pay_details", value
|
23
29
|
end
|
24
30
|
|
25
31
|
instance_variable_set "@#{key}", value
|
data/lib/braintree/bin_data.rb
CHANGED
@@ -17,10 +17,17 @@ module Braintree
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def inspect
|
20
|
-
|
20
|
+
formatted_attributes = self.class._attributes.map do |attr|
|
21
21
|
"#{attr}: #{send(attr).inspect}"
|
22
22
|
end
|
23
|
-
"
|
23
|
+
"#<#{self.class} #{formatted_attributes.join(", ")}>"
|
24
|
+
end
|
25
|
+
|
26
|
+
def self._attributes # :nodoc:
|
27
|
+
[
|
28
|
+
:commercial, :country_of_issuance, :debit, :durbin_regulated, :healthcare,
|
29
|
+
:issuing_bank, :payroll, :prepaid, :product_id
|
30
|
+
]
|
24
31
|
end
|
25
32
|
end
|
26
33
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Braintree
|
2
2
|
class Configuration
|
3
|
-
API_VERSION = "
|
3
|
+
API_VERSION = "6" # :nodoc:
|
4
4
|
DEFAULT_ENDPOINT = "api" # :nodoc:
|
5
5
|
GRAPHQL_API_VERSION = "2018-09-10" # :nodoc:
|
6
6
|
|
@@ -40,12 +40,12 @@ module Braintree
|
|
40
40
|
]
|
41
41
|
|
42
42
|
class << self
|
43
|
-
attr_writer
|
44
|
-
attr_reader
|
43
|
+
attr_writer(*WRITABLE_ATTRIBUTES)
|
44
|
+
attr_reader(*NON_REQUIRED_READABLE_ATTRIBUTES)
|
45
45
|
end
|
46
|
-
attr_reader
|
47
|
-
attr_reader
|
48
|
-
attr_writer
|
46
|
+
attr_reader(*READABLE_ATTRIBUTES)
|
47
|
+
attr_reader(*NON_REQUIRED_READABLE_ATTRIBUTES)
|
48
|
+
attr_writer(*WRITABLE_ATTRIBUTES)
|
49
49
|
|
50
50
|
def self.expectant_reader(*attributes) # :nodoc:
|
51
51
|
attributes.each do |attribute|
|
@@ -56,7 +56,7 @@ module Braintree
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
59
|
-
expectant_reader
|
59
|
+
expectant_reader(*READABLE_ATTRIBUTES)
|
60
60
|
|
61
61
|
# Sets the Braintree environment to use. Valid values are <tt>:sandbox</tt> and <tt>:production</tt>
|
62
62
|
def self.environment=(env)
|
@@ -86,7 +86,7 @@ module Braintree
|
|
86
86
|
:proxy_port => proxy_port,
|
87
87
|
:proxy_user => proxy_user,
|
88
88
|
:proxy_pass => proxy_pass,
|
89
|
-
:ssl_version => ssl_version
|
89
|
+
:ssl_version => ssl_version,
|
90
90
|
)
|
91
91
|
end
|
92
92
|
|
@@ -205,7 +205,7 @@ module Braintree
|
|
205
205
|
def port # :nodoc:
|
206
206
|
case @environment
|
207
207
|
when :development, :integration
|
208
|
-
ENV[
|
208
|
+
ENV["GATEWAY_PORT"] || 3000
|
209
209
|
when :production, :qa, :sandbox
|
210
210
|
443
|
211
211
|
end
|
@@ -214,7 +214,7 @@ module Braintree
|
|
214
214
|
def graphql_port # :nodoc:
|
215
215
|
case @environment
|
216
216
|
when :development, :integration
|
217
|
-
ENV[
|
217
|
+
ENV["GRAPHQL_PORT"] || 8080
|
218
218
|
when :production, :qa, :sandbox
|
219
219
|
443
|
220
220
|
end
|
@@ -235,7 +235,7 @@ module Braintree
|
|
235
235
|
def server # :nodoc:
|
236
236
|
case @environment
|
237
237
|
when :development, :integration
|
238
|
-
ENV[
|
238
|
+
ENV["GATEWAY_HOST"] || "localhost"
|
239
239
|
when :production
|
240
240
|
"#{endpoint}.braintreegateway.com"
|
241
241
|
when :qa
|
@@ -248,7 +248,7 @@ module Braintree
|
|
248
248
|
def graphql_server # :nodoc:
|
249
249
|
case @environment
|
250
250
|
when :development, :integration
|
251
|
-
ENV[
|
251
|
+
ENV["GRAPHQL_HOST"] || "graphql.bt.local"
|
252
252
|
when :production
|
253
253
|
"payments.braintree-api.com"
|
254
254
|
when :qa
|
@@ -70,18 +70,6 @@ module Braintree
|
|
70
70
|
Configuration.gateway.credit_card.create!(*args)
|
71
71
|
end
|
72
72
|
|
73
|
-
# Deprecated. Use Braintree::TransparentRedirect.url
|
74
|
-
def self.create_credit_card_url
|
75
|
-
warn "[DEPRECATED] CreditCard.create_credit_card_url is deprecated. Please use TransparentRedirect.url"
|
76
|
-
Configuration.gateway.credit_card.create_credit_card_url
|
77
|
-
end
|
78
|
-
|
79
|
-
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
80
|
-
def self.create_from_transparent_redirect(query_string)
|
81
|
-
warn "[DEPRECATED] CreditCard.create_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
|
82
|
-
Configuration.gateway.credit_card.create_from_transparent_redirect(query_string)
|
83
|
-
end
|
84
|
-
|
85
73
|
def self.credit(token, transaction_attributes)
|
86
74
|
Transaction.credit(transaction_attributes.merge(:payment_method_token => token))
|
87
75
|
end
|
@@ -110,11 +98,6 @@ module Braintree
|
|
110
98
|
Configuration.gateway.credit_card.from_nonce(*args)
|
111
99
|
end
|
112
100
|
|
113
|
-
# Deprecated. Use Braintree::PaymentMethod.grant
|
114
|
-
def self.grant(*args)
|
115
|
-
Configuration.gateway.credit_card.grant(*args)
|
116
|
-
end
|
117
|
-
|
118
101
|
def self.sale(token, transaction_attributes)
|
119
102
|
Configuration.gateway.transaction.sale(transaction_attributes.merge(:payment_method_token => token))
|
120
103
|
end
|
@@ -131,18 +114,6 @@ module Braintree
|
|
131
114
|
Configuration.gateway.credit_card.update!(*args)
|
132
115
|
end
|
133
116
|
|
134
|
-
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
135
|
-
def self.update_from_transparent_redirect(query_string)
|
136
|
-
warn "[DEPRECATED] CreditCard.update_via_transparent_redirect_request is deprecated. Please use TransparentRedirect.confirm"
|
137
|
-
Configuration.gateway.credit_card.update_from_transparent_redirect(query_string)
|
138
|
-
end
|
139
|
-
|
140
|
-
# Deprecated. Use Braintree::TransparentRedirect.url
|
141
|
-
def self.update_credit_card_url
|
142
|
-
warn "[DEPRECATED] CreditCard.update_credit_card_url is deprecated. Please use TransparentRedirect.url"
|
143
|
-
Configuration.gateway.credit_card.update_credit_card_url
|
144
|
-
end
|
145
|
-
|
146
117
|
def initialize(gateway, attributes) # :nodoc:
|
147
118
|
@gateway = gateway
|
148
119
|
set_instance_variables_from_hash(attributes)
|
@@ -152,28 +123,10 @@ module Braintree
|
|
152
123
|
end
|
153
124
|
|
154
125
|
def _most_recent_verification(attributes)
|
155
|
-
verification = (attributes[:verifications] || []).sort_by{ |verification| verification[:created_at] }.reverse.first
|
126
|
+
verification = (attributes[:verifications] || []).sort_by { |verification| verification[:created_at] }.reverse.first
|
156
127
|
CreditCardVerification._new(verification) if verification
|
157
128
|
end
|
158
129
|
|
159
|
-
# Deprecated. Use Braintree::CreditCard.credit
|
160
|
-
def credit(transaction_attributes)
|
161
|
-
warn "[DEPRECATED] credit as an instance method is deprecated. Please use CreditCard.credit"
|
162
|
-
@gateway.transaction.credit(transaction_attributes.merge(:payment_method_token => token))
|
163
|
-
end
|
164
|
-
|
165
|
-
# Deprecated. Use Braintree::CreditCard.credit!
|
166
|
-
def credit!(transaction_attributes)
|
167
|
-
warn "[DEPRECATED] credit! as an instance method is deprecated. Please use CreditCard.credit!"
|
168
|
-
return_object_or_raise(:transaction) { credit(transaction_attributes) }
|
169
|
-
end
|
170
|
-
|
171
|
-
# Deprecated. Use Braintree::CreditCard.delete
|
172
|
-
def delete
|
173
|
-
warn "[DEPRECATED] delete as an instance method is deprecated. Please use CreditCard.delete"
|
174
|
-
@gateway.credit_card.delete(token)
|
175
|
-
end
|
176
|
-
|
177
130
|
# Returns true if this credit card is the customer's default payment method.
|
178
131
|
def default?
|
179
132
|
@default
|
@@ -202,34 +155,6 @@ module Braintree
|
|
202
155
|
"#{bin}******#{last_4}"
|
203
156
|
end
|
204
157
|
|
205
|
-
# Deprecated. Use Braintree::CreditCard.sale
|
206
|
-
def sale(transaction_attributes)
|
207
|
-
warn "[DEPRECATED] sale as an instance method is deprecated. Please use CreditCard.sale"
|
208
|
-
@gateway.transaction.sale(transaction_attributes.merge(:payment_method_token => token))
|
209
|
-
end
|
210
|
-
|
211
|
-
# Deprecated. Use Braintree::CreditCard.sale!
|
212
|
-
def sale!(transaction_attributes)
|
213
|
-
warn "[DEPRECATED] sale! as an instance method is deprecated. Please use CreditCard.sale!"
|
214
|
-
return_object_or_raise(:transaction) { sale(transaction_attributes) }
|
215
|
-
end
|
216
|
-
|
217
|
-
# Deprecated. Use Braintree::CreditCard.update
|
218
|
-
def update(attributes)
|
219
|
-
warn "[DEPRECATED] update as an instance method is deprecated. Please use CreditCard.update"
|
220
|
-
result = @gateway.credit_card.update(token, attributes)
|
221
|
-
if result.success?
|
222
|
-
copy_instance_variables_from_object result.credit_card
|
223
|
-
end
|
224
|
-
result
|
225
|
-
end
|
226
|
-
|
227
|
-
# Deprecated. Use Braintree::CreditCard.update!
|
228
|
-
def update!(attributes)
|
229
|
-
warn "[DEPRECATED] update! as an instance method is deprecated. Please use CreditCard.update!"
|
230
|
-
return_object_or_raise(:credit_card) { update(attributes) }
|
231
|
-
end
|
232
|
-
|
233
158
|
def nonce
|
234
159
|
@nonce ||= PaymentMethodNonce.create(token)
|
235
160
|
end
|
@@ -256,7 +181,7 @@ module Braintree
|
|
256
181
|
end
|
257
182
|
|
258
183
|
def self._new(*args) # :nodoc:
|
259
|
-
self.new
|
184
|
+
self.new(*args)
|
260
185
|
end
|
261
186
|
end
|
262
187
|
end
|