Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Interface Types #397

Closed
wants to merge 4 commits into from
Closed

Conversation

janpaepke
Copy link
Collaborator

This resolve several type discrepancies between the client and the mollie API.

Since the official docs are too inconsistent to be used as source of truth, the actual optional-ness of these properties was aligned directly with mollie.
No properties were removed and Types should be wider, not narrower, making this a backwards compatible change.

The only exception I could find was the address.postCode, which was defined to be required, when it is actually optional, since not all countries have a post code.
This change will concern the organization.address and order.address.
I don't believe this warrants a major version release.

This resolves:

embed?: MaybeArray<PaymentEmbed>;
testmode?: boolean;
}

export type PageParameters = PaginationParameters & {
profileId?: string;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@fjbender This param was not in the DOCS, which is why I assumed it does not exist and removed it.
If that is correct, the removal won't break anything since any current use wouldn't have worked anyway.

Can you confirm this Query Param is not available for list payments?

Copy link

@hreinberger hreinberger Jan 24, 2025

Choose a reason for hiding this comment

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

I've just tried out listing my payments with this param set, and got this response:

{
    "status": 422,
    "title": "Unprocessable Entity",
    "detail": "Non-existent query parameter \"profileId\" for this API call. Did you mean: \"previous\"?",
    "field": "profileId",
    "_links": {
        "documentation": {
            "href": "https://docs.mollie.com/overview/handling-errors",
            "type": "text/html"
        }
    }
}

So yes, if it was ever possible to filter by profile ID, it's not possible anymore.

*
* @see https://docs.mollie.com/reference/v2/payments-api/create-payment?path=billingAddress#credit-card
*/
billingAddress?: Address;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is not actually removed, but picked from data (see above)

/**
* The card token you got from Mollie Components. The token contains the card information (such as card holder, card number, and expiry date) needed to complete the payment.
*
* @see https://docs.mollie.com/reference/v2/payments-api/create-payment?path=cardToken#credit-card
*/
cardToken?: string;
shippingAddress?: Address & {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is not actually removed, but picked from data (see above)

*
* @see https://docs.mollie.com/overview/common-data-types?path=email#address-object
*/
email?: string;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@fjbender email is missing from the common type definition, but I think that's a mistake, as it is included where the address is used (payments/orders)

@@ -102,7 +120,13 @@ export interface Address {
*
* @see https://docs.mollie.com/overview/common-data-types?path=postalCode#address-object
*/
postalCode: string;
postalCode?: string;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is the only potentially breaking change, as for this was used for orders and is actually optional.
This means users, who consumed order.billingAddress.postalCode may now get a type error.

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.

2 participants