Skip to content

fix: Build type resource path from method_name - #5

Merged
sveneberth merged 1 commit into
mainfrom
fix/create-payment-type-path
Aug 5, 2026
Merged

fix: Build type resource path from method_name#5
sveneberth merged 1 commit into
mainfrom
fix/create-payment-type-path

Conversation

@sveneberth

@sveneberth sveneberth commented Aug 5, 2026

Copy link
Copy Markdown
Member

Summary

createPaymentType() interpolated the PaymentTypes enum member itself instead of a name,
so every server-side type creation requested a non-existent path:

"types/%s" % paymentType.method   # -> types/PaymentTypes.CARD

Two things were wrong at once: stringifying the enum member yields PaymentTypes.CARD
rather than a value, and method holds the short code used in type ids (crd) while the
types endpoint expects the full method name (card).

before: POST /v1/types/PaymentTypes.CARD
after:  POST /v1/types/card

Motivation

The bug stayed invisible as long as payment types were created on the client side (Payment
Page, UI components), which hands a ready typeId to the backend. It surfaces as soon as a
type has to be created server-side — which is mandatory for Installment and Direct Bank
Transfer.

Verification

"types/%s" % Card.method_name.value yields types/card. For every payment type the
resulting path was checked against the API reference (api.unzer.com/swagger-ui/api-docs);
all of them exist there. Not yet run against the sandbox API with a real keypair.

`createPaymentType()` interpolated the `PaymentTypes` enum member itself,
so the request went to `types/PaymentTypes.CARD` instead of `types/card`:

> `"types/%s" % paymentType.method` -> `types/PaymentTypes.CARD`

`method` holds the short code used in type ids (`crd`), while the types
endpoint expects the full method name (`card`). Both are wrong when the
enum member is stringified instead of its value.
@sveneberth sveneberth added the bug Something isn't working label Aug 5, 2026
@sveneberth
sveneberth merged commit c21ecee into main Aug 5, 2026
5 checks passed
@sveneberth
sveneberth deleted the fix/create-payment-type-path branch August 5, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant