pay-lago 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/main.yml +27 -0
- data/.gitignore +28 -0
- data/.rspec +3 -0
- data/.standard.yml +3 -0
- data/CHANGELOG.md +2 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +25 -0
- data/Gemfile.lock +292 -0
- data/LICENSE.txt +21 -0
- data/README.md +85 -0
- data/Rakefile +32 -0
- data/app/controllers/pay/webhooks/lago_controller.rb +41 -0
- data/app/models/concerns/pay/lago/pay_customer_extensions.rb +15 -0
- data/app/models/concerns/pay/lago/pay_extensions.rb +15 -0
- data/bin/console +15 -0
- data/bin/rails +16 -0
- data/bin/setup +8 -0
- data/config/routes.rb +5 -0
- data/docs/1_customers.md +18 -0
- data/docs/2_charges.md +72 -0
- data/docs/3_subscriptions.md +67 -0
- data/docs/4_webhooks.md +66 -0
- data/lib/pay/lago/attributes.rb +24 -0
- data/lib/pay/lago/billable.rb +148 -0
- data/lib/pay/lago/charge.rb +82 -0
- data/lib/pay/lago/engine.rb +27 -0
- data/lib/pay/lago/error.rb +9 -0
- data/lib/pay/lago/payment_method.rb +37 -0
- data/lib/pay/lago/subscription.rb +134 -0
- data/lib/pay/lago/version.rb +7 -0
- data/lib/pay/lago/webhook_extensions.rb +10 -0
- data/lib/pay/lago/webhooks/customer_payment_provider_created.rb +18 -0
- data/lib/pay/lago/webhooks/invoice_created.rb +15 -0
- data/lib/pay/lago/webhooks/invoice_drafted.rb +11 -0
- data/lib/pay/lago/webhooks/invoice_one_off_created.rb +15 -0
- data/lib/pay/lago/webhooks/invoice_payment_status_updated.rb +14 -0
- data/lib/pay/lago/webhooks/subscription_started.rb +12 -0
- data/lib/pay/lago/webhooks/subscription_terminated.rb +12 -0
- data/lib/pay/lago.rb +91 -0
- data/pay-lago.gemspec +27 -0
- data/sig/pay/lago.rbs +6 -0
- data/test/controllers/pay/webhooks/lago_controller_test.rb +37 -0
- data/test/dummy/.browserslistrc +1 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/config/manifest.js +4 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/channels/application_cable/channel.rb +4 -0
- data/test/dummy/app/channels/application_cable/connection.rb +4 -0
- data/test/dummy/app/controllers/application_controller.rb +4 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/controllers/main_controller.rb +4 -0
- data/test/dummy/app/controllers/payment_methods_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/current_helper.rb +9 -0
- data/test/dummy/app/javascript/application.js +9 -0
- data/test/dummy/app/javascript/controllers/application.js +10 -0
- data/test/dummy/app/javascript/controllers/index.js +11 -0
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/account.rb +3 -0
- data/test/dummy/app/models/application_record.rb +3 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/models/team.rb +10 -0
- data/test/dummy/app/models/user.rb +3 -0
- data/test/dummy/app/views/layouts/application.html.erb +36 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/app/webhooks/charge_succeeded.rb +5 -0
- data/test/dummy/bin/importmap +4 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +33 -0
- data/test/dummy/bin/webpack +18 -0
- data/test/dummy/bin/webpack-dev-server +18 -0
- data/test/dummy/config/application.rb +25 -0
- data/test/dummy/config/boot.rb +6 -0
- data/test/dummy/config/cable.yml +9 -0
- data/test/dummy/config/database.yml +3 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +70 -0
- data/test/dummy/config/environments/production.rb +86 -0
- data/test/dummy/config/environments/test.rb +60 -0
- data/test/dummy/config/importmap.rb +8 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/pay.rb +11 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/puma.rb +47 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/config/storage.yml +34 -0
- data/test/dummy/config.ru +6 -0
- data/test/dummy/db/migrate/20170205000000_create_users.rb +22 -0
- data/test/dummy/db/schema.rb +125 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/vendor/javascript/.keep +0 -0
- data/test/fixtures/accounts.yml +2 -0
- data/test/fixtures/pay/customers.yml +7 -0
- data/test/fixtures/teams.yml +4 -0
- data/test/fixtures/users.yml +11 -0
- data/test/pay/lago/billable_test.rb +42 -0
- data/test/pay/lago/charge_test.rb +23 -0
- data/test/pay/lago/subscription_test.rb +48 -0
- data/test/support/fixtures/lago/invoice.one_off_created.json +120 -0
- data/test/support/vcr.rb +28 -0
- data/test/test_helper.rb +66 -0
- data/test/vcr_cassettes/test_add_payment_method_to_lago.yml +56 -0
- data/test/vcr_cassettes/test_can_get_lago_processor_customer.yml +56 -0
- data/test/vcr_cassettes/test_can_make_a_lago_processor_charge.yml +163 -0
- data/test/vcr_cassettes/test_generates_lago_processor_id.yml +107 -0
- data/test/vcr_cassettes/test_lago_cannot_change_quantity.yml +108 -0
- data/test/vcr_cassettes/test_lago_processor_cancel.yml +212 -0
- data/test/vcr_cassettes/test_lago_processor_charge.yml +325 -0
- data/test/vcr_cassettes/test_lago_processor_on_grace_period__is_always_false.yml +108 -0
- data/test/vcr_cassettes/test_lago_processor_pause_raises_an_error.yml +108 -0
- data/test/vcr_cassettes/test_lago_processor_paused__is_always_false.yml +108 -0
- data/test/vcr_cassettes/test_lago_processor_refund_with_premium.yml +378 -0
- data/test/vcr_cassettes/test_lago_processor_refund_without_premium.yml +375 -0
- data/test/vcr_cassettes/test_lago_processor_resume_raises_an_error.yml +108 -0
- data/test/vcr_cassettes/test_lago_processor_subscribe.yml +108 -0
- data/test/vcr_cassettes/test_lago_processor_subscription.yml +160 -0
- data/test/vcr_cassettes/test_lago_processor_swap.yml +212 -0
- metadata +212 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
# Disable warnings locally
|
5
|
+
$VERBOSE = ENV["CI"]
|
6
|
+
require "openssl"
|
7
|
+
require "base64"
|
8
|
+
|
9
|
+
ENV["LAGO_API_URL"] = "http://localhost:3000"
|
10
|
+
|
11
|
+
require "rails/test_help"
|
12
|
+
require "byebug"
|
13
|
+
require "minitest/mock"
|
14
|
+
require "mocha/minitest"
|
15
|
+
require "receipts"
|
16
|
+
|
17
|
+
require File.expand_path("dummy/config/environment.rb", __dir__)
|
18
|
+
ActiveRecord::Migrator.migrations_paths = [File.expand_path("dummy/db/migrate", __dir__), File.expand_path("../db/migrate", __dir__)]
|
19
|
+
|
20
|
+
require_relative "support/vcr"
|
21
|
+
|
22
|
+
# Uncomment to view the stacktrace for debugging tests
|
23
|
+
Rails.backtrace_cleaner.remove_silencers!
|
24
|
+
|
25
|
+
# Filter out Minitest backtrace while allowing backtrace from other libraries
|
26
|
+
# to be shown.
|
27
|
+
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
28
|
+
|
29
|
+
# Load fixtures from the engine
|
30
|
+
if ActiveSupport::TestCase.respond_to?(:fixture_paths=)
|
31
|
+
ActiveSupport::TestCase.fixture_paths << File.expand_path("../fixtures", __FILE__)
|
32
|
+
ActionDispatch::IntegrationTest.fixture_paths << File.expand_path("../fixtures", __FILE__)
|
33
|
+
elsif ActiveSupport::TestCase.respond_to?(:fixture_path=)
|
34
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
35
|
+
ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
|
36
|
+
end
|
37
|
+
|
38
|
+
ActiveSupport::TestCase.fixtures :all
|
39
|
+
|
40
|
+
class ActiveSupport::TestCase
|
41
|
+
include ActionMailer::TestHelper
|
42
|
+
include ActiveJob::TestHelper
|
43
|
+
|
44
|
+
def fake_event(name, format: :json)
|
45
|
+
JSON.parse File.read("test/support/fixtures/#{name}.#{format}")
|
46
|
+
end
|
47
|
+
|
48
|
+
def travel_to_cassette
|
49
|
+
travel_to(VCR.current_cassette.originally_recorded_at || Time.current) do
|
50
|
+
yield
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def assert_indexed_selects
|
55
|
+
subscriber = ActiveSupport::Notifications.subscribe "sql.active_record" do |name, started, finished, unique_id, data|
|
56
|
+
if data[:sql].starts_with? "SELECT"
|
57
|
+
result = data[:connection].explain(data[:sql], data[:binds]).downcase
|
58
|
+
assert result.include?("index"), "Query `#{data[:name]}` did not use an index!"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
yield
|
63
|
+
ensure
|
64
|
+
ActiveSupport::Notifications.unsubscribe(subscriber)
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:3000/api/v1/customers/gid:%2F%2Fdummy%2FPay::Customer%2F772847388
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Authorization:
|
11
|
+
- Bearer 155ed033-8716-4587-9ac6-fed8ddae3317
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
User-Agent:
|
15
|
+
- Lago Ruby v0.44.0-beta
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
Accept:
|
19
|
+
- "*/*"
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
X-Frame-Options:
|
26
|
+
- SAMEORIGIN
|
27
|
+
X-Xss-Protection:
|
28
|
+
- '0'
|
29
|
+
X-Content-Type-Options:
|
30
|
+
- nosniff
|
31
|
+
X-Download-Options:
|
32
|
+
- noopen
|
33
|
+
X-Permitted-Cross-Domain-Policies:
|
34
|
+
- none
|
35
|
+
Referrer-Policy:
|
36
|
+
- strict-origin-when-cross-origin
|
37
|
+
Content-Type:
|
38
|
+
- application/json; charset=utf-8
|
39
|
+
Etag:
|
40
|
+
- W/"af429c6f51b25054dd9b23522b77d57d"
|
41
|
+
Cache-Control:
|
42
|
+
- max-age=0, private, must-revalidate
|
43
|
+
X-Request-Id:
|
44
|
+
- 5e8e37f7-2495-43ce-9fe5-81479614b734
|
45
|
+
X-Runtime:
|
46
|
+
- 0.008701
|
47
|
+
Vary:
|
48
|
+
- Origin
|
49
|
+
Transfer-Encoding:
|
50
|
+
- chunked
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: '{"customer":{"lago_id":"c8bb805a-590c-444f-ae14-66589764f273","external_id":"gid://dummy/Pay::Customer/772847388","name":"Lago
|
54
|
+
User","sequential_id":4,"slug":"AMO-FBCD-004","created_at":"2023-09-18T06:42:57Z","updated_at":"2023-09-18T06:43:11Z","country":null,"address_line1":null,"address_line2":null,"state":null,"zipcode":null,"email":"test@example.com","city":null,"url":null,"phone":null,"logo_url":null,"legal_name":null,"legal_number":null,"currency":"USD","tax_identification_number":null,"timezone":null,"applicable_timezone":"UTC","net_payment_term":null,"external_salesforce_id":null,"billing_configuration":{"invoice_grace_period":null,"payment_provider":null,"vat_rate":null,"document_locale":null},"metadata":[],"taxes":[]}}'
|
55
|
+
recorded_at: Tue, 19 Sep 2023 01:22:27 GMT
|
56
|
+
recorded_with: VCR 6.2.0
|
@@ -0,0 +1,56 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:3000/api/v1/customers/gid:%2F%2Fdummy%2FPay::Customer%2F772847388
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Authorization:
|
11
|
+
- Bearer <LAGO_API_KEY>
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
User-Agent:
|
15
|
+
- Lago Ruby v0.44.0-beta
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
Accept:
|
19
|
+
- "*/*"
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
X-Frame-Options:
|
26
|
+
- SAMEORIGIN
|
27
|
+
X-Xss-Protection:
|
28
|
+
- '0'
|
29
|
+
X-Content-Type-Options:
|
30
|
+
- nosniff
|
31
|
+
X-Download-Options:
|
32
|
+
- noopen
|
33
|
+
X-Permitted-Cross-Domain-Policies:
|
34
|
+
- none
|
35
|
+
Referrer-Policy:
|
36
|
+
- strict-origin-when-cross-origin
|
37
|
+
Content-Type:
|
38
|
+
- application/json; charset=utf-8
|
39
|
+
Etag:
|
40
|
+
- W/"6bf8d0dce7ebdf9890c8d12291028201"
|
41
|
+
Cache-Control:
|
42
|
+
- max-age=0, private, must-revalidate
|
43
|
+
X-Request-Id:
|
44
|
+
- 7f142f9a-64b3-4cf3-aaf5-2d56cc04d909
|
45
|
+
X-Runtime:
|
46
|
+
- '0.007510'
|
47
|
+
Vary:
|
48
|
+
- Origin
|
49
|
+
Transfer-Encoding:
|
50
|
+
- chunked
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: '{"customer":{"lago_id":"e4b5b621-eed8-4b07-8f33-622cb9e5e554","external_id":"gid://dummy/Pay::Customer/772847388","name":"Lago
|
54
|
+
User","sequential_id":3,"slug":"AMO-FBCD-003","created_at":"2023-09-08T02:13:18Z","updated_at":"2023-09-11T02:57:28Z","country":"AU","address_line1":null,"address_line2":null,"state":null,"zipcode":null,"email":"test@example.com","city":null,"url":null,"phone":null,"logo_url":null,"legal_name":null,"legal_number":null,"currency":"USD","tax_identification_number":null,"timezone":null,"applicable_timezone":"UTC","net_payment_term":null,"external_salesforce_id":null,"billing_configuration":{"invoice_grace_period":null,"payment_provider":null,"vat_rate":null,"document_locale":null},"metadata":[],"taxes":[]}}'
|
55
|
+
recorded_at: Mon, 18 Sep 2023 06:30:53 GMT
|
56
|
+
recorded_with: VCR 6.2.0
|
@@ -0,0 +1,163 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:3000/api/v1/customers/gid:%2F%2Fdummy%2FPay::Customer%2F772847388
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Authorization:
|
11
|
+
- Bearer <LAGO_API_KEY>
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
User-Agent:
|
15
|
+
- Lago Ruby v0.44.0-beta
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
Accept:
|
19
|
+
- "*/*"
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
X-Frame-Options:
|
26
|
+
- SAMEORIGIN
|
27
|
+
X-Xss-Protection:
|
28
|
+
- '0'
|
29
|
+
X-Content-Type-Options:
|
30
|
+
- nosniff
|
31
|
+
X-Download-Options:
|
32
|
+
- noopen
|
33
|
+
X-Permitted-Cross-Domain-Policies:
|
34
|
+
- none
|
35
|
+
Referrer-Policy:
|
36
|
+
- strict-origin-when-cross-origin
|
37
|
+
Content-Type:
|
38
|
+
- application/json; charset=utf-8
|
39
|
+
Etag:
|
40
|
+
- W/"af429c6f51b25054dd9b23522b77d57d"
|
41
|
+
Cache-Control:
|
42
|
+
- max-age=0, private, must-revalidate
|
43
|
+
X-Request-Id:
|
44
|
+
- 8e958356-5263-4feb-af6a-d8cddcf5e6b1
|
45
|
+
X-Runtime:
|
46
|
+
- '0.006867'
|
47
|
+
Vary:
|
48
|
+
- Origin
|
49
|
+
Transfer-Encoding:
|
50
|
+
- chunked
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: '{"customer":{"lago_id":"c8bb805a-590c-444f-ae14-66589764f273","external_id":"gid://dummy/Pay::Customer/772847388","name":"Lago
|
54
|
+
User","sequential_id":4,"slug":"AMO-FBCD-004","created_at":"2023-09-18T06:42:57Z","updated_at":"2023-09-18T06:43:11Z","country":null,"address_line1":null,"address_line2":null,"state":null,"zipcode":null,"email":"test@example.com","city":null,"url":null,"phone":null,"logo_url":null,"legal_name":null,"legal_number":null,"currency":"USD","tax_identification_number":null,"timezone":null,"applicable_timezone":"UTC","net_payment_term":null,"external_salesforce_id":null,"billing_configuration":{"invoice_grace_period":null,"payment_provider":null,"vat_rate":null,"document_locale":null},"metadata":[],"taxes":[]}}'
|
55
|
+
recorded_at: Tue, 19 Sep 2023 00:56:14 GMT
|
56
|
+
- request:
|
57
|
+
method: get
|
58
|
+
uri: http://localhost:3000/api/v1/add_ons/pay_default_addon
|
59
|
+
body:
|
60
|
+
encoding: UTF-8
|
61
|
+
string: ''
|
62
|
+
headers:
|
63
|
+
Authorization:
|
64
|
+
- Bearer <LAGO_API_KEY>
|
65
|
+
Content-Type:
|
66
|
+
- application/json
|
67
|
+
User-Agent:
|
68
|
+
- Lago Ruby v0.44.0-beta
|
69
|
+
Accept-Encoding:
|
70
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
71
|
+
Accept:
|
72
|
+
- "*/*"
|
73
|
+
response:
|
74
|
+
status:
|
75
|
+
code: 200
|
76
|
+
message: OK
|
77
|
+
headers:
|
78
|
+
X-Frame-Options:
|
79
|
+
- SAMEORIGIN
|
80
|
+
X-Xss-Protection:
|
81
|
+
- '0'
|
82
|
+
X-Content-Type-Options:
|
83
|
+
- nosniff
|
84
|
+
X-Download-Options:
|
85
|
+
- noopen
|
86
|
+
X-Permitted-Cross-Domain-Policies:
|
87
|
+
- none
|
88
|
+
Referrer-Policy:
|
89
|
+
- strict-origin-when-cross-origin
|
90
|
+
Content-Type:
|
91
|
+
- application/json; charset=utf-8
|
92
|
+
Etag:
|
93
|
+
- W/"313c360c2793ebdbf699d3669bdb5703"
|
94
|
+
Cache-Control:
|
95
|
+
- max-age=0, private, must-revalidate
|
96
|
+
X-Request-Id:
|
97
|
+
- 908f03d8-dada-4878-9160-80ca397e4267
|
98
|
+
X-Runtime:
|
99
|
+
- '0.005912'
|
100
|
+
Vary:
|
101
|
+
- Origin
|
102
|
+
Transfer-Encoding:
|
103
|
+
- chunked
|
104
|
+
body:
|
105
|
+
encoding: UTF-8
|
106
|
+
string: '{"add_on":{"lago_id":"690e70c2-f101-4539-bda7-aefe4b1d068e","name":"Default
|
107
|
+
Charge","code":"pay_default_addon","amount_cents":100,"amount_currency":"USD","created_at":"2023-09-11T05:01:17Z","description":null,"taxes":[]}}'
|
108
|
+
recorded_at: Tue, 19 Sep 2023 00:56:14 GMT
|
109
|
+
- request:
|
110
|
+
method: post
|
111
|
+
uri: http://localhost:3000/api/v1/invoices
|
112
|
+
body:
|
113
|
+
encoding: UTF-8
|
114
|
+
string: '{"invoice":{"external_customer_id":"gid://dummy/Pay::Customer/772847388","currency":"USD","net_payment_term":null,"fees":[{"add_on_code":"pay_default_addon","unit_amount_cents":1000}]}}'
|
115
|
+
headers:
|
116
|
+
Authorization:
|
117
|
+
- Bearer <LAGO_API_KEY>
|
118
|
+
Content-Type:
|
119
|
+
- application/json
|
120
|
+
User-Agent:
|
121
|
+
- Lago Ruby v0.44.0-beta
|
122
|
+
Accept-Encoding:
|
123
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
124
|
+
Accept:
|
125
|
+
- "*/*"
|
126
|
+
response:
|
127
|
+
status:
|
128
|
+
code: 200
|
129
|
+
message: OK
|
130
|
+
headers:
|
131
|
+
X-Frame-Options:
|
132
|
+
- SAMEORIGIN
|
133
|
+
X-Xss-Protection:
|
134
|
+
- '0'
|
135
|
+
X-Content-Type-Options:
|
136
|
+
- nosniff
|
137
|
+
X-Download-Options:
|
138
|
+
- noopen
|
139
|
+
X-Permitted-Cross-Domain-Policies:
|
140
|
+
- none
|
141
|
+
Referrer-Policy:
|
142
|
+
- strict-origin-when-cross-origin
|
143
|
+
Content-Type:
|
144
|
+
- application/json; charset=utf-8
|
145
|
+
Etag:
|
146
|
+
- W/"32ffd12227116e8ec3b74a5bd3b3403b"
|
147
|
+
Cache-Control:
|
148
|
+
- max-age=0, private, must-revalidate
|
149
|
+
X-Request-Id:
|
150
|
+
- 61b34df0-937c-49b6-9843-91f66c1925fa
|
151
|
+
X-Runtime:
|
152
|
+
- '0.052565'
|
153
|
+
Vary:
|
154
|
+
- Origin
|
155
|
+
Transfer-Encoding:
|
156
|
+
- chunked
|
157
|
+
body:
|
158
|
+
encoding: UTF-8
|
159
|
+
string: '{"invoice":{"lago_id":"7a89d164-84d0-4cfc-82a2-b06d36b191e5","sequential_id":3,"number":"AMO-FBCD-004-003","issuing_date":"2023-09-19","payment_due_date":"2023-09-19","net_payment_term":0,"invoice_type":"one_off","status":"finalized","payment_status":"pending","currency":"USD","fees_amount_cents":1000,"taxes_amount_cents":0,"coupons_amount_cents":0,"credit_notes_amount_cents":0,"sub_total_excluding_taxes_amount_cents":1000,"sub_total_including_taxes_amount_cents":1000,"total_amount_cents":1000,"prepaid_credit_amount_cents":0,"file_url":null,"version_number":3,"legacy":false,"amount_currency":"USD","vat_amount_currency":"USD","credit_amount_currency":"USD","total_amount_currency":"USD","amount_cents":1000,"credit_amount_cents":0,"vat_amount_cents":0,"sub_total_vat_excluded_amount_cents":1000,"sub_total_vat_included_amount_cents":1000,"customer":{"lago_id":"c8bb805a-590c-444f-ae14-66589764f273","external_id":"gid://dummy/Pay::Customer/772847388","name":"Lago
|
160
|
+
User","sequential_id":4,"slug":"AMO-FBCD-004","created_at":"2023-09-18T06:42:57Z","updated_at":"2023-09-18T06:43:11Z","country":null,"address_line1":null,"address_line2":null,"state":null,"zipcode":null,"email":"test@example.com","city":null,"url":null,"phone":null,"logo_url":null,"legal_name":null,"legal_number":null,"currency":"USD","tax_identification_number":null,"timezone":null,"applicable_timezone":"UTC","net_payment_term":null,"external_salesforce_id":null,"billing_configuration":{"invoice_grace_period":null,"payment_provider":null,"vat_rate":null,"document_locale":null},"metadata":[]},"subscriptions":[],"fees":[{"lago_id":"51fbcb5c-78a0-4e13-961e-fd9462180fc9","lago_group_id":null,"lago_invoice_id":"7a89d164-84d0-4cfc-82a2-b06d36b191e5","lago_true_up_fee_id":null,"lago_true_up_parent_fee_id":null,"item":{"type":"add_on","code":"pay_default_addon","name":"Default
|
161
|
+
Charge","lago_item_id":"690e70c2-f101-4539-bda7-aefe4b1d068e","item_type":"AddOn"},"pay_in_advance":false,"invoiceable":true,"amount_cents":1000,"amount_currency":"USD","taxes_amount_cents":0,"taxes_rate":0.0,"total_amount_cents":1000,"total_amount_currency":"USD","units":"1.0","description":null,"unit_amount_cents":1000,"events_count":null,"payment_status":"pending","created_at":"2023-09-19T00:56:14Z","succeeded_at":null,"failed_at":null,"refunded_at":null,"vat_amount_cents":0,"vat_amount_currency":"USD"}],"credits":[],"metadata":[],"applied_taxes":[]}}'
|
162
|
+
recorded_at: Tue, 19 Sep 2023 00:56:14 GMT
|
163
|
+
recorded_with: VCR 6.2.0
|
@@ -0,0 +1,107 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:3000/api/v1/customers/gid:%2F%2Fdummy%2FPay::Customer%2F772847389
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Authorization:
|
11
|
+
- Bearer 155ed033-8716-4587-9ac6-fed8ddae3317
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
User-Agent:
|
15
|
+
- Lago Ruby v0.44.0-beta
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
Accept:
|
19
|
+
- "*/*"
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 404
|
23
|
+
message: Not Found
|
24
|
+
headers:
|
25
|
+
X-Frame-Options:
|
26
|
+
- SAMEORIGIN
|
27
|
+
X-Xss-Protection:
|
28
|
+
- '0'
|
29
|
+
X-Content-Type-Options:
|
30
|
+
- nosniff
|
31
|
+
X-Download-Options:
|
32
|
+
- noopen
|
33
|
+
X-Permitted-Cross-Domain-Policies:
|
34
|
+
- none
|
35
|
+
Referrer-Policy:
|
36
|
+
- strict-origin-when-cross-origin
|
37
|
+
Content-Type:
|
38
|
+
- application/json; charset=utf-8
|
39
|
+
Cache-Control:
|
40
|
+
- no-cache
|
41
|
+
X-Request-Id:
|
42
|
+
- ee9259c3-b086-4d94-af56-33d193269239
|
43
|
+
X-Runtime:
|
44
|
+
- 0.031087
|
45
|
+
Vary:
|
46
|
+
- Origin
|
47
|
+
Transfer-Encoding:
|
48
|
+
- chunked
|
49
|
+
body:
|
50
|
+
encoding: UTF-8
|
51
|
+
string: '{"status":404,"error":"Not Found","code":"customer_not_found"}'
|
52
|
+
recorded_at: Tue, 19 Sep 2023 01:11:06 GMT
|
53
|
+
- request:
|
54
|
+
method: post
|
55
|
+
uri: http://localhost:3000/api/v1/customers
|
56
|
+
body:
|
57
|
+
encoding: UTF-8
|
58
|
+
string: '{"customer":{"external_id":"gid://dummy/Pay::Customer/772847389","address_line1":null,"address_line2":null,"city":null,"country":null,"email":"none@example.org","legal_name":null,"legal_number":null,"net_payment_term":null,"tax_identification_number":null,"logo_url":null,"name":"None
|
59
|
+
User","phone":null,"state":null,"url":null,"zipcode":null,"currency":null,"tax_codes":null,"timezone":null}}'
|
60
|
+
headers:
|
61
|
+
Authorization:
|
62
|
+
- Bearer 155ed033-8716-4587-9ac6-fed8ddae3317
|
63
|
+
Content-Type:
|
64
|
+
- application/json
|
65
|
+
User-Agent:
|
66
|
+
- Lago Ruby v0.44.0-beta
|
67
|
+
Accept-Encoding:
|
68
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
69
|
+
Accept:
|
70
|
+
- "*/*"
|
71
|
+
response:
|
72
|
+
status:
|
73
|
+
code: 200
|
74
|
+
message: OK
|
75
|
+
headers:
|
76
|
+
X-Frame-Options:
|
77
|
+
- SAMEORIGIN
|
78
|
+
X-Xss-Protection:
|
79
|
+
- '0'
|
80
|
+
X-Content-Type-Options:
|
81
|
+
- nosniff
|
82
|
+
X-Download-Options:
|
83
|
+
- noopen
|
84
|
+
X-Permitted-Cross-Domain-Policies:
|
85
|
+
- none
|
86
|
+
Referrer-Policy:
|
87
|
+
- strict-origin-when-cross-origin
|
88
|
+
Content-Type:
|
89
|
+
- application/json; charset=utf-8
|
90
|
+
Etag:
|
91
|
+
- W/"e264430069449aaad24e9903beecb042"
|
92
|
+
Cache-Control:
|
93
|
+
- max-age=0, private, must-revalidate
|
94
|
+
X-Request-Id:
|
95
|
+
- 426d9b92-d55d-4d15-800d-c9cc6a088060
|
96
|
+
X-Runtime:
|
97
|
+
- '0.032076'
|
98
|
+
Vary:
|
99
|
+
- Origin
|
100
|
+
Transfer-Encoding:
|
101
|
+
- chunked
|
102
|
+
body:
|
103
|
+
encoding: UTF-8
|
104
|
+
string: '{"customer":{"lago_id":"e9c7bdcd-4e20-4fca-a315-6b78268b9292","external_id":"gid://dummy/Pay::Customer/772847389","name":"None
|
105
|
+
User","sequential_id":5,"slug":"AMO-FBCD-005","created_at":"2023-09-19T01:11:06Z","updated_at":"2023-09-19T01:11:06Z","country":null,"address_line1":null,"address_line2":null,"state":null,"zipcode":null,"email":"none@example.org","city":null,"url":null,"phone":null,"logo_url":null,"legal_name":null,"legal_number":null,"currency":null,"tax_identification_number":null,"timezone":null,"applicable_timezone":"UTC","net_payment_term":null,"external_salesforce_id":null,"billing_configuration":{"invoice_grace_period":null,"payment_provider":null,"vat_rate":null,"document_locale":null},"metadata":[],"taxes":[]}}'
|
106
|
+
recorded_at: Tue, 19 Sep 2023 01:11:06 GMT
|
107
|
+
recorded_with: VCR 6.2.0
|
@@ -0,0 +1,108 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:3000/api/v1/customers/gid:%2F%2Fdummy%2FPay::Customer%2F772847388
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Authorization:
|
11
|
+
- Bearer 155ed033-8716-4587-9ac6-fed8ddae3317
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
User-Agent:
|
15
|
+
- Lago Ruby v0.44.0-beta
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
Accept:
|
19
|
+
- "*/*"
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
X-Frame-Options:
|
26
|
+
- SAMEORIGIN
|
27
|
+
X-Xss-Protection:
|
28
|
+
- '0'
|
29
|
+
X-Content-Type-Options:
|
30
|
+
- nosniff
|
31
|
+
X-Download-Options:
|
32
|
+
- noopen
|
33
|
+
X-Permitted-Cross-Domain-Policies:
|
34
|
+
- none
|
35
|
+
Referrer-Policy:
|
36
|
+
- strict-origin-when-cross-origin
|
37
|
+
Content-Type:
|
38
|
+
- application/json; charset=utf-8
|
39
|
+
Etag:
|
40
|
+
- W/"af429c6f51b25054dd9b23522b77d57d"
|
41
|
+
Cache-Control:
|
42
|
+
- max-age=0, private, must-revalidate
|
43
|
+
X-Request-Id:
|
44
|
+
- 28491ac8-a26c-4ca4-a86f-3e6067ba7032
|
45
|
+
X-Runtime:
|
46
|
+
- '0.036063'
|
47
|
+
Vary:
|
48
|
+
- Origin
|
49
|
+
Transfer-Encoding:
|
50
|
+
- chunked
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: '{"customer":{"lago_id":"c8bb805a-590c-444f-ae14-66589764f273","external_id":"gid://dummy/Pay::Customer/772847388","name":"Lago
|
54
|
+
User","sequential_id":4,"slug":"AMO-FBCD-004","created_at":"2023-09-18T06:42:57Z","updated_at":"2023-09-18T06:43:11Z","country":null,"address_line1":null,"address_line2":null,"state":null,"zipcode":null,"email":"test@example.com","city":null,"url":null,"phone":null,"logo_url":null,"legal_name":null,"legal_number":null,"currency":"USD","tax_identification_number":null,"timezone":null,"applicable_timezone":"UTC","net_payment_term":null,"external_salesforce_id":null,"billing_configuration":{"invoice_grace_period":null,"payment_provider":null,"vat_rate":null,"document_locale":null},"metadata":[],"taxes":[]}}'
|
55
|
+
recorded_at: Wed, 20 Sep 2023 05:21:52 GMT
|
56
|
+
- request:
|
57
|
+
method: post
|
58
|
+
uri: http://localhost:3000/api/v1/subscriptions
|
59
|
+
body:
|
60
|
+
encoding: UTF-8
|
61
|
+
string: '{"subscription":{"external_customer_id":"gid://dummy/Pay::Customer/772847388","plan_code":"default","name":"default","external_id":"gid://dummy/Pay::Subscription/913727099"}}'
|
62
|
+
headers:
|
63
|
+
Authorization:
|
64
|
+
- Bearer 155ed033-8716-4587-9ac6-fed8ddae3317
|
65
|
+
Content-Type:
|
66
|
+
- application/json
|
67
|
+
User-Agent:
|
68
|
+
- Lago Ruby v0.44.0-beta
|
69
|
+
Accept-Encoding:
|
70
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
71
|
+
Accept:
|
72
|
+
- "*/*"
|
73
|
+
response:
|
74
|
+
status:
|
75
|
+
code: 200
|
76
|
+
message: OK
|
77
|
+
headers:
|
78
|
+
X-Frame-Options:
|
79
|
+
- SAMEORIGIN
|
80
|
+
X-Xss-Protection:
|
81
|
+
- '0'
|
82
|
+
X-Content-Type-Options:
|
83
|
+
- nosniff
|
84
|
+
X-Download-Options:
|
85
|
+
- noopen
|
86
|
+
X-Permitted-Cross-Domain-Policies:
|
87
|
+
- none
|
88
|
+
Referrer-Policy:
|
89
|
+
- strict-origin-when-cross-origin
|
90
|
+
Content-Type:
|
91
|
+
- application/json; charset=utf-8
|
92
|
+
Etag:
|
93
|
+
- W/"e02fd87d05bded0f1ac0e8d1345a6991"
|
94
|
+
Cache-Control:
|
95
|
+
- max-age=0, private, must-revalidate
|
96
|
+
X-Request-Id:
|
97
|
+
- 93417ede-4037-4f94-ad13-19d3fcfedb6c
|
98
|
+
X-Runtime:
|
99
|
+
- '0.024726'
|
100
|
+
Vary:
|
101
|
+
- Origin
|
102
|
+
Transfer-Encoding:
|
103
|
+
- chunked
|
104
|
+
body:
|
105
|
+
encoding: UTF-8
|
106
|
+
string: '{"subscription":{"lago_id":"4a849692-2b6d-48cc-a3f4-02c03a004b3b","external_id":"gid://dummy/Pay::Subscription/913727099","lago_customer_id":"c8bb805a-590c-444f-ae14-66589764f273","external_customer_id":"gid://dummy/Pay::Customer/772847388","name":"default","plan_code":"default","status":"active","billing_time":"calendar","subscription_at":"2023-09-19T00:47:59Z","started_at":"2023-09-19T00:47:59Z","terminated_at":null,"canceled_at":null,"created_at":"2023-09-19T00:47:59Z","previous_plan_code":null,"next_plan_code":"another_plan","downgrade_plan_date":"2023-10-01","subscription_date":"2023-09-19"}}'
|
107
|
+
recorded_at: Wed, 20 Sep 2023 05:21:52 GMT
|
108
|
+
recorded_with: VCR 6.2.0
|