Skip to content

fix: send the type of payment confirmation models - #11

Merged
mokevnin merged 1 commit into
mainfrom
fix/confirmation-type
Sep 27, 2026
Merged

mokevnin merged 1 commit into
mainfrom
fix/confirmation-type

Conversation

@mokevnin

Copy link
Copy Markdown
Member

Fixes #10.

A confirmation built from the SDK models was sent without its required type:

Yoomoney::PaymentCreateParams::Confirmation::ConfirmationDataRedirect.new(return_url: "https://example.com")
# before: {"return_url":"https://example.com"}
# after:  {"return_url":"https://example.com","type":"redirect"}
  • lib: each variant of PaymentCreateParams::Confirmation declares required :type, const: :<value>, so it serializes its type by itself. The union has discriminator :type.
  • rbi / sig: the variant constructors take locale: (inherited from ConfirmationData) and type:, which defaults to the variant's value; type is typed on each variant.
  • test: covers each variant's request body (it fails without the lib change) and picking a variant from a hash by type.

The spec side is Hexlet/yoomoney-api#2.

rake lint (rubocop, Sorbet, Steep) and rake test (99 runs, 0 failures) pass.

🤖 Generated with Claude Code

Each confirmation variant inherited a required type from ConfirmationData but
never set it, so ConfirmationDataRedirect.new(return_url:) reached the API
without the type the gateway requires. The variant constructors were also
typed without the inherited fields, so typed callers could not pass type or
locale at all.

Each variant now declares its type as a constant, the union picks variants
by type, and the RBI/RBS constructors take locale and type.

Fixes #10

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mokevnin
mokevnin merged commit 371fb7f into main Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Confirmation models are sent without their required type

1 participant