braintree 2.104.0 → 4.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/braintree.gemspec +7 -4
- data/lib/braintree/account_updater_daily_report.rb +1 -1
- data/lib/braintree/address.rb +2 -23
- data/lib/braintree/apple_pay.rb +1 -1
- data/lib/braintree/apple_pay_card.rb +11 -1
- data/lib/braintree/apple_pay_options.rb +1 -1
- data/lib/braintree/authorization_adjustment.rb +1 -1
- data/lib/braintree/base_module.rb +6 -0
- data/lib/braintree/bin_data.rb +9 -2
- data/lib/braintree/client_token.rb +1 -1
- data/lib/braintree/configuration.rb +12 -12
- data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
- data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
- data/lib/braintree/credit_card.rb +2 -77
- data/lib/braintree/credit_card_gateway.rb +17 -36
- data/lib/braintree/credit_card_verification.rb +18 -5
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +9 -78
- data/lib/braintree/customer_gateway.rb +2 -23
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/disbursement.rb +1 -1
- data/lib/braintree/{transaction/coinbase_details.rb → dispute/paypal_message.rb} +5 -6
- data/lib/braintree/dispute/{history_event.rb → status_history.rb} +3 -1
- data/lib/braintree/dispute.rb +32 -8
- data/lib/braintree/dispute_gateway.rb +4 -9
- data/lib/braintree/dispute_search.rb +6 -3
- data/lib/braintree/document_upload.rb +1 -1
- data/lib/braintree/enriched_customer_data.rb +21 -0
- data/lib/braintree/error_codes.rb +150 -171
- data/lib/braintree/exceptions.rb +5 -3
- data/lib/braintree/exchange_rate.rb +13 -0
- data/lib/braintree/exchange_rate_quote.rb +24 -0
- data/lib/braintree/exchange_rate_quote_gateway.rb +35 -0
- data/lib/braintree/exchange_rate_quote_input.rb +21 -0
- data/lib/braintree/exchange_rate_quote_request.rb +18 -0
- data/lib/braintree/exchange_rate_quote_response.rb +18 -0
- data/lib/braintree/gateway.rb +4 -14
- data/lib/braintree/{android_pay_card.rb → google_pay_card.rb} +11 -3
- data/lib/braintree/granted_payment_instrument_update.rb +1 -1
- data/lib/braintree/graphql_client.rb +7 -7
- data/lib/braintree/http.rb +4 -3
- data/lib/braintree/local_payment_completed.rb +2 -2
- data/lib/braintree/local_payment_expired.rb +21 -0
- data/lib/braintree/local_payment_funded.rb +22 -0
- data/lib/braintree/local_payment_reversed.rb +19 -0
- data/lib/braintree/merchant.rb +1 -1
- data/lib/braintree/merchant_account.rb +1 -1
- data/lib/braintree/merchant_account_gateway.rb +3 -1
- data/lib/braintree/merchant_gateway.rb +1 -1
- data/lib/braintree/modification.rb +1 -1
- data/lib/braintree/oauth_credentials.rb +1 -1
- data/lib/braintree/oauth_gateway.rb +5 -5
- data/lib/braintree/payment_instrument_type.rb +10 -14
- data/lib/braintree/payment_method_customer_data_updated_metadata.rb +24 -0
- data/lib/braintree/payment_method_gateway.rb +15 -17
- data/lib/braintree/payment_method_nonce.rb +7 -4
- data/lib/braintree/payment_method_nonce_details.rb +37 -0
- data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
- data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
- data/lib/braintree/payment_method_parser.rb +1 -8
- data/lib/braintree/plan.rb +21 -1
- data/lib/braintree/plan_gateway.rb +100 -0
- data/lib/braintree/processor_response_types.rb +3 -3
- data/lib/braintree/resource_collection.rb +8 -3
- data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
- data/lib/braintree/risk_data/liability_shift.rb +22 -0
- data/lib/braintree/risk_data.rb +5 -1
- data/lib/braintree/samsung_pay_card.rb +1 -1
- data/lib/braintree/settlement_batch_summary.rb +2 -2
- data/lib/braintree/subscription.rb +11 -11
- data/lib/braintree/successful_result.rb +3 -2
- data/lib/braintree/test/credit_card.rb +1 -0
- data/lib/braintree/test/nonce.rb +4 -23
- data/lib/braintree/three_d_secure_info.rb +22 -12
- 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/adjustment.rb +33 -0
- data/lib/braintree/transaction/installment.rb +28 -0
- data/lib/braintree/transaction/paypal_details.rb +3 -0
- data/lib/braintree/transaction/subscription_details.rb +2 -0
- data/lib/braintree/transaction.rb +65 -120
- data/lib/braintree/transaction_gateway.rb +39 -27
- data/lib/braintree/transaction_line_item.rb +1 -1
- data/lib/braintree/transaction_review.rb +18 -0
- data/lib/braintree/transaction_search.rb +5 -3
- data/lib/braintree/unknown_payment_method.rb +1 -1
- data/lib/braintree/us_bank_account.rb +3 -3
- data/lib/braintree/us_bank_account_verification.rb +1 -1
- data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
- data/lib/braintree/util.rb +21 -6
- data/lib/braintree/venmo_account.rb +1 -1
- data/lib/braintree/venmo_profile_data.rb +23 -0
- data/lib/braintree/version.rb +2 -2
- data/lib/braintree/visa_checkout_card.rb +2 -2
- data/lib/braintree/webhook_notification.rb +44 -30
- data/lib/braintree/webhook_notification_gateway.rb +5 -5
- data/lib/braintree/webhook_testing_gateway.rb +104 -43
- data/lib/braintree/xml/generator.rb +5 -4
- data/lib/braintree/xml/parser.rb +22 -35
- data/lib/braintree/xml/rexml.rb +4 -5
- data/lib/braintree.rb +28 -23
- data/spec/integration/braintree/add_on_spec.rb +1 -1
- data/spec/integration/braintree/address_spec.rb +30 -113
- data/spec/integration/braintree/advanced_search_spec.rb +45 -45
- data/spec/integration/braintree/apple_pay_spec.rb +3 -3
- data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
- data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
- data/spec/integration/braintree/client_api/spec_helper.rb +5 -31
- data/spec/integration/braintree/credit_card_spec.rb +219 -593
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
- data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
- data/spec/integration/braintree/customer_search_spec.rb +8 -8
- data/spec/integration/braintree/customer_spec.rb +484 -513
- data/spec/integration/braintree/dispute_search_spec.rb +35 -6
- data/spec/integration/braintree/dispute_spec.rb +6 -7
- data/spec/integration/braintree/error_codes_spec.rb +1 -1
- data/spec/integration/braintree/exchange_rate_quote_spec.rb +97 -0
- data/spec/integration/braintree/graphql_client_spec.rb +0 -2
- data/spec/integration/braintree/http_spec.rb +2 -2
- data/spec/integration/braintree/merchant_account_spec.rb +28 -29
- data/spec/integration/braintree/merchant_spec.rb +14 -14
- data/spec/integration/braintree/oauth_spec.rb +11 -11
- data/spec/integration/braintree/payment_method_nonce_spec.rb +29 -35
- data/spec/integration/braintree/payment_method_spec.rb +535 -270
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +17 -13
- data/spec/integration/braintree/paypal_account_spec.rb +28 -28
- data/spec/integration/braintree/plan_spec.rb +82 -0
- data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
- data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
- data/spec/integration/braintree/subscription_spec.rb +144 -149
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
- data/spec/integration/braintree/test_transaction_spec.rb +10 -10
- data/spec/integration/braintree/transaction_search_spec.rb +175 -70
- data/spec/integration/braintree/transaction_spec.rb +955 -894
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -26
- data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
- data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
- data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
- data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
- data/spec/integration/spec_helper.rb +16 -7
- data/spec/oauth_test_helper.rb +1 -1
- data/spec/script/httpsd.rb +6 -6
- data/spec/spec_helper.rb +8 -14
- data/spec/unit/braintree/address_spec.rb +1 -9
- data/spec/unit/braintree/apple_pay_card_spec.rb +7 -1
- data/spec/unit/braintree/client_token_spec.rb +2 -2
- data/spec/unit/braintree/configuration_spec.rb +42 -42
- data/spec/unit/braintree/credit_card_spec.rb +13 -32
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
- data/spec/unit/braintree/customer_spec.rb +21 -22
- data/spec/unit/braintree/disbursement_spec.rb +7 -7
- data/spec/unit/braintree/dispute_search_spec.rb +3 -0
- data/spec/unit/braintree/dispute_spec.rb +75 -21
- data/spec/unit/braintree/enriched_customer_data_spec.rb +32 -0
- data/spec/unit/braintree/error_result_spec.rb +5 -5
- data/spec/unit/braintree/errors_spec.rb +8 -8
- data/spec/unit/braintree/exchange_rate_quote_input_spec.rb +42 -0
- data/spec/unit/braintree/exchange_rate_quote_request_spec.rb +82 -0
- data/spec/unit/braintree/exchange_rate_quote_response_spec.rb +52 -0
- data/spec/unit/braintree/exchange_rate_quote_spec.rb +42 -0
- data/spec/unit/braintree/exchange_rate_spec.rb +23 -0
- data/spec/unit/braintree/http_spec.rb +10 -8
- data/spec/unit/braintree/local_payment_completed_spec.rb +14 -0
- data/spec/unit/braintree/local_payment_expired_spec.rb +24 -0
- data/spec/unit/braintree/local_payment_funded_spec.rb +34 -0
- data/spec/unit/braintree/merchant_account_spec.rb +1 -1
- data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +45 -0
- data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
- data/spec/unit/braintree/payment_method_nonce_details_spec.rb +43 -0
- data/spec/unit/braintree/payment_method_nonce_spec.rb +40 -0
- data/spec/unit/braintree/payment_method_spec.rb +1 -1
- data/spec/unit/braintree/paypal_account_spec.rb +2 -2
- data/spec/unit/braintree/resource_collection_spec.rb +30 -1
- data/spec/unit/braintree/risk_data/liability_shift.rb +26 -0
- data/spec/unit/braintree/risk_data_spec.rb +38 -8
- data/spec/unit/braintree/subscription_search_spec.rb +1 -1
- data/spec/unit/braintree/successful_result_spec.rb +1 -1
- data/spec/unit/braintree/three_d_secure_info_spec.rb +32 -14
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
- data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
- data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +7 -1
- data/spec/unit/braintree/transaction_search_spec.rb +12 -12
- data/spec/unit/braintree/transaction_spec.rb +36 -54
- data/spec/unit/braintree/util_spec.rb +55 -21
- data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
- data/spec/unit/braintree/venmo_profile_data_spec.rb +32 -0
- data/spec/unit/braintree/webhook_notification_spec.rb +166 -57
- data/spec/unit/braintree/xml/parser_spec.rb +21 -16
- data/spec/unit/braintree/xml_spec.rb +31 -31
- metadata +62 -30
- data/lib/braintree/amex_express_checkout_card.rb +0 -40
- data/lib/braintree/coinbase_account.rb +0 -34
- data/lib/braintree/europe_bank_account.rb +0 -36
- data/lib/braintree/europe_bank_account_gateway.rb +0 -17
- data/lib/braintree/ideal_payment.rb +0 -61
- data/lib/braintree/ideal_payment_gateway.rb +0 -19
- data/lib/braintree/masterpass_card.rb +0 -83
- data/lib/braintree/settlement_batch.rb +0 -0
- data/lib/braintree/transaction/amex_express_checkout_details.rb +0 -21
- data/lib/braintree/transaction/ideal_payment_details.rb +0 -19
- data/lib/braintree/transaction/masterpass_card_details.rb +0 -49
- data/lib/braintree/transparent_redirect.rb +0 -40
- data/lib/braintree/transparent_redirect_gateway.rb +0 -105
- data/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
@@ -8,7 +8,7 @@ describe Braintree::Subscription do
|
|
8
8
|
:credit_card => {
|
9
9
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
10
10
|
:expiration_date => "05/2010"
|
11
|
-
}
|
11
|
+
},
|
12
12
|
).credit_cards[0]
|
13
13
|
end
|
14
14
|
|
@@ -16,26 +16,24 @@ describe Braintree::Subscription do
|
|
16
16
|
it "is successful with a minimum of params" do
|
17
17
|
result = Braintree::Subscription.create(
|
18
18
|
:payment_method_token => @credit_card.token,
|
19
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
19
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
20
20
|
)
|
21
21
|
|
22
|
-
date_format = /^\d{4}\D\d{1,2}\D\d{1,2}$/
|
23
22
|
result.success?.should == true
|
24
23
|
result.subscription.id.should =~ /^\w{6}$/
|
25
24
|
result.subscription.status.should == Braintree::Subscription::Status::Active
|
26
25
|
result.subscription.plan_id.should == "integration_trialless_plan"
|
27
26
|
|
28
|
-
result.subscription.first_billing_date.
|
29
|
-
result.subscription.next_billing_date.
|
30
|
-
result.subscription.billing_period_start_date.
|
31
|
-
result.subscription.billing_period_end_date.
|
32
|
-
result.subscription.paid_through_date.
|
27
|
+
expect(result.subscription.first_billing_date).to be_a Date
|
28
|
+
expect(result.subscription.next_billing_date).to be_a Date
|
29
|
+
expect(result.subscription.billing_period_start_date).to be_a Date
|
30
|
+
expect(result.subscription.billing_period_end_date).to be_a Date
|
31
|
+
expect(result.subscription.paid_through_date).to be_a Date
|
33
32
|
|
34
33
|
result.subscription.created_at.between?(Time.now - 60, Time.now).should == true
|
35
34
|
result.subscription.updated_at.between?(Time.now - 60, Time.now).should == true
|
36
35
|
|
37
36
|
result.subscription.failure_count.should == 0
|
38
|
-
result.subscription.next_bill_amount.should == "12.34"
|
39
37
|
result.subscription.next_billing_period_amount.should == "12.34"
|
40
38
|
result.subscription.payment_method_token.should == @credit_card.token
|
41
39
|
|
@@ -49,7 +47,7 @@ describe Braintree::Subscription do
|
|
49
47
|
it "returns a transaction with billing period populated" do
|
50
48
|
result = Braintree::Subscription.create(
|
51
49
|
:payment_method_token => @credit_card.token,
|
52
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
50
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
53
51
|
)
|
54
52
|
|
55
53
|
result.success?.should == true
|
@@ -65,10 +63,9 @@ describe Braintree::Subscription do
|
|
65
63
|
result = Braintree::Subscription.create(
|
66
64
|
:payment_method_token => @credit_card.token,
|
67
65
|
:plan_id => SpecHelper::TrialPlan[:id],
|
68
|
-
:id => new_id
|
66
|
+
:id => new_id,
|
69
67
|
)
|
70
68
|
|
71
|
-
date_format = /^\d{4}\D\d{1,2}\D\d{1,2}$/
|
72
69
|
result.success?.should == true
|
73
70
|
result.subscription.id.should == new_id
|
74
71
|
end
|
@@ -83,11 +80,11 @@ describe Braintree::Subscription do
|
|
83
80
|
},
|
84
81
|
:client_token_options => {
|
85
82
|
:customer_id => @credit_card.customer_id
|
86
|
-
}
|
83
|
+
},
|
87
84
|
)
|
88
85
|
result = Braintree::Subscription.create(
|
89
86
|
:payment_method_nonce => nonce,
|
90
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
87
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
91
88
|
)
|
92
89
|
|
93
90
|
result.success?.should == true
|
@@ -100,12 +97,12 @@ describe Braintree::Subscription do
|
|
100
97
|
customer = Braintree::Customer.create!
|
101
98
|
payment_method_result = Braintree::PaymentMethod.create(
|
102
99
|
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment,
|
103
|
-
:customer_id => customer.id
|
100
|
+
:customer_id => customer.id,
|
104
101
|
)
|
105
102
|
|
106
103
|
result = Braintree::Subscription.create(
|
107
104
|
:payment_method_token => payment_method_result.payment_method.token,
|
108
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
105
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
109
106
|
)
|
110
107
|
|
111
108
|
result.should be_success
|
@@ -117,7 +114,7 @@ describe Braintree::Subscription do
|
|
117
114
|
customer = Braintree::Customer.create!
|
118
115
|
payment_method_result = Braintree::PaymentMethod.create(
|
119
116
|
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment,
|
120
|
-
:customer_id => customer.id
|
117
|
+
:customer_id => customer.id,
|
121
118
|
)
|
122
119
|
|
123
120
|
result = Braintree::Subscription.create(
|
@@ -142,11 +139,11 @@ describe Braintree::Subscription do
|
|
142
139
|
customer = Braintree::Customer.create!
|
143
140
|
result = Braintree::Subscription.create(
|
144
141
|
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment,
|
145
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
142
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
146
143
|
)
|
147
144
|
|
148
145
|
result.should_not be_success
|
149
|
-
result.errors.for(:subscription).on(:payment_method_nonce).first.code.should ==
|
146
|
+
result.errors.for(:subscription).on(:payment_method_nonce).first.code.should == "91925"
|
150
147
|
end
|
151
148
|
end
|
152
149
|
|
@@ -154,7 +151,7 @@ describe Braintree::Subscription do
|
|
154
151
|
it "inherits from the plan if not provided" do
|
155
152
|
result = Braintree::Subscription.create(
|
156
153
|
:payment_method_token => @credit_card.token,
|
157
|
-
:plan_id => SpecHelper::BillingDayOfMonthPlan[:id]
|
154
|
+
:plan_id => SpecHelper::BillingDayOfMonthPlan[:id],
|
158
155
|
)
|
159
156
|
|
160
157
|
result.success?.should == true
|
@@ -165,7 +162,7 @@ describe Braintree::Subscription do
|
|
165
162
|
result = Braintree::Subscription.create(
|
166
163
|
:payment_method_token => @credit_card.token,
|
167
164
|
:plan_id => SpecHelper::BillingDayOfMonthPlan[:id],
|
168
|
-
:billing_day_of_month => 25
|
165
|
+
:billing_day_of_month => 25,
|
169
166
|
)
|
170
167
|
|
171
168
|
result.success?.should == true
|
@@ -178,7 +175,7 @@ describe Braintree::Subscription do
|
|
178
175
|
:plan_id => SpecHelper::BillingDayOfMonthPlan[:id],
|
179
176
|
:options => {
|
180
177
|
:start_immediately => true
|
181
|
-
}
|
178
|
+
},
|
182
179
|
)
|
183
180
|
|
184
181
|
result.success?.should == true
|
@@ -191,11 +188,11 @@ describe Braintree::Subscription do
|
|
191
188
|
result = Braintree::Subscription.create(
|
192
189
|
:payment_method_token => @credit_card.token,
|
193
190
|
:plan_id => SpecHelper::BillingDayOfMonthPlan[:id],
|
194
|
-
:first_billing_date => Date.today + 3
|
191
|
+
:first_billing_date => Date.today + 3,
|
195
192
|
)
|
196
193
|
|
197
194
|
result.success?.should == true
|
198
|
-
result.subscription.first_billing_date.should ==
|
195
|
+
result.subscription.first_billing_date.should == Date.today + 3
|
199
196
|
result.subscription.status.should == Braintree::Subscription::Status::Pending
|
200
197
|
end
|
201
198
|
|
@@ -203,7 +200,7 @@ describe Braintree::Subscription do
|
|
203
200
|
result = Braintree::Subscription.create(
|
204
201
|
:payment_method_token => @credit_card.token,
|
205
202
|
:plan_id => SpecHelper::BillingDayOfMonthPlan[:id],
|
206
|
-
:first_billing_date => Date.today - 3
|
203
|
+
:first_billing_date => Date.today - 3,
|
207
204
|
)
|
208
205
|
|
209
206
|
result.success?.should == false
|
@@ -215,7 +212,7 @@ describe Braintree::Subscription do
|
|
215
212
|
it "defaults to the default merchant account if no merchant_account_id is provided" do
|
216
213
|
result = Braintree::Subscription.create(
|
217
214
|
:payment_method_token => @credit_card.token,
|
218
|
-
:plan_id => SpecHelper::TrialPlan[:id]
|
215
|
+
:plan_id => SpecHelper::TrialPlan[:id],
|
219
216
|
)
|
220
217
|
|
221
218
|
result.success?.should == true
|
@@ -226,7 +223,7 @@ describe Braintree::Subscription do
|
|
226
223
|
result = Braintree::Subscription.create(
|
227
224
|
:payment_method_token => @credit_card.token,
|
228
225
|
:plan_id => SpecHelper::TrialPlan[:id],
|
229
|
-
:merchant_account_id => SpecHelper::NonDefaultMerchantAccountId
|
226
|
+
:merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
|
230
227
|
)
|
231
228
|
|
232
229
|
result.success?.should == true
|
@@ -239,7 +236,7 @@ describe Braintree::Subscription do
|
|
239
236
|
result = Braintree::Subscription.create(
|
240
237
|
:payment_method_token => @credit_card.token,
|
241
238
|
:plan_id => SpecHelper::TrialPlan[:id],
|
242
|
-
:number_of_billing_cycles => 10
|
239
|
+
:number_of_billing_cycles => 10,
|
243
240
|
)
|
244
241
|
|
245
242
|
result.success?.should == true
|
@@ -250,7 +247,7 @@ describe Braintree::Subscription do
|
|
250
247
|
result = Braintree::Subscription.create(
|
251
248
|
:payment_method_token => @credit_card.token,
|
252
249
|
:plan_id => SpecHelper::TrialPlan[:id],
|
253
|
-
:never_expires => true
|
250
|
+
:never_expires => true,
|
254
251
|
)
|
255
252
|
|
256
253
|
result.success?.should == true
|
@@ -263,7 +260,7 @@ describe Braintree::Subscription do
|
|
263
260
|
it "with no trial" do
|
264
261
|
result = Braintree::Subscription.create(
|
265
262
|
:payment_method_token => @credit_card.token,
|
266
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
263
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
267
264
|
)
|
268
265
|
|
269
266
|
result.subscription.trial_period.should == false
|
@@ -274,7 +271,7 @@ describe Braintree::Subscription do
|
|
274
271
|
it "with a trial" do
|
275
272
|
result = Braintree::Subscription.create(
|
276
273
|
:payment_method_token => @credit_card.token,
|
277
|
-
:plan_id => SpecHelper::TrialPlan[:id]
|
274
|
+
:plan_id => SpecHelper::TrialPlan[:id],
|
278
275
|
)
|
279
276
|
|
280
277
|
result.subscription.trial_period.should == true
|
@@ -287,7 +284,7 @@ describe Braintree::Subscription do
|
|
287
284
|
:payment_method_token => @credit_card.token,
|
288
285
|
:plan_id => SpecHelper::TrialPlan[:id],
|
289
286
|
:trial_duration => 5,
|
290
|
-
:trial_duration_unit => Braintree::Subscription::TrialDurationUnit::Month
|
287
|
+
:trial_duration_unit => Braintree::Subscription::TrialDurationUnit::Month,
|
291
288
|
)
|
292
289
|
|
293
290
|
result.subscription.trial_period.should == true
|
@@ -299,7 +296,7 @@ describe Braintree::Subscription do
|
|
299
296
|
result = Braintree::Subscription.create(
|
300
297
|
:payment_method_token => @credit_card.token,
|
301
298
|
:plan_id => SpecHelper::TrialPlan[:id],
|
302
|
-
:trial_period => false
|
299
|
+
:trial_period => false,
|
303
300
|
)
|
304
301
|
|
305
302
|
result.subscription.trial_period.should == false
|
@@ -308,7 +305,7 @@ describe Braintree::Subscription do
|
|
308
305
|
it "doesn't create a transaction if there's a trial period" do
|
309
306
|
result = Braintree::Subscription.create(
|
310
307
|
:payment_method_token => @credit_card.token,
|
311
|
-
:plan_id => SpecHelper::TrialPlan[:id]
|
308
|
+
:plan_id => SpecHelper::TrialPlan[:id],
|
312
309
|
)
|
313
310
|
|
314
311
|
result.subscription.transactions.size.should == 0
|
@@ -319,7 +316,7 @@ describe Braintree::Subscription do
|
|
319
316
|
it "creates a transaction if no trial period" do
|
320
317
|
result = Braintree::Subscription.create(
|
321
318
|
:payment_method_token => @credit_card.token,
|
322
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
319
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
323
320
|
)
|
324
321
|
|
325
322
|
result.subscription.transactions.size.should == 1
|
@@ -333,7 +330,7 @@ describe Braintree::Subscription do
|
|
333
330
|
result = Braintree::Subscription.create(
|
334
331
|
:payment_method_token => @credit_card.token,
|
335
332
|
:plan_id => SpecHelper::TriallessPlan[:id],
|
336
|
-
:price => Braintree::Test::TransactionAmounts::Decline
|
333
|
+
:price => Braintree::Test::TransactionAmounts::Decline,
|
337
334
|
)
|
338
335
|
|
339
336
|
result.success?.should be(false)
|
@@ -346,7 +343,7 @@ describe Braintree::Subscription do
|
|
346
343
|
it "defaults to the plan's price" do
|
347
344
|
result = Braintree::Subscription.create(
|
348
345
|
:payment_method_token => @credit_card.token,
|
349
|
-
:plan_id => SpecHelper::TrialPlan[:id]
|
346
|
+
:plan_id => SpecHelper::TrialPlan[:id],
|
350
347
|
)
|
351
348
|
|
352
349
|
result.subscription.price.should == SpecHelper::TrialPlan[:price]
|
@@ -356,7 +353,7 @@ describe Braintree::Subscription do
|
|
356
353
|
result = Braintree::Subscription.create(
|
357
354
|
:payment_method_token => @credit_card.token,
|
358
355
|
:plan_id => SpecHelper::TrialPlan[:id],
|
359
|
-
:price => 98.76
|
356
|
+
:price => 98.76,
|
360
357
|
)
|
361
358
|
|
362
359
|
result.subscription.price.should == BigDecimal("98.76")
|
@@ -369,7 +366,7 @@ describe Braintree::Subscription do
|
|
369
366
|
result = Braintree::Subscription.create(
|
370
367
|
:payment_method_token => @credit_card.token,
|
371
368
|
:plan_id => SpecHelper::TrialPlan[:id],
|
372
|
-
:id => "invalid token"
|
369
|
+
:id => "invalid token",
|
373
370
|
)
|
374
371
|
result.success?.should == false
|
375
372
|
result.errors.for(:subscription).on(:id)[0].message.should == "ID is invalid (use only letters, numbers, '-', and '_')."
|
@@ -380,14 +377,14 @@ describe Braintree::Subscription do
|
|
380
377
|
result = Braintree::Subscription.create(
|
381
378
|
:payment_method_token => @credit_card.token,
|
382
379
|
:plan_id => SpecHelper::TrialPlan[:id],
|
383
|
-
:id => duplicate_token
|
380
|
+
:id => duplicate_token,
|
384
381
|
)
|
385
382
|
result.success?.should == true
|
386
383
|
|
387
384
|
result = Braintree::Subscription.create(
|
388
385
|
:payment_method_token => @credit_card.token,
|
389
386
|
:plan_id => SpecHelper::TrialPlan[:id],
|
390
|
-
:id => duplicate_token
|
387
|
+
:id => duplicate_token,
|
391
388
|
)
|
392
389
|
result.success?.should == false
|
393
390
|
result.errors.for(:subscription).on(:id)[0].message.should == "ID has already been taken."
|
@@ -398,7 +395,7 @@ describe Braintree::Subscription do
|
|
398
395
|
:payment_method_token => @credit_card.token,
|
399
396
|
:plan_id => SpecHelper::TrialPlan[:id],
|
400
397
|
:trial_period => true,
|
401
|
-
:trial_duration => nil
|
398
|
+
:trial_duration => nil,
|
402
399
|
)
|
403
400
|
result.success?.should == false
|
404
401
|
result.errors.for(:subscription).on(:trial_duration)[0].message.should == "Trial Duration is required."
|
@@ -410,7 +407,7 @@ describe Braintree::Subscription do
|
|
410
407
|
:plan_id => SpecHelper::TrialPlan[:id],
|
411
408
|
:trial_period => true,
|
412
409
|
:trial_duration => 2,
|
413
|
-
:trial_duration_unit => nil
|
410
|
+
:trial_duration_unit => nil,
|
414
411
|
)
|
415
412
|
result.success?.should == false
|
416
413
|
result.errors.for(:subscription).on(:trial_duration_unit)[0].message.should == "Trial Duration Unit is invalid."
|
@@ -422,7 +419,7 @@ describe Braintree::Subscription do
|
|
422
419
|
result = Braintree::Subscription.create(
|
423
420
|
:payment_method_token => @credit_card.token,
|
424
421
|
:plan_id => SpecHelper::AddOnDiscountPlan[:id],
|
425
|
-
:options => {:do_not_inherit_add_ons_or_discounts => true}
|
422
|
+
:options => {:do_not_inherit_add_ons_or_discounts => true},
|
426
423
|
)
|
427
424
|
result.success?.should == true
|
428
425
|
|
@@ -435,7 +432,7 @@ describe Braintree::Subscription do
|
|
435
432
|
it "inherits the add_ons and discounts from the plan when not specified" do
|
436
433
|
result = Braintree::Subscription.create(
|
437
434
|
:payment_method_token => @credit_card.token,
|
438
|
-
:plan_id => SpecHelper::AddOnDiscountPlan[:id]
|
435
|
+
:plan_id => SpecHelper::AddOnDiscountPlan[:id],
|
439
436
|
)
|
440
437
|
result.success?.should == true
|
441
438
|
|
@@ -499,7 +496,7 @@ describe Braintree::Subscription do
|
|
499
496
|
:never_expires => true
|
500
497
|
}
|
501
498
|
]
|
502
|
-
}
|
499
|
+
},
|
503
500
|
)
|
504
501
|
result.success?.should == true
|
505
502
|
|
@@ -545,7 +542,7 @@ describe Braintree::Subscription do
|
|
545
542
|
},
|
546
543
|
:discounts => {
|
547
544
|
:remove => [SpecHelper::Discount7]
|
548
|
-
}
|
545
|
+
},
|
549
546
|
)
|
550
547
|
result.success?.should == true
|
551
548
|
|
@@ -573,7 +570,7 @@ describe Braintree::Subscription do
|
|
573
570
|
},
|
574
571
|
:discounts => {
|
575
572
|
:add => [{:inherited_from_id => SpecHelper::Discount15}]
|
576
|
-
}
|
573
|
+
},
|
577
574
|
)
|
578
575
|
result.success?.should == true
|
579
576
|
subscription = result.subscription
|
@@ -624,7 +621,7 @@ describe Braintree::Subscription do
|
|
624
621
|
:quantity => -10,
|
625
622
|
}
|
626
623
|
]
|
627
|
-
}
|
624
|
+
},
|
628
625
|
)
|
629
626
|
result.success?.should == false
|
630
627
|
result.errors.for(:subscription).for(:add_ons).for(:update).for_index(0).on(:amount)[0].code.should == Braintree::ErrorCodes::Subscription::Modification::AmountIsInvalid
|
@@ -638,19 +635,19 @@ describe Braintree::Subscription do
|
|
638
635
|
:payment_method_token => @credit_card.token,
|
639
636
|
:plan_id => SpecHelper::TriallessPlan[:id],
|
640
637
|
:descriptor => {
|
641
|
-
:name =>
|
642
|
-
:phone =>
|
643
|
-
}
|
638
|
+
:name => "123*123456789012345678",
|
639
|
+
:phone => "3334445555"
|
640
|
+
},
|
644
641
|
)
|
645
642
|
|
646
643
|
result.success?.should == true
|
647
|
-
result.subscription.descriptor.name.should ==
|
648
|
-
result.subscription.descriptor.phone.should ==
|
644
|
+
result.subscription.descriptor.name.should == "123*123456789012345678"
|
645
|
+
result.subscription.descriptor.phone.should == "3334445555"
|
649
646
|
|
650
647
|
result.subscription.transactions.size.should == 1
|
651
648
|
transaction = result.subscription.transactions.first
|
652
|
-
transaction.descriptor.name.should ==
|
653
|
-
transaction.descriptor.phone.should ==
|
649
|
+
transaction.descriptor.name.should == "123*123456789012345678"
|
650
|
+
transaction.descriptor.phone.should == "3334445555"
|
654
651
|
end
|
655
652
|
|
656
653
|
it "has validation errors if format is invalid" do
|
@@ -658,10 +655,10 @@ describe Braintree::Subscription do
|
|
658
655
|
:payment_method_token => @credit_card.token,
|
659
656
|
:plan_id => SpecHelper::TriallessPlan[:id],
|
660
657
|
:descriptor => {
|
661
|
-
:name =>
|
662
|
-
:phone =>
|
658
|
+
:name => "badcompanyname12*badproduct12",
|
659
|
+
:phone => "%bad4445555",
|
663
660
|
:url => "12345678901234"
|
664
|
-
}
|
661
|
+
},
|
665
662
|
)
|
666
663
|
result.success?.should == false
|
667
664
|
result.errors.for(:subscription).for(:descriptor).on(:name)[0].code.should == Braintree::ErrorCodes::Descriptor::NameFormatIsInvalid
|
@@ -675,23 +672,21 @@ describe Braintree::Subscription do
|
|
675
672
|
it "returns the subscription if valid" do
|
676
673
|
subscription = Braintree::Subscription.create!(
|
677
674
|
:payment_method_token => @credit_card.token,
|
678
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
675
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
679
676
|
)
|
680
677
|
|
681
|
-
date_format = /^\d{4}\D\d{1,2}\D\d{1,2}$/
|
682
678
|
subscription.id.should =~ /^\w{6}$/
|
683
679
|
subscription.status.should == Braintree::Subscription::Status::Active
|
684
680
|
subscription.plan_id.should == "integration_trialless_plan"
|
685
681
|
|
686
|
-
subscription.first_billing_date.
|
687
|
-
subscription.next_billing_date.
|
688
|
-
subscription.billing_period_start_date.
|
689
|
-
subscription.billing_period_end_date.
|
690
|
-
subscription.paid_through_date.
|
682
|
+
expect(subscription.first_billing_date).to be_a Date
|
683
|
+
expect(subscription.next_billing_date).to be_a Date
|
684
|
+
expect(subscription.billing_period_start_date).to be_a Date
|
685
|
+
expect(subscription.billing_period_end_date).to be_a Date
|
686
|
+
expect(subscription.paid_through_date).to be_a Date
|
691
687
|
|
692
688
|
subscription.failure_count.should == 0
|
693
689
|
subscription.current_billing_cycle.should == 1
|
694
|
-
subscription.next_bill_amount.should == "12.34"
|
695
690
|
subscription.next_billing_period_amount.should == "12.34"
|
696
691
|
subscription.payment_method_token.should == @credit_card.token
|
697
692
|
end
|
@@ -700,7 +695,7 @@ describe Braintree::Subscription do
|
|
700
695
|
expect do
|
701
696
|
Braintree::Subscription.create!(
|
702
697
|
:payment_method_token => @credit_card.token,
|
703
|
-
:plan_id =>
|
698
|
+
:plan_id => "not_a_plan_id",
|
704
699
|
)
|
705
700
|
end.to raise_error(Braintree::ValidationsFailed)
|
706
701
|
end
|
@@ -710,7 +705,7 @@ describe Braintree::Subscription do
|
|
710
705
|
it "finds a subscription" do
|
711
706
|
result = Braintree::Subscription.create(
|
712
707
|
:payment_method_token => @credit_card.token,
|
713
|
-
:plan_id => SpecHelper::TrialPlan[:id]
|
708
|
+
:plan_id => SpecHelper::TrialPlan[:id],
|
714
709
|
)
|
715
710
|
result.success?.should == true
|
716
711
|
|
@@ -719,7 +714,7 @@ describe Braintree::Subscription do
|
|
719
714
|
|
720
715
|
it "raises Braintree::NotFoundError if it cannot find" do
|
721
716
|
expect {
|
722
|
-
Braintree::Subscription.find(
|
717
|
+
Braintree::Subscription.find("noSuchSubscription")
|
723
718
|
}.to raise_error(Braintree::NotFoundError, 'subscription with id "noSuchSubscription" not found')
|
724
719
|
end
|
725
720
|
end
|
@@ -729,13 +724,13 @@ describe Braintree::Subscription do
|
|
729
724
|
@subscription = Braintree::Subscription.create(
|
730
725
|
:payment_method_token => @credit_card.token,
|
731
726
|
:price => 54.32,
|
732
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
727
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
733
728
|
).subscription
|
734
729
|
end
|
735
730
|
|
736
731
|
it "allows changing the merchant_account_id" do
|
737
732
|
result = Braintree::Subscription.update(@subscription.id,
|
738
|
-
:merchant_account_id => SpecHelper::NonDefaultMerchantAccountId
|
733
|
+
:merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
|
739
734
|
)
|
740
735
|
|
741
736
|
result.success?.should == true
|
@@ -746,11 +741,11 @@ describe Braintree::Subscription do
|
|
746
741
|
new_credit_card = Braintree::CreditCard.create!(
|
747
742
|
:customer_id => @credit_card.customer_id,
|
748
743
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
749
|
-
:expiration_date => "05/2010"
|
744
|
+
:expiration_date => "05/2010",
|
750
745
|
)
|
751
746
|
|
752
747
|
result = Braintree::Subscription.update(@subscription.id,
|
753
|
-
:payment_method_token => new_credit_card.token
|
748
|
+
:payment_method_token => new_credit_card.token,
|
754
749
|
)
|
755
750
|
|
756
751
|
result.subscription.payment_method_token.should == new_credit_card.token
|
@@ -764,7 +759,7 @@ describe Braintree::Subscription do
|
|
764
759
|
},
|
765
760
|
:client_token_options => {
|
766
761
|
:customer_id => @credit_card.customer_id,
|
767
|
-
}
|
762
|
+
},
|
768
763
|
)
|
769
764
|
|
770
765
|
result = Braintree::Subscription.update(@subscription.id, :payment_method_nonce => nonce)
|
@@ -775,41 +770,41 @@ describe Braintree::Subscription do
|
|
775
770
|
it "allows changing the descriptors" do
|
776
771
|
result = Braintree::Subscription.update(@subscription.id,
|
777
772
|
:descriptor => {
|
778
|
-
:name =>
|
779
|
-
:phone =>
|
773
|
+
:name => "aaa*1234",
|
774
|
+
:phone => "3334443333",
|
780
775
|
:url => "ebay.com"
|
781
|
-
}
|
776
|
+
},
|
782
777
|
)
|
783
778
|
|
784
779
|
result.success?.should == true
|
785
|
-
result.subscription.descriptor.name.should ==
|
786
|
-
result.subscription.descriptor.phone.should ==
|
787
|
-
result.subscription.descriptor.url.should ==
|
780
|
+
result.subscription.descriptor.name.should == "aaa*1234"
|
781
|
+
result.subscription.descriptor.phone.should == "3334443333"
|
782
|
+
result.subscription.descriptor.url.should == "ebay.com"
|
788
783
|
end
|
789
784
|
|
790
785
|
it "allows changing the paypal description" do
|
791
786
|
customer = Braintree::Customer.create!
|
792
787
|
payment_method = Braintree::PaymentMethod.create(
|
793
788
|
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment,
|
794
|
-
:customer_id => customer.id
|
789
|
+
:customer_id => customer.id,
|
795
790
|
).payment_method
|
796
791
|
|
797
792
|
subscription = Braintree::Subscription.create(
|
798
793
|
:payment_method_token => payment_method.token,
|
799
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
794
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
800
795
|
).subscription
|
801
796
|
|
802
797
|
result = Braintree::Subscription.update(
|
803
798
|
subscription.id,
|
804
799
|
:options => {
|
805
800
|
:paypal => {
|
806
|
-
:description =>
|
801
|
+
:description => "A great product",
|
807
802
|
},
|
808
803
|
},
|
809
804
|
)
|
810
805
|
|
811
806
|
result.success?.should == true
|
812
|
-
result.subscription.description.should ==
|
807
|
+
result.subscription.description.should == "A great product"
|
813
808
|
end
|
814
809
|
|
815
810
|
context "when successful" do
|
@@ -818,7 +813,7 @@ describe Braintree::Subscription do
|
|
818
813
|
result = Braintree::Subscription.update(@subscription.id,
|
819
814
|
:id => new_id,
|
820
815
|
:price => 9999.88,
|
821
|
-
:plan_id => SpecHelper::TrialPlan[:id]
|
816
|
+
:plan_id => SpecHelper::TrialPlan[:id],
|
822
817
|
)
|
823
818
|
|
824
819
|
result.success?.should == true
|
@@ -830,7 +825,7 @@ describe Braintree::Subscription do
|
|
830
825
|
context "proration" do
|
831
826
|
it "prorates if there is a charge (because merchant has proration option enabled in control panel)" do
|
832
827
|
result = Braintree::Subscription.update(@subscription.id,
|
833
|
-
:price => @subscription.price.to_f + 1
|
828
|
+
:price => @subscription.price.to_f + 1,
|
834
829
|
)
|
835
830
|
|
836
831
|
result.success?.should == true
|
@@ -841,7 +836,7 @@ describe Braintree::Subscription do
|
|
841
836
|
it "allows the user to force proration if there is a charge" do
|
842
837
|
result = Braintree::Subscription.update(@subscription.id,
|
843
838
|
:price => @subscription.price.to_f + 1,
|
844
|
-
:options => {
|
839
|
+
:options => {:prorate_charges => true},
|
845
840
|
)
|
846
841
|
|
847
842
|
result.success?.should == true
|
@@ -852,7 +847,7 @@ describe Braintree::Subscription do
|
|
852
847
|
it "allows the user to prevent proration if there is a charge" do
|
853
848
|
result = Braintree::Subscription.update(@subscription.id,
|
854
849
|
:price => @subscription.price.to_f + 1,
|
855
|
-
:options => {
|
850
|
+
:options => {:prorate_charges => false},
|
856
851
|
)
|
857
852
|
|
858
853
|
result.success?.should == true
|
@@ -862,7 +857,7 @@ describe Braintree::Subscription do
|
|
862
857
|
|
863
858
|
it "doesn't prorate if price decreases" do
|
864
859
|
result = Braintree::Subscription.update(@subscription.id,
|
865
|
-
:price => @subscription.price.to_f - 1
|
860
|
+
:price => @subscription.price.to_f - 1,
|
866
861
|
)
|
867
862
|
|
868
863
|
result.success?.should == true
|
@@ -875,7 +870,7 @@ describe Braintree::Subscription do
|
|
875
870
|
:price => @subscription.price.to_f + 2100,
|
876
871
|
:options => {
|
877
872
|
:revert_subscription_on_proration_failure => false
|
878
|
-
}
|
873
|
+
},
|
879
874
|
)
|
880
875
|
|
881
876
|
result.success?.should == true
|
@@ -892,7 +887,7 @@ describe Braintree::Subscription do
|
|
892
887
|
:price => @subscription.price.to_f + 2100,
|
893
888
|
:options => {
|
894
889
|
:revert_subscription_on_proration_failure => true
|
895
|
-
}
|
890
|
+
},
|
896
891
|
)
|
897
892
|
|
898
893
|
result.success?.should == false
|
@@ -910,14 +905,14 @@ describe Braintree::Subscription do
|
|
910
905
|
before(:each) do
|
911
906
|
@subscription = Braintree::Subscription.create(
|
912
907
|
:payment_method_token => @credit_card.token,
|
913
|
-
:plan_id => SpecHelper::TrialPlan[:id]
|
908
|
+
:plan_id => SpecHelper::TrialPlan[:id],
|
914
909
|
).subscription
|
915
910
|
end
|
916
911
|
|
917
912
|
it "raises NotFoundError if the subscription can't be found" do
|
918
913
|
expect {
|
919
914
|
Braintree::Subscription.update(rand(36**9).to_s(36),
|
920
|
-
:price => 58.20
|
915
|
+
:price => 58.20,
|
921
916
|
)
|
922
917
|
}.to raise_error(Braintree::NotFoundError)
|
923
918
|
end
|
@@ -945,11 +940,11 @@ describe Braintree::Subscription do
|
|
945
940
|
duplicate = Braintree::Subscription.create(
|
946
941
|
:payment_method_token => @credit_card.token,
|
947
942
|
:plan_id => SpecHelper::TrialPlan[:id],
|
948
|
-
:id => duplicate_id
|
943
|
+
:id => duplicate_id,
|
949
944
|
)
|
950
945
|
result = Braintree::Subscription.update(
|
951
946
|
@subscription.id,
|
952
|
-
:id => duplicate_id
|
947
|
+
:id => duplicate_id,
|
953
948
|
)
|
954
949
|
result.success?.should == false
|
955
950
|
result.errors.for(:subscription).on(:id)[0].code.should == Braintree::ErrorCodes::Subscription::IdIsInUse
|
@@ -959,14 +954,14 @@ describe Braintree::Subscription do
|
|
959
954
|
subscription = Braintree::Subscription.create(
|
960
955
|
:payment_method_token => @credit_card.token,
|
961
956
|
:price => 54.32,
|
962
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
957
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
963
958
|
).subscription
|
964
959
|
|
965
960
|
result = Braintree::Subscription.cancel(subscription.id)
|
966
961
|
result.success?.should == true
|
967
962
|
|
968
963
|
result = Braintree::Subscription.update(subscription.id,
|
969
|
-
:price => 123.45
|
964
|
+
:price => 123.45,
|
970
965
|
)
|
971
966
|
result.success?.should == false
|
972
967
|
result.errors.for(:subscription)[0].code.should == Braintree::ErrorCodes::Subscription::CannotEditCanceledSubscription
|
@@ -978,12 +973,12 @@ describe Braintree::Subscription do
|
|
978
973
|
subscription = Braintree::Subscription.create(
|
979
974
|
:payment_method_token => @credit_card.token,
|
980
975
|
:plan_id => SpecHelper::TriallessPlan[:id],
|
981
|
-
:number_of_billing_cycles => 10
|
976
|
+
:number_of_billing_cycles => 10,
|
982
977
|
).subscription
|
983
978
|
|
984
979
|
result = Braintree::Subscription.update(
|
985
980
|
subscription.id,
|
986
|
-
:number_of_billing_cycles => 5
|
981
|
+
:number_of_billing_cycles => 5,
|
987
982
|
)
|
988
983
|
|
989
984
|
result.subscription.number_of_billing_cycles.should == 5
|
@@ -993,12 +988,12 @@ describe Braintree::Subscription do
|
|
993
988
|
subscription = Braintree::Subscription.create(
|
994
989
|
:payment_method_token => @credit_card.token,
|
995
990
|
:plan_id => SpecHelper::TriallessPlan[:id],
|
996
|
-
:number_of_billing_cycles => 10
|
991
|
+
:number_of_billing_cycles => 10,
|
997
992
|
).subscription
|
998
993
|
|
999
994
|
result = Braintree::Subscription.update(
|
1000
995
|
subscription.id,
|
1001
|
-
:never_expires => true
|
996
|
+
:never_expires => true,
|
1002
997
|
)
|
1003
998
|
|
1004
999
|
result.success?.should == true
|
@@ -1011,7 +1006,7 @@ describe Braintree::Subscription do
|
|
1011
1006
|
it "can update add_ons and discounts" do
|
1012
1007
|
result = Braintree::Subscription.create(
|
1013
1008
|
:payment_method_token => @credit_card.token,
|
1014
|
-
:plan_id => SpecHelper::AddOnDiscountPlan[:id]
|
1009
|
+
:plan_id => SpecHelper::AddOnDiscountPlan[:id],
|
1015
1010
|
)
|
1016
1011
|
result.success?.should == true
|
1017
1012
|
subscription = result.subscription
|
@@ -1035,7 +1030,7 @@ describe Braintree::Subscription do
|
|
1035
1030
|
:quantity => 9
|
1036
1031
|
}
|
1037
1032
|
]
|
1038
|
-
}
|
1033
|
+
},
|
1039
1034
|
)
|
1040
1035
|
|
1041
1036
|
subscription = result.subscription
|
@@ -1056,7 +1051,7 @@ describe Braintree::Subscription do
|
|
1056
1051
|
it "allows adding new add_ons and discounts" do
|
1057
1052
|
subscription = Braintree::Subscription.create(
|
1058
1053
|
:payment_method_token => @credit_card.token,
|
1059
|
-
:plan_id => SpecHelper::AddOnDiscountPlan[:id]
|
1054
|
+
:plan_id => SpecHelper::AddOnDiscountPlan[:id],
|
1060
1055
|
).subscription
|
1061
1056
|
|
1062
1057
|
result = Braintree::Subscription.update(subscription.id,
|
@@ -1065,7 +1060,7 @@ describe Braintree::Subscription do
|
|
1065
1060
|
},
|
1066
1061
|
:discounts => {
|
1067
1062
|
:add => [{:inherited_from_id => SpecHelper::Discount15}]
|
1068
|
-
}
|
1063
|
+
},
|
1069
1064
|
)
|
1070
1065
|
|
1071
1066
|
result.success?.should == true
|
@@ -1105,7 +1100,7 @@ describe Braintree::Subscription do
|
|
1105
1100
|
it "allows replacing entire set of add_ons and discounts" do
|
1106
1101
|
subscription = Braintree::Subscription.create(
|
1107
1102
|
:payment_method_token => @credit_card.token,
|
1108
|
-
:plan_id => SpecHelper::AddOnDiscountPlan[:id]
|
1103
|
+
:plan_id => SpecHelper::AddOnDiscountPlan[:id],
|
1109
1104
|
).subscription
|
1110
1105
|
|
1111
1106
|
result = Braintree::Subscription.update(subscription.id,
|
@@ -1115,7 +1110,7 @@ describe Braintree::Subscription do
|
|
1115
1110
|
:discounts => {
|
1116
1111
|
:add => [{:inherited_from_id => SpecHelper::Discount15}]
|
1117
1112
|
},
|
1118
|
-
:options => {:replace_all_add_ons_and_discounts => true}
|
1113
|
+
:options => {:replace_all_add_ons_and_discounts => true},
|
1119
1114
|
)
|
1120
1115
|
|
1121
1116
|
result.success?.should == true
|
@@ -1135,7 +1130,7 @@ describe Braintree::Subscription do
|
|
1135
1130
|
it "allows deleting of add_ons and discounts" do
|
1136
1131
|
subscription = Braintree::Subscription.create(
|
1137
1132
|
:payment_method_token => @credit_card.token,
|
1138
|
-
:plan_id => SpecHelper::AddOnDiscountPlan[:id]
|
1133
|
+
:plan_id => SpecHelper::AddOnDiscountPlan[:id],
|
1139
1134
|
).subscription
|
1140
1135
|
|
1141
1136
|
result = Braintree::Subscription.update(subscription.id,
|
@@ -1144,7 +1139,7 @@ describe Braintree::Subscription do
|
|
1144
1139
|
},
|
1145
1140
|
:discounts => {
|
1146
1141
|
:remove => [SpecHelper::Discount7]
|
1147
|
-
}
|
1142
|
+
},
|
1148
1143
|
)
|
1149
1144
|
result.success?.should == true
|
1150
1145
|
|
@@ -1166,7 +1161,7 @@ describe Braintree::Subscription do
|
|
1166
1161
|
@subscription = Braintree::Subscription.create(
|
1167
1162
|
:payment_method_token => @credit_card.token,
|
1168
1163
|
:price => 54.32,
|
1169
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
1164
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
1170
1165
|
).subscription
|
1171
1166
|
end
|
1172
1167
|
|
@@ -1175,7 +1170,7 @@ describe Braintree::Subscription do
|
|
1175
1170
|
subscription = Braintree::Subscription.update!(@subscription.id,
|
1176
1171
|
:id => new_id,
|
1177
1172
|
:price => 9999.88,
|
1178
|
-
:plan_id => SpecHelper::TrialPlan[:id]
|
1173
|
+
:plan_id => SpecHelper::TrialPlan[:id],
|
1179
1174
|
)
|
1180
1175
|
|
1181
1176
|
subscription.id.should =~ /#{new_id}/
|
@@ -1186,7 +1181,7 @@ describe Braintree::Subscription do
|
|
1186
1181
|
it "raises a ValidationsFailed if invalid" do
|
1187
1182
|
expect do
|
1188
1183
|
Braintree::Subscription.update!(@subscription.id,
|
1189
|
-
:plan_id =>
|
1184
|
+
:plan_id => "not_a_plan_id",
|
1190
1185
|
)
|
1191
1186
|
end.to raise_error(Braintree::ValidationsFailed)
|
1192
1187
|
end
|
@@ -1198,7 +1193,7 @@ describe Braintree::Subscription do
|
|
1198
1193
|
subscription = Braintree::Subscription.create(
|
1199
1194
|
:payment_method_token => @credit_card.token,
|
1200
1195
|
:price => 54.32,
|
1201
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
1196
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
1202
1197
|
).subscription
|
1203
1198
|
|
1204
1199
|
result = Braintree::Subscription.cancel(subscription.id)
|
@@ -1208,7 +1203,7 @@ describe Braintree::Subscription do
|
|
1208
1203
|
|
1209
1204
|
it "returns a validation error if record not found" do
|
1210
1205
|
expect {
|
1211
|
-
r = Braintree::Subscription.cancel(
|
1206
|
+
r = Braintree::Subscription.cancel("noSuchSubscription")
|
1212
1207
|
}.to raise_error(Braintree::NotFoundError, 'subscription with id "noSuchSubscription" not found')
|
1213
1208
|
end
|
1214
1209
|
|
@@ -1216,7 +1211,7 @@ describe Braintree::Subscription do
|
|
1216
1211
|
subscription = Braintree::Subscription.create(
|
1217
1212
|
:payment_method_token => @credit_card.token,
|
1218
1213
|
:price => 54.32,
|
1219
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
1214
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
1220
1215
|
).subscription
|
1221
1216
|
|
1222
1217
|
result = Braintree::Subscription.cancel(subscription.id)
|
@@ -1234,7 +1229,7 @@ describe Braintree::Subscription do
|
|
1234
1229
|
subscription = Braintree::Subscription.create!(
|
1235
1230
|
:payment_method_token => @credit_card.token,
|
1236
1231
|
:price => 54.32,
|
1237
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
1232
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
1238
1233
|
)
|
1239
1234
|
|
1240
1235
|
updated_subscription = Braintree::Subscription.cancel!(subscription.id)
|
@@ -1249,13 +1244,13 @@ describe Braintree::Subscription do
|
|
1249
1244
|
subscription_with_trial = Braintree::Subscription.create(
|
1250
1245
|
:payment_method_token => @credit_card.token,
|
1251
1246
|
:plan_id => SpecHelper::TrialPlan[:id],
|
1252
|
-
:id => "subscription1_#{id}"
|
1247
|
+
:id => "subscription1_#{id}",
|
1253
1248
|
).subscription
|
1254
1249
|
|
1255
1250
|
subscription_without_trial = Braintree::Subscription.create(
|
1256
1251
|
:payment_method_token => @credit_card.token,
|
1257
1252
|
:plan_id => SpecHelper::TriallessPlan[:id],
|
1258
|
-
:id => "subscription2_#{id}"
|
1253
|
+
:id => "subscription2_#{id}",
|
1259
1254
|
).subscription
|
1260
1255
|
|
1261
1256
|
subscriptions_in_trial_period = Braintree::Subscription.search do |search|
|
@@ -1281,7 +1276,7 @@ describe Braintree::Subscription do
|
|
1281
1276
|
:payment_method_token => @credit_card.token,
|
1282
1277
|
:plan_id => SpecHelper::TrialPlan[:id],
|
1283
1278
|
:id => "subscription1_#{id}",
|
1284
|
-
:price => "11.38"
|
1279
|
+
:price => "11.38",
|
1285
1280
|
).subscription
|
1286
1281
|
|
1287
1282
|
collection = Braintree::Subscription.search do |search|
|
@@ -1315,13 +1310,13 @@ describe Braintree::Subscription do
|
|
1315
1310
|
subscription1 = Braintree::Subscription.create(
|
1316
1311
|
:payment_method_token => @credit_card.token,
|
1317
1312
|
:plan_id => SpecHelper::TrialPlan[:id],
|
1318
|
-
:id => "subscription1_#{id}"
|
1313
|
+
:id => "subscription1_#{id}",
|
1319
1314
|
).subscription
|
1320
1315
|
|
1321
1316
|
subscription2 = Braintree::Subscription.create(
|
1322
1317
|
:payment_method_token => @credit_card.token,
|
1323
1318
|
:plan_id => SpecHelper::TrialPlan[:id],
|
1324
|
-
:id => "subscription2_#{id}"
|
1319
|
+
:id => "subscription2_#{id}",
|
1325
1320
|
).subscription
|
1326
1321
|
|
1327
1322
|
collection = Braintree::Subscription.search do |search|
|
@@ -1339,14 +1334,14 @@ describe Braintree::Subscription do
|
|
1339
1334
|
:payment_method_token => @credit_card.token,
|
1340
1335
|
:plan_id => SpecHelper::TrialPlan[:id],
|
1341
1336
|
:merchant_account_id => SpecHelper::DefaultMerchantAccountId,
|
1342
|
-
:price => "1"
|
1337
|
+
:price => "1",
|
1343
1338
|
).subscription
|
1344
1339
|
|
1345
1340
|
subscription2 = Braintree::Subscription.create(
|
1346
1341
|
:payment_method_token => @credit_card.token,
|
1347
1342
|
:plan_id => SpecHelper::TrialPlan[:id],
|
1348
1343
|
:merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
|
1349
|
-
:price => "1"
|
1344
|
+
:price => "1",
|
1350
1345
|
).subscription
|
1351
1346
|
|
1352
1347
|
collection = Braintree::Subscription.search do |search|
|
@@ -1372,13 +1367,13 @@ describe Braintree::Subscription do
|
|
1372
1367
|
trialless_subscription = Braintree::Subscription.create(
|
1373
1368
|
:payment_method_token => @credit_card.token,
|
1374
1369
|
:plan_id => SpecHelper::TriallessPlan[:id],
|
1375
|
-
:price => "2"
|
1370
|
+
:price => "2",
|
1376
1371
|
).subscription
|
1377
1372
|
|
1378
1373
|
trial_subscription = Braintree::Subscription.create(
|
1379
1374
|
:payment_method_token => @credit_card.token,
|
1380
1375
|
:plan_id => SpecHelper::TrialPlan[:id],
|
1381
|
-
:price => "2"
|
1376
|
+
:price => "2",
|
1382
1377
|
).subscription
|
1383
1378
|
|
1384
1379
|
collection = Braintree::Subscription.search do |search|
|
@@ -1396,13 +1391,13 @@ describe Braintree::Subscription do
|
|
1396
1391
|
subscription_500 = Braintree::Subscription.create(
|
1397
1392
|
:payment_method_token => @credit_card.token,
|
1398
1393
|
:plan_id => SpecHelper::TrialPlan[:id],
|
1399
|
-
:price => "5.00"
|
1394
|
+
:price => "5.00",
|
1400
1395
|
).subscription
|
1401
1396
|
|
1402
1397
|
subscription_501 = Braintree::Subscription.create(
|
1403
1398
|
:payment_method_token => @credit_card.token,
|
1404
1399
|
:plan_id => SpecHelper::TrialPlan[:id],
|
1405
|
-
:price => "5.01"
|
1400
|
+
:price => "5.01",
|
1406
1401
|
).subscription
|
1407
1402
|
|
1408
1403
|
collection = Braintree::Subscription.search do |search|
|
@@ -1419,13 +1414,13 @@ describe Braintree::Subscription do
|
|
1419
1414
|
active_subscription = Braintree::Subscription.create(
|
1420
1415
|
:payment_method_token => @credit_card.token,
|
1421
1416
|
:plan_id => SpecHelper::TrialPlan[:id],
|
1422
|
-
:price => "6"
|
1417
|
+
:price => "6",
|
1423
1418
|
).subscription
|
1424
1419
|
|
1425
1420
|
past_due_subscription = Braintree::Subscription.create(
|
1426
1421
|
:payment_method_token => @credit_card.token,
|
1427
1422
|
:plan_id => SpecHelper::TrialPlan[:id],
|
1428
|
-
:price => "6"
|
1423
|
+
:price => "6",
|
1429
1424
|
).subscription
|
1430
1425
|
|
1431
1426
|
SpecHelper.make_past_due(past_due_subscription, 5)
|
@@ -1446,7 +1441,7 @@ describe Braintree::Subscription do
|
|
1446
1441
|
it "passes a smoke test" do
|
1447
1442
|
subscription = Braintree::Subscription.create(
|
1448
1443
|
:payment_method_token => @credit_card.token,
|
1449
|
-
:plan_id => SpecHelper::TrialPlan[:id]
|
1444
|
+
:plan_id => SpecHelper::TrialPlan[:id],
|
1450
1445
|
).subscription
|
1451
1446
|
|
1452
1447
|
collection = Braintree::Subscription.search do |search|
|
@@ -1466,19 +1461,19 @@ describe Braintree::Subscription do
|
|
1466
1461
|
subscription_5 = Braintree::Subscription.create(
|
1467
1462
|
:payment_method_token => @credit_card.token,
|
1468
1463
|
:plan_id => SpecHelper::TrialPlan[:id],
|
1469
|
-
:number_of_billing_cycles => 5
|
1464
|
+
:number_of_billing_cycles => 5,
|
1470
1465
|
).subscription
|
1471
1466
|
|
1472
1467
|
subscription_9 = Braintree::Subscription.create(
|
1473
1468
|
:payment_method_token => @credit_card.token,
|
1474
1469
|
:plan_id => SpecHelper::TriallessPlan[:id],
|
1475
|
-
:number_of_billing_cycles => 10
|
1470
|
+
:number_of_billing_cycles => 10,
|
1476
1471
|
).subscription
|
1477
1472
|
|
1478
1473
|
subscription_15 = Braintree::Subscription.create(
|
1479
1474
|
:payment_method_token => @credit_card.token,
|
1480
1475
|
:plan_id => SpecHelper::TriallessPlan[:id],
|
1481
|
-
:number_of_billing_cycles => 15
|
1476
|
+
:number_of_billing_cycles => 15,
|
1482
1477
|
).subscription
|
1483
1478
|
|
1484
1479
|
collection = Braintree::Subscription.search do |search|
|
@@ -1495,12 +1490,12 @@ describe Braintree::Subscription do
|
|
1495
1490
|
it "returns matching results" do
|
1496
1491
|
matching_subscription = Braintree::Subscription.create(
|
1497
1492
|
:payment_method_token => @credit_card.token,
|
1498
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
1493
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
1499
1494
|
).subscription
|
1500
1495
|
|
1501
1496
|
non_matching_subscription = Braintree::Subscription.create(
|
1502
1497
|
:payment_method_token => @credit_card.token,
|
1503
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
1498
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
1504
1499
|
).subscription
|
1505
1500
|
|
1506
1501
|
collection = Braintree::Subscription.search do |search|
|
@@ -1516,12 +1511,12 @@ describe Braintree::Subscription do
|
|
1516
1511
|
it "returns matching results" do
|
1517
1512
|
matching_subscription = Braintree::Subscription.create(
|
1518
1513
|
:payment_method_token => @credit_card.token,
|
1519
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
1514
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
1520
1515
|
).subscription
|
1521
1516
|
|
1522
1517
|
non_matching_subscription = Braintree::Subscription.create(
|
1523
1518
|
:payment_method_token => @credit_card.token,
|
1524
|
-
:plan_id => SpecHelper::TrialPlan[:id]
|
1519
|
+
:plan_id => SpecHelper::TrialPlan[:id],
|
1525
1520
|
).subscription
|
1526
1521
|
|
1527
1522
|
five_days_from_now = Time.now + (5 * 24 * 60 * 60)
|
@@ -1538,7 +1533,7 @@ describe Braintree::Subscription do
|
|
1538
1533
|
before(:each) do
|
1539
1534
|
@subscription = Braintree::Subscription.create(
|
1540
1535
|
:payment_method_token => @credit_card.token,
|
1541
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
1536
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
1542
1537
|
).subscription
|
1543
1538
|
@created_at = @subscription.created_at
|
1544
1539
|
end
|
@@ -1550,7 +1545,7 @@ describe Braintree::Subscription do
|
|
1550
1545
|
search.id.is @subscription.id
|
1551
1546
|
search.created_at.between(
|
1552
1547
|
@created_at - 60,
|
1553
|
-
@created_at + 60
|
1548
|
+
@created_at + 60,
|
1554
1549
|
)
|
1555
1550
|
end
|
1556
1551
|
|
@@ -1583,7 +1578,7 @@ describe Braintree::Subscription do
|
|
1583
1578
|
search.id.is @subscription.id
|
1584
1579
|
search.created_at.between(
|
1585
1580
|
@created_at + 300,
|
1586
|
-
@created_at + 400
|
1581
|
+
@created_at + 400,
|
1587
1582
|
)
|
1588
1583
|
end
|
1589
1584
|
|
@@ -1607,7 +1602,7 @@ describe Braintree::Subscription do
|
|
1607
1602
|
search.id.is @subscription.id
|
1608
1603
|
search.created_at.between(
|
1609
1604
|
now - 60,
|
1610
|
-
now + 60
|
1605
|
+
now + 60,
|
1611
1606
|
)
|
1612
1607
|
end
|
1613
1608
|
|
@@ -1646,7 +1641,7 @@ describe Braintree::Subscription do
|
|
1646
1641
|
search.id.is @subscription.id
|
1647
1642
|
search.created_at.between(
|
1648
1643
|
now + 300,
|
1649
|
-
now + 400
|
1644
|
+
now + 400,
|
1650
1645
|
)
|
1651
1646
|
end
|
1652
1647
|
|
@@ -1658,7 +1653,7 @@ describe Braintree::Subscription do
|
|
1658
1653
|
search.id.is @subscription.id
|
1659
1654
|
search.created_at.between(
|
1660
1655
|
Date.today - 1,
|
1661
|
-
Date.today + 1
|
1656
|
+
Date.today + 1,
|
1662
1657
|
)
|
1663
1658
|
end
|
1664
1659
|
|
@@ -1675,7 +1670,7 @@ describe Braintree::Subscription do
|
|
1675
1670
|
collection = Braintree::Subscription.search
|
1676
1671
|
collection.maximum_size.should > 100
|
1677
1672
|
|
1678
|
-
subscriptions_ids = collection.map {|t| t.id }.uniq.compact
|
1673
|
+
subscriptions_ids = collection.map { |t| t.id }.uniq.compact
|
1679
1674
|
subscriptions_ids.size.should == collection.maximum_size
|
1680
1675
|
end
|
1681
1676
|
end
|
@@ -1684,7 +1679,7 @@ describe Braintree::Subscription do
|
|
1684
1679
|
it "is successful with only subscription id" do
|
1685
1680
|
subscription = Braintree::Subscription.create(
|
1686
1681
|
:payment_method_token => @credit_card.token,
|
1687
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
1682
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
1688
1683
|
).subscription
|
1689
1684
|
SpecHelper.make_past_due(subscription)
|
1690
1685
|
|
@@ -1702,7 +1697,7 @@ describe Braintree::Subscription do
|
|
1702
1697
|
it "is successful with subscription id and amount" do
|
1703
1698
|
subscription = Braintree::Subscription.create(
|
1704
1699
|
:payment_method_token => @credit_card.token,
|
1705
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
1700
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
1706
1701
|
).subscription
|
1707
1702
|
SpecHelper.make_past_due(subscription)
|
1708
1703
|
|
@@ -1720,7 +1715,7 @@ describe Braintree::Subscription do
|
|
1720
1715
|
it "is successful with subscription id and submit_for_settlement" do
|
1721
1716
|
subscription = Braintree::Subscription.create(
|
1722
1717
|
:payment_method_token => @credit_card.token,
|
1723
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
1718
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
1724
1719
|
).subscription
|
1725
1720
|
SpecHelper.make_past_due(subscription)
|
1726
1721
|
|
@@ -1738,7 +1733,7 @@ describe Braintree::Subscription do
|
|
1738
1733
|
it "is successful with subscription id, amount and submit_for_settlement" do
|
1739
1734
|
subscription = Braintree::Subscription.create(
|
1740
1735
|
:payment_method_token => @credit_card.token,
|
1741
|
-
:plan_id => SpecHelper::TriallessPlan[:id]
|
1736
|
+
:plan_id => SpecHelper::TriallessPlan[:id],
|
1742
1737
|
).subscription
|
1743
1738
|
SpecHelper.make_past_due(subscription)
|
1744
1739
|
|