Skip to content

Allow Paying with DTO or Entity Classes Instead of Only Eloquent Models #1032

@realpvz

Description

@realpvz

Is your feature request related to a problem? Please describe.
Currently, the pay() and related wallet methods only accept Eloquent models. This creates a limitation in projects that follow DDD or service-based architecture, where we often work with DTOs or custom entities instead of directly using Eloquent.
I'm frustrated that I can't pass my ReserveDTO or ReserveEntity to the wallet and must instead tightly couple the code to Eloquent, which breaks separation of concerns.

Describe the solution you'd like
It would be great if the wallet could accept a more flexible payer object – either an interface-based solution or support for custom identifiers (like UUIDs or strings) that aren’t strictly tied to an Eloquent model.
This way, developers could implement their own payer object and still benefit from Bavix Wallet's features.

Describe alternatives you've considered

Wrapping the DTO into a temporary Eloquent model (adds unnecessary complexity and risk).

Duplicating logic in a service class just to bridge between Eloquent and DTO.

Using a separate wallet implementation, which I'd prefer to avoid because Bavix Wallet already does 90% of what I need.

Additional context
In our use case, we use DTOs throughout the domain layer, and only at the boundaries do we touch Eloquent. Supporting DTOs or at least allowing custom payloads would make this package usable in more modern, decoupled Laravel architectures.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions