paymill_ruby 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +3 -0
- data/Guardfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +223 -0
- data/Rakefile +6 -0
- data/lib/paymill.rb +54 -0
- data/lib/paymill/errors.rb +10 -0
- data/lib/paymill/models/address.rb +13 -0
- data/lib/paymill/models/base.rb +50 -0
- data/lib/paymill/models/checksum.rb +40 -0
- data/lib/paymill/models/client.rb +24 -0
- data/lib/paymill/models/fee.rb +14 -0
- data/lib/paymill/models/invoice.rb +18 -0
- data/lib/paymill/models/merchant.rb +21 -0
- data/lib/paymill/models/offer.rb +27 -0
- data/lib/paymill/models/payment.rb +20 -0
- data/lib/paymill/models/payment_method.rb +18 -0
- data/lib/paymill/models/preauthorization.rb +25 -0
- data/lib/paymill/models/refund.rb +22 -0
- data/lib/paymill/models/shopping_cart_item.rb +13 -0
- data/lib/paymill/models/subscription.rb +143 -0
- data/lib/paymill/models/subscription_count.rb +18 -0
- data/lib/paymill/models/transaction.rb +27 -0
- data/lib/paymill/models/webhook.rb +37 -0
- data/lib/paymill/restful/methods.rb +134 -0
- data/lib/paymill/version.rb +3 -0
- data/paymill.gemspec +28 -0
- data/samples/authentication/authentication.rb +1 -0
- data/samples/clients/create_new_client.rb +4 -0
- data/samples/clients/export_clients_list.rb +1 -0
- data/samples/clients/get_client_details.rb +1 -0
- data/samples/clients/list_clients.rb +1 -0
- data/samples/clients/remove_client.rb +2 -0
- data/samples/clients/update_client.rb +4 -0
- data/samples/offers/create_new_offer.rb +7 -0
- data/samples/offers/export_offers_list.rb +1 -0
- data/samples/offers/get_offer_details.rb +1 -0
- data/samples/offers/list_offers.rb +1 -0
- data/samples/offers/remove_offer.rb +7 -0
- data/samples/offers/update_offer.rb +8 -0
- data/samples/payments/create_new_credit_card_payment_with_token.rb +1 -0
- data/samples/payments/create_new_credit_card_payment_with_token_and_client.rb +4 -0
- data/samples/payments/create_new_debit_payment_with_token.rb +1 -0
- data/samples/payments/create_new_debit_payment_with_token_and_client.rb +4 -0
- data/samples/payments/export_payments_list.rb +1 -0
- data/samples/payments/get_payment_details.rb +1 -0
- data/samples/payments/list_payments.rb +1 -0
- data/samples/payments/remove_payment.rb +2 -0
- data/samples/preauthorizations/create_new_preauthorization_with_payment.rb +8 -0
- data/samples/preauthorizations/create_new_preauthorization_with_token.rb +6 -0
- data/samples/preauthorizations/export_preauthorizations_list.rb +1 -0
- data/samples/preauthorizations/get_preauthorization_details.rb +1 -0
- data/samples/preauthorizations/list_preauthozizations.rb +1 -0
- data/samples/preauthorizations/remove_preauthorization.rb +2 -0
- data/samples/refunds/create_new_refund.rb +11 -0
- data/samples/refunds/export_refunds_list.rb +1 -0
- data/samples/refunds/get_refund_details.rb +1 -0
- data/samples/refunds/list_refunds.rb +1 -0
- data/samples/subscriptions/cancel_subscription.rb +2 -0
- data/samples/subscriptions/create_new_subscription_with_an_offer.rb +15 -0
- data/samples/subscriptions/create_new_subscription_with_an_offer_and_different_values.rb +19 -0
- data/samples/subscriptions/create_new_subscription_without_an_offer.rb +13 -0
- data/samples/subscriptions/delete_subscription.rb +2 -0
- data/samples/subscriptions/export_subscriptions_list.rb +1 -0
- data/samples/subscriptions/get_subscription_details.rb +1 -0
- data/samples/subscriptions/list_subscriptions.rb +1 -0
- data/samples/subscriptions/pause_subscription.rb +7 -0
- data/samples/subscriptions/update_subscription.rb +12 -0
- data/samples/subscriptions/update_subscription_amount.rb +7 -0
- data/samples/subscriptions/update_subscription_offer.rb +14 -0
- data/samples/transactions/create_new_transaction_with_app_fee.rb +8 -0
- data/samples/transactions/create_new_transaction_with_client_and_payment.rb +12 -0
- data/samples/transactions/create_new_transaction_with_payment.rb +7 -0
- data/samples/transactions/create_new_transaction_with_preauthorization.rb +10 -0
- data/samples/transactions/create_new_transaction_with_token.rb +6 -0
- data/samples/transactions/export_transactions_list.rb +1 -0
- data/samples/transactions/get_transaction_details_by_id.rb +1 -0
- data/samples/transactions/get_transaction_details_by_slv.rb +1 -0
- data/samples/transactions/list_transactions.rb +1 -0
- data/samples/transactions/upate_transaction.rb +3 -0
- data/samples/webhooks/create_new_email_webhook.rb +5 -0
- data/samples/webhooks/create_new_url_webhook.rb +4 -0
- data/samples/webhooks/export_webhooks_list.rb +1 -0
- data/samples/webhooks/get_webhook_details.rb +1 -0
- data/samples/webhooks/remove_webhook.rb +2 -0
- data/samples/webhooks/update_webhook.rb +3 -0
- data/spec/paymill/models/address_spec.rb +42 -0
- data/spec/paymill/models/checksum_spec.rb +77 -0
- data/spec/paymill/models/client_spec.rb +311 -0
- data/spec/paymill/models/offer_spec.rb +151 -0
- data/spec/paymill/models/payment_spec.rb +188 -0
- data/spec/paymill/models/preauthorization_spec.rb +180 -0
- data/spec/paymill/models/refund_spec.rb +90 -0
- data/spec/paymill/models/subscription_spec.rb +607 -0
- data/spec/paymill/models/transaction_spec.rb +226 -0
- data/spec/paymill/models/webhook_spec.rb +195 -0
- data/spec/spec_helper.rb +28 -0
- metadata +265 -0
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Paymill
|
4
|
+
describe Refund do
|
5
|
+
|
6
|
+
let( :currency ) { 'USD' }
|
7
|
+
|
8
|
+
refund_id = nil
|
9
|
+
|
10
|
+
context '::create' do
|
11
|
+
before( :each ) do
|
12
|
+
uri = URI.parse("https://test-token.paymill.com?transaction.mode=CONNECTOR_TEST&channel.id=941569045353c8ac2a5689deb88871bb&jsonPFunction=paymilljstests&account.number=4111111111111111&account.expiry.month=12&account.expiry.year=2015&account.verification=123&account.holder=John%20Rambo&presentation.amount3D=3201&presentation.currency3D=EUR")
|
13
|
+
https = Net::HTTP.new(uri.host, uri.port)
|
14
|
+
https.use_ssl = true
|
15
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
16
|
+
request.basic_auth( ENV['PAYMILL_API_TEST_KEY'], "" )
|
17
|
+
response = https.request(request)
|
18
|
+
@token = response.body.match('tok_[a-z|0-9]+')[0]
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
it 'should refund 1$ from transaction', :vcr do
|
23
|
+
amount = Random.rand(200..10000)
|
24
|
+
transaction = Transaction.create( token: @token, amount: amount, currency: currency )
|
25
|
+
|
26
|
+
refund = Refund.create( transaction, amount: 100 )
|
27
|
+
refund_id = refund.id
|
28
|
+
|
29
|
+
expect( refund.id ).to be_a String
|
30
|
+
expect( refund.amount ).to be 100
|
31
|
+
expect( refund.status ).to eq 'refunded'
|
32
|
+
expect( refund.description ).to be_nil
|
33
|
+
expect( refund.livemode ).to be false
|
34
|
+
expect( refund.created_at ).to be_a Time
|
35
|
+
expect( refund.updated_at ).to be_a Time
|
36
|
+
expect( refund.response_code ).to be 20000
|
37
|
+
expect( refund.transaction.id ).to eq transaction.id
|
38
|
+
expect( refund.transaction.amount ).to eq( transaction.origin_amount - 100 )
|
39
|
+
expect( refund.app_id ).to be_nil
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should refund 1$ from transaction with description', :vcr do
|
43
|
+
amount = Random.rand(200..10000)
|
44
|
+
transaction = Transaction.create( token: @token, amount: amount, currency: currency )
|
45
|
+
|
46
|
+
refund = Refund.create( transaction, amount: 100, description: 'Refunded By Ruby' )
|
47
|
+
expect( refund.id ).to be_a String
|
48
|
+
expect( refund.amount ).to be 100
|
49
|
+
expect( refund.status ).to eq 'refunded'
|
50
|
+
expect( refund.description ).to eq 'Refunded By Ruby'
|
51
|
+
expect( refund.livemode ).to be false
|
52
|
+
expect( refund.created_at ).to be_a Time
|
53
|
+
expect( refund.updated_at ).to be_a Time
|
54
|
+
expect( refund.response_code ).to be 20000
|
55
|
+
expect( refund.transaction.id ).to eq transaction.id
|
56
|
+
expect( refund.transaction.amount ).to eq( transaction.origin_amount - 100 )
|
57
|
+
expect( refund.app_id ).to be_nil
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should throw ArgumentError when no amount given', :vcr do
|
61
|
+
expect{ Refund.create( Transaction.create( token: @token, amount: 290, currency: currency ) ) }.to raise_error ArgumentError
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should throw ArgumentError when no transaction given', :vcr do
|
65
|
+
expect{ Refund.create( amount: 999 ) }.to raise_error ArgumentError
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context '::find' do
|
70
|
+
it 'should find existing refund', :vcr do
|
71
|
+
refund = Refund.find( refund_id )
|
72
|
+
|
73
|
+
expect( refund.id ).to be_a String
|
74
|
+
expect( refund.amount ).to be 100
|
75
|
+
expect( refund.status ).to eq 'refunded'
|
76
|
+
expect( refund.description ).to be_nil
|
77
|
+
expect( refund.livemode ).to be false
|
78
|
+
expect( refund.created_at ).to be_a Time
|
79
|
+
expect( refund.updated_at ).to be_a Time
|
80
|
+
expect( refund.response_code ).to be 20000
|
81
|
+
expect( refund.transaction ).not_to be_nil
|
82
|
+
expect( refund.app_id ).to be_nil
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'should raise PaymillError when invalid id given', :vcr do
|
86
|
+
expect{ Refund.find( 'fake_id' ) }.to raise_error PaymillError
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,607 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Paymill
|
4
|
+
describe Subscription do
|
5
|
+
|
6
|
+
let( :amount ) { 2990 }
|
7
|
+
let( :currency ) { 'USD' }
|
8
|
+
let( :interval ) { '1 MONTH' }
|
9
|
+
let( :client ) { Client.create( email: 'rocky.balboa@qaiware.com' ) }
|
10
|
+
let( :offer ) { Offer.create( amount: amount, currency: currency, interval: interval, name: 'Premium Stallion' ) }
|
11
|
+
|
12
|
+
subscription_id = nil
|
13
|
+
|
14
|
+
context '::create' do
|
15
|
+
before( :each ) do
|
16
|
+
uri = URI.parse("https://test-token.paymill.com?transaction.mode=CONNECTOR_TEST&channel.id=941569045353c8ac2a5689deb88871bb&jsonPFunction=paymilljstests&account.number=4111111111111111&account.expiry.month=12&account.expiry.year=2015&account.verification=123&account.holder=John%20Rambo&presentation.amount3D=3201&presentation.currency3D=EUR")
|
17
|
+
https = Net::HTTP.new(uri.host, uri.port)
|
18
|
+
https.use_ssl = true
|
19
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
20
|
+
request.basic_auth( ENV['PAYMILL_API_TEST_KEY'], "" )
|
21
|
+
response = https.request(request)
|
22
|
+
@token = response.body.match('tok_[a-z|0-9]+')[0]
|
23
|
+
@payment = Payment.create( token: @token, client: client.id )
|
24
|
+
@preauth = Preauthorization.create( payment: @payment, amount: amount, currency: currency, description: 'The Italian Stallion' )
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should create subscription from offer', :vcr do
|
28
|
+
subscription = Subscription.create( offer: offer, payment: @payment, client: client )
|
29
|
+
|
30
|
+
expect( subscription ).to be_a Subscription
|
31
|
+
|
32
|
+
expect( subscription.id ).to be_a String
|
33
|
+
expect( subscription.offer.id ).to eq offer.id
|
34
|
+
expect( subscription.livemode ).to be false
|
35
|
+
expect( subscription.amount ).to be amount
|
36
|
+
expect( subscription.temp_amount ).to be_nil
|
37
|
+
expect( subscription.currency ).to eq currency
|
38
|
+
expect( subscription.name ).to eq 'Premium Stallion'
|
39
|
+
expect( subscription.interval ).to eq interval
|
40
|
+
expect( subscription.trial_start ).to be_nil
|
41
|
+
expect( subscription.trial_end ).to be_nil
|
42
|
+
expect( subscription.period_of_validity ).to be_nil
|
43
|
+
expect( subscription.end_of_period ).to be_nil
|
44
|
+
expect( subscription.next_capture_at ).to be_a Time
|
45
|
+
expect( subscription.created_at ).to be_a Time
|
46
|
+
expect( subscription.updated_at ).to be_a Time
|
47
|
+
expect( subscription.canceled_at ).to be_nil
|
48
|
+
expect( subscription.payment.id ).to eq @payment.id
|
49
|
+
expect( subscription.app_id ).to be_nil
|
50
|
+
expect( subscription.is_canceled ).to be false
|
51
|
+
expect( subscription.is_deleted ).to be false
|
52
|
+
expect( subscription.status ).to eq 'active'
|
53
|
+
expect( subscription.client.id ).to eq client.id
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should throw ArgumentError when creating subscription without offer', :vcr do
|
57
|
+
expect{ Subscription.create( payment: @payment ) }.to raise_error ArgumentError
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should throw ArgumentError when creating subscription without interval', :vcr do
|
61
|
+
expect{ Subscription.create( payment: @payment, amount: amount, currency: currency ) }.to raise_error ArgumentError
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should create subscription without offer', :vcr do
|
65
|
+
subscription = Subscription.create( payment: @payment, client: client, amount: amount, currency: currency, interval: interval )
|
66
|
+
|
67
|
+
expect( subscription ).to be_a Subscription
|
68
|
+
|
69
|
+
expect( subscription.id ).to be_a String
|
70
|
+
expect( subscription.offer.amount ).to be amount
|
71
|
+
expect( subscription.offer.currency ).to eq currency
|
72
|
+
expect( subscription.offer.interval ).to eq interval
|
73
|
+
expect( subscription.livemode ).to be false
|
74
|
+
expect( subscription.amount ).to be amount
|
75
|
+
expect( subscription.temp_amount ).to be_nil
|
76
|
+
expect( subscription.currency ).to eq currency
|
77
|
+
expect( subscription.name ).to be_empty
|
78
|
+
expect( subscription.interval ).to eq interval
|
79
|
+
expect( subscription.trial_start ).to be_nil
|
80
|
+
expect( subscription.trial_end ).to be_nil
|
81
|
+
expect( subscription.period_of_validity ).to be_nil
|
82
|
+
expect( subscription.end_of_period ).to be_nil
|
83
|
+
expect( subscription.next_capture_at ).to be_a Time
|
84
|
+
expect( subscription.created_at ).to be_a Time
|
85
|
+
expect( subscription.updated_at ).to be_a Time
|
86
|
+
expect( subscription.canceled_at ).to be_nil
|
87
|
+
expect( subscription.payment.id ).to eq @payment.id
|
88
|
+
expect( subscription.app_id ).to be_nil
|
89
|
+
expect( subscription.is_canceled ).to be false
|
90
|
+
expect( subscription.is_deleted ).to be false
|
91
|
+
expect( subscription.status ).to eq 'active'
|
92
|
+
expect( subscription.client.id ).to eq client.id
|
93
|
+
expect( subscription.client.email ).to eq client.email
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'should create subscription without offer and new payment', :vcr do
|
97
|
+
subscription = Subscription.create( payment: Payment.create( token: @token), amount: amount, currency: currency, interval: interval )
|
98
|
+
|
99
|
+
expect( subscription ).to be_a Subscription
|
100
|
+
|
101
|
+
expect( subscription.id ).to be_a String
|
102
|
+
expect( subscription.offer.amount ).to be amount
|
103
|
+
expect( subscription.offer.currency ).to eq currency
|
104
|
+
expect( subscription.offer.interval ).to eq interval
|
105
|
+
expect( subscription.livemode ).to be false
|
106
|
+
expect( subscription.amount ).to be amount
|
107
|
+
expect( subscription.temp_amount ).to be_nil
|
108
|
+
expect( subscription.currency ).to eq currency
|
109
|
+
expect( subscription.name ).to be_empty
|
110
|
+
expect( subscription.interval ).to eq interval
|
111
|
+
expect( subscription.trial_start ).to be_nil
|
112
|
+
expect( subscription.trial_end ).to be_nil
|
113
|
+
expect( subscription.period_of_validity ).to be_nil
|
114
|
+
expect( subscription.end_of_period ).to be_nil
|
115
|
+
expect( subscription.next_capture_at ).to be_a Time
|
116
|
+
expect( subscription.created_at ).to be_a Time
|
117
|
+
expect( subscription.updated_at ).to be_a Time
|
118
|
+
expect( subscription.canceled_at ).to be_nil
|
119
|
+
expect( subscription.payment.id ).not_to eq @payment.id
|
120
|
+
expect( subscription.app_id ).to be_nil
|
121
|
+
expect( subscription.is_canceled ).to be false
|
122
|
+
expect( subscription.is_deleted ).to be false
|
123
|
+
expect( subscription.status ).to eq 'active'
|
124
|
+
expect( subscription.client.id ).not_to eq client.id
|
125
|
+
expect( subscription.client.email ).to be_nil
|
126
|
+
end
|
127
|
+
|
128
|
+
xit 'should create subscription without offer with client and new payment', :vcr do
|
129
|
+
subscription = Subscription.create( payment: Payment.create( token: token), client: client, amount: amount, currency: currency, interval: interval )
|
130
|
+
|
131
|
+
expect( subscription ).to be_a Subscription
|
132
|
+
|
133
|
+
expect( subscription.id ).to be_a String
|
134
|
+
expect( subscription.offer.amount ).to be amount
|
135
|
+
expect( subscription.offer.currency ).to eq currency
|
136
|
+
expect( subscription.offer.interval ).to eq interval
|
137
|
+
expect( subscription.livemode ).to be false
|
138
|
+
expect( subscription.amount ).to be amount
|
139
|
+
expect( subscription.temp_amount ).to be_nil
|
140
|
+
expect( subscription.currency ).to eq currency
|
141
|
+
expect( subscription.name ).to be_empty
|
142
|
+
expect( subscription.interval ).to eq interval
|
143
|
+
expect( subscription.trial_start ).to be_nil
|
144
|
+
expect( subscription.trial_end ).to be_nil
|
145
|
+
expect( subscription.period_of_validity ).to be_nil
|
146
|
+
expect( subscription.end_of_period ).to be_nil
|
147
|
+
expect( subscription.next_capture_at ).to be_a Time
|
148
|
+
expect( subscription.created_at ).to be_a Time
|
149
|
+
expect( subscription.updated_at ).to be_a Time
|
150
|
+
expect( subscription.canceled_at ).to be_nil
|
151
|
+
expect( subscription.payment.id ).not_to eq payment.id
|
152
|
+
expect( subscription.app_id ).to be_nil
|
153
|
+
expect( subscription.is_canceled ).to be false
|
154
|
+
expect( subscription.is_deleted ).to be false
|
155
|
+
expect( subscription.status ).to eq 'active'
|
156
|
+
expect( subscription.client.id ).to eq client.id
|
157
|
+
expect( subscription.client.email ).to eq client.email
|
158
|
+
end
|
159
|
+
|
160
|
+
it 'should create subscription without offer with name and period_of_validity and start_at', :vcr do
|
161
|
+
subscription = Subscription.create( payment: @payment, amount: amount, currency: currency, interval: interval, name: 'Basic Stallion', period_of_validity: '2 YEAR', start_at: 2.days.from_now, mandate_reference: 'Terminator' )
|
162
|
+
subscription_id = subscription.id
|
163
|
+
|
164
|
+
expect( subscription ).to be_a Subscription
|
165
|
+
|
166
|
+
expect( subscription.id ).to be_a String
|
167
|
+
expect( subscription.mandate_reference ).to eq 'Terminator'
|
168
|
+
expect( subscription.offer.amount ).to be amount
|
169
|
+
expect( subscription.offer.currency ).to eq currency
|
170
|
+
expect( subscription.offer.interval ).to eq interval
|
171
|
+
expect( subscription.offer.name ).to eq 'Basic Stallion'
|
172
|
+
expect( subscription.livemode ).to be false
|
173
|
+
expect( subscription.amount ).to be amount
|
174
|
+
expect( subscription.temp_amount ).to be_nil
|
175
|
+
expect( subscription.currency ).to eq currency
|
176
|
+
expect( subscription.name ).to eq 'Basic Stallion'
|
177
|
+
expect( subscription.interval ).to eq interval
|
178
|
+
expect( subscription.trial_start ).to be_a Time
|
179
|
+
expect( subscription.trial_end ).to be_a Time
|
180
|
+
expect( subscription.period_of_validity ).to eq '2 YEAR'
|
181
|
+
expect( subscription.end_of_period ).to be_a Time
|
182
|
+
expect( subscription.next_capture_at ).to be_a Time
|
183
|
+
expect( subscription.created_at ).to be_a Time
|
184
|
+
expect( subscription.updated_at ).to be_a Time
|
185
|
+
expect( subscription.canceled_at ).to be_nil
|
186
|
+
expect( subscription.payment.id ).to eq @payment.id
|
187
|
+
expect( subscription.app_id ).to be_nil
|
188
|
+
expect( subscription.is_canceled ).to be false
|
189
|
+
expect( subscription.is_deleted ).to be false
|
190
|
+
expect( subscription.status ).to eq 'active'
|
191
|
+
expect( subscription.client.id ).to eq client.id
|
192
|
+
expect( subscription.client.email ).to eq client.email
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'should creaate subscription with offer and different values', :vcr do
|
196
|
+
subscription = Subscription.create( payment: @payment, amount: 777, currency: 'EUR', interval: '1 WEEK', offer: offer )
|
197
|
+
|
198
|
+
expect( subscription ).to be_a Subscription
|
199
|
+
|
200
|
+
expect( subscription.id ).to be_a String
|
201
|
+
expect( subscription.offer.amount ).to be amount
|
202
|
+
expect( subscription.offer.currency ).to eq currency
|
203
|
+
expect( subscription.offer.interval ).to eq interval
|
204
|
+
expect( subscription.offer.name ).to eq 'Premium Stallion'
|
205
|
+
expect( subscription.livemode ).to be false
|
206
|
+
expect( subscription.amount ).to be 777
|
207
|
+
expect( subscription.temp_amount ).to be_nil
|
208
|
+
expect( subscription.currency ).to eq 'EUR'
|
209
|
+
expect( subscription.name ).to eq 'Premium Stallion'
|
210
|
+
expect( subscription.interval ).to eq '1 WEEK'
|
211
|
+
expect( subscription.trial_start ).to be_nil
|
212
|
+
expect( subscription.trial_end ).to be_nil
|
213
|
+
expect( subscription.period_of_validity ).to be_nil
|
214
|
+
expect( subscription.end_of_period ).to be_nil
|
215
|
+
expect( subscription.next_capture_at ).to be_a Time
|
216
|
+
expect( subscription.created_at ).to be_a Time
|
217
|
+
expect( subscription.updated_at ).to be_a Time
|
218
|
+
expect( subscription.canceled_at ).to be_nil
|
219
|
+
expect( subscription.payment.id ).to eq @payment.id
|
220
|
+
expect( subscription.app_id ).to be_nil
|
221
|
+
expect( subscription.is_canceled ).to be false
|
222
|
+
expect( subscription.is_deleted ).to be false
|
223
|
+
expect( subscription.status ).to eq 'active'
|
224
|
+
expect( subscription.client.id ).to eq client.id
|
225
|
+
expect( subscription.client.email ).to eq client.email
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
context '::find' do
|
230
|
+
it 'should find a subscription by given id', :vcr do
|
231
|
+
expect( Subscription.find( subscription_id ).id ).to eq subscription_id
|
232
|
+
end
|
233
|
+
|
234
|
+
it 'should throw PaymillError by given fake id', :vcr do
|
235
|
+
expect{ Subscription.find( 'fake_id' ).id }.to raise_error PaymillError
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
context '::update' do
|
240
|
+
before( :each ) do
|
241
|
+
uri = URI.parse("https://test-token.paymill.com?transaction.mode=CONNECTOR_TEST&channel.id=941569045353c8ac2a5689deb88871bb&jsonPFunction=paymilljstests&account.number=4111111111111111&account.expiry.month=12&account.expiry.year=2015&account.verification=123&account.holder=John%20Rambo&presentation.amount3D=3201&presentation.currency3D=EUR")
|
242
|
+
https = Net::HTTP.new(uri.host, uri.port)
|
243
|
+
https.use_ssl = true
|
244
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
245
|
+
request.basic_auth( ENV['PAYMILL_API_TEST_KEY'], "" )
|
246
|
+
response = https.request(request)
|
247
|
+
@token = response.body.match('tok_[a-z|0-9]+')[0]
|
248
|
+
@payment = Payment.create( token: @token, client: client.id )
|
249
|
+
@preauth = Preauthorization.create( payment: @payment, amount: amount, currency: currency, description: 'The Italian Stallion' )
|
250
|
+
end
|
251
|
+
|
252
|
+
it 'should update all "instance" attributes without the offer', :vcr do
|
253
|
+
subscription = Subscription.create( payment: @payment, amount: amount, currency: currency, interval: interval, name: 'Basic Stallion', period_of_validity: '2 YEAR', start_at: 2.days.from_now )
|
254
|
+
|
255
|
+
subscription.payment = Payment.create( token: @token, client: client )
|
256
|
+
payment_id = subscription.payment.id
|
257
|
+
subscription.currency = 'EUR'
|
258
|
+
subscription.interval = '1 MONTH,FRIDAY'
|
259
|
+
subscription.name = 'Changed Subscription'
|
260
|
+
subscription.period_of_validity = '14 MONTH'
|
261
|
+
|
262
|
+
subscription.update
|
263
|
+
|
264
|
+
expect( subscription ).to be_a Subscription
|
265
|
+
|
266
|
+
expect( subscription.id ).to be_a String
|
267
|
+
expect( subscription.offer.amount ).to be amount
|
268
|
+
expect( subscription.offer.currency ).to eq currency
|
269
|
+
expect( subscription.offer.interval ).to eq interval
|
270
|
+
expect( subscription.offer.name ).to eq 'Basic Stallion'
|
271
|
+
expect( subscription.livemode ).to be false
|
272
|
+
expect( subscription.amount ).to be amount
|
273
|
+
expect( subscription.temp_amount ).to be_nil
|
274
|
+
expect( subscription.currency ).to eq 'EUR'
|
275
|
+
expect( subscription.name ).to eq 'Changed Subscription'
|
276
|
+
expect( subscription.interval ).to eq '1 MONTH,FRIDAY'
|
277
|
+
expect( subscription.trial_start ).to be_a Time
|
278
|
+
expect( subscription.trial_end ).to be_a Time
|
279
|
+
expect( subscription.period_of_validity ).to eq '14 MONTH'
|
280
|
+
expect( subscription.end_of_period ).to be_a Time
|
281
|
+
expect( subscription.next_capture_at ).to be_a Time
|
282
|
+
expect( subscription.created_at ).to be_a Time
|
283
|
+
expect( subscription.updated_at ).to be_a Time
|
284
|
+
expect( subscription.canceled_at ).to be_nil
|
285
|
+
expect( subscription.payment.id ).to eq payment_id
|
286
|
+
expect( subscription.app_id ).to be_nil
|
287
|
+
expect( subscription.is_canceled ).to be false
|
288
|
+
expect( subscription.is_deleted ).to be false
|
289
|
+
expect( subscription.status ).to eq 'active'
|
290
|
+
expect( subscription.client.id ).to eq client.id
|
291
|
+
expect( subscription.client.email ).to eq client.email
|
292
|
+
expect( subscription.created_at ).to be < subscription.updated_at
|
293
|
+
end
|
294
|
+
|
295
|
+
it 'should change the amount of a subscription once', :vcr do
|
296
|
+
subscription = Subscription.create( payment: @payment, offer: offer )
|
297
|
+
sleep 1
|
298
|
+
subscription.update_amount_once( 1717 )
|
299
|
+
|
300
|
+
expect( subscription.id ).to be_a String
|
301
|
+
expect( subscription.offer.amount ).to be amount
|
302
|
+
expect( subscription.offer.currency ).to eq currency
|
303
|
+
expect( subscription.offer.interval ).to eq interval
|
304
|
+
expect( subscription.offer.name ).to eq offer.name
|
305
|
+
expect( subscription.livemode ).to be false
|
306
|
+
expect( subscription.amount ).to be amount
|
307
|
+
expect( subscription.temp_amount ).to be 1717
|
308
|
+
expect( subscription.currency ).to eq currency
|
309
|
+
expect( subscription.name ).to eq offer.name
|
310
|
+
expect( subscription.interval ).to eq interval
|
311
|
+
expect( subscription.trial_start ).to be_nil
|
312
|
+
expect( subscription.trial_end ).to be_nil
|
313
|
+
expect( subscription.period_of_validity ).to be_nil
|
314
|
+
expect( subscription.end_of_period ).to be_nil
|
315
|
+
expect( subscription.next_capture_at ).to be_a Time
|
316
|
+
expect( subscription.created_at ).to be_a Time
|
317
|
+
expect( subscription.updated_at ).to be_a Time
|
318
|
+
expect( subscription.canceled_at ).to be_nil
|
319
|
+
expect( subscription.app_id ).to be_nil
|
320
|
+
expect( subscription.is_canceled ).to be false
|
321
|
+
expect( subscription.is_deleted ).to be false
|
322
|
+
expect( subscription.status ).to eq 'active'
|
323
|
+
expect( subscription.client.email ).to eq client.email
|
324
|
+
expect( subscription.created_at ).to be < subscription.updated_at
|
325
|
+
end
|
326
|
+
|
327
|
+
it 'should change the amount of a subscription permanently', :vcr do
|
328
|
+
subscription = Subscription.find( subscription_id )
|
329
|
+
|
330
|
+
subscription.update_amount_permanently( 1717 )
|
331
|
+
|
332
|
+
expect( subscription.id ).to be_a String
|
333
|
+
expect( subscription.offer.amount ).to be amount
|
334
|
+
expect( subscription.offer.currency ).to eq currency
|
335
|
+
expect( subscription.offer.interval ).to eq interval
|
336
|
+
expect( subscription.offer.name ).to eq 'Basic Stallion'
|
337
|
+
expect( subscription.livemode ).to be false
|
338
|
+
expect( subscription.amount ).to be 1717
|
339
|
+
expect( subscription.temp_amount ).to be_nil
|
340
|
+
expect( subscription.currency ).to eq currency
|
341
|
+
expect( subscription.name ).to eq 'Basic Stallion'
|
342
|
+
expect( subscription.interval ).to eq interval
|
343
|
+
expect( subscription.trial_start ).to be_a Time
|
344
|
+
expect( subscription.trial_end ).to be_a Time
|
345
|
+
expect( subscription.period_of_validity ).to eq '2 YEAR'
|
346
|
+
expect( subscription.end_of_period ).to be_a Time
|
347
|
+
expect( subscription.next_capture_at ).to be_a Time
|
348
|
+
expect( subscription.created_at ).to be_a Time
|
349
|
+
expect( subscription.updated_at ).to be_a Time
|
350
|
+
expect( subscription.canceled_at ).to be_nil
|
351
|
+
expect( subscription.app_id ).to be_nil
|
352
|
+
expect( subscription.is_canceled ).to be false
|
353
|
+
expect( subscription.is_deleted ).to be false
|
354
|
+
expect( subscription.status ).to eq 'active'
|
355
|
+
expect( subscription.client.email ).to eq client.email
|
356
|
+
expect( subscription.created_at ).to be < subscription.updated_at
|
357
|
+
end
|
358
|
+
|
359
|
+
it 'should change the offer of a subscription with no refund and unchanged capture date', :vcr do
|
360
|
+
subscription = Subscription.create( payment: @payment, offer: offer )
|
361
|
+
new_offer = Offer.create( name: 'Foo', amount: 4990, currency: 'EUR', interval: '2 WEEK')
|
362
|
+
|
363
|
+
subscription.update_offer_without_changes( new_offer )
|
364
|
+
|
365
|
+
expect( subscription.id ).to be_a String
|
366
|
+
expect( subscription.offer.amount ).to be new_offer.amount
|
367
|
+
expect( subscription.offer.currency ).to eq new_offer.currency
|
368
|
+
expect( subscription.offer.interval ).to eq new_offer.interval
|
369
|
+
expect( subscription.offer.name ).to eq new_offer.name
|
370
|
+
expect( subscription.livemode ).to be false
|
371
|
+
expect( subscription.amount ).to be new_offer.amount
|
372
|
+
expect( subscription.temp_amount ).to be_nil
|
373
|
+
expect( subscription.currency ).to eq new_offer.currency
|
374
|
+
expect( subscription.name ).to eq new_offer.name
|
375
|
+
expect( subscription.interval ).to eq new_offer.interval
|
376
|
+
expect( subscription.trial_start ).to be_nil
|
377
|
+
expect( subscription.trial_end ).to be_nil
|
378
|
+
expect( subscription.period_of_validity ).to be_nil
|
379
|
+
expect( subscription.end_of_period ).to be_nil
|
380
|
+
expect( subscription.next_capture_at ).to be_a Time
|
381
|
+
expect( subscription.created_at ).to be_a Time
|
382
|
+
expect( subscription.updated_at ).to be_a Time
|
383
|
+
expect( subscription.canceled_at ).to be_nil
|
384
|
+
expect( subscription.app_id ).to be_nil
|
385
|
+
expect( subscription.is_canceled ).to be false
|
386
|
+
expect( subscription.is_deleted ).to be false
|
387
|
+
expect( subscription.status ).to eq 'active'
|
388
|
+
expect( subscription.client.email ).to eq client.email
|
389
|
+
expect( subscription.created_at ).to be < subscription.updated_at
|
390
|
+
end
|
391
|
+
|
392
|
+
it 'should change the offer of a subscription with refund and unchanged capture date', :vcr do
|
393
|
+
subscription = Subscription.create( payment: @payment, offer: offer )
|
394
|
+
new_offer = Offer.create( name: 'Foo', amount: 1990, currency: 'EUR', interval: '2 WEEK')
|
395
|
+
|
396
|
+
subscription.update_offer_with_refund( new_offer )
|
397
|
+
|
398
|
+
expect( subscription.id ).to be_a String
|
399
|
+
expect( subscription.offer.amount ).to be new_offer.amount
|
400
|
+
expect( subscription.offer.currency ).to eq new_offer.currency
|
401
|
+
expect( subscription.offer.interval ).to eq new_offer.interval
|
402
|
+
expect( subscription.offer.name ).to eq new_offer.name
|
403
|
+
expect( subscription.livemode ).to be false
|
404
|
+
expect( subscription.amount ).to be new_offer.amount
|
405
|
+
expect( subscription.temp_amount ).to be_nil
|
406
|
+
expect( subscription.currency ).to eq new_offer.currency
|
407
|
+
expect( subscription.name ).to eq new_offer.name
|
408
|
+
expect( subscription.interval ).to eq new_offer.interval
|
409
|
+
expect( subscription.trial_start ).to be_nil
|
410
|
+
expect( subscription.trial_end ).to be_nil
|
411
|
+
expect( subscription.period_of_validity ).to be_nil
|
412
|
+
expect( subscription.end_of_period ).to be_nil
|
413
|
+
expect( subscription.next_capture_at ).to be_a Time
|
414
|
+
expect( subscription.created_at ).to be_a Time
|
415
|
+
expect( subscription.updated_at ).to be_a Time
|
416
|
+
expect( subscription.canceled_at ).to be_nil
|
417
|
+
expect( subscription.app_id ).to be_nil
|
418
|
+
expect( subscription.is_canceled ).to be false
|
419
|
+
expect( subscription.is_deleted ).to be false
|
420
|
+
expect( subscription.status ).to eq 'active'
|
421
|
+
expect( subscription.client.email ).to eq client.email
|
422
|
+
expect( subscription.created_at ).to be < subscription.updated_at
|
423
|
+
end
|
424
|
+
|
425
|
+
it 'should change the offer of a subscription with refund and capture date', :vcr do
|
426
|
+
subscription = Subscription.create( payment: @payment, offer: offer )
|
427
|
+
new_offer = Offer.create( name: 'Foo', amount: 1990, currency: 'EUR', interval: '2 WEEK')
|
428
|
+
|
429
|
+
subscription.update_offer_with_refund_and_capture_date( new_offer )
|
430
|
+
|
431
|
+
expect( subscription.id ).to be_a String
|
432
|
+
expect( subscription.offer.amount ).to be new_offer.amount
|
433
|
+
expect( subscription.offer.currency ).to eq new_offer.currency
|
434
|
+
expect( subscription.offer.interval ).to eq new_offer.interval
|
435
|
+
expect( subscription.offer.name ).to eq new_offer.name
|
436
|
+
expect( subscription.livemode ).to be false
|
437
|
+
expect( subscription.amount ).to be new_offer.amount
|
438
|
+
expect( subscription.temp_amount ).to be_nil
|
439
|
+
expect( subscription.currency ).to eq new_offer.currency
|
440
|
+
expect( subscription.name ).to eq new_offer.name
|
441
|
+
expect( subscription.interval ).to eq new_offer.interval
|
442
|
+
expect( subscription.trial_start ).to be_nil
|
443
|
+
expect( subscription.trial_end ).to be_nil
|
444
|
+
expect( subscription.period_of_validity ).to be_nil
|
445
|
+
expect( subscription.end_of_period ).to be_nil
|
446
|
+
expect( subscription.next_capture_at ).to be_a Time
|
447
|
+
expect( subscription.created_at ).to be_a Time
|
448
|
+
expect( subscription.updated_at ).to be_a Time
|
449
|
+
expect( subscription.canceled_at ).to be_nil
|
450
|
+
expect( subscription.app_id ).to be_nil
|
451
|
+
expect( subscription.is_canceled ).to be false
|
452
|
+
expect( subscription.is_deleted ).to be false
|
453
|
+
expect( subscription.status ).to eq 'active'
|
454
|
+
expect( subscription.client.email ).to eq client.email
|
455
|
+
expect( subscription.created_at ).to be < subscription.updated_at
|
456
|
+
end
|
457
|
+
|
458
|
+
it 'should stops the trial period', :vcr do
|
459
|
+
subscription = Subscription.create( payment: @payment, amount: amount, currency: currency, interval: interval, name: 'Bar', start_at: Time.new( 2016, 11, 17, 15, 0, 0 ).to_i )
|
460
|
+
next_capture_at = subscription.next_capture_at
|
461
|
+
expect( subscription.trial_end.beginning_of_day ).to eq Time.new( 2016, 11, 17, 15, 0, 0 ).beginning_of_day
|
462
|
+
|
463
|
+
subscription.stop_trial_period()
|
464
|
+
|
465
|
+
expect( subscription.trial_end ).to eq subscription.updated_at
|
466
|
+
expect( subscription.next_capture_at ).to be < next_capture_at
|
467
|
+
expect( subscription.created_at ).to be < subscription.updated_at
|
468
|
+
end
|
469
|
+
|
470
|
+
it 'should unlimit-limit the validity of a subscription', :vcr do
|
471
|
+
subscription = Subscription.create( payment: @payment, offer: offer, name: 'Baz', period_of_validity: '2 MONTH' )
|
472
|
+
expect( subscription.period_of_validity ).to eq '2 MONTH'
|
473
|
+
expect( subscription.end_of_period ).not_to be_nil
|
474
|
+
|
475
|
+
subscription.unlimit
|
476
|
+
expect( subscription.end_of_period ).to be_nil
|
477
|
+
expect( subscription.period_of_validity ).to be_nil
|
478
|
+
|
479
|
+
subscription.limit( '3 MONTH' )
|
480
|
+
expect( subscription.end_of_period ).to be_a Time
|
481
|
+
expect( subscription.period_of_validity ).to eq '3 MONTH'
|
482
|
+
expect( subscription.created_at ).to be < subscription.updated_at
|
483
|
+
end
|
484
|
+
|
485
|
+
it 'should pause-play a subscription', :vcr do
|
486
|
+
subscription = Subscription.create( payment: @payment, offer: offer, name: 'To Delete' )
|
487
|
+
expect( subscription.period_of_validity ).to be_nil
|
488
|
+
expect( subscription.end_of_period ).to be_nil
|
489
|
+
|
490
|
+
subscription.pause
|
491
|
+
expect( subscription.status ).to eq 'inactive'
|
492
|
+
|
493
|
+
subscription.play
|
494
|
+
expect( subscription.status ).to eq 'active'
|
495
|
+
expect( subscription.created_at ).to be < subscription.updated_at
|
496
|
+
end
|
497
|
+
|
498
|
+
it "should update subscription's currency", :vcr do
|
499
|
+
subscription = Subscription.find( subscription_id )
|
500
|
+
subscription.currency = 'BGN'
|
501
|
+
subscription.update
|
502
|
+
|
503
|
+
expect( subscription.currency ).to eq 'BGN'
|
504
|
+
expect( subscription.created_at ).to be < subscription.updated_at
|
505
|
+
end
|
506
|
+
|
507
|
+
it "should update subscription's name", :vcr do
|
508
|
+
subscription = Subscription.find( subscription_id )
|
509
|
+
subscription.name = 'goo'
|
510
|
+
subscription.update
|
511
|
+
|
512
|
+
expect( subscription.name ).to eq 'goo'
|
513
|
+
expect( subscription.created_at ).to be < subscription.updated_at
|
514
|
+
end
|
515
|
+
|
516
|
+
it "should update subscription's interval", :vcr do
|
517
|
+
subscription = Subscription.find( subscription_id )
|
518
|
+
subscription.interval = '5 WEEK'
|
519
|
+
subscription.update
|
520
|
+
|
521
|
+
expect( subscription.interval ).to eq '5 WEEK'
|
522
|
+
expect( subscription.created_at ).to be < subscription.updated_at
|
523
|
+
end
|
524
|
+
|
525
|
+
it "should update subscription's payment", :vcr do
|
526
|
+
new_payment = Payment.create( token: @token, client: client )
|
527
|
+
subscription = Subscription.find( subscription_id )
|
528
|
+
subscription.payment = new_payment
|
529
|
+
subscription.update
|
530
|
+
|
531
|
+
expect( subscription.payment.id ).to eq new_payment.id
|
532
|
+
expect( subscription.created_at ).to be < subscription.updated_at
|
533
|
+
end
|
534
|
+
end
|
535
|
+
|
536
|
+
context '::delete' do
|
537
|
+
before( :each ) do
|
538
|
+
uri = URI.parse("https://test-token.paymill.com?transaction.mode=CONNECTOR_TEST&channel.id=941569045353c8ac2a5689deb88871bb&jsonPFunction=paymilljstests&account.number=4111111111111111&account.expiry.month=12&account.expiry.year=2015&account.verification=123&account.holder=John%20Rambo&presentation.amount3D=3201&presentation.currency3D=EUR")
|
539
|
+
https = Net::HTTP.new(uri.host, uri.port)
|
540
|
+
https.use_ssl = true
|
541
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
542
|
+
request.basic_auth( ENV['PAYMILL_API_TEST_KEY'], "" )
|
543
|
+
response = https.request(request)
|
544
|
+
@token = response.body.match('tok_[a-z|0-9]+')[0]
|
545
|
+
@payment = Payment.create( token: @token, client: client.id )
|
546
|
+
@preauth = Preauthorization.create( payment: @payment, amount: amount, currency: currency, description: 'The Italian Stallion' )
|
547
|
+
end
|
548
|
+
|
549
|
+
it 'should cancel the given subscription', :vcr do
|
550
|
+
subscription = Subscription.create( payment: @payment, offer: offer, name: 'To Delete' ).cancel
|
551
|
+
|
552
|
+
expect( subscription.id ).to be_a String
|
553
|
+
expect( subscription.offer.amount ).to be offer.amount
|
554
|
+
expect( subscription.offer.currency ).to eq offer.currency
|
555
|
+
expect( subscription.offer.interval ).to eq offer.interval
|
556
|
+
expect( subscription.offer.name ).to eq offer.name
|
557
|
+
expect( subscription.livemode ).to be false
|
558
|
+
expect( subscription.amount ).to be offer.amount
|
559
|
+
expect( subscription.temp_amount ).to be_nil
|
560
|
+
expect( subscription.currency ).to eq offer.currency
|
561
|
+
expect( subscription.name ).to eq 'To Delete'
|
562
|
+
expect( subscription.interval ).to eq offer.interval
|
563
|
+
expect( subscription.trial_start ).to be_nil
|
564
|
+
expect( subscription.trial_end ).to be_nil
|
565
|
+
expect( subscription.period_of_validity ).to be_nil
|
566
|
+
expect( subscription.end_of_period ).to be_nil
|
567
|
+
expect( subscription.next_capture_at ).to be_nil
|
568
|
+
expect( subscription.created_at ).to be_a Time
|
569
|
+
expect( subscription.updated_at ).to be_a Time
|
570
|
+
expect( subscription.canceled_at ).to be_a Time
|
571
|
+
expect( subscription.app_id ).to be_nil
|
572
|
+
expect( subscription.is_canceled ).to be true
|
573
|
+
expect( subscription.is_deleted ).to be false
|
574
|
+
expect( subscription.status ).to eq 'inactive'
|
575
|
+
expect( subscription.client.email ).to eq client.email
|
576
|
+
end
|
577
|
+
it 'should remove the given subscription', :vcr do
|
578
|
+
subscription = Subscription.create( payment: @payment, offer: offer, name: 'To Delete' ).remove
|
579
|
+
|
580
|
+
expect( subscription.id ).to be_a String
|
581
|
+
expect( subscription.offer.amount ).to be offer.amount
|
582
|
+
expect( subscription.offer.currency ).to eq offer.currency
|
583
|
+
expect( subscription.offer.interval ).to eq offer.interval
|
584
|
+
expect( subscription.offer.name ).to eq offer.name
|
585
|
+
expect( subscription.livemode ).to be false
|
586
|
+
expect( subscription.amount ).to be offer.amount
|
587
|
+
expect( subscription.temp_amount ).to be_nil
|
588
|
+
expect( subscription.currency ).to eq offer.currency
|
589
|
+
expect( subscription.name ).to eq 'To Delete'
|
590
|
+
expect( subscription.interval ).to eq offer.interval
|
591
|
+
expect( subscription.trial_start ).to be_nil
|
592
|
+
expect( subscription.trial_end ).to be_nil
|
593
|
+
expect( subscription.period_of_validity ).to be_nil
|
594
|
+
expect( subscription.end_of_period ).to be_nil
|
595
|
+
expect( subscription.next_capture_at ).to be_nil
|
596
|
+
expect( subscription.created_at ).to be_a Time
|
597
|
+
expect( subscription.updated_at ).to be_a Time
|
598
|
+
expect( subscription.canceled_at ).to be_a Time
|
599
|
+
expect( subscription.app_id ).to be_nil
|
600
|
+
expect( subscription.is_canceled ).to be true
|
601
|
+
expect( subscription.is_deleted ).to be true
|
602
|
+
expect( subscription.status ).to eq 'inactive'
|
603
|
+
expect( subscription.client.email ).to eq client.email
|
604
|
+
end
|
605
|
+
end
|
606
|
+
end
|
607
|
+
end
|