Skip to content

feat(wallets): Move wallets API under customers#321

Merged
vankiru merged 13 commits into
mainfrom
feat/move-wallets-api-to-customer-wallets
Mar 2, 2026
Merged

feat(wallets): Move wallets API under customers#321
vankiru merged 13 commits into
mainfrom
feat/move-wallets-api-to-customer-wallets

Conversation

@vankiru
Copy link
Copy Markdown
Contributor

@vankiru vankiru commented Feb 11, 2026

Context

The PR implements api for /customers/:customer_external_id/wallets and /customers/:customer_external_id/wallets/:code/metadata endpoints.

Related PR: getlago/lago-api#4995

Description

The new customer wallets and metadata API looks like this 👇

# GET /customers/:customer_id/wallets
client.customers.wallets.get_all(customer_id)
client.customers.wallets.get_all(customer_id, page: 1, per_page: 100)

# POST /customers/:customer_id/wallets
client.customers.wallets.create(customer_id, params)

# GET /customers/:customer_id/wallets/:wallet_code
client.customers.wallets.get(customer_id, wallet_code)

# PATCH /customers/:customer_id/wallets/:wallet_code
client.customers.wallets.update(customer_id, wallet_code, params)

# DELETE /customers/:customer_id/wallets/:wallet_code
client.customers.wallets.destroy(customer_id, wallet_code)

And for the metadata:

# POST /customers/:customer_id/wallets/:wallet_code/metadata
client.customers.wallets.metadata.replace(customer_id, wallet_code, metadata)

# PATCH /customers/:customer_id/wallets/:wallet_code/metadata
client.customers.wallets.merge(customer_id, wallet_code, metadata)

# DELETE /customers/:customer_id/wallets/:wallet_code/metadata
client.customers.wallets.delete_all(customer_id, wallet_code)

# DELETE /customers/:customer_id/wallets/:wallet_code/metadata/:key
client.customers.wallets.delete_key(customer_id, wallet_code, key)

Nested Resource

The PR also adds a Nested resource that makes it easier to define multi-resource endpoints by introducing an api_resource method that takes the parent resource ids.

Its interface is pretty similar to the existing Resource::Base, with one small difference for update:

  • in Nested, all the resource ids come first and the params are the last arguments (if any),
  • in Base, it's the other way around.

@vankiru vankiru force-pushed the feat/move-wallets-api-to-customer-wallets branch from aa737b8 to bfffa83 Compare February 12, 2026 08:04
@vankiru vankiru marked this pull request as ready for review February 12, 2026 09:41
Copy link
Copy Markdown
Contributor

@groyoh groyoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job! Integration tests were for wallet but not metadata, is that expected ?

Comment thread lib/lago/api/resources/nested.rb
Comment thread lib/lago/api/resources/nested.rb Outdated
Comment thread lib/lago/api/resources/nested.rb Outdated
Comment thread lib/lago/api/resources/nested.rb Outdated
Comment thread lib/lago/api/resources/customers/wallets/whitelist_params.rb Outdated
Comment thread spec/integration/customers/wallets_spec.rb
@vankiru vankiru force-pushed the feat/move-wallets-api-to-customer-wallets branch from 8872849 to 27d1ce2 Compare March 2, 2026 08:23
@vankiru vankiru merged commit 22f1f60 into main Mar 2, 2026
6 checks passed
@vankiru vankiru deleted the feat/move-wallets-api-to-customer-wallets branch March 2, 2026 09:04
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.

3 participants