braintree 2.83.0 → 2.84.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/address.rb +12 -12
- data/lib/braintree/address/country_names.rb +4 -1
- data/lib/braintree/address_gateway.rb +10 -0
- data/lib/braintree/client_token.rb +2 -2
- data/lib/braintree/client_token_gateway.rb +2 -0
- data/lib/braintree/credit_card.rb +20 -20
- data/lib/braintree/credit_card_gateway.rb +18 -0
- data/lib/braintree/credit_card_verification.rb +2 -2
- data/lib/braintree/customer.rb +18 -18
- data/lib/braintree/customer_gateway.rb +14 -2
- data/lib/braintree/dispute.rb +12 -12
- data/lib/braintree/dispute/history_event.rb +2 -0
- data/lib/braintree/dispute_search.rb +3 -0
- data/lib/braintree/document_upload.rb +6 -2
- data/lib/braintree/document_upload_gateway.rb +6 -0
- data/lib/braintree/ideal_payment.rb +3 -3
- data/lib/braintree/ideal_payment_gateway.rb +0 -1
- data/lib/braintree/merchant_account.rb +14 -6
- data/lib/braintree/merchant_account_gateway.rb +10 -0
- data/lib/braintree/payment_method.rb +20 -12
- data/lib/braintree/payment_method_gateway.rb +10 -0
- data/lib/braintree/payment_method_nonce.rb +8 -4
- data/lib/braintree/payment_method_nonce_gateway.rb +6 -0
- data/lib/braintree/settlement_batch_summary_gateway.rb +2 -0
- data/lib/braintree/subscription.rb +18 -14
- data/lib/braintree/subscription_gateway.rb +18 -0
- data/lib/braintree/transaction.rb +54 -54
- data/lib/braintree/transaction_gateway.rb +44 -1
- data/lib/braintree/transparent_redirect.rb +12 -12
- data/lib/braintree/us_bank_account.rb +5 -5
- data/lib/braintree/us_bank_account_gateway.rb +0 -1
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/webhook_notification.rb +4 -4
- data/lib/braintree/webhook_testing.rb +2 -2
- data/spec/httpsd.pid +1 -0
- data/spec/integration/braintree/client_api/spec_helper.rb +0 -15
- data/spec/integration/braintree/customer_spec.rb +73 -0
- data/spec/integration/braintree/dispute_search_spec.rb +69 -0
- data/spec/integration/braintree/document_upload_spec.rb +13 -0
- data/spec/integration/braintree/merchant_account_spec.rb +22 -0
- data/spec/integration/braintree/payment_method_nonce_spec.rb +29 -0
- data/spec/integration/braintree/payment_method_spec.rb +63 -93
- data/spec/integration/braintree/subscription_spec.rb +13 -0
- data/spec/integration/braintree/transaction_search_spec.rb +0 -41
- data/spec/integration/braintree/transaction_spec.rb +12 -1
- data/spec/unit/braintree/dispute_search_spec.rb +3 -0
- data/spec/unit/braintree/transaction_spec.rb +0 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 363bcd4d73f995c9a4d466742eeec1496685280b
|
4
|
+
data.tar.gz: a1cd82c6bb218c247760888361869e070290a74f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07ef9f0eafcf69cd852a6a296d3a3662915cd13460574b11af1dc111cf6c50febb6036563f27d625397a268e317f08156714064ce230797b4008a839bb8a2249
|
7
|
+
data.tar.gz: c85e68010fb8f18916c7ed9d71dec1e5ed9b97e494db6fc3e47b63561bd5fa1a42d4e4ececf6d8849ad4f0d1e37192ad5c0df006e67f10ae5a114d331821f568
|
data/lib/braintree/address.rb
CHANGED
@@ -19,28 +19,28 @@ module Braintree
|
|
19
19
|
attr_reader :street_address
|
20
20
|
attr_reader :updated_at
|
21
21
|
|
22
|
-
def self.create(
|
23
|
-
Configuration.gateway.address.create(
|
22
|
+
def self.create(*args)
|
23
|
+
Configuration.gateway.address.create(*args)
|
24
24
|
end
|
25
25
|
|
26
|
-
def self.create!(
|
27
|
-
|
26
|
+
def self.create!(*args)
|
27
|
+
Configuration.gateway.address.create!(*args)
|
28
28
|
end
|
29
29
|
|
30
|
-
def self.delete(
|
31
|
-
Configuration.gateway.address.delete(
|
30
|
+
def self.delete(*args)
|
31
|
+
Configuration.gateway.address.delete(*args)
|
32
32
|
end
|
33
33
|
|
34
|
-
def self.find(
|
35
|
-
Configuration.gateway.address.find(
|
34
|
+
def self.find(*args)
|
35
|
+
Configuration.gateway.address.find(*args)
|
36
36
|
end
|
37
37
|
|
38
|
-
def self.update(
|
39
|
-
Configuration.gateway.address.update(
|
38
|
+
def self.update(*args)
|
39
|
+
Configuration.gateway.address.update(*args)
|
40
40
|
end
|
41
41
|
|
42
|
-
def self.update!(
|
43
|
-
|
42
|
+
def self.update!(*args)
|
43
|
+
Configuration.gateway.address.update!(*args)
|
44
44
|
end
|
45
45
|
|
46
46
|
def initialize(gateway, attributes) # :nodoc:
|
@@ -29,6 +29,7 @@ module Braintree
|
|
29
29
|
["Bermuda", "BM", "BMU", "060"],
|
30
30
|
["Bhutan", "BT", "BTN", "064"],
|
31
31
|
["Bolivia", "BO", "BOL", "068"],
|
32
|
+
["Bonaire, Sint Eustatius and Saba", "BQ", "BES", "535"],
|
32
33
|
["Bosnia and Herzegovina", "BA", "BIH", "070"],
|
33
34
|
["Botswana", "BW", "BWA", "072"],
|
34
35
|
["Bouvet Island", "BV", "BVT", "074"],
|
@@ -58,6 +59,7 @@ module Braintree
|
|
58
59
|
["Côte d'Ivoire", "CI", "CIV", "384"],
|
59
60
|
["Croatia", "HR", "HRV", "191"],
|
60
61
|
["Cuba", "CU", "CUB", "192"],
|
62
|
+
["Curaçao", "CW", "CUW", "531"],
|
61
63
|
["Cyprus", "CY", "CYP", "196"],
|
62
64
|
["Czech Republic", "CZ", "CZE", "203"],
|
63
65
|
["Denmark", "DK", "DNK", "208"],
|
@@ -156,7 +158,6 @@ module Braintree
|
|
156
158
|
["Nauru", "NR", "NRU", "520"],
|
157
159
|
["Nepal", "NP", "NPL", "524"],
|
158
160
|
["Netherlands", "NL", "NLD", "528"],
|
159
|
-
["Netherlands Antilles", "AN", "ANT", "530"],
|
160
161
|
["New Caledonia", "NC", "NCL", "540"],
|
161
162
|
["New Zealand", "NZ", "NZL", "554"],
|
162
163
|
["Nicaragua", "NI", "NIC", "558"],
|
@@ -200,12 +201,14 @@ module Braintree
|
|
200
201
|
["Seychelles", "SC", "SYC", "690"],
|
201
202
|
["Sierra Leone", "SL", "SLE", "694"],
|
202
203
|
["Singapore", "SG", "SGP", "702"],
|
204
|
+
["Sint Maarten (Dutch part)", "SX", "SXM", "534"],
|
203
205
|
["Slovakia", "SK", "SVK", "703"],
|
204
206
|
["Slovenia", "SI", "SVN", "705"],
|
205
207
|
["Solomon Islands", "SB", "SLB", "090"],
|
206
208
|
["Somalia", "SO", "SOM", "706"],
|
207
209
|
["South Africa", "ZA", "ZAF", "710"],
|
208
210
|
["South Georgia and South Sandwich Islands", "GS", "SGS", "239"],
|
211
|
+
["South Sudan", "SS", "SSD", "728"],
|
209
212
|
["Spain", "ES", "ESP", "724"],
|
210
213
|
["Sri Lanka", "LK", "LKA", "144"],
|
211
214
|
["Sudan", "SD", "SDN", "736"],
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Braintree
|
2
2
|
class AddressGateway # :nodoc
|
3
|
+
include BaseModule
|
4
|
+
|
3
5
|
def initialize(gateway)
|
4
6
|
@gateway = gateway
|
5
7
|
@config = gateway.config
|
@@ -24,6 +26,10 @@ module Braintree
|
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
29
|
+
def create!(*args)
|
30
|
+
return_object_or_raise(:address) { create(*args) }
|
31
|
+
end
|
32
|
+
|
27
33
|
def delete(customer_or_customer_id, address_id)
|
28
34
|
customer_id = _determine_customer_id(customer_or_customer_id)
|
29
35
|
@config.http.delete("#{@config.base_merchant_path}/customers/#{customer_id}/addresses/#{address_id}")
|
@@ -52,6 +58,10 @@ module Braintree
|
|
52
58
|
end
|
53
59
|
end
|
54
60
|
|
61
|
+
def update!(*args)
|
62
|
+
return_object_or_raise(:address) { update(*args) }
|
63
|
+
end
|
64
|
+
|
55
65
|
def _determine_customer_id(customer_or_customer_id) # :nodoc:
|
56
66
|
customer_id = customer_or_customer_id.is_a?(Customer) ? customer_or_customer_id.id : customer_or_customer_id
|
57
67
|
unless customer_id =~ /\A[\w_-]+\z/
|
@@ -61,12 +61,12 @@ module Braintree
|
|
61
61
|
attr_reader :updated_at
|
62
62
|
attr_reader :verification
|
63
63
|
|
64
|
-
def self.create(
|
65
|
-
Configuration.gateway.credit_card.create(
|
64
|
+
def self.create(*args)
|
65
|
+
Configuration.gateway.credit_card.create(*args)
|
66
66
|
end
|
67
67
|
|
68
|
-
def self.create!(
|
69
|
-
|
68
|
+
def self.create!(*args)
|
69
|
+
Configuration.gateway.credit_card.create!(*args)
|
70
70
|
end
|
71
71
|
|
72
72
|
# Deprecated. Use Braintree::TransparentRedirect.url
|
@@ -89,29 +89,29 @@ module Braintree
|
|
89
89
|
return_object_or_raise(:transaction) { credit(token, transaction_attributes) }
|
90
90
|
end
|
91
91
|
|
92
|
-
def self.delete(
|
93
|
-
Configuration.gateway.credit_card.delete(
|
92
|
+
def self.delete(*args)
|
93
|
+
Configuration.gateway.credit_card.delete(*args)
|
94
94
|
end
|
95
95
|
|
96
|
-
def self.expired(
|
97
|
-
Configuration.gateway.credit_card.expired(
|
96
|
+
def self.expired(*args)
|
97
|
+
Configuration.gateway.credit_card.expired(*args)
|
98
98
|
end
|
99
99
|
|
100
|
-
def self.expiring_between(
|
101
|
-
Configuration.gateway.credit_card.expiring_between(
|
100
|
+
def self.expiring_between(*args)
|
101
|
+
Configuration.gateway.credit_card.expiring_between(*args)
|
102
102
|
end
|
103
103
|
|
104
|
-
def self.find(
|
105
|
-
Configuration.gateway.credit_card.find(
|
104
|
+
def self.find(*args)
|
105
|
+
Configuration.gateway.credit_card.find(*args)
|
106
106
|
end
|
107
107
|
|
108
|
-
def self.from_nonce(
|
109
|
-
Configuration.gateway.credit_card.from_nonce(
|
108
|
+
def self.from_nonce(*args)
|
109
|
+
Configuration.gateway.credit_card.from_nonce(*args)
|
110
110
|
end
|
111
111
|
|
112
112
|
# Deprecated. Use Braintree::PaymentMethod.grant
|
113
|
-
def self.grant(
|
114
|
-
Configuration.gateway.credit_card.grant(
|
113
|
+
def self.grant(*args)
|
114
|
+
Configuration.gateway.credit_card.grant(*args)
|
115
115
|
end
|
116
116
|
|
117
117
|
def self.sale(token, transaction_attributes)
|
@@ -122,12 +122,12 @@ module Braintree
|
|
122
122
|
return_object_or_raise(:transaction) { sale(token, transaction_attributes) }
|
123
123
|
end
|
124
124
|
|
125
|
-
def self.update(
|
126
|
-
Configuration.gateway.credit_card.update(
|
125
|
+
def self.update(*args)
|
126
|
+
Configuration.gateway.credit_card.update(*args)
|
127
127
|
end
|
128
128
|
|
129
|
-
def self.update!(
|
130
|
-
|
129
|
+
def self.update!(*args)
|
130
|
+
Configuration.gateway.credit_card.update!(*args)
|
131
131
|
end
|
132
132
|
|
133
133
|
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Braintree
|
2
2
|
class CreditCardGateway # :nodoc:
|
3
|
+
include BaseModule
|
4
|
+
|
3
5
|
def initialize(gateway)
|
4
6
|
@gateway = gateway
|
5
7
|
@config = gateway.config
|
@@ -14,6 +16,10 @@ module Braintree
|
|
14
16
|
_do_create("/payment_methods", :credit_card => attributes)
|
15
17
|
end
|
16
18
|
|
19
|
+
def create!(*args)
|
20
|
+
return_object_or_raise(:credit_card) { create(*args) }
|
21
|
+
end
|
22
|
+
|
17
23
|
# Deprecated
|
18
24
|
def create_credit_card_url
|
19
25
|
"#{@config.base_merchant_url}/payment_methods/all/create_via_transparent_redirect_request"
|
@@ -25,6 +31,14 @@ module Braintree
|
|
25
31
|
_do_create("/payment_methods/all/confirm_transparent_redirect_request", :id => params[:id])
|
26
32
|
end
|
27
33
|
|
34
|
+
def credit(token, transaction_attributes)
|
35
|
+
@gateway.transaction.credit(transaction_attributes.merge(:payment_method_token => token))
|
36
|
+
end
|
37
|
+
|
38
|
+
def credit!(*args)
|
39
|
+
return_object_or_raise(:transaction) { credit(*args) }
|
40
|
+
end
|
41
|
+
|
28
42
|
def delete(token)
|
29
43
|
@config.http.delete("#{@config.base_merchant_path}/payment_methods/credit_card/#{token}")
|
30
44
|
end
|
@@ -67,6 +81,10 @@ module Braintree
|
|
67
81
|
_do_update(:put, "/payment_methods/credit_card/#{token}", :credit_card => attributes)
|
68
82
|
end
|
69
83
|
|
84
|
+
def update!(*args)
|
85
|
+
return_object_or_raise(:credit_card) { update(*args) }
|
86
|
+
end
|
87
|
+
|
70
88
|
# Deprecated
|
71
89
|
def update_from_transparent_redirect(query_string)
|
72
90
|
warn "[DEPRECATED] CreditCard.update_via_transparent_redirect_request is deprecated. Please use TransparentRedirect.confirm"
|
data/lib/braintree/customer.rb
CHANGED
@@ -30,12 +30,12 @@ module Braintree
|
|
30
30
|
Configuration.gateway.customer.all
|
31
31
|
end
|
32
32
|
|
33
|
-
def self.create(
|
34
|
-
Configuration.gateway.customer.create(
|
33
|
+
def self.create(*args)
|
34
|
+
Configuration.gateway.customer.create(*args)
|
35
35
|
end
|
36
36
|
|
37
|
-
def self.create!(
|
38
|
-
|
37
|
+
def self.create!(*args)
|
38
|
+
Configuration.gateway.customer.create!(*args)
|
39
39
|
end
|
40
40
|
|
41
41
|
# Deprecated. Use Braintree::TransparentRedirect.url
|
@@ -45,9 +45,9 @@ module Braintree
|
|
45
45
|
end
|
46
46
|
|
47
47
|
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
48
|
-
def self.create_from_transparent_redirect(
|
48
|
+
def self.create_from_transparent_redirect(*args)
|
49
49
|
warn "[DEPRECATED] Customer.create_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
|
50
|
-
Configuration.gateway.customer.create_from_transparent_redirect(
|
50
|
+
Configuration.gateway.customer.create_from_transparent_redirect(*args)
|
51
51
|
end
|
52
52
|
|
53
53
|
def self.credit(customer_id, transaction_attributes)
|
@@ -58,12 +58,12 @@ module Braintree
|
|
58
58
|
return_object_or_raise(:transaction){ credit(customer_id, transaction_attributes) }
|
59
59
|
end
|
60
60
|
|
61
|
-
def self.delete(
|
62
|
-
Configuration.gateway.customer.delete(
|
61
|
+
def self.delete(*args)
|
62
|
+
Configuration.gateway.customer.delete(*args)
|
63
63
|
end
|
64
64
|
|
65
|
-
def self.find(
|
66
|
-
Configuration.gateway.customer.find(
|
65
|
+
def self.find(*args)
|
66
|
+
Configuration.gateway.customer.find(*args)
|
67
67
|
end
|
68
68
|
|
69
69
|
def self.sale(customer_id, transaction_attributes)
|
@@ -79,16 +79,16 @@ module Braintree
|
|
79
79
|
end
|
80
80
|
|
81
81
|
# Returns a ResourceCollection of transactions for the customer with the given +customer_id+.
|
82
|
-
def self.transactions(
|
83
|
-
Configuration.gateway.customer.transactions(
|
82
|
+
def self.transactions(*args)
|
83
|
+
Configuration.gateway.customer.transactions(*args)
|
84
84
|
end
|
85
85
|
|
86
|
-
def self.update(
|
87
|
-
Configuration.gateway.customer.update(
|
86
|
+
def self.update(*args)
|
87
|
+
Configuration.gateway.customer.update(*args)
|
88
88
|
end
|
89
89
|
|
90
|
-
def self.update!(
|
91
|
-
|
90
|
+
def self.update!(*args)
|
91
|
+
Configuration.gateway.customer.update!(*args)
|
92
92
|
end
|
93
93
|
|
94
94
|
# Deprecated. Use Braintree::TransparentRedirect.url
|
@@ -98,9 +98,9 @@ module Braintree
|
|
98
98
|
end
|
99
99
|
|
100
100
|
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
101
|
-
def self.update_from_transparent_redirect(
|
101
|
+
def self.update_from_transparent_redirect(*args)
|
102
102
|
warn "[DEPRECATED] Customer.update_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
|
103
|
-
Configuration.gateway.customer.update_from_transparent_redirect(
|
103
|
+
Configuration.gateway.customer.update_from_transparent_redirect(*args)
|
104
104
|
end
|
105
105
|
|
106
106
|
def initialize(gateway, attributes) # :nodoc:
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Braintree
|
2
2
|
class CustomerGateway # :nodoc:
|
3
|
+
include BaseModule
|
4
|
+
|
3
5
|
def initialize(gateway)
|
4
6
|
@gateway = gateway
|
5
7
|
@config = gateway.config
|
@@ -16,6 +18,10 @@ module Braintree
|
|
16
18
|
_do_create "/customers", :customer => attributes
|
17
19
|
end
|
18
20
|
|
21
|
+
def create!(*args)
|
22
|
+
return_object_or_raise(:customer) { create(*args) }
|
23
|
+
end
|
24
|
+
|
19
25
|
# Deprecated
|
20
26
|
def create_customer_url
|
21
27
|
"#{@config.base_merchant_url}/customers/all/create_via_transparent_redirect_request"
|
@@ -32,10 +38,12 @@ module Braintree
|
|
32
38
|
SuccessfulResult.new
|
33
39
|
end
|
34
40
|
|
35
|
-
def find(customer_id)
|
41
|
+
def find(customer_id, options = {})
|
36
42
|
raise ArgumentError, "customer_id contains invalid characters" unless customer_id.to_s =~ /\A[\w-]+\z/
|
37
43
|
raise ArgumentError, "customer_id cannot be blank" if customer_id.nil?|| customer_id.to_s.strip == ""
|
38
|
-
|
44
|
+
|
45
|
+
query_params = options[:association_filter_id].nil? ? "" : "?association_filter_id=#{options[:association_filter_id]}"
|
46
|
+
response = @config.http.get("#{@config.base_merchant_path}/customers/#{customer_id}#{query_params}")
|
39
47
|
Customer._new(@gateway, response[:customer])
|
40
48
|
rescue NotFoundError
|
41
49
|
raise NotFoundError, "customer with id #{customer_id.inspect} not found"
|
@@ -59,6 +67,10 @@ module Braintree
|
|
59
67
|
_do_update(:put, "/customers/#{customer_id}", :customer => attributes)
|
60
68
|
end
|
61
69
|
|
70
|
+
def update!(*args)
|
71
|
+
return_object_or_raise(:customer) { update(*args) }
|
72
|
+
end
|
73
|
+
|
62
74
|
# Deprecated
|
63
75
|
def update_customer_url
|
64
76
|
warn "[DEPRECATED] Customer.update_customer_url is deprecated. Please use TransparentRedirect.url"
|
data/lib/braintree/dispute.rb
CHANGED
@@ -71,28 +71,28 @@ module Braintree
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
-
def self.accept(
|
75
|
-
Configuration.gateway.dispute.accept(
|
74
|
+
def self.accept(*args)
|
75
|
+
Configuration.gateway.dispute.accept(*args)
|
76
76
|
end
|
77
77
|
|
78
|
-
def self.add_file_evidence(
|
79
|
-
Configuration.gateway.dispute.add_file_evidence(
|
78
|
+
def self.add_file_evidence(*args)
|
79
|
+
Configuration.gateway.dispute.add_file_evidence(*args)
|
80
80
|
end
|
81
81
|
|
82
|
-
def self.add_text_evidence(
|
83
|
-
Configuration.gateway.dispute.add_text_evidence(
|
82
|
+
def self.add_text_evidence(*args)
|
83
|
+
Configuration.gateway.dispute.add_text_evidence(*args)
|
84
84
|
end
|
85
85
|
|
86
|
-
def self.finalize(
|
87
|
-
Configuration.gateway.dispute.finalize(
|
86
|
+
def self.finalize(*args)
|
87
|
+
Configuration.gateway.dispute.finalize(*args)
|
88
88
|
end
|
89
89
|
|
90
|
-
def self.find(
|
91
|
-
Configuration.gateway.dispute.find(
|
90
|
+
def self.find(*args)
|
91
|
+
Configuration.gateway.dispute.find(*args)
|
92
92
|
end
|
93
93
|
|
94
|
-
def self.remove_evidence(
|
95
|
-
Configuration.gateway.dispute.remove_evidence(
|
94
|
+
def self.remove_evidence(*args)
|
95
|
+
Configuration.gateway.dispute.remove_evidence(*args)
|
96
96
|
end
|
97
97
|
|
98
98
|
def self.search(&block)
|