pay-lago 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/Gemfile.lock +2 -2
  4. data/README.md +2 -5
  5. data/app/models/concerns/pay/lago/pay_payment_method_extensions.rb +23 -0
  6. data/docs/4_payment_methods.md +40 -0
  7. data/lib/pay/lago/billable.rb +53 -12
  8. data/lib/pay/lago/engine.rb +2 -1
  9. data/lib/pay/lago/payment_method.rb +44 -6
  10. data/lib/pay/lago/subscription.rb +6 -13
  11. data/lib/pay/lago/version.rb +1 -1
  12. data/lib/pay/lago/webhooks/customer_payment_provider_created.rb +1 -7
  13. data/pay-lago.gemspec +1 -1
  14. data/test/dummy/db/migrate/1_create_pay_tables.rb +93 -0
  15. data/test/dummy/db/schema.rb +17 -16
  16. data/test/fixtures/pay/customers.yml +1 -0
  17. data/test/pay/lago/billable_test.rb +1 -1
  18. data/test/pay/lago/payment_method_test.rb +34 -0
  19. data/test/pay/lago/subscription_test.rb +3 -5
  20. data/test/vcr_cassettes/test_PaymentMethod_can_be_made_default__updating_Lago.yml +163 -0
  21. data/test/vcr_cassettes/test_add_payment_method_to_lago.yml +62 -8
  22. data/test/vcr_cassettes/test_can_get_lago_processor_customer.yml +7 -7
  23. data/test/vcr_cassettes/test_can_make_a_lago_processor_charge.yml +22 -22
  24. data/test/vcr_cassettes/test_generates_lago_processor_id.yml +8 -59
  25. data/test/vcr_cassettes/test_lago_cannot_change_quantity.yml +16 -16
  26. data/test/vcr_cassettes/test_lago_processor_cancel.yml +32 -32
  27. data/test/vcr_cassettes/test_lago_processor_charge.yml +55 -55
  28. data/test/vcr_cassettes/test_lago_processor_on_grace_period__is_always_false.yml +16 -16
  29. data/test/vcr_cassettes/test_lago_processor_pause_raises_an_error.yml +16 -16
  30. data/test/vcr_cassettes/test_lago_processor_paused__is_always_false.yml +16 -16
  31. data/test/vcr_cassettes/test_lago_processor_refund_with_premium.yml +64 -64
  32. data/test/vcr_cassettes/test_lago_processor_resume_raises_an_error.yml +16 -16
  33. data/test/vcr_cassettes/test_lago_processor_subscribe.yml +17 -16
  34. data/test/vcr_cassettes/test_lago_processor_subscription.yml +24 -24
  35. data/test/vcr_cassettes/test_lago_processor_swap.yml +86 -32
  36. metadata +10 -5
  37. /data/docs/{4_webhooks.md → 5_webhooks.md} +0 -0
@@ -35,11 +35,9 @@ class Pay::Lago::Subscription::Test < ActiveSupport::TestCase
35
35
  end
36
36
 
37
37
  test "lago processor swap" do
38
- travel_to Date.parse("2023-09-18") do
39
- @subscription.swap("another_plan")
40
- assert_equal @subscription.changing_plan?, true
41
- assert_equal @subscription.subscription.next_plan_code, "another_plan"
42
- end
38
+ @subscription.swap("another_plan")
39
+ @subscription.subscription(reload: true)
40
+ assert_equal @subscription.subscription.plan.code, "another_plan"
43
41
  end
44
42
 
45
43
  test "lago cannot change quantity" do
@@ -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.52.2-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/"97cba9d09cf8d9e47b2eb5e9e4d3f468"
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ X-Request-Id:
44
+ - 4ca68f08-368d-43c9-84ff-00c94fe6f9f8
45
+ X-Runtime:
46
+ - '0.008039'
47
+ Vary:
48
+ - Origin
49
+ Transfer-Encoding:
50
+ - chunked
51
+ body:
52
+ encoding: UTF-8
53
+ string: '{"customer":{"lago_id":"f8186952-5b73-480b-96ac-af4c7c953344","external_id":"gid://dummy/Pay::Customer/772847388","name":"Lago
54
+ User","sequential_id":3,"slug":"AMO-15BA-003","created_at":"2023-11-07T23:51:03Z","updated_at":"2023-12-11T04:52:33Z","country":null,"address_line1":null,"address_line2":null,"state":null,"zipcode":null,"email":"lago@example.org","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":"stripe","vat_rate":null,"document_locale":null,"provider_customer_id":"x","provider_payment_methods":["card"]},"metadata":[],"taxes":[]}}'
55
+ recorded_at: Mon, 11 Dec 2023 06:07:17 GMT
56
+ - request:
57
+ method: post
58
+ uri: http://localhost:3000/api/v1/customers
59
+ body:
60
+ encoding: UTF-8
61
+ string: '{"customer":{"external_id":"gid://dummy/Pay::Customer/772847388","address_line1":null,"address_line2":null,"city":null,"country":null,"email":"lago@example.org","legal_name":null,"legal_number":null,"net_payment_term":null,"tax_identification_number":null,"logo_url":null,"name":"Lago
62
+ User","phone":null,"state":null,"url":null,"zipcode":null,"currency":"USD","tax_codes":null,"timezone":null,"billing_configuration":{"payment_provider":"stripe","provider_customer_id":"test_1234_a"}}}'
63
+ headers:
64
+ Authorization:
65
+ - Bearer <LAGO_API_KEY>
66
+ Content-Type:
67
+ - application/json
68
+ User-Agent:
69
+ - Lago Ruby v0.52.2-beta
70
+ Accept-Encoding:
71
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
72
+ Accept:
73
+ - "*/*"
74
+ response:
75
+ status:
76
+ code: 200
77
+ message: OK
78
+ headers:
79
+ X-Frame-Options:
80
+ - SAMEORIGIN
81
+ X-Xss-Protection:
82
+ - '0'
83
+ X-Content-Type-Options:
84
+ - nosniff
85
+ X-Download-Options:
86
+ - noopen
87
+ X-Permitted-Cross-Domain-Policies:
88
+ - none
89
+ Referrer-Policy:
90
+ - strict-origin-when-cross-origin
91
+ Content-Type:
92
+ - application/json; charset=utf-8
93
+ Etag:
94
+ - W/"cc37a5917ff5ee222c568eb23ff5f263"
95
+ Cache-Control:
96
+ - max-age=0, private, must-revalidate
97
+ X-Request-Id:
98
+ - 69b0db8a-8c15-47dd-bcee-56816ce8303f
99
+ X-Runtime:
100
+ - '0.033672'
101
+ Vary:
102
+ - Origin
103
+ Transfer-Encoding:
104
+ - chunked
105
+ body:
106
+ encoding: UTF-8
107
+ string: '{"customer":{"lago_id":"f8186952-5b73-480b-96ac-af4c7c953344","external_id":"gid://dummy/Pay::Customer/772847388","name":"Lago
108
+ User","sequential_id":3,"slug":"AMO-15BA-003","created_at":"2023-11-07T23:51:03Z","updated_at":"2023-12-11T04:52:33Z","country":null,"address_line1":null,"address_line2":null,"state":null,"zipcode":null,"email":"lago@example.org","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":"stripe","vat_rate":null,"document_locale":null,"provider_customer_id":"test_1234_a","provider_payment_methods":["card"]},"metadata":[],"taxes":[]}}'
109
+ recorded_at: Mon, 11 Dec 2023 06:07:17 GMT
110
+ - request:
111
+ method: get
112
+ uri: http://localhost:3000/api/v1/customers/gid:%2F%2Fdummy%2FPay::Customer%2F772847388
113
+ body:
114
+ encoding: UTF-8
115
+ string: ''
116
+ headers:
117
+ Authorization:
118
+ - Bearer <LAGO_API_KEY>
119
+ Content-Type:
120
+ - application/json
121
+ User-Agent:
122
+ - Lago Ruby v0.52.2-beta
123
+ Accept-Encoding:
124
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
125
+ Accept:
126
+ - "*/*"
127
+ response:
128
+ status:
129
+ code: 200
130
+ message: OK
131
+ headers:
132
+ X-Frame-Options:
133
+ - SAMEORIGIN
134
+ X-Xss-Protection:
135
+ - '0'
136
+ X-Content-Type-Options:
137
+ - nosniff
138
+ X-Download-Options:
139
+ - noopen
140
+ X-Permitted-Cross-Domain-Policies:
141
+ - none
142
+ Referrer-Policy:
143
+ - strict-origin-when-cross-origin
144
+ Content-Type:
145
+ - application/json; charset=utf-8
146
+ Etag:
147
+ - W/"cc37a5917ff5ee222c568eb23ff5f263"
148
+ Cache-Control:
149
+ - max-age=0, private, must-revalidate
150
+ X-Request-Id:
151
+ - 5f8d9c50-3426-49ff-8963-5c8eac081ec0
152
+ X-Runtime:
153
+ - '0.007714'
154
+ Vary:
155
+ - Origin
156
+ Transfer-Encoding:
157
+ - chunked
158
+ body:
159
+ encoding: UTF-8
160
+ string: '{"customer":{"lago_id":"f8186952-5b73-480b-96ac-af4c7c953344","external_id":"gid://dummy/Pay::Customer/772847388","name":"Lago
161
+ User","sequential_id":3,"slug":"AMO-15BA-003","created_at":"2023-11-07T23:51:03Z","updated_at":"2023-12-11T04:52:33Z","country":null,"address_line1":null,"address_line2":null,"state":null,"zipcode":null,"email":"lago@example.org","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":"stripe","vat_rate":null,"document_locale":null,"provider_customer_id":"test_1234_a","provider_payment_methods":["card"]},"metadata":[],"taxes":[]}}'
162
+ recorded_at: Mon, 11 Dec 2023 06:07:17 GMT
163
+ recorded_with: VCR 6.2.0
@@ -8,11 +8,11 @@ http_interactions:
8
8
  string: ''
9
9
  headers:
10
10
  Authorization:
11
- - Bearer 155ed033-8716-4587-9ac6-fed8ddae3317
11
+ - Bearer <LAGO_API_KEY>
12
12
  Content-Type:
13
13
  - application/json
14
14
  User-Agent:
15
- - Lago Ruby v0.44.0-beta
15
+ - Lago Ruby v0.52.2-beta
16
16
  Accept-Encoding:
17
17
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
18
  Accept:
@@ -37,20 +37,74 @@ http_interactions:
37
37
  Content-Type:
38
38
  - application/json; charset=utf-8
39
39
  Etag:
40
- - W/"af429c6f51b25054dd9b23522b77d57d"
40
+ - W/"cc37a5917ff5ee222c568eb23ff5f263"
41
41
  Cache-Control:
42
42
  - max-age=0, private, must-revalidate
43
43
  X-Request-Id:
44
- - 5e8e37f7-2495-43ce-9fe5-81479614b734
44
+ - 2a8c2d12-2a68-4b01-b686-906cf41776ce
45
45
  X-Runtime:
46
- - 0.008701
46
+ - '0.007276'
47
47
  Vary:
48
48
  - Origin
49
49
  Transfer-Encoding:
50
50
  - chunked
51
51
  body:
52
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
53
+ string: '{"customer":{"lago_id":"f8186952-5b73-480b-96ac-af4c7c953344","external_id":"gid://dummy/Pay::Customer/772847388","name":"Lago
54
+ User","sequential_id":3,"slug":"AMO-15BA-003","created_at":"2023-11-07T23:51:03Z","updated_at":"2023-12-11T04:52:33Z","country":null,"address_line1":null,"address_line2":null,"state":null,"zipcode":null,"email":"lago@example.org","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":"stripe","vat_rate":null,"document_locale":null,"provider_customer_id":"test_1234_a","provider_payment_methods":["card"]},"metadata":[],"taxes":[]}}'
55
+ recorded_at: Mon, 11 Dec 2023 06:07:17 GMT
56
+ - request:
57
+ method: post
58
+ uri: http://localhost:3000/api/v1/customers
59
+ body:
60
+ encoding: UTF-8
61
+ string: '{"customer":{"external_id":"gid://dummy/Pay::Customer/772847388","address_line1":null,"address_line2":null,"city":null,"country":null,"email":"lago@example.org","legal_name":null,"legal_number":null,"net_payment_term":null,"tax_identification_number":null,"logo_url":null,"name":"Lago
62
+ User","phone":null,"state":null,"url":null,"zipcode":null,"currency":"USD","tax_codes":null,"timezone":null,"billing_configuration":{"payment_provider":"stripe","provider_customer_id":"x"}}}'
63
+ headers:
64
+ Authorization:
65
+ - Bearer <LAGO_API_KEY>
66
+ Content-Type:
67
+ - application/json
68
+ User-Agent:
69
+ - Lago Ruby v0.52.2-beta
70
+ Accept-Encoding:
71
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
72
+ Accept:
73
+ - "*/*"
74
+ response:
75
+ status:
76
+ code: 200
77
+ message: OK
78
+ headers:
79
+ X-Frame-Options:
80
+ - SAMEORIGIN
81
+ X-Xss-Protection:
82
+ - '0'
83
+ X-Content-Type-Options:
84
+ - nosniff
85
+ X-Download-Options:
86
+ - noopen
87
+ X-Permitted-Cross-Domain-Policies:
88
+ - none
89
+ Referrer-Policy:
90
+ - strict-origin-when-cross-origin
91
+ Content-Type:
92
+ - application/json; charset=utf-8
93
+ Etag:
94
+ - W/"97cba9d09cf8d9e47b2eb5e9e4d3f468"
95
+ Cache-Control:
96
+ - max-age=0, private, must-revalidate
97
+ X-Request-Id:
98
+ - f6aafd8d-9094-45b5-8054-7551b1f4af23
99
+ X-Runtime:
100
+ - '0.026853'
101
+ Vary:
102
+ - Origin
103
+ Transfer-Encoding:
104
+ - chunked
105
+ body:
106
+ encoding: UTF-8
107
+ string: '{"customer":{"lago_id":"f8186952-5b73-480b-96ac-af4c7c953344","external_id":"gid://dummy/Pay::Customer/772847388","name":"Lago
108
+ User","sequential_id":3,"slug":"AMO-15BA-003","created_at":"2023-11-07T23:51:03Z","updated_at":"2023-12-11T04:52:33Z","country":null,"address_line1":null,"address_line2":null,"state":null,"zipcode":null,"email":"lago@example.org","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":"stripe","vat_rate":null,"document_locale":null,"provider_customer_id":"x","provider_payment_methods":["card"]},"metadata":[],"taxes":[]}}'
109
+ recorded_at: Mon, 11 Dec 2023 06:07:17 GMT
56
110
  recorded_with: VCR 6.2.0
@@ -12,7 +12,7 @@ http_interactions:
12
12
  Content-Type:
13
13
  - application/json
14
14
  User-Agent:
15
- - Lago Ruby v0.44.0-beta
15
+ - Lago Ruby v0.52.2-beta
16
16
  Accept-Encoding:
17
17
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
18
  Accept:
@@ -37,20 +37,20 @@ http_interactions:
37
37
  Content-Type:
38
38
  - application/json; charset=utf-8
39
39
  Etag:
40
- - W/"6bf8d0dce7ebdf9890c8d12291028201"
40
+ - W/"97cba9d09cf8d9e47b2eb5e9e4d3f468"
41
41
  Cache-Control:
42
42
  - max-age=0, private, must-revalidate
43
43
  X-Request-Id:
44
- - 7f142f9a-64b3-4cf3-aaf5-2d56cc04d909
44
+ - 95e46874-9990-4f8d-88fd-b9ae0e133f42
45
45
  X-Runtime:
46
- - '0.007510'
46
+ - '0.007639'
47
47
  Vary:
48
48
  - Origin
49
49
  Transfer-Encoding:
50
50
  - chunked
51
51
  body:
52
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
53
+ string: '{"customer":{"lago_id":"f8186952-5b73-480b-96ac-af4c7c953344","external_id":"gid://dummy/Pay::Customer/772847388","name":"Lago
54
+ User","sequential_id":3,"slug":"AMO-15BA-003","created_at":"2023-11-07T23:51:03Z","updated_at":"2023-12-11T04:52:33Z","country":null,"address_line1":null,"address_line2":null,"state":null,"zipcode":null,"email":"lago@example.org","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":"stripe","vat_rate":null,"document_locale":null,"provider_customer_id":"x","provider_payment_methods":["card"]},"metadata":[],"taxes":[]}}'
55
+ recorded_at: Mon, 11 Dec 2023 06:07:17 GMT
56
56
  recorded_with: VCR 6.2.0
@@ -12,7 +12,7 @@ http_interactions:
12
12
  Content-Type:
13
13
  - application/json
14
14
  User-Agent:
15
- - Lago Ruby v0.44.0-beta
15
+ - Lago Ruby v0.52.2-beta
16
16
  Accept-Encoding:
17
17
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
18
  Accept:
@@ -37,22 +37,22 @@ http_interactions:
37
37
  Content-Type:
38
38
  - application/json; charset=utf-8
39
39
  Etag:
40
- - W/"af429c6f51b25054dd9b23522b77d57d"
40
+ - W/"97cba9d09cf8d9e47b2eb5e9e4d3f468"
41
41
  Cache-Control:
42
42
  - max-age=0, private, must-revalidate
43
43
  X-Request-Id:
44
- - 8e958356-5263-4feb-af6a-d8cddcf5e6b1
44
+ - fa5a1b21-b4e4-47e3-91e5-89cace375d67
45
45
  X-Runtime:
46
- - '0.006867'
46
+ - '0.009533'
47
47
  Vary:
48
48
  - Origin
49
49
  Transfer-Encoding:
50
50
  - chunked
51
51
  body:
52
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
53
+ string: '{"customer":{"lago_id":"f8186952-5b73-480b-96ac-af4c7c953344","external_id":"gid://dummy/Pay::Customer/772847388","name":"Lago
54
+ User","sequential_id":3,"slug":"AMO-15BA-003","created_at":"2023-11-07T23:51:03Z","updated_at":"2023-12-11T04:52:33Z","country":null,"address_line1":null,"address_line2":null,"state":null,"zipcode":null,"email":"lago@example.org","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":"stripe","vat_rate":null,"document_locale":null,"provider_customer_id":"x","provider_payment_methods":["card"]},"metadata":[],"taxes":[]}}'
55
+ recorded_at: Mon, 11 Dec 2023 06:07:17 GMT
56
56
  - request:
57
57
  method: get
58
58
  uri: http://localhost:3000/api/v1/add_ons/pay_default_addon
@@ -65,7 +65,7 @@ http_interactions:
65
65
  Content-Type:
66
66
  - application/json
67
67
  User-Agent:
68
- - Lago Ruby v0.44.0-beta
68
+ - Lago Ruby v0.52.2-beta
69
69
  Accept-Encoding:
70
70
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
71
71
  Accept:
@@ -90,22 +90,22 @@ http_interactions:
90
90
  Content-Type:
91
91
  - application/json; charset=utf-8
92
92
  Etag:
93
- - W/"313c360c2793ebdbf699d3669bdb5703"
93
+ - W/"77fb31eebefbe33c8bea2d96beecffbd"
94
94
  Cache-Control:
95
95
  - max-age=0, private, must-revalidate
96
96
  X-Request-Id:
97
- - 908f03d8-dada-4878-9160-80ca397e4267
97
+ - b7170520-e521-4cd4-9c34-6f4c641ca15b
98
98
  X-Runtime:
99
- - '0.005912'
99
+ - '0.005485'
100
100
  Vary:
101
101
  - Origin
102
102
  Transfer-Encoding:
103
103
  - chunked
104
104
  body:
105
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
106
+ string: '{"add_on":{"lago_id":"a5c017e5-acfa-455a-8f3d-4271aee27bca","name":"Default
107
+ Charge","invoice_display_name":null,"code":"pay_default_addon","amount_cents":100,"amount_currency":"USD","created_at":"2023-10-23T04:59:35Z","description":null,"taxes":[]}}'
108
+ recorded_at: Mon, 11 Dec 2023 06:07:17 GMT
109
109
  - request:
110
110
  method: post
111
111
  uri: http://localhost:3000/api/v1/invoices
@@ -118,7 +118,7 @@ http_interactions:
118
118
  Content-Type:
119
119
  - application/json
120
120
  User-Agent:
121
- - Lago Ruby v0.44.0-beta
121
+ - Lago Ruby v0.52.2-beta
122
122
  Accept-Encoding:
123
123
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
124
124
  Accept:
@@ -143,21 +143,21 @@ http_interactions:
143
143
  Content-Type:
144
144
  - application/json; charset=utf-8
145
145
  Etag:
146
- - W/"32ffd12227116e8ec3b74a5bd3b3403b"
146
+ - W/"fff6ca796e1684718e010f3ee1699f8b"
147
147
  Cache-Control:
148
148
  - max-age=0, private, must-revalidate
149
149
  X-Request-Id:
150
- - 61b34df0-937c-49b6-9843-91f66c1925fa
150
+ - f8df3c75-89d4-4509-baa9-fc6303a225fb
151
151
  X-Runtime:
152
- - '0.052565'
152
+ - '0.048430'
153
153
  Vary:
154
154
  - Origin
155
155
  Transfer-Encoding:
156
156
  - chunked
157
157
  body:
158
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
159
+ string: '{"invoice":{"lago_id":"b3cb3503-33ce-4623-9c96-e5c505b638ee","sequential_id":39,"number":"AMO-15BA-003-039","issuing_date":"2023-12-11","payment_due_date":"2023-12-11","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":"f8186952-5b73-480b-96ac-af4c7c953344","external_id":"gid://dummy/Pay::Customer/772847388","name":"Lago
160
+ User","sequential_id":3,"slug":"AMO-15BA-003","created_at":"2023-11-07T23:51:03Z","updated_at":"2023-12-11T04:52:33Z","country":null,"address_line1":null,"address_line2":null,"state":null,"zipcode":null,"email":"lago@example.org","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":"stripe","vat_rate":null,"document_locale":null,"provider_customer_id":"x","provider_payment_methods":["card"]},"metadata":[]},"subscriptions":[],"fees":[{"lago_id":"ddcee66b-9d12-4f01-9e47-1f05811f2350","lago_group_id":null,"lago_invoice_id":"b3cb3503-33ce-4623-9c96-e5c505b638ee","lago_true_up_fee_id":null,"lago_true_up_parent_fee_id":null,"lago_subscription_id":null,"external_subscription_id":null,"lago_customer_id":null,"external_customer_id":null,"item":{"type":"add_on","code":"pay_default_addon","name":"Default
161
+ Charge","invoice_display_name":"Default Charge","group_invoice_display_name":null,"lago_item_id":"a5c017e5-acfa-455a-8f3d-4271aee27bca","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,"precise_unit_amount":"10.0","events_count":null,"payment_status":"pending","created_at":"2023-12-11T06:07:17Z","succeeded_at":null,"failed_at":null,"refunded_at":null,"amount_details":"{}","vat_amount_cents":0,"vat_amount_currency":"USD","unit_amount_cents":1000}],"credits":[],"metadata":[],"applied_taxes":[]}}'
162
+ recorded_at: Mon, 11 Dec 2023 06:07:17 GMT
163
163
  recorded_with: VCR 6.2.0
@@ -8,62 +8,11 @@ http_interactions:
8
8
  string: ''
9
9
  headers:
10
10
  Authorization:
11
- - Bearer 155ed033-8716-4587-9ac6-fed8ddae3317
11
+ - Bearer <LAGO_API_KEY>
12
12
  Content-Type:
13
13
  - application/json
14
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
15
+ - Lago Ruby v0.52.2-beta
67
16
  Accept-Encoding:
68
17
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
69
18
  Accept:
@@ -88,20 +37,20 @@ http_interactions:
88
37
  Content-Type:
89
38
  - application/json; charset=utf-8
90
39
  Etag:
91
- - W/"e264430069449aaad24e9903beecb042"
40
+ - W/"9f0cd9d30c7f9061505ebf69f212662a"
92
41
  Cache-Control:
93
42
  - max-age=0, private, must-revalidate
94
43
  X-Request-Id:
95
- - 426d9b92-d55d-4d15-800d-c9cc6a088060
44
+ - 48c02b54-d1f1-4746-ac3c-699088e401bd
96
45
  X-Runtime:
97
- - '0.032076'
46
+ - '0.006909'
98
47
  Vary:
99
48
  - Origin
100
49
  Transfer-Encoding:
101
50
  - chunked
102
51
  body:
103
52
  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
53
+ string: '{"customer":{"lago_id":"8f02266e-4edb-447f-b84b-096d3fd3fc09","external_id":"gid://dummy/Pay::Customer/772847389","name":"None
54
+ User","sequential_id":5,"slug":"AMO-15BA-005","created_at":"2023-12-11T04:49:08Z","updated_at":"2023-12-11T04:55:04Z","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":"USD","tax_identification_number":null,"timezone":null,"applicable_timezone":"UTC","net_payment_term":null,"external_salesforce_id":"","billing_configuration":{"invoice_grace_period":null,"payment_provider":null,"vat_rate":null,"document_locale":null},"metadata":[],"taxes":[]}}'
55
+ recorded_at: Mon, 11 Dec 2023 06:07:17 GMT
107
56
  recorded_with: VCR 6.2.0
@@ -8,11 +8,11 @@ http_interactions:
8
8
  string: ''
9
9
  headers:
10
10
  Authorization:
11
- - Bearer 155ed033-8716-4587-9ac6-fed8ddae3317
11
+ - Bearer <LAGO_API_KEY>
12
12
  Content-Type:
13
13
  - application/json
14
14
  User-Agent:
15
- - Lago Ruby v0.44.0-beta
15
+ - Lago Ruby v0.52.2-beta
16
16
  Accept-Encoding:
17
17
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
18
  Accept:
@@ -37,35 +37,35 @@ http_interactions:
37
37
  Content-Type:
38
38
  - application/json; charset=utf-8
39
39
  Etag:
40
- - W/"af429c6f51b25054dd9b23522b77d57d"
40
+ - W/"97cba9d09cf8d9e47b2eb5e9e4d3f468"
41
41
  Cache-Control:
42
42
  - max-age=0, private, must-revalidate
43
43
  X-Request-Id:
44
- - 28491ac8-a26c-4ca4-a86f-3e6067ba7032
44
+ - 88a92404-7c1a-403f-8012-20c4d23d4dc5
45
45
  X-Runtime:
46
- - '0.036063'
46
+ - '0.007983'
47
47
  Vary:
48
48
  - Origin
49
49
  Transfer-Encoding:
50
50
  - chunked
51
51
  body:
52
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
53
+ string: '{"customer":{"lago_id":"f8186952-5b73-480b-96ac-af4c7c953344","external_id":"gid://dummy/Pay::Customer/772847388","name":"Lago
54
+ User","sequential_id":3,"slug":"AMO-15BA-003","created_at":"2023-11-07T23:51:03Z","updated_at":"2023-12-11T04:52:33Z","country":null,"address_line1":null,"address_line2":null,"state":null,"zipcode":null,"email":"lago@example.org","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":"stripe","vat_rate":null,"document_locale":null,"provider_customer_id":"x","provider_payment_methods":["card"]},"metadata":[],"taxes":[]}}'
55
+ recorded_at: Mon, 11 Dec 2023 06:07:17 GMT
56
56
  - request:
57
57
  method: post
58
58
  uri: http://localhost:3000/api/v1/subscriptions
59
59
  body:
60
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"}}'
61
+ string: '{"subscription":{"external_customer_id":"gid://dummy/Pay::Customer/772847388","plan_code":"default","name":"default","external_id":"gid://dummy/Pay::Subscription/2"}}'
62
62
  headers:
63
63
  Authorization:
64
- - Bearer 155ed033-8716-4587-9ac6-fed8ddae3317
64
+ - Bearer <LAGO_API_KEY>
65
65
  Content-Type:
66
66
  - application/json
67
67
  User-Agent:
68
- - Lago Ruby v0.44.0-beta
68
+ - Lago Ruby v0.52.2-beta
69
69
  Accept-Encoding:
70
70
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
71
71
  Accept:
@@ -90,19 +90,19 @@ http_interactions:
90
90
  Content-Type:
91
91
  - application/json; charset=utf-8
92
92
  Etag:
93
- - W/"e02fd87d05bded0f1ac0e8d1345a6991"
93
+ - W/"a40b5ae362acd75fd3cb1682b457acac"
94
94
  Cache-Control:
95
95
  - max-age=0, private, must-revalidate
96
96
  X-Request-Id:
97
- - 93417ede-4037-4f94-ad13-19d3fcfedb6c
97
+ - 91445be1-9971-4a67-9622-b30595fb1738
98
98
  X-Runtime:
99
- - '0.024726'
99
+ - '0.031543'
100
100
  Vary:
101
101
  - Origin
102
102
  Transfer-Encoding:
103
103
  - chunked
104
104
  body:
105
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
106
+ string: '{"subscription":{"lago_id":"57d6887f-b67b-4572-9dac-1bb4b62a90c9","external_id":"gid://dummy/Pay::Subscription/2","lago_customer_id":"f8186952-5b73-480b-96ac-af4c7c953344","external_customer_id":"gid://dummy/Pay::Customer/772847388","name":"default","plan_code":"default","status":"active","billing_time":"calendar","subscription_at":"2023-12-11T06:07:16Z","started_at":"2023-12-11T06:07:16Z","ending_at":null,"terminated_at":null,"canceled_at":null,"created_at":"2023-12-11T06:07:16Z","previous_plan_code":null,"next_plan_code":null,"downgrade_plan_date":null,"subscription_date":"2023-12-11","plan":{"lago_id":"53e656cc-7d9e-433a-9494-7beb33164c1c","name":"Default","invoice_display_name":null,"created_at":"2023-12-11T04:51:50Z","code":"default","interval":"monthly","description":"","amount_cents":100,"amount_currency":"USD","trial_period":0.0,"pay_in_advance":false,"bill_charges_monthly":null,"customers_count":1,"active_subscriptions_count":1,"draft_invoices_count":0,"parent_id":null,"charges":[],"taxes":[]}}}'
107
+ recorded_at: Mon, 11 Dec 2023 06:07:17 GMT
108
108
  recorded_with: VCR 6.2.0