braintree 2.104.1 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/braintree.gemspec +6 -3
- data/lib/braintree.rb +3 -17
- data/lib/braintree/address.rb +0 -22
- data/lib/braintree/base_module.rb +6 -0
- data/lib/braintree/configuration.rb +1 -1
- data/lib/braintree/credit_card.rb +0 -75
- data/lib/braintree/credit_card_gateway.rb +3 -32
- data/lib/braintree/credit_card_verification.rb +13 -0
- data/lib/braintree/customer.rb +3 -74
- data/lib/braintree/customer_gateway.rb +0 -23
- data/lib/braintree/dispute.rb +1 -7
- data/lib/braintree/dispute/{history_event.rb → status_history.rb} +3 -1
- data/lib/braintree/dispute_gateway.rb +2 -7
- data/lib/braintree/error_codes.rb +139 -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} +1 -2
- data/lib/braintree/merchant_account_gateway.rb +2 -0
- data/lib/braintree/payment_instrument_type.rb +1 -5
- data/lib/braintree/payment_method_gateway.rb +4 -9
- data/lib/braintree/payment_method_parser.rb +1 -8
- data/lib/braintree/subscription.rb +5 -5
- data/lib/braintree/successful_result.rb +0 -1
- data/lib/braintree/test/nonce.rb +4 -23
- data/lib/braintree/transaction.rb +2 -79
- 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/subscription_details.rb +2 -0
- data/lib/braintree/transaction_gateway.rb +12 -21
- data/lib/braintree/transaction_search.rb +0 -1
- data/lib/braintree/util.rb +17 -2
- data/lib/braintree/version.rb +2 -2
- data/lib/braintree/webhook_notification.rb +0 -10
- data/lib/braintree/webhook_testing_gateway.rb +0 -43
- data/lib/braintree/xml/libxml.rb +1 -0
- data/lib/braintree/xml/parser.rb +11 -34
- data/spec/integration/braintree/address_spec.rb +2 -89
- data/spec/integration/braintree/client_api/spec_helper.rb +0 -26
- data/spec/integration/braintree/credit_card_spec.rb +6 -471
- data/spec/integration/braintree/customer_spec.rb +22 -362
- data/spec/integration/braintree/dispute_search_spec.rb +2 -2
- data/spec/integration/braintree/dispute_spec.rb +1 -2
- data/spec/integration/braintree/payment_method_spec.rb +77 -120
- data/spec/integration/braintree/subscription_spec.rb +11 -16
- data/spec/integration/braintree/transaction_search_spec.rb +3 -3
- data/spec/integration/braintree/transaction_spec.rb +83 -511
- data/spec/integration/spec_helper.rb +1 -4
- data/spec/spec_helper.rb +1 -11
- data/spec/unit/braintree/address_spec.rb +0 -8
- data/spec/unit/braintree/credit_card_spec.rb +1 -20
- data/spec/unit/braintree/customer_spec.rb +0 -12
- data/spec/unit/braintree/dispute_spec.rb +1 -12
- data/spec/unit/braintree/http_spec.rb +3 -3
- data/spec/unit/braintree/transaction_spec.rb +1 -35
- data/spec/unit/braintree/util_spec.rb +37 -3
- data/spec/unit/braintree/webhook_notification_spec.rb +1 -1
- data/spec/unit/braintree/xml/parser_spec.rb +21 -16
- metadata +26 -30
- 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/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: 65d2cc6a7357e4cb814afc85ad926832dc746e874a08583b7905cd8b3aa8b004
|
4
|
+
data.tar.gz: 6c43487912cceb31dbeb1b0b9d73050f6b6179e2a99c062a632b04f8c7c9c866
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb38ff65933619995157992aba73994dac75a28f190e098c16cd3864215305710ffa8db7ada6ff3b88f5f78a6f65a1db0d9158672f1e277fa44dfe052e5be9da
|
7
|
+
data.tar.gz: 70c01aac5d220f2b2d82b2dc7180071d4f8db67e8bd3622e512ccbd849fc19eecde5db6c6232f244b3495c2b2bdb0e3aff92121141d801e4722c1c004b1201f8
|
data/LICENSE
CHANGED
data/braintree.gemspec
CHANGED
@@ -3,19 +3,22 @@ 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
@@ -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,9 +69,7 @@ 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"
|
79
74
|
require "braintree/transaction/local_payment_details"
|
80
75
|
require "braintree/merchant"
|
@@ -108,8 +103,6 @@ require "braintree/resource_collection"
|
|
108
103
|
require "braintree/revoked_payment_method_metadata"
|
109
104
|
require "braintree/paginated_collection"
|
110
105
|
require "braintree/paginated_result"
|
111
|
-
require "braintree/europe_bank_account"
|
112
|
-
require "braintree/europe_bank_account_gateway"
|
113
106
|
require "braintree/us_bank_account"
|
114
107
|
require "braintree/us_bank_account_verification"
|
115
108
|
require "braintree/us_bank_account_verification_gateway"
|
@@ -134,12 +127,10 @@ require "braintree/transaction_line_item"
|
|
134
127
|
require "braintree/test_transaction"
|
135
128
|
require "braintree/transaction/address_details"
|
136
129
|
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
130
|
require "braintree/transaction/credit_card_details"
|
141
131
|
require "braintree/transaction/customer_details"
|
142
132
|
require "braintree/transaction/disbursement_details"
|
133
|
+
require "braintree/transaction/google_pay_details"
|
143
134
|
require "braintree/transaction/paypal_details"
|
144
135
|
require "braintree/transaction/paypal_here_details"
|
145
136
|
require "braintree/transaction/subscription_details"
|
@@ -149,19 +140,15 @@ require "braintree/transaction_search"
|
|
149
140
|
require "braintree/transaction/status_details"
|
150
141
|
require "braintree/transaction/venmo_account_details"
|
151
142
|
require "braintree/transaction/visa_checkout_card_details"
|
152
|
-
require "braintree/transaction/masterpass_card_details"
|
153
143
|
require "braintree/transaction/samsung_pay_card_details"
|
154
144
|
require "braintree/unknown_payment_method"
|
155
145
|
require "braintree/disbursement"
|
156
146
|
require "braintree/dispute_search"
|
157
|
-
require "braintree/transparent_redirect"
|
158
|
-
require "braintree/transparent_redirect_gateway"
|
159
147
|
require "braintree/validation_error"
|
160
148
|
require "braintree/validation_error_collection"
|
161
149
|
require "braintree/venmo_account"
|
162
150
|
require "braintree/version"
|
163
151
|
require "braintree/visa_checkout_card"
|
164
|
-
require "braintree/masterpass_card"
|
165
152
|
require "braintree/samsung_pay_card"
|
166
153
|
require "braintree/webhook_notification"
|
167
154
|
require "braintree/webhook_notification_gateway"
|
@@ -170,5 +157,4 @@ require "braintree/webhook_testing_gateway"
|
|
170
157
|
require "braintree/xml"
|
171
158
|
require "braintree/xml/generator"
|
172
159
|
require "braintree/xml/libxml"
|
173
|
-
require "braintree/xml/rexml"
|
174
160
|
require "braintree/xml/parser"
|
data/lib/braintree/address.rb
CHANGED
@@ -53,28 +53,6 @@ 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
|
@@ -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
|
@@ -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)
|
@@ -156,24 +127,6 @@ module Braintree
|
|
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
|
@@ -20,17 +20,6 @@ module Braintree
|
|
20
20
|
return_object_or_raise(:credit_card) { create(*args) }
|
21
21
|
end
|
22
22
|
|
23
|
-
# Deprecated
|
24
|
-
def create_credit_card_url
|
25
|
-
"#{@config.base_merchant_url}/payment_methods/all/create_via_transparent_redirect_request"
|
26
|
-
end
|
27
|
-
|
28
|
-
# Deprecated
|
29
|
-
def create_from_transparent_redirect(query_string)
|
30
|
-
params = @gateway.transparent_redirect.parse_and_validate_query_string query_string
|
31
|
-
_do_create("/payment_methods/all/confirm_transparent_redirect_request", :id => params[:id])
|
32
|
-
end
|
33
|
-
|
34
23
|
def credit(token, transaction_attributes)
|
35
24
|
@gateway.transaction.credit(transaction_attributes.merge(:payment_method_token => token))
|
36
25
|
end
|
@@ -71,11 +60,6 @@ module Braintree
|
|
71
60
|
raise NotFoundError, "nonce #{nonce.inspect} locked, consumed, or not found"
|
72
61
|
end
|
73
62
|
|
74
|
-
# Deprecated in favor of PaymentMethodGateway.grant
|
75
|
-
def grant(token, allow_vaulting)
|
76
|
-
@gateway.payment_method.grant(token, allow_vaulting)
|
77
|
-
end
|
78
|
-
|
79
63
|
def update(token, attributes)
|
80
64
|
Util.verify_keys(CreditCardGateway._update_signature, attributes)
|
81
65
|
_do_update(:put, "/payment_methods/credit_card/#{token}", :credit_card => attributes)
|
@@ -85,19 +69,6 @@ module Braintree
|
|
85
69
|
return_object_or_raise(:credit_card) { update(*args) }
|
86
70
|
end
|
87
71
|
|
88
|
-
# Deprecated
|
89
|
-
def update_from_transparent_redirect(query_string)
|
90
|
-
warn "[DEPRECATED] CreditCard.update_via_transparent_redirect_request is deprecated. Please use TransparentRedirect.confirm"
|
91
|
-
params = @gateway.transparent_redirect.parse_and_validate_query_string query_string
|
92
|
-
_do_update(:post, "/payment_methods/all/confirm_transparent_redirect_request", :id => params[:id])
|
93
|
-
end
|
94
|
-
|
95
|
-
# Deprecated
|
96
|
-
def update_credit_card_url
|
97
|
-
warn "[DEPRECATED] CreditCard.update_credit_card_url is deprecated. Please use TransparentRedirect.url"
|
98
|
-
"#{@config.base_merchant_url}/payment_methods/all/update_via_transparent_redirect_request"
|
99
|
-
end
|
100
|
-
|
101
72
|
def self._create_signature # :nodoc:
|
102
73
|
_signature(:create)
|
103
74
|
end
|
@@ -110,9 +81,9 @@ module Braintree
|
|
110
81
|
billing_address_params = AddressGateway._shared_signature
|
111
82
|
options = [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type]
|
112
83
|
signature = [
|
113
|
-
:billing_address_id, :cardholder_name, :cvv, :
|
114
|
-
:
|
115
|
-
:
|
84
|
+
:billing_address_id, :cardholder_name, :cvv, :expiration_date, :expiration_month,
|
85
|
+
:expiration_year, :number, :token, :venmo_sdk_payment_method_code, :device_data,
|
86
|
+
:payment_method_nonce,
|
116
87
|
{:external_vault => [:network_transaction_id]},
|
117
88
|
{:options => options},
|
118
89
|
{:billing_address => billing_address_params}
|
@@ -3,6 +3,19 @@ module Braintree
|
|
3
3
|
include BaseModule
|
4
4
|
include Braintree::Util::IdEquality
|
5
5
|
|
6
|
+
module GatewayRejectionReason
|
7
|
+
ApplicationIncomplete = "application_incomplete"
|
8
|
+
AVS = "avs"
|
9
|
+
AVSAndCVV = "avs_and_cvv"
|
10
|
+
CVV = "cvv"
|
11
|
+
Duplicate = "duplicate"
|
12
|
+
Fraud = "fraud"
|
13
|
+
RiskThreshold = "risk_threshold"
|
14
|
+
ThreeDSecure = "three_d_secure"
|
15
|
+
TokenIssuance = "token_issuance"
|
16
|
+
Unrecognized = "unrecognized"
|
17
|
+
end
|
18
|
+
|
6
19
|
module Status
|
7
20
|
Failed = 'failed'
|
8
21
|
GatewayRejected = 'gateway_rejected'
|
data/lib/braintree/customer.rb
CHANGED
@@ -4,11 +4,7 @@ module Braintree
|
|
4
4
|
include Braintree::Util::IdEquality
|
5
5
|
|
6
6
|
attr_reader :addresses
|
7
|
-
attr_reader :amex_express_checkout_cards # Deprecated
|
8
|
-
# NEXT_MAJOR_VERSION rename Android Pay to Google Pay
|
9
|
-
attr_reader :android_pay_cards
|
10
7
|
attr_reader :apple_pay_cards
|
11
|
-
attr_reader :coinbase_accounts
|
12
8
|
attr_reader :company
|
13
9
|
attr_reader :created_at
|
14
10
|
attr_reader :credit_cards
|
@@ -16,10 +12,10 @@ module Braintree
|
|
16
12
|
attr_reader :email
|
17
13
|
attr_reader :fax
|
18
14
|
attr_reader :first_name
|
15
|
+
attr_reader :google_pay_cards
|
19
16
|
attr_reader :graphql_id
|
20
17
|
attr_reader :id
|
21
18
|
attr_reader :last_name
|
22
|
-
attr_reader :masterpass_cards # Deprecated
|
23
19
|
attr_reader :paypal_accounts
|
24
20
|
attr_reader :phone
|
25
21
|
attr_reader :samsung_pay_cards
|
@@ -41,18 +37,6 @@ module Braintree
|
|
41
37
|
Configuration.gateway.customer.create!(*args)
|
42
38
|
end
|
43
39
|
|
44
|
-
# Deprecated. Use Braintree::TransparentRedirect.url
|
45
|
-
def self.create_customer_url
|
46
|
-
warn "[DEPRECATED] Customer.create_customer_url is deprecated. Please use TransparentRedirect.url"
|
47
|
-
Configuration.gateway.customer.create_customer_url
|
48
|
-
end
|
49
|
-
|
50
|
-
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
51
|
-
def self.create_from_transparent_redirect(*args)
|
52
|
-
warn "[DEPRECATED] Customer.create_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
|
53
|
-
Configuration.gateway.customer.create_from_transparent_redirect(*args)
|
54
|
-
end
|
55
|
-
|
56
40
|
def self.credit(customer_id, transaction_attributes)
|
57
41
|
Transaction.credit(transaction_attributes.merge(:customer_id => customer_id))
|
58
42
|
end
|
@@ -94,33 +78,16 @@ module Braintree
|
|
94
78
|
Configuration.gateway.customer.update!(*args)
|
95
79
|
end
|
96
80
|
|
97
|
-
# Deprecated. Use Braintree::TransparentRedirect.url
|
98
|
-
def self.update_customer_url
|
99
|
-
warn "[DEPRECATED] Customer.update_customer_url is deprecated. Please use TransparentRedirect.url"
|
100
|
-
Configuration.gateway.customer.update_customer_url
|
101
|
-
end
|
102
|
-
|
103
|
-
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
104
|
-
def self.update_from_transparent_redirect(*args)
|
105
|
-
warn "[DEPRECATED] Customer.update_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
|
106
|
-
Configuration.gateway.customer.update_from_transparent_redirect(*args)
|
107
|
-
end
|
108
|
-
|
109
81
|
def initialize(gateway, attributes) # :nodoc:
|
110
82
|
@gateway = gateway
|
111
83
|
set_instance_variables_from_hash(attributes)
|
112
84
|
@credit_cards = (@credit_cards || []).map { |pm| CreditCard._new gateway, pm }
|
113
85
|
@paypal_accounts = (@paypal_accounts || []).map { |pm| PayPalAccount._new gateway, pm }
|
114
|
-
@coinbase_accounts = (@coinbase_accounts || []).map { |pm| CoinbaseAccount._new gateway, pm }
|
115
86
|
@apple_pay_cards = (@apple_pay_cards || []).map { |pm| ApplePayCard._new gateway, pm }
|
116
|
-
@
|
117
|
-
# NEXT_MAJOR_VERSION rename Android Pay to Google Pay
|
118
|
-
@android_pay_cards = (@android_pay_cards || []).map { |pm| AndroidPayCard._new gateway, pm }
|
119
|
-
@amex_express_checkout_cards = (@amex_express_checkout_cards || []).map { |pm| AmexExpressCheckoutCard._new gateway, pm }
|
87
|
+
@google_pay_cards = (@google_pay_cards || []).map { |pm| GooglePayCard._new gateway, pm }
|
120
88
|
@venmo_accounts = (@venmo_accounts || []).map { |pm| VenmoAccount._new gateway, pm }
|
121
89
|
@us_bank_accounts = (@us_bank_accounts || []).map { |pm| UsBankAccount._new gateway, pm }
|
122
90
|
@visa_checkout_cards = (@visa_checkout_cards|| []).map { |pm| VisaCheckoutCard._new gateway, pm }
|
123
|
-
@masterpass_cards = (@masterpass_cards|| []).map { |pm| MasterpassCard._new gateway, pm }
|
124
91
|
@samsung_pay_cards = (@samsung_pay_cards|| []).map { |pm| SamsungPayCard._new gateway, pm }
|
125
92
|
@addresses = (@addresses || []).map { |addr| Address._new gateway, addr }
|
126
93
|
@custom_fields = attributes[:custom_fields].is_a?(Hash) ? attributes[:custom_fields] : {}
|
@@ -134,14 +101,6 @@ module Braintree
|
|
134
101
|
return_object_or_raise(:transaction) { credit(transaction_attributes) }
|
135
102
|
end
|
136
103
|
|
137
|
-
# Deprecated. Use Braintree::Customer.default_payment_method
|
138
|
-
#
|
139
|
-
# Returns the customer's default credit card.
|
140
|
-
def default_credit_card
|
141
|
-
warn "[DEPRECATED] Customer#default_credit_card is deprecated. Please use Customer#default_payment_method"
|
142
|
-
@credit_cards.find { |credit_card| credit_card.default? }
|
143
|
-
end
|
144
|
-
|
145
104
|
# Returns the customer's default payment method.
|
146
105
|
def default_payment_method
|
147
106
|
payment_methods.find { |payment_instrument| payment_instrument.default? }
|
@@ -156,9 +115,7 @@ module Braintree
|
|
156
115
|
@credit_cards +
|
157
116
|
@paypal_accounts +
|
158
117
|
@apple_pay_cards +
|
159
|
-
@
|
160
|
-
@android_pay_cards +
|
161
|
-
@amex_express_checkout_cards +
|
118
|
+
@google_pay_cards +
|
162
119
|
@venmo_accounts +
|
163
120
|
@us_bank_accounts +
|
164
121
|
@visa_checkout_cards +
|
@@ -175,39 +132,11 @@ module Braintree
|
|
175
132
|
"#<#{self.class} #{nice_attributes.join(', ')}>"
|
176
133
|
end
|
177
134
|
|
178
|
-
# Deprecated. Use Braintree::Customer.sale
|
179
|
-
def sale(transaction_attributes)
|
180
|
-
warn "[DEPRECATED] sale as an instance method is deprecated. Please use Customer.sale"
|
181
|
-
@gateway.transaction.sale(transaction_attributes.merge(:customer_id => id))
|
182
|
-
end
|
183
|
-
|
184
|
-
# Deprecated. Use Braintree::Customer.sale!
|
185
|
-
def sale!(transaction_attributes)
|
186
|
-
warn "[DEPRECATED] sale! as an instance method is deprecated. Please use Customer.sale!"
|
187
|
-
return_object_or_raise(:transaction) { sale(transaction_attributes) }
|
188
|
-
end
|
189
|
-
|
190
135
|
# Returns a ResourceCollection of transactions for the customer.
|
191
136
|
def transactions(options = {})
|
192
137
|
@gateway.customer.transactions(id, options)
|
193
138
|
end
|
194
139
|
|
195
|
-
# Deprecated. Use Braintree::Customer.update
|
196
|
-
def update(attributes)
|
197
|
-
warn "[DEPRECATED] update as an instance method is deprecated. Please use Customer.update"
|
198
|
-
result = @gateway.customer.update(id, attributes)
|
199
|
-
if result.success?
|
200
|
-
copy_instance_variables_from_object result.customer
|
201
|
-
end
|
202
|
-
result
|
203
|
-
end
|
204
|
-
|
205
|
-
# Deprecated. Use Braintree::Customer.update!
|
206
|
-
def update!(attributes)
|
207
|
-
warn "[DEPRECATED] update! as an instance method is deprecated. Please use Customer.update!"
|
208
|
-
return_object_or_raise(:customer) { update(attributes) }
|
209
|
-
end
|
210
|
-
|
211
140
|
class << self
|
212
141
|
protected :new
|
213
142
|
end
|