braintree 2.38.0 → 2.39.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.
- data/README.rdoc +1 -1
- data/lib/braintree.rb +3 -0
- data/lib/braintree/apple_pay_card.rb +1 -1
- data/lib/braintree/coinbase_account.rb +20 -0
- data/lib/braintree/customer.rb +3 -2
- data/lib/braintree/error_codes.rb +49 -1
- data/lib/braintree/payment_method_gateway.rb +4 -0
- data/lib/braintree/subscription.rb +9 -0
- data/lib/braintree/subscription/status_details.rb +13 -0
- data/lib/braintree/test/nonce.rb +1 -0
- data/lib/braintree/transaction.rb +2 -0
- data/lib/braintree/transaction/apple_pay_details.rb +1 -1
- data/lib/braintree/transaction/coinbase_details.rb +13 -0
- data/lib/braintree/version.rb +1 -1
- data/spec/httpsd.pid +1 -1
- data/spec/integration/braintree/coinbase_spec.rb +31 -0
- data/spec/integration/braintree/customer_spec.rb +1 -0
- data/spec/integration/braintree/http_spec.rb +1 -1
- data/spec/integration/braintree/payment_method_spec.rb +1 -0
- data/spec/integration/braintree/subscription_spec.rb +12 -8
- data/spec/integration/braintree/test_transaction_spec.rb +1 -1
- data/spec/integration/braintree/transaction_spec.rb +15 -14
- data/spec/integration/braintree/transparent_redirect_spec.rb +8 -0
- data/spec/spec_helper.rb +13 -3
- data/spec/unit/braintree/address_spec.rb +2 -2
- data/spec/unit/braintree/credit_card_spec.rb +2 -2
- data/spec/unit/braintree/customer_spec.rb +2 -2
- data/spec/unit/braintree/digest_spec.rb +3 -3
- data/spec/unit/braintree/payment_method_spec.rb +2 -2
- data/spec/unit/braintree/subscription_spec.rb +2 -2
- data/spec/unit/braintree/transaction_spec.rb +2 -2
- data/spec/unit/braintree/transparent_redirect_spec.rb +3 -3
- data/spec/unit/braintree/util_spec.rb +1 -1
- data/spec/unit/braintree/webhook_notification_spec.rb +16 -11
- metadata +143 -135
- checksums.yaml +0 -7
data/README.rdoc
CHANGED
data/lib/braintree.rb
CHANGED
|
@@ -29,6 +29,7 @@ require "braintree/advanced_search"
|
|
|
29
29
|
require "braintree/apple_pay_card"
|
|
30
30
|
require "braintree/client_token"
|
|
31
31
|
require "braintree/client_token_gateway"
|
|
32
|
+
require "braintree/coinbase_account"
|
|
32
33
|
require "braintree/configuration"
|
|
33
34
|
require "braintree/credit_card"
|
|
34
35
|
require "braintree/credit_card_gateway"
|
|
@@ -71,6 +72,7 @@ require "braintree/sepa_bank_account_gateway"
|
|
|
71
72
|
require "braintree/sha256_digest"
|
|
72
73
|
require "braintree/signature_service"
|
|
73
74
|
require "braintree/subscription"
|
|
75
|
+
require "braintree/subscription/status_details"
|
|
74
76
|
require "braintree/subscription_gateway"
|
|
75
77
|
require "braintree/subscription_search"
|
|
76
78
|
require "braintree/successful_result"
|
|
@@ -84,6 +86,7 @@ require "braintree/transaction"
|
|
|
84
86
|
require "braintree/test_transaction"
|
|
85
87
|
require "braintree/transaction/address_details"
|
|
86
88
|
require "braintree/transaction/apple_pay_details"
|
|
89
|
+
require "braintree/transaction/coinbase_details"
|
|
87
90
|
require "braintree/transaction/credit_card_details"
|
|
88
91
|
require "braintree/transaction/customer_details"
|
|
89
92
|
require "braintree/transaction/disbursement_details"
|
|
@@ -13,7 +13,7 @@ module Braintree
|
|
|
13
13
|
|
|
14
14
|
attr_reader :token, :card_type, :last_4, :default, :image_url,
|
|
15
15
|
:created_at, :updated_at, :subscriptions, :expiration_month,
|
|
16
|
-
:expiration_year, :expired
|
|
16
|
+
:expiration_year, :expired, :payment_instrument_name
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def initialize(gateway, attributes) # :nodoc:
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class CoinbaseAccount
|
|
3
|
+
include BaseModule # :nodoc:
|
|
4
|
+
|
|
5
|
+
attr_reader :token, :user_id, :user_email, :user_name, :subscriptions, :created_at, :updated_at, :default
|
|
6
|
+
def initialize(gateway, attributes) # :nodoc:
|
|
7
|
+
@gateway = gateway
|
|
8
|
+
set_instance_variables_from_hash(attributes)
|
|
9
|
+
@subscriptions = (@subscriptions || []).map { |subscription_hash| Subscription._new(@gateway, subscription_hash) }
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
class << self
|
|
13
|
+
protected :new
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self._new(*args) # :nodoc:
|
|
17
|
+
self.new *args
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
data/lib/braintree/customer.rb
CHANGED
|
@@ -4,7 +4,7 @@ module Braintree
|
|
|
4
4
|
include BaseModule
|
|
5
5
|
|
|
6
6
|
attr_reader :addresses, :company, :created_at, :credit_cards, :email, :fax, :first_name, :id, :last_name,
|
|
7
|
-
:phone, :updated_at, :website, :custom_fields, :paypal_accounts, :apple_pay_cards
|
|
7
|
+
:phone, :updated_at, :website, :custom_fields, :paypal_accounts, :apple_pay_cards, :coinbase_accounts
|
|
8
8
|
|
|
9
9
|
# See http://www.braintreepayments.com/docs/ruby/customers/search
|
|
10
10
|
def self.all
|
|
@@ -108,6 +108,7 @@ module Braintree
|
|
|
108
108
|
set_instance_variables_from_hash(attributes)
|
|
109
109
|
@credit_cards = (@credit_cards || []).map { |pm| CreditCard._new gateway, pm }
|
|
110
110
|
@paypal_accounts = (@paypal_accounts || []).map { |pm| PayPalAccount._new gateway, pm }
|
|
111
|
+
@coinbase_accounts = (@coinbase_accounts || []).map { |pm| CoinbaseAccount._new gateway, pm }
|
|
111
112
|
@apple_pay_cards = (@apple_pay_cards || []).map { |pm| ApplePayCard._new gateway, pm }
|
|
112
113
|
@addresses = (@addresses || []).map { |addr| Address._new gateway, addr }
|
|
113
114
|
@custom_fields = attributes[:custom_fields].is_a?(Hash) ? attributes[:custom_fields] : {}
|
|
@@ -143,7 +144,7 @@ module Braintree
|
|
|
143
144
|
|
|
144
145
|
# Returns the customer's payment methods
|
|
145
146
|
def payment_methods
|
|
146
|
-
@credit_cards.dup + @paypal_accounts.dup + @apple_pay_cards.dup
|
|
147
|
+
@credit_cards.dup + @paypal_accounts.dup + @apple_pay_cards.dup + @coinbase_accounts.dup
|
|
147
148
|
end
|
|
148
149
|
|
|
149
150
|
def inspect # :nodoc:
|
|
@@ -52,6 +52,10 @@ module Braintree
|
|
|
52
52
|
MerchantKeysAlreadyConfigured = "93515"
|
|
53
53
|
MerchantKeysNotConfigured = "93516"
|
|
54
54
|
CertificateInvalid = "93517"
|
|
55
|
+
CertificateMismatch = "93519"
|
|
56
|
+
InvalidToken = "83520"
|
|
57
|
+
PrivateKeyMismatch = "93521"
|
|
58
|
+
KeyMismatchStoringCertificate = "93522"
|
|
55
59
|
end
|
|
56
60
|
|
|
57
61
|
# See http://www.braintreepayments.com/docs/ruby/credit_cards/validations
|
|
@@ -81,6 +85,7 @@ module Braintree
|
|
|
81
85
|
NumberLengthIsInvalid = "81716"
|
|
82
86
|
NumberMustBeTestNumber = "81717"
|
|
83
87
|
PaymentMethodConflict = "81725"
|
|
88
|
+
PaymentMethodIsNotACreditCard = "91738"
|
|
84
89
|
PaymentMethodNonceCardTypeIsNotAccepted = "91734"
|
|
85
90
|
PaymentMethodNonceConsumed = "91731"
|
|
86
91
|
PaymentMethodNonceLocked = "91733"
|
|
@@ -96,8 +101,11 @@ module Braintree
|
|
|
96
101
|
module Options
|
|
97
102
|
UseBillingForShippingDisabled = "91572"
|
|
98
103
|
UpdateExistingTokenIsInvalid = "91723"
|
|
99
|
-
VerificationMerchantAccountIdIsInvalid = "91728"
|
|
100
104
|
UpdateExistingTokenNotAllowed = "91729"
|
|
105
|
+
VerificationMerchantAccountIdIsInvalid = "91728"
|
|
106
|
+
VerificationAmountCannotBeNegative = "91739"
|
|
107
|
+
VerificationAmountFormatIsInvalid = "91740"
|
|
108
|
+
VerificationAmountNotSupportedByProcessor = "91741"
|
|
101
109
|
end
|
|
102
110
|
end
|
|
103
111
|
|
|
@@ -143,6 +151,32 @@ module Braintree
|
|
|
143
151
|
PayPalAccountsAreNotAccepted = "82904"
|
|
144
152
|
PayPalCommunicationError = "92910"
|
|
145
153
|
TokenIsInUse = "92906"
|
|
154
|
+
AuthExpired = "92911"
|
|
155
|
+
CannotHaveFundingSourceWithoutAccessToken = "92912"
|
|
156
|
+
InvalidFundingSourceSelection = "92913"
|
|
157
|
+
CannotUpdatePayPalAccountUsingPaymentMethodNonce = "92914"
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
module SEPABankAccount
|
|
161
|
+
IBANIsRequired = "93001"
|
|
162
|
+
BICIsRequired = "93002"
|
|
163
|
+
AccountHolderNameIsRequired = "93003"
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
module SEPAMandate
|
|
167
|
+
AccountHolderNameIsRequired = "83301"
|
|
168
|
+
BICIsRequired = "83302"
|
|
169
|
+
IBANIsRequired = "83303"
|
|
170
|
+
TypeIsRequired = "93304"
|
|
171
|
+
IBANInvalidCharacter = "83305"
|
|
172
|
+
BICInvalidCharacter = "83306"
|
|
173
|
+
BICLengthIsInvalid = "83307"
|
|
174
|
+
BICUnsupportedCountry = "83308"
|
|
175
|
+
IBANUnsupportedCountry = "83309"
|
|
176
|
+
IBANInvalidFormat = "83310"
|
|
177
|
+
LocaleIsUnsupported = "93311"
|
|
178
|
+
BillingAddressIsInvalid = "93312"
|
|
179
|
+
TypeIsInvalid = "93313"
|
|
146
180
|
end
|
|
147
181
|
|
|
148
182
|
# See http://www.braintreepayments.com/docs/ruby/subscriptions/validations
|
|
@@ -260,6 +294,7 @@ module Braintree
|
|
|
260
294
|
PaymentMethodTokenCardTypeIsNotAccepted = "91517"
|
|
261
295
|
PaymentMethodTokenIsInvalid = "91518"
|
|
262
296
|
PaymentInstrumentNotSupportedByMerchantAccount = "91577"
|
|
297
|
+
PayPalAuthExpired = "91579"
|
|
263
298
|
PayPalNotEnabled = "91576"
|
|
264
299
|
ProcessorAuthorizationCodeCannotBeSet = "91519"
|
|
265
300
|
ProcessorAuthorizationCodeIsInvalid = "81520"
|
|
@@ -273,8 +308,10 @@ module Braintree
|
|
|
273
308
|
ServiceFeeAmountIsTooLarge = "91556"
|
|
274
309
|
ServiceFeeAmountNotAllowedOnMasterMerchantAccount = "91557"
|
|
275
310
|
ServiceFeeIsNotAllowedOnCredits = "91552"
|
|
311
|
+
ServiceFeeNotAcceptedForPayPal = "91578"
|
|
276
312
|
SettlementAmountIsLessThanServiceFeeAmount = "91551"
|
|
277
313
|
SettlementAmountIsTooLarge = "91522"
|
|
314
|
+
ShippingAddressDoesntMatchCustomer = "91581"
|
|
278
315
|
SubMerchantAccountRequiresServiceFeeAmount = "91553"
|
|
279
316
|
SubscriptionDoesNotBelongToCustomer = "91529"
|
|
280
317
|
SubscriptionIdIsInvalid = "91528"
|
|
@@ -292,15 +329,22 @@ module Braintree
|
|
|
292
329
|
module Options
|
|
293
330
|
SubmitForSettlementIsRequiredForCloning = "91544"
|
|
294
331
|
VaultIsDisabled = "91525"
|
|
332
|
+
|
|
333
|
+
module PayPal
|
|
334
|
+
CustomFieldTooLong = "91580"
|
|
335
|
+
end
|
|
295
336
|
end
|
|
296
337
|
|
|
297
338
|
module Industry
|
|
339
|
+
IndustryTypeIsInvalid = "93401"
|
|
340
|
+
|
|
298
341
|
module Lodging
|
|
299
342
|
EmptyData = "93402"
|
|
300
343
|
FolioNumberIsInvalid = "93403"
|
|
301
344
|
CheckInDateIsInvalid = "93404"
|
|
302
345
|
CheckOutDateIsInvalid = "93405"
|
|
303
346
|
CheckOutDateMustFollowCheckInDate = "93406"
|
|
347
|
+
UnknownDataField = "93407"
|
|
304
348
|
end
|
|
305
349
|
|
|
306
350
|
module TravelCruise
|
|
@@ -435,14 +479,18 @@ module Braintree
|
|
|
435
479
|
ProxyMerchantDoesNotExist = "92805"
|
|
436
480
|
VerifyCardRequiresCustomerId = "92802"
|
|
437
481
|
UnsupportedVersion = "92806"
|
|
482
|
+
MerchantAccountDoesNotExist = "92807"
|
|
438
483
|
end
|
|
439
484
|
|
|
440
485
|
module PaymentMethod
|
|
486
|
+
PaymentMethodNonceConsumed = "93106"
|
|
441
487
|
CustomerIdIsInvalid = "93105"
|
|
442
488
|
CustomerIdIsRequired = "93104"
|
|
443
489
|
NonceIsInvalid = "93102"
|
|
444
490
|
NonceIsRequired = "93103"
|
|
445
491
|
PaymentMethodParamsAreRequired = "93101"
|
|
492
|
+
PaymentMethodNonceUnknown = "93108"
|
|
493
|
+
PaymentMethodNonceLocked = "93109"
|
|
446
494
|
CannotForwardPaymentMethodType = "93107"
|
|
447
495
|
end
|
|
448
496
|
|
|
@@ -16,6 +16,8 @@ module Braintree
|
|
|
16
16
|
SuccessfulResult.new(:payment_method => CreditCard._new(@gateway, response[:credit_card]))
|
|
17
17
|
elsif response[:paypal_account]
|
|
18
18
|
SuccessfulResult.new(:payment_method => PayPalAccount._new(@gateway, response[:paypal_account]))
|
|
19
|
+
elsif response[:coinbase_account]
|
|
20
|
+
SuccessfulResult.new(:payment_method => CoinbaseAccount._new(@gateway, response[:coinbase_account]))
|
|
19
21
|
elsif response[:sepa_bank_account]
|
|
20
22
|
SuccessfulResult.new(:payment_method => SEPABankAccount._new(@gateway, response[:sepa_bank_account]))
|
|
21
23
|
elsif response[:apple_pay_card]
|
|
@@ -40,6 +42,8 @@ module Braintree
|
|
|
40
42
|
CreditCard._new(@gateway, response[:credit_card])
|
|
41
43
|
elsif response.has_key?(:paypal_account)
|
|
42
44
|
PayPalAccount._new(@gateway, response[:paypal_account])
|
|
45
|
+
elsif response[:coinbase_account]
|
|
46
|
+
SuccessfulResult.new(:payment_method => CoinbaseAccount._new(@gateway, response[:coinbase_account]))
|
|
43
47
|
elsif response.has_key?(:sepa_bank_account)
|
|
44
48
|
SEPABankAccount._new(@gateway, response[:sepa_bank_account])
|
|
45
49
|
elsif response.has_key?(:apple_pay_card)
|
|
@@ -3,6 +3,13 @@ module Braintree
|
|
|
3
3
|
class Subscription
|
|
4
4
|
include BaseModule
|
|
5
5
|
|
|
6
|
+
module Source
|
|
7
|
+
Api = "api"
|
|
8
|
+
ControlPanel = "control_panel"
|
|
9
|
+
Recurring = "recurring"
|
|
10
|
+
Unrecognized = "unrecognized"
|
|
11
|
+
end
|
|
12
|
+
|
|
6
13
|
module Status
|
|
7
14
|
Active = 'Active'
|
|
8
15
|
Canceled = 'Canceled'
|
|
@@ -30,6 +37,7 @@ module Braintree
|
|
|
30
37
|
attr_reader :descriptor
|
|
31
38
|
attr_reader :current_billing_cycle
|
|
32
39
|
attr_reader :updated_at, :created_at
|
|
40
|
+
attr_reader :status_history
|
|
33
41
|
|
|
34
42
|
# See http://www.braintreepayments.com/docs/ruby/subscriptions/cancel
|
|
35
43
|
def self.cancel(subscription_id)
|
|
@@ -77,6 +85,7 @@ module Braintree
|
|
|
77
85
|
transactions.map! { |attrs| Transaction._new(gateway, attrs) }
|
|
78
86
|
add_ons.map! { |attrs| AddOn._new(attrs) }
|
|
79
87
|
discounts.map! { |attrs| Discount._new(attrs) }
|
|
88
|
+
@status_history = attributes[:status_history] ? attributes[:status_history].map { |s| StatusDetails.new(s) } : []
|
|
80
89
|
end
|
|
81
90
|
|
|
82
91
|
def next_bill_amount
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class Subscription
|
|
3
|
+
class StatusDetails # :nodoc:
|
|
4
|
+
include BaseModule
|
|
5
|
+
|
|
6
|
+
attr_reader :balance, :price, :status, :subscription_source, :timestamp, :user
|
|
7
|
+
|
|
8
|
+
def initialize(attributes)
|
|
9
|
+
set_instance_variables_from_hash attributes unless attributes.nil?
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
data/lib/braintree/test/nonce.rb
CHANGED
|
@@ -83,6 +83,7 @@ module Braintree
|
|
|
83
83
|
attr_reader :billing_details, :shipping_details
|
|
84
84
|
attr_reader :paypal_details
|
|
85
85
|
attr_reader :apple_pay_details
|
|
86
|
+
attr_reader :coinbase_details
|
|
86
87
|
attr_reader :plan_id
|
|
87
88
|
# The authorization code from the processor.
|
|
88
89
|
attr_reader :processor_authorization_code
|
|
@@ -246,6 +247,7 @@ module Braintree
|
|
|
246
247
|
@descriptor = Descriptor.new(@descriptor)
|
|
247
248
|
@paypal_details = PayPalDetails.new(@paypal)
|
|
248
249
|
@apple_pay_details = ApplePayDetails.new(@apple_pay)
|
|
250
|
+
@coinbase_details = CoinbaseDetails.new(@coinbase_account)
|
|
249
251
|
disputes.map! { |attrs| Dispute._new(attrs) } if disputes
|
|
250
252
|
@custom_fields = attributes[:custom_fields].is_a?(Hash) ? attributes[:custom_fields] : {}
|
|
251
253
|
add_ons.map! { |attrs| AddOn._new(attrs) } if add_ons
|
|
@@ -4,7 +4,7 @@ module Braintree
|
|
|
4
4
|
include BaseModule
|
|
5
5
|
|
|
6
6
|
attr_reader :card_type, :last_4, :expiration_month, :expiration_year,
|
|
7
|
-
:cardholder_name
|
|
7
|
+
:cardholder_name, :payment_instrument_name
|
|
8
8
|
|
|
9
9
|
def initialize(attributes)
|
|
10
10
|
set_instance_variables_from_hash attributes unless attributes.nil?
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class Transaction
|
|
3
|
+
class CoinbaseDetails
|
|
4
|
+
include BaseModule
|
|
5
|
+
|
|
6
|
+
attr_reader :user_id, :user_name, :user_email, :token
|
|
7
|
+
|
|
8
|
+
def initialize(attributes)
|
|
9
|
+
set_instance_variables_from_hash attributes unless attributes.nil?
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
data/lib/braintree/version.rb
CHANGED
data/spec/httpsd.pid
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
26274
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
|
2
|
+
|
|
3
|
+
describe "Coinbase" do
|
|
4
|
+
|
|
5
|
+
def assert_valid_coinbase_attrs(account_or_details)
|
|
6
|
+
[:user_id, :user_name, :user_email].each do |attr|
|
|
7
|
+
[nil,""].should_not include(account_or_details.send(attr))
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "works for transaction#create" do
|
|
12
|
+
result = Braintree::Transaction.sale(:payment_method_nonce => Braintree::Test::Nonce::Coinbase, :amount => "0.02")
|
|
13
|
+
result.should be_success
|
|
14
|
+
assert_valid_coinbase_attrs(result.transaction.coinbase_details)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "works for vaulting" do
|
|
18
|
+
customer = Braintree::Customer.create!
|
|
19
|
+
vaulted = Braintree::PaymentMethod.create(:customer_id => customer.id, :payment_method_nonce => Braintree::Test::Nonce::Coinbase).payment_method
|
|
20
|
+
assert_valid_coinbase_attrs(vaulted)
|
|
21
|
+
|
|
22
|
+
found = Braintree::PaymentMethod.find(vaulted.token).payment_method
|
|
23
|
+
assert_valid_coinbase_attrs(found)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "is returned on Customers" do
|
|
27
|
+
customer = Braintree::Customer.create!(:payment_method_nonce => Braintree::Test::Nonce::Coinbase)
|
|
28
|
+
customer.payment_methods.should == customer.coinbase_accounts
|
|
29
|
+
assert_valid_coinbase_attrs(customer.coinbase_accounts[0])
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -756,6 +756,7 @@ describe Braintree::Customer do
|
|
|
756
756
|
apple_pay_card.should be_a Braintree::ApplePayCard
|
|
757
757
|
apple_pay_card.token.should_not be_nil
|
|
758
758
|
apple_pay_card.expiration_year.should_not be_nil
|
|
759
|
+
apple_pay_card.payment_instrument_name.should == "AmEx 41002"
|
|
759
760
|
end
|
|
760
761
|
|
|
761
762
|
it "works for a blank customer" do
|
|
@@ -216,7 +216,7 @@ describe Braintree::Http do
|
|
|
216
216
|
context = OpenSSL::X509::StoreContext.new(OpenSSL::X509::Store.new)
|
|
217
217
|
expect do
|
|
218
218
|
Braintree::Configuration.instantiate.http._verify_ssl_certificate(true, context)
|
|
219
|
-
end.to_not raise_error
|
|
219
|
+
end.to_not raise_error
|
|
220
220
|
output.string.should == ""
|
|
221
221
|
ensure
|
|
222
222
|
Braintree::Configuration.logger = old_logger
|
|
@@ -86,6 +86,7 @@ describe Braintree::PaymentMethod do
|
|
|
86
86
|
apple_pay_card.should_not be_nil
|
|
87
87
|
apple_pay_card.token.should == token
|
|
88
88
|
apple_pay_card.card_type.should == Braintree::ApplePayCard::CardType::AmEx
|
|
89
|
+
apple_pay_card.payment_instrument_name.should == "AmEx 41002"
|
|
89
90
|
apple_pay_card.default.should == true
|
|
90
91
|
apple_pay_card.image_url.should =~ /apple_pay/
|
|
91
92
|
apple_pay_card.expiration_month.to_i.should > 0
|
|
@@ -38,6 +38,10 @@ describe Braintree::Subscription do
|
|
|
38
38
|
result.subscription.next_bill_amount.should == "12.34"
|
|
39
39
|
result.subscription.next_billing_period_amount.should == "12.34"
|
|
40
40
|
result.subscription.payment_method_token.should == @credit_card.token
|
|
41
|
+
|
|
42
|
+
result.subscription.status_history.first.price.should == "12.34"
|
|
43
|
+
result.subscription.status_history.first.status.should == Braintree::Subscription::Status::Active
|
|
44
|
+
result.subscription.status_history.first.subscription_source.should == Braintree::Subscription::Source::Api
|
|
41
45
|
end
|
|
42
46
|
|
|
43
47
|
it "returns a transaction with billing period populated" do
|
|
@@ -305,7 +309,7 @@ describe Braintree::Subscription do
|
|
|
305
309
|
:price => Braintree::Test::TransactionAmounts::Decline
|
|
306
310
|
)
|
|
307
311
|
|
|
308
|
-
result.success?.should
|
|
312
|
+
result.success?.should be(false)
|
|
309
313
|
result.transaction.status.should == Braintree::Transaction::Status::ProcessorDeclined
|
|
310
314
|
result.message.should == "Do Not Honor"
|
|
311
315
|
end
|
|
@@ -417,14 +421,14 @@ describe Braintree::Subscription do
|
|
|
417
421
|
add_ons.first.amount.should == BigDecimal.new("10.00")
|
|
418
422
|
add_ons.first.quantity.should == 1
|
|
419
423
|
add_ons.first.number_of_billing_cycles.should be_nil
|
|
420
|
-
add_ons.first.never_expires?.should
|
|
424
|
+
add_ons.first.never_expires?.should be(true)
|
|
421
425
|
add_ons.first.current_billing_cycle.should == 0
|
|
422
426
|
|
|
423
427
|
add_ons.last.id.should == "increase_20"
|
|
424
428
|
add_ons.last.amount.should == BigDecimal.new("20.00")
|
|
425
429
|
add_ons.last.quantity.should == 1
|
|
426
430
|
add_ons.last.number_of_billing_cycles.should be_nil
|
|
427
|
-
add_ons.last.never_expires?.should
|
|
431
|
+
add_ons.last.never_expires?.should be(true)
|
|
428
432
|
add_ons.last.current_billing_cycle.should == 0
|
|
429
433
|
|
|
430
434
|
subscription.discounts.size.should == 2
|
|
@@ -434,14 +438,14 @@ describe Braintree::Subscription do
|
|
|
434
438
|
discounts.first.amount.should == BigDecimal.new("11.00")
|
|
435
439
|
discounts.first.quantity.should == 1
|
|
436
440
|
discounts.first.number_of_billing_cycles.should be_nil
|
|
437
|
-
discounts.first.never_expires?.should
|
|
441
|
+
discounts.first.never_expires?.should be(true)
|
|
438
442
|
discounts.first.current_billing_cycle.should == 0
|
|
439
443
|
|
|
440
444
|
discounts.last.id.should == "discount_7"
|
|
441
445
|
discounts.last.amount.should == BigDecimal.new("7.00")
|
|
442
446
|
discounts.last.quantity.should == 1
|
|
443
447
|
discounts.last.number_of_billing_cycles.should be_nil
|
|
444
|
-
discounts.last.never_expires?.should
|
|
448
|
+
discounts.last.never_expires?.should be(true)
|
|
445
449
|
discounts.last.current_billing_cycle.should == 0
|
|
446
450
|
end
|
|
447
451
|
|
|
@@ -481,7 +485,7 @@ describe Braintree::Subscription do
|
|
|
481
485
|
add_ons.first.amount.should == BigDecimal.new("50.00")
|
|
482
486
|
add_ons.first.quantity.should == 2
|
|
483
487
|
add_ons.first.number_of_billing_cycles.should == 5
|
|
484
|
-
add_ons.first.never_expires?.should
|
|
488
|
+
add_ons.first.never_expires?.should be(false)
|
|
485
489
|
add_ons.first.current_billing_cycle.should == 0
|
|
486
490
|
|
|
487
491
|
add_ons.last.id.should == "increase_20"
|
|
@@ -501,7 +505,7 @@ describe Braintree::Subscription do
|
|
|
501
505
|
discounts.last.amount.should == BigDecimal.new("15.00")
|
|
502
506
|
discounts.last.quantity.should == 3
|
|
503
507
|
discounts.last.number_of_billing_cycles.should be_nil
|
|
504
|
-
discounts.last.never_expires?.should
|
|
508
|
+
discounts.last.never_expires?.should be(true)
|
|
505
509
|
discounts.last.current_billing_cycle.should == 0
|
|
506
510
|
end
|
|
507
511
|
|
|
@@ -947,7 +951,7 @@ describe Braintree::Subscription do
|
|
|
947
951
|
|
|
948
952
|
result.success?.should == true
|
|
949
953
|
result.subscription.number_of_billing_cycles.should == nil
|
|
950
|
-
result.subscription.never_expires?.should
|
|
954
|
+
result.subscription.never_expires?.should be(true)
|
|
951
955
|
end
|
|
952
956
|
end
|
|
953
957
|
|