braintree 2.10.0 → 2.10.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/lib/braintree/address.rb +1 -1
- data/lib/braintree/configuration.rb +1 -1
- data/lib/braintree/credit_card.rb +24 -24
- data/lib/braintree/credit_card_verification.rb +1 -1
- data/lib/braintree/customer.rb +24 -24
- data/lib/braintree/error_codes.rb +5 -5
- data/lib/braintree/error_result.rb +1 -1
- data/lib/braintree/errors.rb +1 -1
- data/lib/braintree/exceptions.rb +11 -11
- data/lib/braintree/subscription.rb +6 -6
- data/lib/braintree/successful_result.rb +1 -1
- data/lib/braintree/test/credit_card_numbers.rb +1 -1
- data/lib/braintree/test/transaction_amounts.rb +1 -1
- data/lib/braintree/transaction.rb +19 -19
- data/lib/braintree/transparent_redirect.rb +10 -10
- data/lib/braintree/validation_error.rb +1 -1
- data/lib/braintree/validation_error_collection.rb +1 -1
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/xml/generator.rb +7 -1
- data/spec/integration/braintree/http_spec.rb +1 -15
- data/spec/integration/braintree/transaction_spec.rb +4 -4
- metadata +13 -11
data/README.rdoc
CHANGED
data/lib/braintree/address.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
# See http://www.
|
2
|
+
# See http://www.braintreepayments.com/docs/ruby
|
3
3
|
class CreditCard
|
4
4
|
include BaseModule # :nodoc:
|
5
5
|
|
@@ -29,83 +29,83 @@ module Braintree
|
|
29
29
|
attr_reader :billing_address, :bin, :card_type, :cardholder_name, :created_at, :customer_id, :expiration_month,
|
30
30
|
:expiration_year, :last_4, :subscriptions, :token, :updated_at
|
31
31
|
|
32
|
-
# See http://www.
|
32
|
+
# See http://www.braintreepayments.com/docs/ruby/credit_cards/create
|
33
33
|
def self.create(attributes)
|
34
34
|
Configuration.gateway.credit_card.create(attributes)
|
35
35
|
end
|
36
36
|
|
37
|
-
# See http://www.
|
37
|
+
# See http://www.braintreepayments.com/docs/ruby/credit_cards/create
|
38
38
|
def self.create!(attributes)
|
39
39
|
return_object_or_raise(:credit_card) { create(attributes) }
|
40
40
|
end
|
41
41
|
|
42
42
|
# Deprecated. Use Braintree::TransparentRedirect.url
|
43
|
-
# See http://www.
|
43
|
+
# See http://www.braintreepayments.com/docs/ruby/credit_cards/create_tr
|
44
44
|
def self.create_credit_card_url
|
45
45
|
warn "[DEPRECATED] CreditCard.create_credit_card_url is deprecated. Please use TransparentRedirect.url"
|
46
46
|
Configuration.gateway.credit_card.create_credit_card_url
|
47
47
|
end
|
48
48
|
|
49
49
|
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
50
|
-
# See http://www.
|
50
|
+
# See http://www.braintreepayments.com/docs/ruby/credit_cards/create_tr
|
51
51
|
def self.create_from_transparent_redirect(query_string)
|
52
52
|
warn "[DEPRECATED] CreditCard.create_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
|
53
53
|
Configuration.gateway.credit_card.create_from_transparent_redirect(query_string)
|
54
54
|
end
|
55
55
|
|
56
|
-
# See http://www.
|
56
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault
|
57
57
|
def self.credit(token, transaction_attributes)
|
58
58
|
Transaction.credit(transaction_attributes.merge(:payment_method_token => token))
|
59
59
|
end
|
60
60
|
|
61
|
-
# See http://www.
|
61
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault
|
62
62
|
def self.credit!(token, transaction_attributes)
|
63
63
|
return_object_or_raise(:transaction) { credit(token, transaction_attributes) }
|
64
64
|
end
|
65
65
|
|
66
|
-
# See http://www.
|
66
|
+
# See http://www.braintreepayments.com/docs/ruby/credit_cards/delete
|
67
67
|
def self.delete(token)
|
68
68
|
Configuration.gateway.credit_card.delete(token)
|
69
69
|
end
|
70
70
|
|
71
|
-
# See http://www.
|
71
|
+
# See http://www.braintreepayments.com/docs/ruby/credit_cards/search
|
72
72
|
def self.expired(options = {})
|
73
73
|
Configuration.gateway.credit_card.expired(options)
|
74
74
|
end
|
75
75
|
|
76
|
-
# See http://www.
|
76
|
+
# See http://www.braintreepayments.com/docs/ruby/credit_cards/search
|
77
77
|
def self.expiring_between(start_date, end_date, options = {})
|
78
78
|
Configuration.gateway.credit_card.expiring_between(start_date, end_date, options)
|
79
79
|
end
|
80
80
|
|
81
|
-
# See http://www.
|
81
|
+
# See http://www.braintreepayments.com/docs/ruby/credit_cards/search
|
82
82
|
def self.find(token)
|
83
83
|
Configuration.gateway.credit_card.find(token)
|
84
84
|
end
|
85
85
|
|
86
|
-
# See http://www.
|
86
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault
|
87
87
|
def self.sale(token, transaction_attributes)
|
88
88
|
Configuration.gateway.transaction.sale(transaction_attributes.merge(:payment_method_token => token))
|
89
89
|
end
|
90
90
|
|
91
|
-
# See http://www.
|
91
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault
|
92
92
|
def self.sale!(token, transaction_attributes)
|
93
93
|
return_object_or_raise(:transaction) { sale(token, transaction_attributes) }
|
94
94
|
end
|
95
95
|
|
96
|
-
# See http://www.
|
96
|
+
# See http://www.braintreepayments.com/docs/ruby/credit_cards/update
|
97
97
|
def self.update(token, attributes)
|
98
98
|
Configuration.gateway.credit_card.update(token, attributes)
|
99
99
|
end
|
100
100
|
|
101
|
-
# See http://www.
|
101
|
+
# See http://www.braintreepayments.com/docs/ruby/credit_cards/update
|
102
102
|
def self.update!(token, attributes)
|
103
103
|
return_object_or_raise(:credit_card) { update(token, attributes) }
|
104
104
|
end
|
105
105
|
|
106
106
|
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
107
107
|
#
|
108
|
-
# See http://www.
|
108
|
+
# See http://www.braintreepayments.com/docs/ruby/credit_cards/update_tr
|
109
109
|
def self.update_from_transparent_redirect(query_string)
|
110
110
|
warn "[DEPRECATED] CreditCard.update_via_transparent_redirect_request is deprecated. Please use TransparentRedirect.confirm"
|
111
111
|
Configuration.gateway.credit_card.update_from_transparent_redirect(query_string)
|
@@ -113,7 +113,7 @@ module Braintree
|
|
113
113
|
|
114
114
|
# Deprecated. Use Braintree::TransparentRedirect.url
|
115
115
|
#
|
116
|
-
# See http://www.
|
116
|
+
# See http://www.braintreepayments.com/docs/ruby/credit_cards/update_tr
|
117
117
|
def self.update_credit_card_url
|
118
118
|
warn "[DEPRECATED] CreditCard.update_credit_card_url is deprecated. Please use TransparentRedirect.url"
|
119
119
|
Configuration.gateway.credit_card.update_credit_card_url
|
@@ -128,7 +128,7 @@ module Braintree
|
|
128
128
|
|
129
129
|
# Deprecated. Use Braintree::CreditCard.credit
|
130
130
|
#
|
131
|
-
# See http://www.
|
131
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault
|
132
132
|
def credit(transaction_attributes)
|
133
133
|
warn "[DEPRECATED] credit as an instance method is deprecated. Please use CreditCard.credit"
|
134
134
|
@gateway.transaction.credit(transaction_attributes.merge(:payment_method_token => token))
|
@@ -136,7 +136,7 @@ module Braintree
|
|
136
136
|
|
137
137
|
# Deprecated. Use Braintree::CreditCard.credit!
|
138
138
|
#
|
139
|
-
# See http://www.
|
139
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault
|
140
140
|
def credit!(transaction_attributes)
|
141
141
|
warn "[DEPRECATED] credit! as an instance method is deprecated. Please use CreditCard.credit!"
|
142
142
|
return_object_or_raise(:transaction) { credit(transaction_attributes) }
|
@@ -144,7 +144,7 @@ module Braintree
|
|
144
144
|
|
145
145
|
# Deprecated. Use Braintree::CreditCard.delete
|
146
146
|
#
|
147
|
-
# http://www.
|
147
|
+
# http://www.braintreepayments.com/docs/ruby/credit_cards/delete
|
148
148
|
def delete
|
149
149
|
warn "[DEPRECATED] delete as an instance method is deprecated. Please use CreditCard.delete"
|
150
150
|
@gateway.credit_card.delete(token)
|
@@ -180,7 +180,7 @@ module Braintree
|
|
180
180
|
|
181
181
|
# Deprecated. Use Braintree::CreditCard.sale
|
182
182
|
#
|
183
|
-
# See http://www.
|
183
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault
|
184
184
|
def sale(transaction_attributes)
|
185
185
|
warn "[DEPRECATED] sale as an instance method is deprecated. Please use CreditCard.sale"
|
186
186
|
@gateway.transaction.sale(transaction_attributes.merge(:payment_method_token => token))
|
@@ -188,7 +188,7 @@ module Braintree
|
|
188
188
|
|
189
189
|
# Deprecated. Use Braintree::CreditCard.sale!
|
190
190
|
#
|
191
|
-
# See http://www.
|
191
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault
|
192
192
|
def sale!(transaction_attributes)
|
193
193
|
warn "[DEPRECATED] sale! as an instance method is deprecated. Please use CreditCard.sale!"
|
194
194
|
return_object_or_raise(:transaction) { sale(transaction_attributes) }
|
@@ -196,7 +196,7 @@ module Braintree
|
|
196
196
|
|
197
197
|
# Deprecated. Use Braintree::CreditCard.update
|
198
198
|
#
|
199
|
-
# See http://www.
|
199
|
+
# See http://www.braintreepayments.com/docs/ruby/credit_cards/update
|
200
200
|
def update(attributes)
|
201
201
|
warn "[DEPRECATED] update as an instance method is deprecated. Please use CreditCard.update"
|
202
202
|
result = @gateway.credit_card.update(token, attributes)
|
@@ -208,7 +208,7 @@ module Braintree
|
|
208
208
|
|
209
209
|
# Deprecated. Use Braintree::CreditCard.update!
|
210
210
|
#
|
211
|
-
# See http://www.
|
211
|
+
# See http://www.braintreepayments.com/docs/ruby/credit_cards/update
|
212
212
|
def update!(attributes)
|
213
213
|
warn "[DEPRECATED] update! as an instance method is deprecated. Please use CreditCard.update!"
|
214
214
|
return_object_or_raise(:credit_card) { update(attributes) }
|
data/lib/braintree/customer.rb
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
module Braintree
|
2
|
-
# See http://www.
|
2
|
+
# See http://www.braintreepayments.com/docs/ruby
|
3
3
|
class Customer
|
4
4
|
include BaseModule
|
5
5
|
|
6
6
|
attr_reader :addresses, :company, :created_at, :credit_cards, :email, :fax, :first_name, :id, :last_name,
|
7
7
|
:phone, :updated_at, :website, :custom_fields
|
8
8
|
|
9
|
-
# See http://www.
|
9
|
+
# See http://www.braintreepayments.com/docs/ruby/customers/search
|
10
10
|
def self.all
|
11
11
|
Configuration.gateway.customer.all
|
12
12
|
end
|
13
13
|
|
14
|
-
# See http://www.
|
14
|
+
# See http://www.braintreepayments.com/docs/ruby/customers/create
|
15
15
|
def self.create(attributes = {})
|
16
16
|
Configuration.gateway.customer.create(attributes)
|
17
17
|
end
|
18
18
|
|
19
|
-
# See http://www.
|
19
|
+
# See http://www.braintreepayments.com/docs/ruby/customers/create
|
20
20
|
def self.create!(attributes = {})
|
21
21
|
return_object_or_raise(:customer) { create(attributes) }
|
22
22
|
end
|
23
23
|
|
24
24
|
# Deprecated. Use Braintree::TransparentRedirect.url
|
25
25
|
#
|
26
|
-
# See http://www.
|
26
|
+
# See http://www.braintreepayments.com/docs/ruby/customers/create_tr
|
27
27
|
def self.create_customer_url
|
28
28
|
warn "[DEPRECATED] Customer.create_customer_url is deprecated. Please use TransparentRedirect.url"
|
29
29
|
Configuration.gateway.customer.create_customer_url
|
@@ -31,43 +31,43 @@ module Braintree
|
|
31
31
|
|
32
32
|
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
33
33
|
#
|
34
|
-
# See http://www.
|
34
|
+
# See http://www.braintreepayments.com/docs/ruby/customers/create_tr
|
35
35
|
def self.create_from_transparent_redirect(query_string)
|
36
36
|
warn "[DEPRECATED] Customer.create_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
|
37
37
|
Configuration.gateway.customer.create_from_transparent_redirect(query_string)
|
38
38
|
end
|
39
39
|
|
40
|
-
# See http://www.
|
40
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault
|
41
41
|
def self.credit(customer_id, transaction_attributes)
|
42
42
|
Transaction.credit(transaction_attributes.merge(:customer_id => customer_id))
|
43
43
|
end
|
44
44
|
|
45
|
-
# See http://www.
|
45
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault
|
46
46
|
def self.credit!(customer_id, transaction_attributes)
|
47
47
|
return_object_or_raise(:transaction){ credit(customer_id, transaction_attributes) }
|
48
48
|
end
|
49
49
|
|
50
|
-
# See http://www.
|
50
|
+
# See http://www.braintreepayments.com/docs/ruby/customers/delete
|
51
51
|
def self.delete(customer_id)
|
52
52
|
Configuration.gateway.customer.delete(customer_id)
|
53
53
|
end
|
54
54
|
|
55
|
-
# See http://www.
|
55
|
+
# See http://www.braintreepayments.com/docs/ruby/customers/search
|
56
56
|
def self.find(customer_id)
|
57
57
|
Configuration.gateway.customer.find(customer_id)
|
58
58
|
end
|
59
59
|
|
60
|
-
# See http://www.
|
60
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault
|
61
61
|
def self.sale(customer_id, transaction_attributes)
|
62
62
|
Transaction.sale(transaction_attributes.merge(:customer_id => customer_id))
|
63
63
|
end
|
64
64
|
|
65
|
-
# See http://www.
|
65
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault
|
66
66
|
def self.sale!(customer_id, transaction_attributes)
|
67
67
|
return_object_or_raise(:transaction) { sale(customer_id, transaction_attributes) }
|
68
68
|
end
|
69
69
|
|
70
|
-
# See http://www.
|
70
|
+
# See http://www.braintreepayments.com/docs/ruby/customers/search
|
71
71
|
def self.search(&block)
|
72
72
|
Configuration.gateway.customer.search(&block)
|
73
73
|
end
|
@@ -77,19 +77,19 @@ module Braintree
|
|
77
77
|
Configuration.gateway.customer.transactions(customer_id, options = {})
|
78
78
|
end
|
79
79
|
|
80
|
-
# See http://www.
|
80
|
+
# See http://www.braintreepayments.com/docs/ruby/customers/update
|
81
81
|
def self.update(customer_id, attributes)
|
82
82
|
Configuration.gateway.customer.update(customer_id, attributes)
|
83
83
|
end
|
84
84
|
|
85
|
-
# See http://www.
|
85
|
+
# See http://www.braintreepayments.com/docs/ruby/customers/update
|
86
86
|
def self.update!(customer_id, attributes)
|
87
87
|
return_object_or_raise(:customer) { update(customer_id, attributes) }
|
88
88
|
end
|
89
89
|
|
90
90
|
# Deprecated. Use Braintree::TransparentRedirect.url
|
91
91
|
#
|
92
|
-
# See http://www.
|
92
|
+
# See http://www.braintreepayments.com/docs/ruby/customers/update_tr
|
93
93
|
def self.update_customer_url
|
94
94
|
warn "[DEPRECATED] Customer.update_customer_url is deprecated. Please use TransparentRedirect.url"
|
95
95
|
Configuration.gateway.customer.update_customer_url
|
@@ -97,7 +97,7 @@ module Braintree
|
|
97
97
|
|
98
98
|
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
99
99
|
#
|
100
|
-
# See http://www.
|
100
|
+
# See http://www.braintreepayments.com/docs/ruby/customers/update_tr
|
101
101
|
def self.update_from_transparent_redirect(query_string)
|
102
102
|
warn "[DEPRECATED] Customer.update_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
|
103
103
|
Configuration.gateway.customer.update_from_transparent_redirect(query_string)
|
@@ -110,17 +110,17 @@ module Braintree
|
|
110
110
|
@addresses = (@addresses || []).map { |addr| Address._new gateway, addr }
|
111
111
|
end
|
112
112
|
|
113
|
-
# See http://www.
|
113
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault
|
114
114
|
def credit(transaction_attributes)
|
115
115
|
@gateway.transaction.credit(transaction_attributes.merge(:customer_id => id))
|
116
116
|
end
|
117
117
|
|
118
|
-
# See http://www.
|
118
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault
|
119
119
|
def credit!(transaction_attributes)
|
120
120
|
return_object_or_raise(:transaction) { credit(transaction_attributes) }
|
121
121
|
end
|
122
122
|
|
123
|
-
# See http://www.
|
123
|
+
# See http://www.braintreepayments.com/docs/ruby/customers/delete
|
124
124
|
def delete
|
125
125
|
@gateway.customer.delete(id)
|
126
126
|
end
|
@@ -137,7 +137,7 @@ module Braintree
|
|
137
137
|
|
138
138
|
# Deprecated. Use Braintree::Customer.sale
|
139
139
|
#
|
140
|
-
# See http://www.
|
140
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault
|
141
141
|
def sale(transaction_attributes)
|
142
142
|
warn "[DEPRECATED] sale as an instance method is deprecated. Please use Customer.sale"
|
143
143
|
@gateway.transaction.sale(transaction_attributes.merge(:customer_id => id))
|
@@ -145,7 +145,7 @@ module Braintree
|
|
145
145
|
|
146
146
|
# Deprecated. Use Braintree::Customer.sale!
|
147
147
|
#
|
148
|
-
# See http://www.
|
148
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault
|
149
149
|
def sale!(transaction_attributes)
|
150
150
|
warn "[DEPRECATED] sale! as an instance method is deprecated. Please use Customer.sale!"
|
151
151
|
return_object_or_raise(:transaction) { sale(transaction_attributes) }
|
@@ -158,7 +158,7 @@ module Braintree
|
|
158
158
|
|
159
159
|
# Deprecated. Use Braintree::Customer.update
|
160
160
|
#
|
161
|
-
# See http://www.
|
161
|
+
# See http://www.braintreepayments.com/docs/ruby/customers/update
|
162
162
|
def update(attributes)
|
163
163
|
warn "[DEPRECATED] update as an instance method is deprecated. Please use Customer.update"
|
164
164
|
result = @gateway.customer.update(id, attributes)
|
@@ -170,7 +170,7 @@ module Braintree
|
|
170
170
|
|
171
171
|
# Deprecated. Use Braintree::Customer.update!
|
172
172
|
#
|
173
|
-
# See http://www.
|
173
|
+
# See http://www.braintreepayments.com/docs/ruby/customers/update
|
174
174
|
def update!(attributes)
|
175
175
|
warn "[DEPRECATED] update! as an instance method is deprecated. Please use Customer.update!"
|
176
176
|
return_object_or_raise(:customer) { update(attributes) }
|
@@ -3,7 +3,7 @@ module Braintree
|
|
3
3
|
# The constants should be used to check for a specific validation error in a ValidationErrorCollection.
|
4
4
|
# The error messages returned from the server may change, but the codes will remain the same.
|
5
5
|
module ErrorCodes
|
6
|
-
# See http://www.
|
6
|
+
# See http://www.braintreepayments.com/docs/ruby/addresses/validations
|
7
7
|
module Address
|
8
8
|
CannotBeBlank = "81801"
|
9
9
|
CompanyIsTooLong = "81802"
|
@@ -25,7 +25,7 @@ module Braintree
|
|
25
25
|
TooManyAddressesPerCustomer = "91818"
|
26
26
|
end
|
27
27
|
|
28
|
-
# See http://www.
|
28
|
+
# See http://www.braintreepayments.com/docs/ruby/credit_cards/validations
|
29
29
|
module CreditCard
|
30
30
|
BillingAddressConflict = "91701"
|
31
31
|
BillingAddressIdIsInvalid = "91702"
|
@@ -57,7 +57,7 @@ module Braintree
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
# See http://www.
|
60
|
+
# See http://www.braintreepayments.com/docs/ruby/customers/validations
|
61
61
|
module Customer
|
62
62
|
CompanyIsTooLong = "81601"
|
63
63
|
CustomFieldIsInvalid = "91602"
|
@@ -84,7 +84,7 @@ module Braintree
|
|
84
84
|
NameFormatIsInvalid = "92201"
|
85
85
|
end
|
86
86
|
|
87
|
-
# See http://www.
|
87
|
+
# See http://www.braintreepayments.com/docs/ruby/subscriptions/validations
|
88
88
|
module Subscription
|
89
89
|
BillingDayOfMonthCannotBeUpdated = "91918"
|
90
90
|
BillingDayOfMonthIsInvalid = "91914"
|
@@ -142,7 +142,7 @@ module Braintree
|
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
|
-
# See http://www.
|
145
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/validations
|
146
146
|
module Transaction
|
147
147
|
AmountCannotBeNegative = "81501"
|
148
148
|
AmountIsInvalid = "81503"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
# See http://www.
|
2
|
+
# See http://www.braintreepayments.com/docs/ruby/general/result_objects
|
3
3
|
class ErrorResult
|
4
4
|
|
5
5
|
attr_reader :credit_card_verification, :transaction, :subscription, :errors, :params, :message
|
data/lib/braintree/errors.rb
CHANGED
data/lib/braintree/exceptions.rb
CHANGED
@@ -2,41 +2,41 @@ module Braintree # :nodoc:
|
|
2
2
|
# Super class for all Braintree exceptions.
|
3
3
|
class BraintreeError < ::StandardError; end
|
4
4
|
|
5
|
-
# See http://www.
|
5
|
+
# See http://www.braintreepayments.com/docs/ruby/general/exceptions
|
6
6
|
class AuthenticationError < BraintreeError; end
|
7
7
|
|
8
|
-
# See http://www.
|
8
|
+
# See http://www.braintreepayments.com/docs/ruby/general/exceptions
|
9
9
|
class AuthorizationError < BraintreeError; end
|
10
10
|
|
11
|
-
# See http://www.
|
11
|
+
# See http://www.braintreepayments.com/docs/ruby/general/exceptions
|
12
12
|
class ConfigurationError < BraintreeError
|
13
13
|
def initialize(setting, message) # :nodoc:
|
14
14
|
super "Braintree::Configuration.#{setting} #{message}"
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
# See http://www.
|
18
|
+
# See http://www.braintreepayments.com/docs/ruby/general/exceptions
|
19
19
|
class DownForMaintenanceError < BraintreeError; end
|
20
20
|
|
21
|
-
# See http://www.
|
21
|
+
# See http://www.braintreepayments.com/docs/ruby/general/exceptions
|
22
22
|
class ForgedQueryString < BraintreeError; end
|
23
23
|
|
24
|
-
# See http://www.
|
24
|
+
# See http://www.braintreepayments.com/docs/ruby/general/exceptions
|
25
25
|
class NotFoundError < BraintreeError; end
|
26
26
|
|
27
|
-
# See http://www.
|
27
|
+
# See http://www.braintreepayments.com/docs/ruby/general/exceptions
|
28
28
|
class ServerError < BraintreeError; end
|
29
29
|
|
30
|
-
# See http://www.
|
30
|
+
# See http://www.braintreepayments.com/docs/ruby/general/exceptions
|
31
31
|
class SSLCertificateError < BraintreeError; end
|
32
32
|
|
33
|
-
# See http://www.
|
33
|
+
# See http://www.braintreepayments.com/docs/ruby/general/exceptions
|
34
34
|
class UnexpectedError < BraintreeError; end
|
35
35
|
|
36
|
-
# See http://www.
|
36
|
+
# See http://www.braintreepayments.com/docs/ruby/general/exceptions
|
37
37
|
class UpgradeRequiredError < BraintreeError; end
|
38
38
|
|
39
|
-
# See http://www.
|
39
|
+
# See http://www.braintreepayments.com/docs/ruby/general/exceptions
|
40
40
|
class ValidationsFailed < BraintreeError
|
41
41
|
attr_reader :error_result
|
42
42
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
# See http://www.
|
2
|
+
# See http://www.braintreepayments.com/docs/ruby/subscriptions/overview
|
3
3
|
class Subscription
|
4
4
|
include BaseModule
|
5
5
|
|
@@ -29,12 +29,12 @@ module Braintree
|
|
29
29
|
attr_reader :add_ons, :discounts
|
30
30
|
attr_reader :descriptor
|
31
31
|
|
32
|
-
# See http://www.
|
32
|
+
# See http://www.braintreepayments.com/docs/ruby/subscriptions/cancel
|
33
33
|
def self.cancel(subscription_id)
|
34
34
|
Configuration.gateway.subscription.cancel(subscription_id)
|
35
35
|
end
|
36
36
|
|
37
|
-
# See http://www.
|
37
|
+
# See http://www.braintreepayments.com/docs/ruby/subscriptions/create
|
38
38
|
def self.create(attributes)
|
39
39
|
Configuration.gateway.subscription.create(attributes)
|
40
40
|
end
|
@@ -43,7 +43,7 @@ module Braintree
|
|
43
43
|
return_object_or_raise(:subscription) { create(attributes) }
|
44
44
|
end
|
45
45
|
|
46
|
-
# See http://www.
|
46
|
+
# See http://www.braintreepayments.com/docs/ruby/subscriptions/search
|
47
47
|
def self.find(id)
|
48
48
|
Configuration.gateway.subscription.find(id)
|
49
49
|
end
|
@@ -52,12 +52,12 @@ module Braintree
|
|
52
52
|
Configuration.gateway.transaction.retry_subscription_charge(subscription_id, amount)
|
53
53
|
end
|
54
54
|
|
55
|
-
# See http://www.
|
55
|
+
# See http://www.braintreepayments.com/docs/ruby/subscriptions/search
|
56
56
|
def self.search(&block)
|
57
57
|
Configuration.gateway.subscription.search(&block)
|
58
58
|
end
|
59
59
|
|
60
|
-
# See http://www.
|
60
|
+
# See http://www.braintreepayments.com/docs/ruby/subscriptions/update
|
61
61
|
def self.update(subscription_id, attributes)
|
62
62
|
Configuration.gateway.subscription.update(subscription_id, attributes)
|
63
63
|
end
|
@@ -4,7 +4,7 @@ module Braintree
|
|
4
4
|
# credit card numbers that should be used when working in the sandbox environment. The sandbox
|
5
5
|
# will not accept any credit card numbers other than the ones listed below.
|
6
6
|
#
|
7
|
-
# See http://www.
|
7
|
+
# See http://www.braintreepayments.com/docs/ruby/reference/sandbox
|
8
8
|
module CreditCardNumbers
|
9
9
|
AmExes = %w[
|
10
10
|
378282246310005
|
@@ -3,7 +3,7 @@ module Braintree
|
|
3
3
|
# The constants in this module can be used to create transactions with
|
4
4
|
# the desired status in the sandbox environment.
|
5
5
|
#
|
6
|
-
# See http://www.
|
6
|
+
# See http://www.braintreepayments.com/docs/ruby/reference/sandbox
|
7
7
|
module TransactionAmounts
|
8
8
|
Authorize = "1000.00"
|
9
9
|
Decline = "2000.00"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
# See http://www.
|
2
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/overview
|
3
3
|
class Transaction
|
4
4
|
include BaseModule
|
5
5
|
|
@@ -71,19 +71,19 @@ module Braintree
|
|
71
71
|
attr_reader :updated_at
|
72
72
|
attr_reader :add_ons, :discounts
|
73
73
|
|
74
|
-
# See http://www.
|
74
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create
|
75
75
|
def self.create(attributes)
|
76
76
|
Configuration.gateway.transaction.create(attributes)
|
77
77
|
end
|
78
78
|
|
79
|
-
# See http://www.
|
79
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create
|
80
80
|
def self.create!(attributes)
|
81
81
|
return_object_or_raise(:transaction) { create(attributes) }
|
82
82
|
end
|
83
83
|
|
84
84
|
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
85
85
|
#
|
86
|
-
# See http://www.
|
86
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create_tr
|
87
87
|
def self.create_from_transparent_redirect(query_string)
|
88
88
|
warn "[DEPRECATED] Transaction.create_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
|
89
89
|
Configuration.gateway.transaction.create_from_transparent_redirect(query_string)
|
@@ -91,7 +91,7 @@ module Braintree
|
|
91
91
|
|
92
92
|
# Deprecated. Use Braintree::TransparentRedirect.url
|
93
93
|
#
|
94
|
-
# See http://www.
|
94
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create_tr
|
95
95
|
def self.create_transaction_url
|
96
96
|
warn "[DEPRECATED] Transaction.create_transaction_url is deprecated. Please use TransparentRedirect.url"
|
97
97
|
Configuration.gateway.transaction.create_transaction_url
|
@@ -105,47 +105,47 @@ module Braintree
|
|
105
105
|
return_object_or_raise(:transaction) { credit(attributes) }
|
106
106
|
end
|
107
107
|
|
108
|
-
# See http://www.
|
108
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/search
|
109
109
|
def self.find(id)
|
110
110
|
Configuration.gateway.transaction.find(id)
|
111
111
|
end
|
112
112
|
|
113
|
-
# See http://www.
|
113
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/refund
|
114
114
|
def self.refund(id, amount = nil)
|
115
115
|
Configuration.gateway.transaction.refund(id, amount)
|
116
116
|
end
|
117
117
|
|
118
|
-
# See http://www.
|
118
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create
|
119
119
|
def self.sale(attributes)
|
120
120
|
Configuration.gateway.transaction.sale(attributes)
|
121
121
|
end
|
122
122
|
|
123
|
-
# See http://www.
|
123
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create
|
124
124
|
def self.sale!(attributes)
|
125
125
|
return_object_or_raise(:transaction) { sale(attributes) }
|
126
126
|
end
|
127
127
|
|
128
|
-
# See http://www.
|
128
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/search
|
129
129
|
def self.search(&block)
|
130
130
|
Configuration.gateway.transaction.search(&block)
|
131
131
|
end
|
132
132
|
|
133
|
-
# See http://www.
|
133
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/submit_for_settlement
|
134
134
|
def self.submit_for_settlement(transaction_id, amount = nil)
|
135
135
|
Configuration.gateway.transaction.submit_for_settlement(transaction_id, amount)
|
136
136
|
end
|
137
137
|
|
138
|
-
# See http://www.
|
138
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/submit_for_settlement
|
139
139
|
def self.submit_for_settlement!(transaction_id, amount = nil)
|
140
140
|
return_object_or_raise(:transaction) { submit_for_settlement(transaction_id, amount) }
|
141
141
|
end
|
142
142
|
|
143
|
-
# See http://www.
|
143
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/void
|
144
144
|
def self.void(transaction_id)
|
145
145
|
Configuration.gateway.transaction.void(transaction_id)
|
146
146
|
end
|
147
147
|
|
148
|
-
# See http://www.
|
148
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/void
|
149
149
|
def self.void!(transaction_id)
|
150
150
|
return_object_or_raise(:transaction) { void(transaction_id) }
|
151
151
|
end
|
@@ -187,7 +187,7 @@ module Braintree
|
|
187
187
|
|
188
188
|
# Deprecated. Use Braintree::Transaction.refund
|
189
189
|
#
|
190
|
-
# See http://www.
|
190
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/refund
|
191
191
|
def refund(amount = nil)
|
192
192
|
warn "[DEPRECATED] refund as an instance method is deprecated. Please use Transaction.refund"
|
193
193
|
result = @gateway.transaction.refund(id, amount)
|
@@ -211,7 +211,7 @@ module Braintree
|
|
211
211
|
|
212
212
|
# Deprecated. Use Braintree::Transaction.submit_for_settlement
|
213
213
|
#
|
214
|
-
# See http://www.
|
214
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/submit_for_settlement
|
215
215
|
def submit_for_settlement(amount = nil)
|
216
216
|
warn "[DEPRECATED] submit_for_settlement as an instance method is deprecated. Please use Transaction.submit_for_settlement"
|
217
217
|
result = @gateway.transaction.submit_for_settlement(id, amount)
|
@@ -223,7 +223,7 @@ module Braintree
|
|
223
223
|
|
224
224
|
# Deprecated. Use Braintree::Transaction.submit_for_settlement!
|
225
225
|
#
|
226
|
-
# See http://www.
|
226
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/submit_for_settlement
|
227
227
|
def submit_for_settlement!(amount = nil)
|
228
228
|
warn "[DEPRECATED] submit_for_settlement! as an instance method is deprecated. Please use Transaction.submit_for_settlement!"
|
229
229
|
return_object_or_raise(:transaction) { submit_for_settlement(amount) }
|
@@ -267,7 +267,7 @@ module Braintree
|
|
267
267
|
|
268
268
|
# Deprecated. Use Braintree::Transaction.void
|
269
269
|
#
|
270
|
-
# See http://www.
|
270
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/void
|
271
271
|
def void
|
272
272
|
warn "[DEPRECATED] void as an instance method is deprecated. Please use Transaction.void"
|
273
273
|
result = @gateway.transaction.void(id)
|
@@ -279,7 +279,7 @@ module Braintree
|
|
279
279
|
|
280
280
|
# Deprecated. Use Braintree::Transaction.void!
|
281
281
|
#
|
282
|
-
# See http://www.
|
282
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/void
|
283
283
|
def void!
|
284
284
|
warn "[DEPRECATED] void! as an instance method is deprecated. Please use Transaction.void!"
|
285
285
|
return_object_or_raise(:transaction) { void }
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Braintree
|
2
2
|
# See:
|
3
|
-
# * http://www.
|
4
|
-
# * http://www.
|
5
|
-
# * http://www.
|
6
|
-
# * http://www.
|
7
|
-
# * http://www.
|
3
|
+
# * http://www.braintreepayments.com/docs/ruby/transactions/create_tr
|
4
|
+
# * http://www.braintreepayments.com/docs/ruby/customers/create_tr
|
5
|
+
# * http://www.braintreepayments.com/docs/ruby/customers/update_tr
|
6
|
+
# * http://www.braintreepayments.com/docs/ruby/credit_cards/create_tr
|
7
|
+
# * http://www.braintreepayments.com/docs/ruby/credit_cards/update_tr
|
8
8
|
module TransparentRedirect
|
9
9
|
module Kind # :nodoc:
|
10
10
|
CreateCustomer = "create_customer"
|
@@ -18,27 +18,27 @@ module Braintree
|
|
18
18
|
Configuration.gateway.transparent_redirect.confirm(query_string)
|
19
19
|
end
|
20
20
|
|
21
|
-
# See http://www.
|
21
|
+
# See http://www.braintreepayments.com/docs/ruby/credit_cards/create_tr
|
22
22
|
def self.create_credit_card_data(params)
|
23
23
|
Configuration.gateway.transparent_redirect.create_credit_card_data(params)
|
24
24
|
end
|
25
25
|
|
26
|
-
# See http://www.
|
26
|
+
# See http://www.braintreepayments.com/docs/ruby/customers/create_tr
|
27
27
|
def self.create_customer_data(params)
|
28
28
|
Configuration.gateway.transparent_redirect.create_customer_data(params)
|
29
29
|
end
|
30
30
|
|
31
|
-
# See http://www.
|
31
|
+
# See http://www.braintreepayments.com/docs/ruby/transactions/create_tr
|
32
32
|
def self.transaction_data(params)
|
33
33
|
Configuration.gateway.transparent_redirect.transaction_data(params)
|
34
34
|
end
|
35
35
|
|
36
|
-
# See http://www.
|
36
|
+
# See http://www.braintreepayments.com/docs/ruby/credit_cards/update_tr
|
37
37
|
def self.update_credit_card_data(params)
|
38
38
|
Configuration.gateway.transparent_redirect.update_credit_card_data(params)
|
39
39
|
end
|
40
40
|
|
41
|
-
# See http://www.
|
41
|
+
# See http://www.braintreepayments.com/docs/ruby/customers/update_tr
|
42
42
|
def self.update_customer_data(params)
|
43
43
|
Configuration.gateway.transparent_redirect.update_customer_data(params)
|
44
44
|
end
|
data/lib/braintree/version.rb
CHANGED
@@ -97,7 +97,13 @@ module Braintree
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def self._xml_escape(key)
|
100
|
-
key.to_s.tr("_", "-")
|
100
|
+
dasherized_key = key.to_s.tr("_", "-")
|
101
|
+
|
102
|
+
if Builder::XChar.respond_to?(:encode)
|
103
|
+
Builder::XChar.encode(dasherized_key)
|
104
|
+
else
|
105
|
+
dasherized_key.to_xs
|
106
|
+
end
|
101
107
|
end
|
102
108
|
end
|
103
109
|
end
|
@@ -113,20 +113,6 @@ describe Braintree::Http do
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
-
it "accepts the certificate on the QA server" do
|
117
|
-
begin
|
118
|
-
original_env = Braintree::Configuration.environment
|
119
|
-
Braintree::Configuration.environment = :qa
|
120
|
-
Braintree::Configuration.stub(:base_merchant_path).and_return("/")
|
121
|
-
|
122
|
-
expect do
|
123
|
-
Braintree::Configuration.instantiate.http._http_do(Net::HTTP::Get, "/login")
|
124
|
-
end.to_not raise_error
|
125
|
-
ensure
|
126
|
-
Braintree::Configuration.environment = original_env
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
116
|
it "accepts the certificate on the sandbox server" do
|
131
117
|
begin
|
132
118
|
original_env = Braintree::Configuration.environment
|
@@ -158,7 +144,7 @@ describe Braintree::Http do
|
|
158
144
|
it "raises an appropriate error if certificate fails validation" do
|
159
145
|
begin
|
160
146
|
original_env = Braintree::Configuration.environment
|
161
|
-
Braintree::Configuration.environment = :
|
147
|
+
Braintree::Configuration.environment = :sandbox
|
162
148
|
config = Braintree::Configuration.instantiate
|
163
149
|
config.stub(:base_merchant_path).and_return("/")
|
164
150
|
config.stub(:ca_file).and_return("does_not_exist")
|
@@ -811,7 +811,7 @@ describe Braintree::Transaction do
|
|
811
811
|
:email => "dan@example.com",
|
812
812
|
:phone => "419-555-1234",
|
813
813
|
:fax => "419-555-1235",
|
814
|
-
:website => "http://
|
814
|
+
:website => "http://braintreepayments.com"
|
815
815
|
},
|
816
816
|
:billing => {
|
817
817
|
:first_name => "Carl",
|
@@ -862,7 +862,7 @@ describe Braintree::Transaction do
|
|
862
862
|
transaction.customer_details.email.should == "dan@example.com"
|
863
863
|
transaction.customer_details.phone.should == "419-555-1234"
|
864
864
|
transaction.customer_details.fax.should == "419-555-1235"
|
865
|
-
transaction.customer_details.website.should == "http://
|
865
|
+
transaction.customer_details.website.should == "http://braintreepayments.com"
|
866
866
|
transaction.billing_details.first_name.should == "Carl"
|
867
867
|
transaction.billing_details.last_name.should == "Jones"
|
868
868
|
transaction.billing_details.company.should == "Braintree"
|
@@ -1390,7 +1390,7 @@ describe Braintree::Transaction do
|
|
1390
1390
|
:email => "dan@example.com",
|
1391
1391
|
:phone => "419-555-1234",
|
1392
1392
|
:fax => "419-555-1235",
|
1393
|
-
:website => "http://
|
1393
|
+
:website => "http://braintreepayments.com"
|
1394
1394
|
},
|
1395
1395
|
:billing => {
|
1396
1396
|
:first_name => "Carl",
|
@@ -1444,7 +1444,7 @@ describe Braintree::Transaction do
|
|
1444
1444
|
transaction.customer_details.email.should == "dan@example.com"
|
1445
1445
|
transaction.customer_details.phone.should == "419-555-1234"
|
1446
1446
|
transaction.customer_details.fax.should == "419-555-1235"
|
1447
|
-
transaction.customer_details.website.should == "http://
|
1447
|
+
transaction.customer_details.website.should == "http://braintreepayments.com"
|
1448
1448
|
transaction.billing_details.first_name.should == "Carl"
|
1449
1449
|
transaction.billing_details.last_name.should == "Jones"
|
1450
1450
|
transaction.billing_details.company.should == "Braintree"
|
metadata
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: braintree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 37
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 10
|
9
|
-
-
|
10
|
-
version: 2.10.
|
9
|
+
- 1
|
10
|
+
version: 2.10.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
|
-
- Braintree
|
13
|
+
- Braintree
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-07 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,14 +26,16 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 15
|
30
30
|
segments:
|
31
|
+
- 2
|
32
|
+
- 0
|
31
33
|
- 0
|
32
|
-
version:
|
34
|
+
version: 2.0.0
|
33
35
|
type: :runtime
|
34
36
|
version_requirements: *id001
|
35
37
|
description: Ruby library for integrating with the Braintree Gateway
|
36
|
-
email:
|
38
|
+
email: code@getbraintree.com
|
37
39
|
executables: []
|
38
40
|
|
39
41
|
extensions: []
|
@@ -141,7 +143,7 @@ files:
|
|
141
143
|
- lib/ssl/securetrust_ca.crt
|
142
144
|
- lib/ssl/www_braintreegateway_com.ca.crt
|
143
145
|
has_rdoc: true
|
144
|
-
homepage: http://www.
|
146
|
+
homepage: http://www.braintreepayments.com/
|
145
147
|
licenses: []
|
146
148
|
|
147
149
|
post_install_message:
|
@@ -170,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
172
|
requirements: []
|
171
173
|
|
172
174
|
rubyforge_project: braintree
|
173
|
-
rubygems_version: 1.
|
175
|
+
rubygems_version: 1.4.0
|
174
176
|
signing_key:
|
175
177
|
specification_version: 3
|
176
178
|
summary: Braintree Gateway Ruby Client Library
|