braintree 2.103.0 → 3.2.0
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 +5 -17
- data/lib/braintree/address.rb +0 -22
- data/lib/braintree/base_module.rb +6 -0
- data/lib/braintree/bin_data.rb +9 -2
- data/lib/braintree/configuration.rb +1 -1
- data/lib/braintree/credit_card.rb +0 -75
- data/lib/braintree/credit_card_gateway.rb +4 -33
- data/lib/braintree/credit_card_verification.rb +13 -0
- data/lib/braintree/customer.rb +3 -72
- 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/transaction.rb +1 -0
- data/lib/braintree/dispute_gateway.rb +2 -7
- data/lib/braintree/error_codes.rb +144 -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 -1
- data/lib/braintree/local_payment_completed.rb +1 -1
- data/lib/braintree/merchant_account_gateway.rb +2 -0
- data/lib/braintree/payment_instrument_type.rb +1 -4
- data/lib/braintree/payment_method_gateway.rb +5 -9
- data/lib/braintree/payment_method_parser.rb +1 -7
- data/lib/braintree/resource_collection.rb +8 -3
- data/lib/braintree/subscription.rb +5 -5
- data/lib/braintree/successful_result.rb +0 -1
- data/lib/braintree/test/credit_card.rb +1 -0
- data/lib/braintree/test/nonce.rb +4 -20
- data/lib/braintree/transaction.rb +12 -74
- 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 +3 -0
- data/lib/braintree/transaction/subscription_details.rb +2 -0
- data/lib/braintree/transaction_gateway.rb +14 -20
- 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 +189 -362
- data/spec/integration/braintree/dispute_search_spec.rb +3 -3
- data/spec/integration/braintree/dispute_spec.rb +1 -2
- data/spec/integration/braintree/merchant_spec.rb +2 -2
- data/spec/integration/braintree/payment_method_spec.rb +254 -120
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +8 -4
- data/spec/integration/braintree/paypal_account_spec.rb +1 -1
- 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 +300 -534
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +12 -6
- data/spec/integration/spec_helper.rb +1 -4
- data/spec/spec_helper.rb +2 -11
- data/spec/unit/braintree/address_spec.rb +0 -8
- data/spec/unit/braintree/credit_card_spec.rb +3 -22
- data/spec/unit/braintree/customer_spec.rb +2 -13
- data/spec/unit/braintree/dispute_spec.rb +3 -12
- data/spec/unit/braintree/http_spec.rb +3 -3
- data/spec/unit/braintree/local_payment_completed_spec.rb +14 -0
- data/spec/unit/braintree/resource_collection_spec.rb +29 -0
- data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +59 -0
- 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 +30 -30
- data/lib/braintree/amex_express_checkout_card.rb +0 -38
- 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 -81
- 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 -47
- 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: 78d503215e210019aebf40c5b4f0d42f8e98721a728016930efedc008c138ccc
|
|
4
|
+
data.tar.gz: 688dca23d5029e44cdb81915b2935bdf93d1b3b68f0e44703b46856d4a1abf6a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8a3a1935223a681e1b7935ef2e81bbe68448ebac245e3fe460892c423098c0db6c9cc9d05d25e11539fe392fdc34cef60e8a41e18a1ed1e95191729cf5aa624c
|
|
7
|
+
data.tar.gz: bb1137c11f4ab8e12fba995e6fb547222ceb99f13231b393a8f631b487f11d74661c6d461383614eccdbce9acbbd8d91890bf8bd3c759b8579e0ecbbcccc24ce
|
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,17 @@ 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"
|
|
144
|
+
require "braintree/transaction/installment"
|
|
145
|
+
require "braintree/transaction/installment/adjustment"
|
|
154
146
|
require "braintree/unknown_payment_method"
|
|
155
147
|
require "braintree/disbursement"
|
|
156
148
|
require "braintree/dispute_search"
|
|
157
|
-
require "braintree/transparent_redirect"
|
|
158
|
-
require "braintree/transparent_redirect_gateway"
|
|
159
149
|
require "braintree/validation_error"
|
|
160
150
|
require "braintree/validation_error_collection"
|
|
161
151
|
require "braintree/venmo_account"
|
|
162
152
|
require "braintree/version"
|
|
163
153
|
require "braintree/visa_checkout_card"
|
|
164
|
-
require "braintree/masterpass_card"
|
|
165
154
|
require "braintree/samsung_pay_card"
|
|
166
155
|
require "braintree/webhook_notification"
|
|
167
156
|
require "braintree/webhook_notification_gateway"
|
|
@@ -170,5 +159,4 @@ require "braintree/webhook_testing_gateway"
|
|
|
170
159
|
require "braintree/xml"
|
|
171
160
|
require "braintree/xml/generator"
|
|
172
161
|
require "braintree/xml/libxml"
|
|
173
|
-
require "braintree/xml/rexml"
|
|
174
162
|
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
|
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
|
|
@@ -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
|
|
@@ -108,11 +79,11 @@ module Braintree
|
|
|
108
79
|
|
|
109
80
|
def self._signature(type) # :nodoc:
|
|
110
81
|
billing_address_params = AddressGateway._shared_signature
|
|
111
|
-
options = [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type]
|
|
82
|
+
options = [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type,:verification_currency_iso_code]
|
|
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,10 +4,7 @@ module Braintree
|
|
|
4
4
|
include Braintree::Util::IdEquality
|
|
5
5
|
|
|
6
6
|
attr_reader :addresses
|
|
7
|
-
attr_reader :amex_express_checkout_cards
|
|
8
|
-
attr_reader :android_pay_cards
|
|
9
7
|
attr_reader :apple_pay_cards
|
|
10
|
-
attr_reader :coinbase_accounts
|
|
11
8
|
attr_reader :company
|
|
12
9
|
attr_reader :created_at
|
|
13
10
|
attr_reader :credit_cards
|
|
@@ -15,10 +12,10 @@ module Braintree
|
|
|
15
12
|
attr_reader :email
|
|
16
13
|
attr_reader :fax
|
|
17
14
|
attr_reader :first_name
|
|
15
|
+
attr_reader :google_pay_cards
|
|
18
16
|
attr_reader :graphql_id
|
|
19
17
|
attr_reader :id
|
|
20
18
|
attr_reader :last_name
|
|
21
|
-
attr_reader :masterpass_cards
|
|
22
19
|
attr_reader :paypal_accounts
|
|
23
20
|
attr_reader :phone
|
|
24
21
|
attr_reader :samsung_pay_cards
|
|
@@ -40,18 +37,6 @@ module Braintree
|
|
|
40
37
|
Configuration.gateway.customer.create!(*args)
|
|
41
38
|
end
|
|
42
39
|
|
|
43
|
-
# Deprecated. Use Braintree::TransparentRedirect.url
|
|
44
|
-
def self.create_customer_url
|
|
45
|
-
warn "[DEPRECATED] Customer.create_customer_url is deprecated. Please use TransparentRedirect.url"
|
|
46
|
-
Configuration.gateway.customer.create_customer_url
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
|
50
|
-
def self.create_from_transparent_redirect(*args)
|
|
51
|
-
warn "[DEPRECATED] Customer.create_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
|
|
52
|
-
Configuration.gateway.customer.create_from_transparent_redirect(*args)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
40
|
def self.credit(customer_id, transaction_attributes)
|
|
56
41
|
Transaction.credit(transaction_attributes.merge(:customer_id => customer_id))
|
|
57
42
|
end
|
|
@@ -93,32 +78,16 @@ module Braintree
|
|
|
93
78
|
Configuration.gateway.customer.update!(*args)
|
|
94
79
|
end
|
|
95
80
|
|
|
96
|
-
# Deprecated. Use Braintree::TransparentRedirect.url
|
|
97
|
-
def self.update_customer_url
|
|
98
|
-
warn "[DEPRECATED] Customer.update_customer_url is deprecated. Please use TransparentRedirect.url"
|
|
99
|
-
Configuration.gateway.customer.update_customer_url
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
|
103
|
-
def self.update_from_transparent_redirect(*args)
|
|
104
|
-
warn "[DEPRECATED] Customer.update_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
|
|
105
|
-
Configuration.gateway.customer.update_from_transparent_redirect(*args)
|
|
106
|
-
end
|
|
107
|
-
|
|
108
81
|
def initialize(gateway, attributes) # :nodoc:
|
|
109
82
|
@gateway = gateway
|
|
110
83
|
set_instance_variables_from_hash(attributes)
|
|
111
84
|
@credit_cards = (@credit_cards || []).map { |pm| CreditCard._new gateway, pm }
|
|
112
85
|
@paypal_accounts = (@paypal_accounts || []).map { |pm| PayPalAccount._new gateway, pm }
|
|
113
|
-
@coinbase_accounts = (@coinbase_accounts || []).map { |pm| CoinbaseAccount._new gateway, pm }
|
|
114
86
|
@apple_pay_cards = (@apple_pay_cards || []).map { |pm| ApplePayCard._new gateway, pm }
|
|
115
|
-
@
|
|
116
|
-
@android_pay_cards = (@android_pay_cards || []).map { |pm| AndroidPayCard._new gateway, pm }
|
|
117
|
-
@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 }
|
|
118
88
|
@venmo_accounts = (@venmo_accounts || []).map { |pm| VenmoAccount._new gateway, pm }
|
|
119
89
|
@us_bank_accounts = (@us_bank_accounts || []).map { |pm| UsBankAccount._new gateway, pm }
|
|
120
90
|
@visa_checkout_cards = (@visa_checkout_cards|| []).map { |pm| VisaCheckoutCard._new gateway, pm }
|
|
121
|
-
@masterpass_cards = (@masterpass_cards|| []).map { |pm| MasterpassCard._new gateway, pm }
|
|
122
91
|
@samsung_pay_cards = (@samsung_pay_cards|| []).map { |pm| SamsungPayCard._new gateway, pm }
|
|
123
92
|
@addresses = (@addresses || []).map { |addr| Address._new gateway, addr }
|
|
124
93
|
@custom_fields = attributes[:custom_fields].is_a?(Hash) ? attributes[:custom_fields] : {}
|
|
@@ -132,14 +101,6 @@ module Braintree
|
|
|
132
101
|
return_object_or_raise(:transaction) { credit(transaction_attributes) }
|
|
133
102
|
end
|
|
134
103
|
|
|
135
|
-
# Deprecated. Use Braintree::Customer.default_payment_method
|
|
136
|
-
#
|
|
137
|
-
# Returns the customer's default credit card.
|
|
138
|
-
def default_credit_card
|
|
139
|
-
warn "[DEPRECATED] Customer#default_credit_card is deprecated. Please use Customer#default_payment_method"
|
|
140
|
-
@credit_cards.find { |credit_card| credit_card.default? }
|
|
141
|
-
end
|
|
142
|
-
|
|
143
104
|
# Returns the customer's default payment method.
|
|
144
105
|
def default_payment_method
|
|
145
106
|
payment_methods.find { |payment_instrument| payment_instrument.default? }
|
|
@@ -154,9 +115,7 @@ module Braintree
|
|
|
154
115
|
@credit_cards +
|
|
155
116
|
@paypal_accounts +
|
|
156
117
|
@apple_pay_cards +
|
|
157
|
-
@
|
|
158
|
-
@android_pay_cards +
|
|
159
|
-
@amex_express_checkout_cards +
|
|
118
|
+
@google_pay_cards +
|
|
160
119
|
@venmo_accounts +
|
|
161
120
|
@us_bank_accounts +
|
|
162
121
|
@visa_checkout_cards +
|
|
@@ -173,39 +132,11 @@ module Braintree
|
|
|
173
132
|
"#<#{self.class} #{nice_attributes.join(', ')}>"
|
|
174
133
|
end
|
|
175
134
|
|
|
176
|
-
# Deprecated. Use Braintree::Customer.sale
|
|
177
|
-
def sale(transaction_attributes)
|
|
178
|
-
warn "[DEPRECATED] sale as an instance method is deprecated. Please use Customer.sale"
|
|
179
|
-
@gateway.transaction.sale(transaction_attributes.merge(:customer_id => id))
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
# Deprecated. Use Braintree::Customer.sale!
|
|
183
|
-
def sale!(transaction_attributes)
|
|
184
|
-
warn "[DEPRECATED] sale! as an instance method is deprecated. Please use Customer.sale!"
|
|
185
|
-
return_object_or_raise(:transaction) { sale(transaction_attributes) }
|
|
186
|
-
end
|
|
187
|
-
|
|
188
135
|
# Returns a ResourceCollection of transactions for the customer.
|
|
189
136
|
def transactions(options = {})
|
|
190
137
|
@gateway.customer.transactions(id, options)
|
|
191
138
|
end
|
|
192
139
|
|
|
193
|
-
# Deprecated. Use Braintree::Customer.update
|
|
194
|
-
def update(attributes)
|
|
195
|
-
warn "[DEPRECATED] update as an instance method is deprecated. Please use Customer.update"
|
|
196
|
-
result = @gateway.customer.update(id, attributes)
|
|
197
|
-
if result.success?
|
|
198
|
-
copy_instance_variables_from_object result.customer
|
|
199
|
-
end
|
|
200
|
-
result
|
|
201
|
-
end
|
|
202
|
-
|
|
203
|
-
# Deprecated. Use Braintree::Customer.update!
|
|
204
|
-
def update!(attributes)
|
|
205
|
-
warn "[DEPRECATED] update! as an instance method is deprecated. Please use Customer.update!"
|
|
206
|
-
return_object_or_raise(:customer) { update(attributes) }
|
|
207
|
-
end
|
|
208
|
-
|
|
209
140
|
class << self
|
|
210
141
|
protected :new
|
|
211
142
|
end
|