Skip to content

Sync with upstream getlago/lago-go-client main - #1

Open
FogDong wants to merge 85 commits into
mainfrom
sync-upstream-main
Open

FogDong wants to merge 85 commits into
mainfrom
sync-upstream-main

Conversation

@FogDong

@FogDong FogDong commented Aug 17, 2026

Copy link
Copy Markdown

Merges upstream getlago/lago-go-client main (83 new commits) into this fork.

Notable upstream changes:

  • purchase_order_number support, draft invoice Delete, flexible webhook events
  • subscription activation_rules / cancellation_reason / activated_at
  • multi-currency customer billing, billing_entity exposure and filters
  • rate limit headers via OnRateLimitInfo callback
  • golang.org/x/net bumped to 0.55.0

Fork-specific follow-up included: rewrote getlago -> bentoml import paths in new upstream test files so go build ./... and go test ./... pass.

Note: direct push to main is blocked by branch protection (no force-push), so this is a merge PR instead of a rebase.

ivannovosad and others added 30 commits October 17, 2025 10:49
## Context

Go 1.23 EOL was the 12th August 2025.

## Description

This updates to Go 1.24.
## Context

The CI currently relies on `golangci-lint` version 2.1 while the README's suggested command install version 1.47.3.

## Description

This ensures both uses the same version and updates to the latest version as well.
feat(issuing-date): Add subscription_invoice_issuing_date settings to BillingEntity and Customer
Introduce fixed charges - recurring fixed fees attached to plans.

This adds:
- New FixedCharge types and enums (standard, graduated, volume models)
- FixedChargeProperties for pricing configuration
- Plan input/output support for fixed charges and bill_fixed_charges_monthly
- Subscription plan overrides for fixed charges
- New endpoint to list subscription fixed charges
- Fee support for fixed_charge type and lago_fixed_charge_id field
feat(fixed-charges): Add support for fixed charges

Introduce fixed charges - recurring fixed fees attached to plans.

This adds:

* New FixedCharge types and enums (standard, graduated, volume models)
* FixedChargeProperties for pricing configuration
* Plan input/output support for fixed charges and bill_fixed_charges_monthly
* Subscription plan overrides for fixed charges
* New endpoint to list subscription fixed charges
* Fee support for fixed_charge type and lago_fixed_charge_id field
* feat: Add wallet priority field
Related PR getlago/lago-api#4391
Added a new field offset_amount_cents to Credit Notes
Added a new field max_offsettable_amount_cents to Credit Note Estimated
Related PR: getlago/lago-api#4877
…y-in-advance-termination

feat(offset-invoice-on-pay-in-advance-termination) Add offset option to OnTerminationCreditNote
…ions list (getlago#311)

Related PR getlago/lago-api#4983
Adding plan_amount_cents and plan_amount_currency to the subscription payload
…id (getlago#310)

Related PR getlago/lago-api#4965
Adding a customer object to the credit_notes response in create/show/update/void actions
…e-doc

Feat(wallets): add code to wallets
feat(alerts): add batch actions on alerts
…#309)

* feat(webhook): Add a method to parse the webhook messages

* Test webhooks messages with fixtures
New independent CRUD endpoints for charges, fixed charges, and charge
filters were added to the Lago API at both plan and subscription levels.
murparreira and others added 30 commits May 5, 2026 09:44
…#336)

Surface x-ratelimit-* headers from successful responses so callers can
build observability around the rate limit (warn at thresholds, emit
metrics) without inspecting internals.

- Add RateLimitInfo struct with UsagePct() helper
- Add OnRateLimitInfo callback on RetryPolicy
- Parse and emit headers on every non-429 response in executeWithRetry
- Ship NewLoggingRateLimitObserver as a zero-config observer (defaults: 80/90/95%)
- Callback panics are recovered and logged so they cannot break requests
- Backward-compatible: callback is optional, default behavior unchanged
…arams-current-usage

fix(api): Deprecate filter_by prefixed params on current usage
* add support for consolidate invoice flag

* update tests
…-response

fix(BIL-17): Handle empty retry payment responses
fix: rename tax JSON field to taxes for add_on, charge and plan minimum commitment
## Context

The Lago API now lets callers pin a subscription or wallet to a
specific billing entity within a multi-entity organization, and reads
back the resolved entity on each resource. The Go client needs the
matching request and response fields so callers can set and inspect
that value.

## Description

Adds the `billing_entity_code` request field to `SubscriptionInput`
(covering POST + PUT /subscriptions) and `WalletInput` (covering POST
/wallets and the customer-nested variant), and the response field on
`Subscription` and `Wallet` so it can be read back. Also adds a
`billing_entity_codes` array filter on `SubscriptionListInput` for
GET /subscriptions. The list filter on /wallets and /payment_requests
is deferred — those `GetList` paths serialize via
`json.Marshal -> map[string]string`, which cannot carry array
parameters, and the user asked to avoid structural changes.
…ment_request list endpoints

## Context

The Lago API accepts `billing_entity_codes[]` as a list filter on
`GET /wallets`, `GET /customers/:external_id/wallets`, and
`GET /payment_requests`. The Go client could not pass it: those
list inputs serialized their query string via
`json.Marshal -> map[string]string`, which cannot carry an array
value (`json.Unmarshal` errors out and `GetList` returns early
without making the request).

## Description

Switches `WalletListInput` and `PaymentRequestListInput` from
`json:` tags to `url:` tags, and rewrites the three `GetList`
methods to use `query.Values()` + `UrlValues` — the same pattern
already used by subscription, invoice, and credit-note list
endpoints. Adds `BillingEntityCodes []string` on both inputs so
callers can pass `billing_entity_codes[]=...` repeatedly.
feat(multi-entity): expose billing_entity on subscription and wallet
…lago#347)

* [ING-30] feat: Add currency to list inputs

## Context

The lago-api backend exposes a `currency` query parameter on the
subscriptions, wallets, and payment_requests list endpoints (PR #5249).
The Go client list inputs did not surface it.

## Description

Add a `Currency` field to SubscriptionListInput, WalletListInput, and
PaymentRequestListInput. The struct tag matches each method's serializer:
`url` for SubscriptionListInput (encoded via go-querystring) and `json`
for the wallet and payment_request inputs (encoded via json.Marshal into
a query map).

* add support for overdue balances in dunning campaign finished webhook

* fix currency definition

---------

Co-authored-by: Felipe Rodrigues <aquinofb@gmail.com>
[ING-242] feat(wallets): add grants_target_top_up to recurring transaction rules
…iption-activation

feat(subscriptions): add activation_rules, cancellation_reason and activated_at
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.38.0 to 0.55.0.
- [Commits](golang/net@v0.38.0...v0.55.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.55.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…lago#340)

The Lago API requires PUT /webhook_endpoints/:id payloads to be wrapped
under a "webhook_endpoint" root key, matching the existing Create
behavior. Without the wrapper, the API responds with
400 BadRequest: "param is missing or the value is empty or invalid:
webhook_endpoint".

Wraps the Update body in WebhookEndpointParams to match Create, and adds
tests asserting the JSON body shape for both Create and Update.
feat(purchase-order): add purchase_order_number types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.