mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
Merge branch 'tests' of git.sleede.com:projets/fab-manager into tests
This commit is contained in:
commit
752f40a951
13
README.md
13
README.md
@ -155,7 +155,7 @@ DNS name or IP address of the server hosting the elasticSearch database.
|
||||
SECRET_KEY_BASE
|
||||
|
||||
Used by the authentication system to generate random tokens, eg. for resetting passwords.
|
||||
Used by Rails to generate the integrity of signed cookies.
|
||||
Used by Rails to verify the integrity of signed cookies.
|
||||
You can generate such a random key by running `rake secret`.
|
||||
|
||||
STRIPE_API_KEY & STRIPE_PUBLISHABLE_KEY
|
||||
@ -174,8 +174,8 @@ So set this setting carefully before starting the application for the first time
|
||||
|
||||
INVOICE_PREFIX
|
||||
|
||||
When payments are done on the platform, an invoice will be generate as a PDF file.
|
||||
This value configure the prefix of the PDF file name.
|
||||
When payments are done on the platform, an invoice will be generated as a PDF file.
|
||||
The PDF file name will be of the form "(INVOICE_PREFIX) - (invoice ID) _ (invoice date) .pdf"
|
||||
|
||||
FABLAB_WITHOUT_PLANS
|
||||
|
||||
@ -203,7 +203,7 @@ Identifier of your Google Analytics account.
|
||||
DISQUS_SHORTNAME
|
||||
|
||||
Unique identifier of your [Disqus](http://www.disqus.com) forum.
|
||||
Disquq forums are used to allow visitors to comment on projects.
|
||||
Disqus forums are used to allow visitors to comment on projects.
|
||||
See https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname- for more informations.
|
||||
|
||||
TWITTER_NAME
|
||||
@ -213,6 +213,7 @@ Identifier of the Twitter account, for witch the last tweet will be displayed on
|
||||
TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET, TWITTER_ACCESS_TOKEN & TWITTER_ACCESS_TOKEN_SECRET
|
||||
|
||||
Keys and secrets to access the twitter API.
|
||||
Retrieve them from https://apps.twitter.com
|
||||
|
||||
Settings related to i18n
|
||||
|
||||
@ -443,7 +444,9 @@ If you are in a development environment, your can keep the default values, other
|
||||
#### Settings
|
||||
RAILS_LOCALE
|
||||
|
||||
Be sure that `config/locales/rails.XX.yml` exists, where `XX` match your configured rails_locale.
|
||||
Configure Ruby on Rails for l10n.
|
||||
|
||||
Be sure that `config/locales/rails.XX.yml` exists, where `XX` match your configured RAILS_LOCALE.
|
||||
You can find templates of these files at https://github.com/svenfuchs/rails-i18n/tree/rails-4-x/rails/locale.
|
||||
|
||||
Be aware that **this file MUST contain the CURRENCY symbol used to generate invoices** (among other things).
|
||||
|
@ -154,11 +154,11 @@
|
||||
|
||||
<tr class="invoice-vat invoice-editable vat-line italic" ng-click="openEditVAT()" ng-show="invoice.VAT.active">
|
||||
<td>{{ 'including_VAT' | translate }} {{invoice.VAT.rate}} %</td>
|
||||
<td>{{30*invoice.VAT.rate/100 | currency}}</td>
|
||||
<td>{{30/(invoice.VAT.rate/100+1) | currency}}</td>
|
||||
</tr>
|
||||
<tr class="invoice-ht vat-line italic" ng-show="invoice.VAT.active">
|
||||
<td translate>{{ 'including_total_excluding_taxes' }}</td>
|
||||
<td>{{30-(30*invoice.VAT.rate/100) | currency}}</td>
|
||||
<td>{{30-(30/(invoice.VAT.rate/100+1)) | currency}}</td>
|
||||
</tr>
|
||||
<tr class="invoice-payed vat-line bold" ng-show="invoice.VAT.active">
|
||||
<td translate>{{ 'including_amount_payed_on_ordering' }}</td>
|
||||
|
@ -117,7 +117,7 @@ class Invoice < ActiveRecord::Base
|
||||
reference
|
||||
end
|
||||
|
||||
# only for debug
|
||||
# for debug & used by rake task "fablab:regenerate_invoices"
|
||||
def regenerate_invoice_pdf
|
||||
pdf = ::PDF::Invoice.new(self).render
|
||||
File.binwrite(file, pdf)
|
||||
|
@ -138,7 +138,7 @@ module PDF
|
||||
data += [ [I18n.t('invoices.total_including_all_taxes'), number_to_currency(total)] ]
|
||||
|
||||
vat_rate = Setting.find_by({name: 'invoice_VAT-rate'}).value.to_f
|
||||
vat = total * vat_rate / 100
|
||||
vat = total / (vat_rate / 100 + 1)
|
||||
data += [ [I18n.t('invoices.including_VAT_RATE', RATE: vat_rate), number_to_currency(vat)] ]
|
||||
data += [ [I18n.t('invoices.including_total_excluding_taxes'), number_to_currency(total-vat)] ]
|
||||
data += [ [I18n.t('invoices.including_amount_payed_on_ordering'), number_to_currency(total)] ]
|
||||
|
@ -26,14 +26,7 @@ namespace :fablab do
|
||||
start_date = Time.new(year.to_i, month.to_i, 1)
|
||||
end_date = start_date.next_month
|
||||
puts "-> Start regenerate the invoices between #{I18n.l start_date, format: :long} in #{I18n.l end_date-1.minute, format: :long}"
|
||||
index = '000'
|
||||
invoices = Invoice.only_invoice.where("created_at >= :start_date AND created_at < :end_date", {start_date: start_date, end_date: end_date}).order(created_at: :asc)
|
||||
invoices.each do |i|
|
||||
i.update_columns(reference: "#{year.to_s[2..3]}#{'%02d' % month}#{index.next!}#{i.stp_invoice_id ? '/VL' : ''}")
|
||||
if i.avoir
|
||||
i.avoir.update_columns(reference: "#{year.to_s[2..3]}#{'%02d' % month}#{index.next!}/A")
|
||||
end
|
||||
end
|
||||
invoices.each(&:regenerate_invoice_pdf)
|
||||
puts "-> Done"
|
||||
end
|
||||
|
57
test/integration/subscriptions/create_as_admin_test.rb
Normal file
57
test/integration/subscriptions/create_as_admin_test.rb
Normal file
@ -0,0 +1,57 @@
|
||||
class CreateAsUserTest < ActionDispatch::IntegrationTest
|
||||
|
||||
|
||||
setup do
|
||||
@admin = User.find_by_username('admin')
|
||||
login_as(@admin, scope: :user)
|
||||
end
|
||||
|
||||
test "admin takes a subscription for a user" do
|
||||
user = User.find_by_username('jdupond')
|
||||
plan = Plan.find_by(group_id: user.group.id, type: 'Plan', base_name: 'Mensuel')
|
||||
|
||||
VCR.use_cassette("subscriptions_admin_create_success") do
|
||||
post '/api/subscriptions',
|
||||
{
|
||||
subscription: {
|
||||
plan_id: plan.id,
|
||||
user_id: user.id
|
||||
}
|
||||
}.to_json, default_headers
|
||||
end
|
||||
|
||||
|
||||
# Check response format & status
|
||||
assert_equal 201, response.status, response.body
|
||||
assert_equal Mime::JSON, response.content_type
|
||||
|
||||
# Check the correct plan was subscribed
|
||||
subscription = json_response(response.body)
|
||||
assert_equal plan.id, subscription[:plan_id], 'subscribed plan does not match'
|
||||
|
||||
# Check that the user has the correct subscription
|
||||
assert_not_nil user.subscription, "user's subscription was not found"
|
||||
assert_not_nil user.subscription.plan, "user's subscribed plan was not found"
|
||||
assert_equal plan.id, user.subscription.plan_id, "user's plan does not match"
|
||||
|
||||
# Check that the training credits were set correctly
|
||||
assert_empty user.training_credits, 'training credits were not reset'
|
||||
assert_equal user.subscription.plan.training_credit_nb, plan.training_credit_nb, 'trainings credits were not allocated'
|
||||
|
||||
# Check that the user benefit from prices of his plan
|
||||
printer = Machine.find_by_slug('imprimante-3d')
|
||||
assert_equal 15, (printer.prices.find_by(group_id: user.group_id, plan_id: user.subscription.plan_id).amount / 100), 'machine hourly price does not match'
|
||||
|
||||
# Check notification was sent to the user
|
||||
notification = Notification.find_by(notification_type_id: NotificationType.find_by_name('notify_member_subscribed_plan'), attached_object_type: 'Subscription', attached_object_id: subscription[:id])
|
||||
assert_not_nil notification, 'user notification was not created'
|
||||
assert_equal user.id, notification.receiver_id, 'wrong user notified'
|
||||
|
||||
# Check generated invoice
|
||||
invoice = Invoice.find_by(invoiced_type: 'Subscription', invoiced_id: subscription[:id])
|
||||
assert_not_nil invoice, 'Invoice was not created'
|
||||
assert File.exist?(invoice.file), 'Invoice PDF was not generated'
|
||||
assert_equal plan.amount, invoice.total, 'Invoice total price does not match the bought subscription'
|
||||
end
|
||||
|
||||
end
|
59
test/integration/subscriptions/create_as_user_test.rb
Normal file
59
test/integration/subscriptions/create_as_user_test.rb
Normal file
@ -0,0 +1,59 @@
|
||||
class CreateAsUserTest < ActionDispatch::IntegrationTest
|
||||
|
||||
|
||||
setup do
|
||||
@user = User.find_by_username('jdupond')
|
||||
login_as(@user, scope: :user)
|
||||
end
|
||||
|
||||
test "user takes a subscription" do
|
||||
plan = Plan.find_by(group_id: @user.group.id, type: 'Plan', base_name: 'Mensuel')
|
||||
|
||||
VCR.use_cassette("subscriptions_user_create_success") do
|
||||
post '/api/subscriptions',
|
||||
{
|
||||
subscription: {
|
||||
plan_id: plan.id,
|
||||
user_id: @user.id,
|
||||
card_token: stripe_card_token
|
||||
}
|
||||
}.to_json, default_headers
|
||||
end
|
||||
|
||||
# Check response format & status
|
||||
assert_equal 201, response.status, response.body
|
||||
assert_equal Mime::JSON, response.content_type
|
||||
|
||||
# Check the correct plan was subscribed
|
||||
subscription = json_response(response.body)
|
||||
assert_equal plan.id, subscription[:plan_id], 'subscribed plan does not match'
|
||||
|
||||
# Check that the user has the correct subscription
|
||||
assert_not_nil @user.subscription, "user's subscription was not found"
|
||||
assert_not_nil @user.subscription.plan, "user's subscribed plan was not found"
|
||||
assert_equal plan.id, @user.subscription.plan_id, "user's plan does not match"
|
||||
|
||||
# Check that the training credits were set correctly
|
||||
assert_empty @user.training_credits, 'training credits were not reset'
|
||||
assert_equal @user.subscription.plan.training_credit_nb, plan.training_credit_nb, 'trainings credits were not allocated'
|
||||
|
||||
# Check that the user benefit from prices of his plan
|
||||
printer = Machine.find_by_slug('imprimante-3d')
|
||||
assert_equal 15, (printer.prices.find_by(group_id: @user.group_id, plan_id: @user.subscription.plan_id).amount / 100), 'machine hourly price does not match'
|
||||
|
||||
# Check notifications were sent for every admins
|
||||
notifications = Notification.where(notification_type_id: NotificationType.find_by_name('notify_admin_subscribed_plan'), attached_object_type: 'Subscription', attached_object_id: subscription[:id])
|
||||
assert_not_empty notifications, 'no notifications were created'
|
||||
notified_users_ids = notifications.map {|n| n.receiver_id }
|
||||
User.admins.each do |adm|
|
||||
assert_includes notified_users_ids, adm.id, "Admin #{adm.id} was not notified"
|
||||
end
|
||||
|
||||
# Check generated invoice
|
||||
invoice = Invoice.find_by(invoiced_type: 'Subscription', invoiced_id: subscription[:id])
|
||||
assert_not_nil invoice, 'Invoice was not created'
|
||||
assert File.exist?(invoice.file), 'Invoice PDF was not generated'
|
||||
assert_equal plan.amount, invoice.total, 'Invoice total price does not match the bought subscription'
|
||||
end
|
||||
|
||||
end
|
@ -1,31 +0,0 @@
|
||||
class SubscriptionsTest < ActionDispatch::IntegrationTest
|
||||
|
||||
|
||||
setup do
|
||||
@user = User.find_by_username('jdupond')
|
||||
login_as(@user, scope: :user)
|
||||
end
|
||||
|
||||
test "user take a subscription" do
|
||||
plan = Plan.where(group_id: @user.group.id, type: 'Plan').first
|
||||
|
||||
VCR.use_cassette("subscriptions_user_create_success") do
|
||||
post '/api/subscriptions',
|
||||
{
|
||||
subscription: {
|
||||
plan_id: plan.id,
|
||||
user_id: @user.id,
|
||||
card_token: stripe_card_token
|
||||
}
|
||||
}.to_json, default_headers
|
||||
end
|
||||
|
||||
assert_equal 201, response.status, response.body
|
||||
assert_equal Mime::JSON, response.content_type
|
||||
|
||||
subscription = json_response(response.body)
|
||||
assert_equal plan.id, subscription[:plan_id]
|
||||
|
||||
end
|
||||
|
||||
end
|
802
test/vcr_cassettes/subscriptions_admin_create_success.yml
Normal file
802
test/vcr_cassettes/subscriptions_admin_create_success.yml
Normal file
@ -0,0 +1,802 @@
|
||||
---
|
||||
http_interactions:
|
||||
- request:
|
||||
method: get
|
||||
uri: https://api.stripe.com/v1/customers/cus_8Di1wjdVktv5kt
|
||||
body:
|
||||
encoding: US-ASCII
|
||||
string: ''
|
||||
headers:
|
||||
Accept:
|
||||
- "*/*; q=0.5, application/xml"
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
User-Agent:
|
||||
- Stripe/v1 RubyBindings/1.30.2
|
||||
Authorization:
|
||||
- Bearer sk_test_mGokO9TGtrVxMOyK4yZiktBE
|
||||
Content-Type:
|
||||
- application/x-www-form-urlencoded
|
||||
X-Stripe-Client-User-Agent:
|
||||
- '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.0 p0 (2015-12-25)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
|
||||
version 3.13.0-83-generic (buildd@lgw01-55) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
|
||||
) #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016","hostname":"sylvain-sleede-pc"}'
|
||||
response:
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
headers:
|
||||
Server:
|
||||
- nginx
|
||||
Date:
|
||||
- Wed, 06 Apr 2016 16:16:21 GMT
|
||||
Content-Type:
|
||||
- application/json
|
||||
Content-Length:
|
||||
- '3462'
|
||||
Connection:
|
||||
- keep-alive
|
||||
Access-Control-Allow-Credentials:
|
||||
- 'true'
|
||||
Access-Control-Allow-Methods:
|
||||
- GET, POST, HEAD, OPTIONS, DELETE
|
||||
Access-Control-Allow-Origin:
|
||||
- "*"
|
||||
Access-Control-Max-Age:
|
||||
- '300'
|
||||
Cache-Control:
|
||||
- no-cache, no-store
|
||||
Request-Id:
|
||||
- req_8Dkq2KtxZyjTlS
|
||||
Stripe-Version:
|
||||
- '2015-10-16'
|
||||
Strict-Transport-Security:
|
||||
- max-age=31556926; includeSubDomains
|
||||
body:
|
||||
encoding: UTF-8
|
||||
string: |
|
||||
{
|
||||
"id": "cus_8Di1wjdVktv5kt",
|
||||
"object": "customer",
|
||||
"account_balance": 0,
|
||||
"created": 1459948888,
|
||||
"currency": "usd",
|
||||
"default_source": "card_17xGjJ2sOmf47Nz9UrQOP8Cl",
|
||||
"delinquent": false,
|
||||
"description": "Jean Dupond",
|
||||
"discount": null,
|
||||
"email": "jean.dupond@gmail.com",
|
||||
"livemode": false,
|
||||
"metadata": {},
|
||||
"shipping": null,
|
||||
"sources": {
|
||||
"object": "list",
|
||||
"data": [
|
||||
{
|
||||
"id": "card_17xGjJ2sOmf47Nz9UrQOP8Cl",
|
||||
"object": "card",
|
||||
"address_city": null,
|
||||
"address_country": null,
|
||||
"address_line1": null,
|
||||
"address_line1_check": null,
|
||||
"address_line2": null,
|
||||
"address_state": null,
|
||||
"address_zip": null,
|
||||
"address_zip_check": null,
|
||||
"brand": "Visa",
|
||||
"country": "US",
|
||||
"customer": "cus_8Di1wjdVktv5kt",
|
||||
"cvc_check": "pass",
|
||||
"dynamic_last4": null,
|
||||
"exp_month": 4,
|
||||
"exp_year": 2017,
|
||||
"fingerprint": "o52jybR7bnmNn6AT",
|
||||
"funding": "credit",
|
||||
"last4": "4242",
|
||||
"metadata": {},
|
||||
"name": null,
|
||||
"tokenization_method": null
|
||||
}
|
||||
],
|
||||
"has_more": false,
|
||||
"total_count": 1,
|
||||
"url": "/v1/customers/cus_8Di1wjdVktv5kt/sources"
|
||||
},
|
||||
"subscriptions": {
|
||||
"object": "list",
|
||||
"data": [
|
||||
{
|
||||
"id": "sub_8Di9gqPLwt5IIC",
|
||||
"object": "subscription",
|
||||
"application_fee_percent": null,
|
||||
"cancel_at_period_end": true,
|
||||
"canceled_at": 1459949404,
|
||||
"current_period_end": 1462541399,
|
||||
"current_period_start": 1459949399,
|
||||
"customer": "cus_8Di1wjdVktv5kt",
|
||||
"discount": null,
|
||||
"ended_at": null,
|
||||
"metadata": {},
|
||||
"plan": {
|
||||
"id": "mensuel-standard-month-20160404171519",
|
||||
"object": "plan",
|
||||
"amount": 3000,
|
||||
"created": 1459782921,
|
||||
"currency": "usd",
|
||||
"interval": "month",
|
||||
"interval_count": 1,
|
||||
"livemode": false,
|
||||
"metadata": {},
|
||||
"name": "Mensuel - standard, association - month",
|
||||
"statement_descriptor": null,
|
||||
"trial_period_days": null
|
||||
},
|
||||
"quantity": 1,
|
||||
"start": 1459949399,
|
||||
"status": "active",
|
||||
"tax_percent": null,
|
||||
"trial_end": null,
|
||||
"trial_start": null
|
||||
},
|
||||
{
|
||||
"id": "sub_8Di2VadRvr7A99",
|
||||
"object": "subscription",
|
||||
"application_fee_percent": null,
|
||||
"cancel_at_period_end": true,
|
||||
"canceled_at": 1459948972,
|
||||
"current_period_end": 1462540968,
|
||||
"current_period_start": 1459948968,
|
||||
"customer": "cus_8Di1wjdVktv5kt",
|
||||
"discount": null,
|
||||
"ended_at": null,
|
||||
"metadata": {},
|
||||
"plan": {
|
||||
"id": "mensuel-standard-month-20160404171519",
|
||||
"object": "plan",
|
||||
"amount": 3000,
|
||||
"created": 1459782921,
|
||||
"currency": "usd",
|
||||
"interval": "month",
|
||||
"interval_count": 1,
|
||||
"livemode": false,
|
||||
"metadata": {},
|
||||
"name": "Mensuel - standard, association - month",
|
||||
"statement_descriptor": null,
|
||||
"trial_period_days": null
|
||||
},
|
||||
"quantity": 1,
|
||||
"start": 1459948968,
|
||||
"status": "active",
|
||||
"tax_percent": null,
|
||||
"trial_end": null,
|
||||
"trial_start": null
|
||||
}
|
||||
],
|
||||
"has_more": false,
|
||||
"total_count": 2,
|
||||
"url": "/v1/customers/cus_8Di1wjdVktv5kt/subscriptions"
|
||||
}
|
||||
}
|
||||
http_version:
|
||||
recorded_at: Wed, 06 Apr 2016 16:16:21 GMT
|
||||
- request:
|
||||
method: post
|
||||
uri: https://api.stripe.com/v1/customers/cus_8Di1wjdVktv5kt/subscriptions
|
||||
body:
|
||||
encoding: UTF-8
|
||||
string: plan=mensuel-standard-month-20160404171519
|
||||
headers:
|
||||
Accept:
|
||||
- "*/*; q=0.5, application/xml"
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
User-Agent:
|
||||
- Stripe/v1 RubyBindings/1.30.2
|
||||
Authorization:
|
||||
- Bearer sk_test_mGokO9TGtrVxMOyK4yZiktBE
|
||||
Content-Type:
|
||||
- application/x-www-form-urlencoded
|
||||
X-Stripe-Client-User-Agent:
|
||||
- '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.0 p0 (2015-12-25)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
|
||||
version 3.13.0-83-generic (buildd@lgw01-55) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
|
||||
) #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016","hostname":"sylvain-sleede-pc"}'
|
||||
Content-Length:
|
||||
- '42'
|
||||
response:
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
headers:
|
||||
Server:
|
||||
- nginx
|
||||
Date:
|
||||
- Wed, 06 Apr 2016 16:16:22 GMT
|
||||
Content-Type:
|
||||
- application/json
|
||||
Content-Length:
|
||||
- '821'
|
||||
Connection:
|
||||
- keep-alive
|
||||
Access-Control-Allow-Credentials:
|
||||
- 'true'
|
||||
Access-Control-Allow-Methods:
|
||||
- GET, POST, HEAD, OPTIONS, DELETE
|
||||
Access-Control-Allow-Origin:
|
||||
- "*"
|
||||
Access-Control-Max-Age:
|
||||
- '300'
|
||||
Cache-Control:
|
||||
- no-cache, no-store
|
||||
Request-Id:
|
||||
- req_8Dkqxbz3ZxvmBy
|
||||
Stripe-Version:
|
||||
- '2015-10-16'
|
||||
Strict-Transport-Security:
|
||||
- max-age=31556926; includeSubDomains
|
||||
body:
|
||||
encoding: UTF-8
|
||||
string: |
|
||||
{
|
||||
"id": "sub_8DkqBcR1bQvr5G",
|
||||
"object": "subscription",
|
||||
"application_fee_percent": null,
|
||||
"cancel_at_period_end": false,
|
||||
"canceled_at": null,
|
||||
"current_period_end": 1462551382,
|
||||
"current_period_start": 1459959382,
|
||||
"customer": "cus_8Di1wjdVktv5kt",
|
||||
"discount": null,
|
||||
"ended_at": null,
|
||||
"metadata": {},
|
||||
"plan": {
|
||||
"id": "mensuel-standard-month-20160404171519",
|
||||
"object": "plan",
|
||||
"amount": 3000,
|
||||
"created": 1459782921,
|
||||
"currency": "usd",
|
||||
"interval": "month",
|
||||
"interval_count": 1,
|
||||
"livemode": false,
|
||||
"metadata": {},
|
||||
"name": "Mensuel - standard, association - month",
|
||||
"statement_descriptor": null,
|
||||
"trial_period_days": null
|
||||
},
|
||||
"quantity": 1,
|
||||
"start": 1459959382,
|
||||
"status": "active",
|
||||
"tax_percent": null,
|
||||
"trial_end": null,
|
||||
"trial_start": null
|
||||
}
|
||||
http_version:
|
||||
recorded_at: Wed, 06 Apr 2016 16:16:22 GMT
|
||||
- request:
|
||||
method: get
|
||||
uri: https://api.stripe.com/v1/invoices?customer=cus_8Di1wjdVktv5kt&limit=1
|
||||
body:
|
||||
encoding: US-ASCII
|
||||
string: ''
|
||||
headers:
|
||||
Accept:
|
||||
- "*/*; q=0.5, application/xml"
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
User-Agent:
|
||||
- Stripe/v1 RubyBindings/1.30.2
|
||||
Authorization:
|
||||
- Bearer sk_test_mGokO9TGtrVxMOyK4yZiktBE
|
||||
Content-Type:
|
||||
- application/x-www-form-urlencoded
|
||||
X-Stripe-Client-User-Agent:
|
||||
- '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.0 p0 (2015-12-25)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
|
||||
version 3.13.0-83-generic (buildd@lgw01-55) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
|
||||
) #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016","hostname":"sylvain-sleede-pc"}'
|
||||
response:
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
headers:
|
||||
Server:
|
||||
- nginx
|
||||
Date:
|
||||
- Wed, 06 Apr 2016 16:16:24 GMT
|
||||
Content-Type:
|
||||
- application/json
|
||||
Content-Length:
|
||||
- '2207'
|
||||
Connection:
|
||||
- keep-alive
|
||||
Access-Control-Allow-Credentials:
|
||||
- 'true'
|
||||
Access-Control-Allow-Methods:
|
||||
- GET, POST, HEAD, OPTIONS, DELETE
|
||||
Access-Control-Allow-Origin:
|
||||
- "*"
|
||||
Access-Control-Max-Age:
|
||||
- '300'
|
||||
Cache-Control:
|
||||
- no-cache, no-store
|
||||
Request-Id:
|
||||
- req_8DkqeZjTLH22XJ
|
||||
Stripe-Version:
|
||||
- '2015-10-16'
|
||||
Strict-Transport-Security:
|
||||
- max-age=31556926; includeSubDomains
|
||||
body:
|
||||
encoding: UTF-8
|
||||
string: |
|
||||
{
|
||||
"object": "list",
|
||||
"data": [
|
||||
{
|
||||
"id": "in_17xJKM2sOmf47Nz9wOmb9YSB",
|
||||
"object": "invoice",
|
||||
"amount_due": 3000,
|
||||
"application_fee": null,
|
||||
"attempt_count": 1,
|
||||
"attempted": true,
|
||||
"charge": "ch_17xJKM2sOmf47Nz9huANudcu",
|
||||
"closed": true,
|
||||
"currency": "usd",
|
||||
"customer": "cus_8Di1wjdVktv5kt",
|
||||
"date": 1459959382,
|
||||
"description": null,
|
||||
"discount": null,
|
||||
"ending_balance": 0,
|
||||
"forgiven": false,
|
||||
"lines": {
|
||||
"object": "list",
|
||||
"data": [
|
||||
{
|
||||
"id": "sub_8DkqBcR1bQvr5G",
|
||||
"object": "line_item",
|
||||
"amount": 3000,
|
||||
"currency": "usd",
|
||||
"description": null,
|
||||
"discountable": true,
|
||||
"livemode": false,
|
||||
"metadata": {},
|
||||
"period": {
|
||||
"start": 1459959382,
|
||||
"end": 1462551382
|
||||
},
|
||||
"plan": {
|
||||
"id": "mensuel-standard-month-20160404171519",
|
||||
"object": "plan",
|
||||
"amount": 3000,
|
||||
"created": 1459782921,
|
||||
"currency": "usd",
|
||||
"interval": "month",
|
||||
"interval_count": 1,
|
||||
"livemode": false,
|
||||
"metadata": {},
|
||||
"name": "Mensuel - standard, association - month",
|
||||
"statement_descriptor": null,
|
||||
"trial_period_days": null
|
||||
},
|
||||
"proration": false,
|
||||
"quantity": 1,
|
||||
"subscription": null,
|
||||
"type": "subscription"
|
||||
}
|
||||
],
|
||||
"has_more": false,
|
||||
"total_count": 1,
|
||||
"url": "/v1/invoices/in_17xJKM2sOmf47Nz9wOmb9YSB/lines"
|
||||
},
|
||||
"livemode": false,
|
||||
"metadata": {},
|
||||
"next_payment_attempt": null,
|
||||
"paid": true,
|
||||
"period_end": 1459959382,
|
||||
"period_start": 1459948968,
|
||||
"receipt_number": null,
|
||||
"starting_balance": 0,
|
||||
"statement_descriptor": null,
|
||||
"subscription": "sub_8DkqBcR1bQvr5G",
|
||||
"subtotal": 3000,
|
||||
"tax": null,
|
||||
"tax_percent": null,
|
||||
"total": 3000,
|
||||
"webhooks_delivered_at": 1459959382
|
||||
}
|
||||
],
|
||||
"has_more": true,
|
||||
"url": "/v1/invoices"
|
||||
}
|
||||
http_version:
|
||||
recorded_at: Wed, 06 Apr 2016 16:16:23 GMT
|
||||
- request:
|
||||
method: get
|
||||
uri: https://api.stripe.com/v1/customers/cus_8Di1wjdVktv5kt
|
||||
body:
|
||||
encoding: US-ASCII
|
||||
string: ''
|
||||
headers:
|
||||
Accept:
|
||||
- "*/*; q=0.5, application/xml"
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
User-Agent:
|
||||
- Stripe/v1 RubyBindings/1.30.2
|
||||
Authorization:
|
||||
- Bearer sk_test_mGokO9TGtrVxMOyK4yZiktBE
|
||||
Content-Type:
|
||||
- application/x-www-form-urlencoded
|
||||
X-Stripe-Client-User-Agent:
|
||||
- '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.0 p0 (2015-12-25)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
|
||||
version 3.13.0-83-generic (buildd@lgw01-55) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
|
||||
) #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016","hostname":"sylvain-sleede-pc"}'
|
||||
response:
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
headers:
|
||||
Server:
|
||||
- nginx
|
||||
Date:
|
||||
- Wed, 06 Apr 2016 16:16:25 GMT
|
||||
Content-Type:
|
||||
- application/json
|
||||
Content-Length:
|
||||
- '4482'
|
||||
Connection:
|
||||
- keep-alive
|
||||
Access-Control-Allow-Credentials:
|
||||
- 'true'
|
||||
Access-Control-Allow-Methods:
|
||||
- GET, POST, HEAD, OPTIONS, DELETE
|
||||
Access-Control-Allow-Origin:
|
||||
- "*"
|
||||
Access-Control-Max-Age:
|
||||
- '300'
|
||||
Cache-Control:
|
||||
- no-cache, no-store
|
||||
Request-Id:
|
||||
- req_8Dkq9n5NEnaqj7
|
||||
Stripe-Version:
|
||||
- '2015-10-16'
|
||||
Strict-Transport-Security:
|
||||
- max-age=31556926; includeSubDomains
|
||||
body:
|
||||
encoding: UTF-8
|
||||
string: |
|
||||
{
|
||||
"id": "cus_8Di1wjdVktv5kt",
|
||||
"object": "customer",
|
||||
"account_balance": 0,
|
||||
"created": 1459948888,
|
||||
"currency": "usd",
|
||||
"default_source": "card_17xGjJ2sOmf47Nz9UrQOP8Cl",
|
||||
"delinquent": false,
|
||||
"description": "Jean Dupond",
|
||||
"discount": null,
|
||||
"email": "jean.dupond@gmail.com",
|
||||
"livemode": false,
|
||||
"metadata": {},
|
||||
"shipping": null,
|
||||
"sources": {
|
||||
"object": "list",
|
||||
"data": [
|
||||
{
|
||||
"id": "card_17xGjJ2sOmf47Nz9UrQOP8Cl",
|
||||
"object": "card",
|
||||
"address_city": null,
|
||||
"address_country": null,
|
||||
"address_line1": null,
|
||||
"address_line1_check": null,
|
||||
"address_line2": null,
|
||||
"address_state": null,
|
||||
"address_zip": null,
|
||||
"address_zip_check": null,
|
||||
"brand": "Visa",
|
||||
"country": "US",
|
||||
"customer": "cus_8Di1wjdVktv5kt",
|
||||
"cvc_check": "pass",
|
||||
"dynamic_last4": null,
|
||||
"exp_month": 4,
|
||||
"exp_year": 2017,
|
||||
"fingerprint": "o52jybR7bnmNn6AT",
|
||||
"funding": "credit",
|
||||
"last4": "4242",
|
||||
"metadata": {},
|
||||
"name": null,
|
||||
"tokenization_method": null
|
||||
}
|
||||
],
|
||||
"has_more": false,
|
||||
"total_count": 1,
|
||||
"url": "/v1/customers/cus_8Di1wjdVktv5kt/sources"
|
||||
},
|
||||
"subscriptions": {
|
||||
"object": "list",
|
||||
"data": [
|
||||
{
|
||||
"id": "sub_8DkqBcR1bQvr5G",
|
||||
"object": "subscription",
|
||||
"application_fee_percent": null,
|
||||
"cancel_at_period_end": false,
|
||||
"canceled_at": null,
|
||||
"current_period_end": 1462551382,
|
||||
"current_period_start": 1459959382,
|
||||
"customer": "cus_8Di1wjdVktv5kt",
|
||||
"discount": null,
|
||||
"ended_at": null,
|
||||
"metadata": {},
|
||||
"plan": {
|
||||
"id": "mensuel-standard-month-20160404171519",
|
||||
"object": "plan",
|
||||
"amount": 3000,
|
||||
"created": 1459782921,
|
||||
"currency": "usd",
|
||||
"interval": "month",
|
||||
"interval_count": 1,
|
||||
"livemode": false,
|
||||
"metadata": {},
|
||||
"name": "Mensuel - standard, association - month",
|
||||
"statement_descriptor": null,
|
||||
"trial_period_days": null
|
||||
},
|
||||
"quantity": 1,
|
||||
"start": 1459959382,
|
||||
"status": "active",
|
||||
"tax_percent": null,
|
||||
"trial_end": null,
|
||||
"trial_start": null
|
||||
},
|
||||
{
|
||||
"id": "sub_8Di9gqPLwt5IIC",
|
||||
"object": "subscription",
|
||||
"application_fee_percent": null,
|
||||
"cancel_at_period_end": true,
|
||||
"canceled_at": 1459949404,
|
||||
"current_period_end": 1462541399,
|
||||
"current_period_start": 1459949399,
|
||||
"customer": "cus_8Di1wjdVktv5kt",
|
||||
"discount": null,
|
||||
"ended_at": null,
|
||||
"metadata": {},
|
||||
"plan": {
|
||||
"id": "mensuel-standard-month-20160404171519",
|
||||
"object": "plan",
|
||||
"amount": 3000,
|
||||
"created": 1459782921,
|
||||
"currency": "usd",
|
||||
"interval": "month",
|
||||
"interval_count": 1,
|
||||
"livemode": false,
|
||||
"metadata": {},
|
||||
"name": "Mensuel - standard, association - month",
|
||||
"statement_descriptor": null,
|
||||
"trial_period_days": null
|
||||
},
|
||||
"quantity": 1,
|
||||
"start": 1459949399,
|
||||
"status": "active",
|
||||
"tax_percent": null,
|
||||
"trial_end": null,
|
||||
"trial_start": null
|
||||
},
|
||||
{
|
||||
"id": "sub_8Di2VadRvr7A99",
|
||||
"object": "subscription",
|
||||
"application_fee_percent": null,
|
||||
"cancel_at_period_end": true,
|
||||
"canceled_at": 1459948972,
|
||||
"current_period_end": 1462540968,
|
||||
"current_period_start": 1459948968,
|
||||
"customer": "cus_8Di1wjdVktv5kt",
|
||||
"discount": null,
|
||||
"ended_at": null,
|
||||
"metadata": {},
|
||||
"plan": {
|
||||
"id": "mensuel-standard-month-20160404171519",
|
||||
"object": "plan",
|
||||
"amount": 3000,
|
||||
"created": 1459782921,
|
||||
"currency": "usd",
|
||||
"interval": "month",
|
||||
"interval_count": 1,
|
||||
"livemode": false,
|
||||
"metadata": {},
|
||||
"name": "Mensuel - standard, association - month",
|
||||
"statement_descriptor": null,
|
||||
"trial_period_days": null
|
||||
},
|
||||
"quantity": 1,
|
||||
"start": 1459948968,
|
||||
"status": "active",
|
||||
"tax_percent": null,
|
||||
"trial_end": null,
|
||||
"trial_start": null
|
||||
}
|
||||
],
|
||||
"has_more": false,
|
||||
"total_count": 3,
|
||||
"url": "/v1/customers/cus_8Di1wjdVktv5kt/subscriptions"
|
||||
}
|
||||
}
|
||||
http_version:
|
||||
recorded_at: Wed, 06 Apr 2016 16:16:25 GMT
|
||||
- request:
|
||||
method: get
|
||||
uri: https://api.stripe.com/v1/customers/cus_8Di1wjdVktv5kt/subscriptions/sub_8DkqBcR1bQvr5G
|
||||
body:
|
||||
encoding: US-ASCII
|
||||
string: ''
|
||||
headers:
|
||||
Accept:
|
||||
- "*/*; q=0.5, application/xml"
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
User-Agent:
|
||||
- Stripe/v1 RubyBindings/1.30.2
|
||||
Authorization:
|
||||
- Bearer sk_test_mGokO9TGtrVxMOyK4yZiktBE
|
||||
Content-Type:
|
||||
- application/x-www-form-urlencoded
|
||||
X-Stripe-Client-User-Agent:
|
||||
- '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.0 p0 (2015-12-25)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
|
||||
version 3.13.0-83-generic (buildd@lgw01-55) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
|
||||
) #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016","hostname":"sylvain-sleede-pc"}'
|
||||
response:
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
headers:
|
||||
Server:
|
||||
- nginx
|
||||
Date:
|
||||
- Wed, 06 Apr 2016 16:16:26 GMT
|
||||
Content-Type:
|
||||
- application/json
|
||||
Content-Length:
|
||||
- '821'
|
||||
Connection:
|
||||
- keep-alive
|
||||
Access-Control-Allow-Credentials:
|
||||
- 'true'
|
||||
Access-Control-Allow-Methods:
|
||||
- GET, POST, HEAD, OPTIONS, DELETE
|
||||
Access-Control-Allow-Origin:
|
||||
- "*"
|
||||
Access-Control-Max-Age:
|
||||
- '300'
|
||||
Cache-Control:
|
||||
- no-cache, no-store
|
||||
Request-Id:
|
||||
- req_8DkqSt9TNkbCet
|
||||
Stripe-Version:
|
||||
- '2015-10-16'
|
||||
Strict-Transport-Security:
|
||||
- max-age=31556926; includeSubDomains
|
||||
body:
|
||||
encoding: UTF-8
|
||||
string: |
|
||||
{
|
||||
"id": "sub_8DkqBcR1bQvr5G",
|
||||
"object": "subscription",
|
||||
"application_fee_percent": null,
|
||||
"cancel_at_period_end": false,
|
||||
"canceled_at": null,
|
||||
"current_period_end": 1462551382,
|
||||
"current_period_start": 1459959382,
|
||||
"customer": "cus_8Di1wjdVktv5kt",
|
||||
"discount": null,
|
||||
"ended_at": null,
|
||||
"metadata": {},
|
||||
"plan": {
|
||||
"id": "mensuel-standard-month-20160404171519",
|
||||
"object": "plan",
|
||||
"amount": 3000,
|
||||
"created": 1459782921,
|
||||
"currency": "usd",
|
||||
"interval": "month",
|
||||
"interval_count": 1,
|
||||
"livemode": false,
|
||||
"metadata": {},
|
||||
"name": "Mensuel - standard, association - month",
|
||||
"statement_descriptor": null,
|
||||
"trial_period_days": null
|
||||
},
|
||||
"quantity": 1,
|
||||
"start": 1459959382,
|
||||
"status": "active",
|
||||
"tax_percent": null,
|
||||
"trial_end": null,
|
||||
"trial_start": null
|
||||
}
|
||||
http_version:
|
||||
recorded_at: Wed, 06 Apr 2016 16:16:25 GMT
|
||||
- request:
|
||||
method: delete
|
||||
uri: https://api.stripe.com/v1/customers/cus_8Di1wjdVktv5kt/subscriptions/sub_8DkqBcR1bQvr5G?at_period_end=true
|
||||
body:
|
||||
encoding: US-ASCII
|
||||
string: ''
|
||||
headers:
|
||||
Accept:
|
||||
- "*/*; q=0.5, application/xml"
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
User-Agent:
|
||||
- Stripe/v1 RubyBindings/1.30.2
|
||||
Authorization:
|
||||
- Bearer sk_test_mGokO9TGtrVxMOyK4yZiktBE
|
||||
Content-Type:
|
||||
- application/x-www-form-urlencoded
|
||||
X-Stripe-Client-User-Agent:
|
||||
- '{"bindings_version":"1.30.2","lang":"ruby","lang_version":"2.3.0 p0 (2015-12-25)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
|
||||
version 3.13.0-83-generic (buildd@lgw01-55) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
|
||||
) #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016","hostname":"sylvain-sleede-pc"}'
|
||||
response:
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
headers:
|
||||
Server:
|
||||
- nginx
|
||||
Date:
|
||||
- Wed, 06 Apr 2016 16:16:26 GMT
|
||||
Content-Type:
|
||||
- application/json
|
||||
Content-Length:
|
||||
- '826'
|
||||
Connection:
|
||||
- keep-alive
|
||||
Access-Control-Allow-Credentials:
|
||||
- 'true'
|
||||
Access-Control-Allow-Methods:
|
||||
- GET, POST, HEAD, OPTIONS, DELETE
|
||||
Access-Control-Allow-Origin:
|
||||
- "*"
|
||||
Access-Control-Max-Age:
|
||||
- '300'
|
||||
Cache-Control:
|
||||
- no-cache, no-store
|
||||
Request-Id:
|
||||
- req_8DkqQmbuyBCYqr
|
||||
Stripe-Version:
|
||||
- '2015-10-16'
|
||||
Strict-Transport-Security:
|
||||
- max-age=31556926; includeSubDomains
|
||||
body:
|
||||
encoding: UTF-8
|
||||
string: |
|
||||
{
|
||||
"id": "sub_8DkqBcR1bQvr5G",
|
||||
"object": "subscription",
|
||||
"application_fee_percent": null,
|
||||
"cancel_at_period_end": true,
|
||||
"canceled_at": 1459959386,
|
||||
"current_period_end": 1462551382,
|
||||
"current_period_start": 1459959382,
|
||||
"customer": "cus_8Di1wjdVktv5kt",
|
||||
"discount": null,
|
||||
"ended_at": null,
|
||||
"metadata": {},
|
||||
"plan": {
|
||||
"id": "mensuel-standard-month-20160404171519",
|
||||
"object": "plan",
|
||||
"amount": 3000,
|
||||
"created": 1459782921,
|
||||
"currency": "usd",
|
||||
"interval": "month",
|
||||
"interval_count": 1,
|
||||
"livemode": false,
|
||||
"metadata": {},
|
||||
"name": "Mensuel - standard, association - month",
|
||||
"statement_descriptor": null,
|
||||
"trial_period_days": null
|
||||
},
|
||||
"quantity": 1,
|
||||
"start": 1459959382,
|
||||
"status": "active",
|
||||
"tax_percent": null,
|
||||
"trial_end": null,
|
||||
"trial_start": null
|
||||
}
|
||||
http_version:
|
||||
recorded_at: Wed, 06 Apr 2016 16:16:26 GMT
|
||||
recorded_with: VCR 3.0.1
|
Loading…
x
Reference in New Issue
Block a user