Skip to content

feat: request builders#3

Merged
danielhe4rt merged 9 commits into1.xfrom
feat/builders
Oct 28, 2025
Merged

feat: request builders#3
danielhe4rt merged 9 commits into1.xfrom
feat/builders

Conversation

@Clintonrocha98
Copy link
Collaborator

  • Implemented the Builder pattern across all request (Request) classes in the SDK.

  • Added dedicated builders for each resource: Billing, Customer, Pix, Withdraw, and related objects.

  • Introduced a static builder() method for all classes supporting fluent construction.

  • Added automatic validation of required fields during the build() process.

  • Updated the README with:

    • Explanation and motivation behind the Builder pattern.
    • New usage examples demonstrating the fluent interface.
    • A new section “List of Available Builders” detailing all existing builders.
  • Goal: improve readability, safety, and consistency when creating requests within the SDK.

@danielhe4rt danielhe4rt changed the title feat/builders feat: request builders Oct 28, 2025
}

if ($errors !== []) {
throw new InvalidArgumentException('Missing required fields: '.implode(', ', $errors));
Copy link
Member

Choose a reason for hiding this comment

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

All builders use the same Exception. Maybe this can be a custom exception where the static method receives the errors and constructs the message.

thow new AbacatePayException::missingRequiredFields($errors);

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's change it later on. We need to ship a new version for now.

@danielhe4rt danielhe4rt merged commit 8fdc94e into 1.x Oct 28, 2025
@Clintonrocha98 Clintonrocha98 deleted the feat/builders branch October 29, 2025 21:12
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