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
@@ -0,0 +1,160 @@
|
|
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
|
+
- "1eb621ad-c152-487e-8233-ed29ea1ddbe0"
|
45
|
+
X-Runtime:
|
46
|
+
- '0.006367'
|
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 03:07:55 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/"fb3fb93434e12318f7063defd93d7c68"
|
94
|
+
Cache-Control:
|
95
|
+
- max-age=0, private, must-revalidate
|
96
|
+
X-Request-Id:
|
97
|
+
- 33b9839a-08f2-4c19-82ba-76d2add45bdf
|
98
|
+
X-Runtime:
|
99
|
+
- 0.017908
|
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":null,"downgrade_plan_date":null,"subscription_date":"2023-09-19"}}'
|
107
|
+
recorded_at: Wed, 20 Sep 2023 03:07:55 GMT
|
108
|
+
- request:
|
109
|
+
method: get
|
110
|
+
uri: http://localhost:3000/api/v1/subscriptions?external_customer_id=gid://dummy/Pay::Customer/772847388&per_page=9223372036854775807
|
111
|
+
body:
|
112
|
+
encoding: UTF-8
|
113
|
+
string: ''
|
114
|
+
headers:
|
115
|
+
Authorization:
|
116
|
+
- Bearer 155ed033-8716-4587-9ac6-fed8ddae3317
|
117
|
+
Content-Type:
|
118
|
+
- application/json
|
119
|
+
User-Agent:
|
120
|
+
- Lago Ruby v0.44.0-beta
|
121
|
+
Accept-Encoding:
|
122
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
123
|
+
Accept:
|
124
|
+
- "*/*"
|
125
|
+
response:
|
126
|
+
status:
|
127
|
+
code: 200
|
128
|
+
message: OK
|
129
|
+
headers:
|
130
|
+
X-Frame-Options:
|
131
|
+
- SAMEORIGIN
|
132
|
+
X-Xss-Protection:
|
133
|
+
- '0'
|
134
|
+
X-Content-Type-Options:
|
135
|
+
- nosniff
|
136
|
+
X-Download-Options:
|
137
|
+
- noopen
|
138
|
+
X-Permitted-Cross-Domain-Policies:
|
139
|
+
- none
|
140
|
+
Referrer-Policy:
|
141
|
+
- strict-origin-when-cross-origin
|
142
|
+
Content-Type:
|
143
|
+
- application/json; charset=utf-8
|
144
|
+
Etag:
|
145
|
+
- W/"a5adc13a7d66ae7cd525b05b0c7afdad"
|
146
|
+
Cache-Control:
|
147
|
+
- max-age=0, private, must-revalidate
|
148
|
+
X-Request-Id:
|
149
|
+
- "1373b2d1-3494-48d2-b3f5-5c6049bb40bb"
|
150
|
+
X-Runtime:
|
151
|
+
- 0.016650
|
152
|
+
Vary:
|
153
|
+
- Origin
|
154
|
+
Transfer-Encoding:
|
155
|
+
- chunked
|
156
|
+
body:
|
157
|
+
encoding: UTF-8
|
158
|
+
string: '{"subscriptions":[{"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":null,"downgrade_plan_date":null,"subscription_date":"2023-09-19"}],"meta":{"current_page":1,"next_page":null,"prev_page":null,"total_pages":1,"total_count":1}}'
|
159
|
+
recorded_at: Wed, 20 Sep 2023 03:07:55 GMT
|
160
|
+
recorded_with: VCR 6.2.0
|
@@ -0,0 +1,212 @@
|
|
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
|
+
- 55db2865-29d7-4e9c-99e5-84b7ca8e0529
|
45
|
+
X-Runtime:
|
46
|
+
- 0.008192
|
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 03:27:08 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
|
+
- fd96eca5-5543-4934-be42-e26299bf9963
|
98
|
+
X-Runtime:
|
99
|
+
- 0.021745
|
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 03:27:08 GMT
|
108
|
+
- request:
|
109
|
+
method: get
|
110
|
+
uri: http://localhost:3000/api/v1/subscriptions?external_customer_id=gid://dummy/Pay::Customer/772847388&per_page=9223372036854775807
|
111
|
+
body:
|
112
|
+
encoding: UTF-8
|
113
|
+
string: ''
|
114
|
+
headers:
|
115
|
+
Authorization:
|
116
|
+
- Bearer 155ed033-8716-4587-9ac6-fed8ddae3317
|
117
|
+
Content-Type:
|
118
|
+
- application/json
|
119
|
+
User-Agent:
|
120
|
+
- Lago Ruby v0.44.0-beta
|
121
|
+
Accept-Encoding:
|
122
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
123
|
+
Accept:
|
124
|
+
- "*/*"
|
125
|
+
response:
|
126
|
+
status:
|
127
|
+
code: 200
|
128
|
+
message: OK
|
129
|
+
headers:
|
130
|
+
X-Frame-Options:
|
131
|
+
- SAMEORIGIN
|
132
|
+
X-Xss-Protection:
|
133
|
+
- '0'
|
134
|
+
X-Content-Type-Options:
|
135
|
+
- nosniff
|
136
|
+
X-Download-Options:
|
137
|
+
- noopen
|
138
|
+
X-Permitted-Cross-Domain-Policies:
|
139
|
+
- none
|
140
|
+
Referrer-Policy:
|
141
|
+
- strict-origin-when-cross-origin
|
142
|
+
Content-Type:
|
143
|
+
- application/json; charset=utf-8
|
144
|
+
Etag:
|
145
|
+
- W/"7fc7bee0fb810974f19d17e80ded8d7b"
|
146
|
+
Cache-Control:
|
147
|
+
- max-age=0, private, must-revalidate
|
148
|
+
X-Request-Id:
|
149
|
+
- 798b937b-612a-4e6f-ae3a-7c23a8d96d65
|
150
|
+
X-Runtime:
|
151
|
+
- 0.011820
|
152
|
+
Vary:
|
153
|
+
- Origin
|
154
|
+
Transfer-Encoding:
|
155
|
+
- chunked
|
156
|
+
body:
|
157
|
+
encoding: UTF-8
|
158
|
+
string: '{"subscriptions":[{"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"}],"meta":{"current_page":1,"next_page":null,"prev_page":null,"total_pages":1,"total_count":1}}'
|
159
|
+
recorded_at: Wed, 20 Sep 2023 03:27:08 GMT
|
160
|
+
- request:
|
161
|
+
method: post
|
162
|
+
uri: http://localhost:3000/api/v1/subscriptions
|
163
|
+
body:
|
164
|
+
encoding: UTF-8
|
165
|
+
string: '{"subscription":{"external_customer_id":"gid://dummy/Pay::Customer/772847388","plan_code":"another_plan","external_id":"gid://dummy/Pay::Subscription/913727099"}}'
|
166
|
+
headers:
|
167
|
+
Authorization:
|
168
|
+
- Bearer 155ed033-8716-4587-9ac6-fed8ddae3317
|
169
|
+
Content-Type:
|
170
|
+
- application/json
|
171
|
+
User-Agent:
|
172
|
+
- Lago Ruby v0.44.0-beta
|
173
|
+
Accept-Encoding:
|
174
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
175
|
+
Accept:
|
176
|
+
- "*/*"
|
177
|
+
response:
|
178
|
+
status:
|
179
|
+
code: 200
|
180
|
+
message: OK
|
181
|
+
headers:
|
182
|
+
X-Frame-Options:
|
183
|
+
- SAMEORIGIN
|
184
|
+
X-Xss-Protection:
|
185
|
+
- '0'
|
186
|
+
X-Content-Type-Options:
|
187
|
+
- nosniff
|
188
|
+
X-Download-Options:
|
189
|
+
- noopen
|
190
|
+
X-Permitted-Cross-Domain-Policies:
|
191
|
+
- none
|
192
|
+
Referrer-Policy:
|
193
|
+
- strict-origin-when-cross-origin
|
194
|
+
Content-Type:
|
195
|
+
- application/json; charset=utf-8
|
196
|
+
Etag:
|
197
|
+
- W/"e02fd87d05bded0f1ac0e8d1345a6991"
|
198
|
+
Cache-Control:
|
199
|
+
- max-age=0, private, must-revalidate
|
200
|
+
X-Request-Id:
|
201
|
+
- fd754b57-e750-4d01-92b8-b77f4489304d
|
202
|
+
X-Runtime:
|
203
|
+
- 0.039601
|
204
|
+
Vary:
|
205
|
+
- Origin
|
206
|
+
Transfer-Encoding:
|
207
|
+
- chunked
|
208
|
+
body:
|
209
|
+
encoding: UTF-8
|
210
|
+
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"}}'
|
211
|
+
recorded_at: Wed, 20 Sep 2023 03:27:08 GMT
|
212
|
+
recorded_with: VCR 6.2.0
|
metadata
ADDED
@@ -0,0 +1,212 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pay-lago
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Moxvallix
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-10-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pay
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '6.8'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '6.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: lago-ruby-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.50.0.pre.beta
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.50.0.pre.beta
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- dev@moxvallix.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".github/workflows/main.yml"
|
49
|
+
- ".gitignore"
|
50
|
+
- ".rspec"
|
51
|
+
- ".standard.yml"
|
52
|
+
- CHANGELOG.md
|
53
|
+
- CODE_OF_CONDUCT.md
|
54
|
+
- Gemfile
|
55
|
+
- Gemfile.lock
|
56
|
+
- LICENSE.txt
|
57
|
+
- README.md
|
58
|
+
- Rakefile
|
59
|
+
- app/controllers/pay/webhooks/lago_controller.rb
|
60
|
+
- app/models/concerns/pay/lago/pay_customer_extensions.rb
|
61
|
+
- app/models/concerns/pay/lago/pay_extensions.rb
|
62
|
+
- bin/console
|
63
|
+
- bin/rails
|
64
|
+
- bin/setup
|
65
|
+
- config/routes.rb
|
66
|
+
- docs/1_customers.md
|
67
|
+
- docs/2_charges.md
|
68
|
+
- docs/3_subscriptions.md
|
69
|
+
- docs/4_webhooks.md
|
70
|
+
- lib/pay/lago.rb
|
71
|
+
- lib/pay/lago/attributes.rb
|
72
|
+
- lib/pay/lago/billable.rb
|
73
|
+
- lib/pay/lago/charge.rb
|
74
|
+
- lib/pay/lago/engine.rb
|
75
|
+
- lib/pay/lago/error.rb
|
76
|
+
- lib/pay/lago/payment_method.rb
|
77
|
+
- lib/pay/lago/subscription.rb
|
78
|
+
- lib/pay/lago/version.rb
|
79
|
+
- lib/pay/lago/webhook_extensions.rb
|
80
|
+
- lib/pay/lago/webhooks/customer_payment_provider_created.rb
|
81
|
+
- lib/pay/lago/webhooks/invoice_created.rb
|
82
|
+
- lib/pay/lago/webhooks/invoice_drafted.rb
|
83
|
+
- lib/pay/lago/webhooks/invoice_one_off_created.rb
|
84
|
+
- lib/pay/lago/webhooks/invoice_payment_status_updated.rb
|
85
|
+
- lib/pay/lago/webhooks/subscription_started.rb
|
86
|
+
- lib/pay/lago/webhooks/subscription_terminated.rb
|
87
|
+
- pay-lago.gemspec
|
88
|
+
- sig/pay/lago.rbs
|
89
|
+
- test/controllers/pay/webhooks/lago_controller_test.rb
|
90
|
+
- test/dummy/.browserslistrc
|
91
|
+
- test/dummy/Rakefile
|
92
|
+
- test/dummy/app/assets/config/manifest.js
|
93
|
+
- test/dummy/app/assets/images/.keep
|
94
|
+
- test/dummy/app/assets/stylesheets/application.css
|
95
|
+
- test/dummy/app/channels/application_cable/channel.rb
|
96
|
+
- test/dummy/app/channels/application_cable/connection.rb
|
97
|
+
- test/dummy/app/controllers/application_controller.rb
|
98
|
+
- test/dummy/app/controllers/concerns/.keep
|
99
|
+
- test/dummy/app/controllers/main_controller.rb
|
100
|
+
- test/dummy/app/controllers/payment_methods_controller.rb
|
101
|
+
- test/dummy/app/helpers/application_helper.rb
|
102
|
+
- test/dummy/app/helpers/current_helper.rb
|
103
|
+
- test/dummy/app/javascript/application.js
|
104
|
+
- test/dummy/app/javascript/controllers/application.js
|
105
|
+
- test/dummy/app/javascript/controllers/index.js
|
106
|
+
- test/dummy/app/jobs/application_job.rb
|
107
|
+
- test/dummy/app/mailers/application_mailer.rb
|
108
|
+
- test/dummy/app/models/account.rb
|
109
|
+
- test/dummy/app/models/application_record.rb
|
110
|
+
- test/dummy/app/models/concerns/.keep
|
111
|
+
- test/dummy/app/models/team.rb
|
112
|
+
- test/dummy/app/models/user.rb
|
113
|
+
- test/dummy/app/views/layouts/application.html.erb
|
114
|
+
- test/dummy/app/views/layouts/mailer.html.erb
|
115
|
+
- test/dummy/app/views/layouts/mailer.text.erb
|
116
|
+
- test/dummy/app/webhooks/charge_succeeded.rb
|
117
|
+
- test/dummy/bin/importmap
|
118
|
+
- test/dummy/bin/rails
|
119
|
+
- test/dummy/bin/rake
|
120
|
+
- test/dummy/bin/setup
|
121
|
+
- test/dummy/bin/webpack
|
122
|
+
- test/dummy/bin/webpack-dev-server
|
123
|
+
- test/dummy/config.ru
|
124
|
+
- test/dummy/config/application.rb
|
125
|
+
- test/dummy/config/boot.rb
|
126
|
+
- test/dummy/config/cable.yml
|
127
|
+
- test/dummy/config/database.yml
|
128
|
+
- test/dummy/config/environment.rb
|
129
|
+
- test/dummy/config/environments/development.rb
|
130
|
+
- test/dummy/config/environments/production.rb
|
131
|
+
- test/dummy/config/environments/test.rb
|
132
|
+
- test/dummy/config/importmap.rb
|
133
|
+
- test/dummy/config/initializers/application_controller_renderer.rb
|
134
|
+
- test/dummy/config/initializers/assets.rb
|
135
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
136
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
137
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
138
|
+
- test/dummy/config/initializers/inflections.rb
|
139
|
+
- test/dummy/config/initializers/mime_types.rb
|
140
|
+
- test/dummy/config/initializers/pay.rb
|
141
|
+
- test/dummy/config/initializers/session_store.rb
|
142
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
143
|
+
- test/dummy/config/locales/en.yml
|
144
|
+
- test/dummy/config/puma.rb
|
145
|
+
- test/dummy/config/routes.rb
|
146
|
+
- test/dummy/config/secrets.yml
|
147
|
+
- test/dummy/config/spring.rb
|
148
|
+
- test/dummy/config/storage.yml
|
149
|
+
- test/dummy/db/migrate/20170205000000_create_users.rb
|
150
|
+
- test/dummy/db/schema.rb
|
151
|
+
- test/dummy/lib/assets/.keep
|
152
|
+
- test/dummy/log/.keep
|
153
|
+
- test/dummy/public/404.html
|
154
|
+
- test/dummy/public/422.html
|
155
|
+
- test/dummy/public/500.html
|
156
|
+
- test/dummy/public/apple-touch-icon-precomposed.png
|
157
|
+
- test/dummy/public/apple-touch-icon.png
|
158
|
+
- test/dummy/public/favicon.ico
|
159
|
+
- test/dummy/vendor/javascript/.keep
|
160
|
+
- test/fixtures/accounts.yml
|
161
|
+
- test/fixtures/pay/customers.yml
|
162
|
+
- test/fixtures/teams.yml
|
163
|
+
- test/fixtures/users.yml
|
164
|
+
- test/pay/lago/billable_test.rb
|
165
|
+
- test/pay/lago/charge_test.rb
|
166
|
+
- test/pay/lago/subscription_test.rb
|
167
|
+
- test/support/fixtures/lago/invoice.one_off_created.json
|
168
|
+
- test/support/vcr.rb
|
169
|
+
- test/test_helper.rb
|
170
|
+
- test/vcr_cassettes/test_add_payment_method_to_lago.yml
|
171
|
+
- test/vcr_cassettes/test_can_get_lago_processor_customer.yml
|
172
|
+
- test/vcr_cassettes/test_can_make_a_lago_processor_charge.yml
|
173
|
+
- test/vcr_cassettes/test_generates_lago_processor_id.yml
|
174
|
+
- test/vcr_cassettes/test_lago_cannot_change_quantity.yml
|
175
|
+
- test/vcr_cassettes/test_lago_processor_cancel.yml
|
176
|
+
- test/vcr_cassettes/test_lago_processor_charge.yml
|
177
|
+
- test/vcr_cassettes/test_lago_processor_on_grace_period__is_always_false.yml
|
178
|
+
- test/vcr_cassettes/test_lago_processor_pause_raises_an_error.yml
|
179
|
+
- test/vcr_cassettes/test_lago_processor_paused__is_always_false.yml
|
180
|
+
- test/vcr_cassettes/test_lago_processor_refund_with_premium.yml
|
181
|
+
- test/vcr_cassettes/test_lago_processor_refund_without_premium.yml
|
182
|
+
- test/vcr_cassettes/test_lago_processor_resume_raises_an_error.yml
|
183
|
+
- test/vcr_cassettes/test_lago_processor_subscribe.yml
|
184
|
+
- test/vcr_cassettes/test_lago_processor_subscription.yml
|
185
|
+
- test/vcr_cassettes/test_lago_processor_swap.yml
|
186
|
+
homepage: https://github.com/demingfactor/pay-lago
|
187
|
+
licenses:
|
188
|
+
- MIT
|
189
|
+
metadata:
|
190
|
+
homepage_uri: https://github.com/demingfactor/pay-lago
|
191
|
+
source_code_uri: https://github.com/demingfactor/pay-lago
|
192
|
+
changelog_uri: https://github.com/demingfactor/pay-lago/blob/main/CHANGELOG.md
|
193
|
+
post_install_message:
|
194
|
+
rdoc_options: []
|
195
|
+
require_paths:
|
196
|
+
- lib
|
197
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
203
|
+
requirements:
|
204
|
+
- - ">="
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: '0'
|
207
|
+
requirements: []
|
208
|
+
rubygems_version: 3.3.3
|
209
|
+
signing_key:
|
210
|
+
specification_version: 4
|
211
|
+
summary: Lago processor support for Pay gem.
|
212
|
+
test_files: []
|