Viincenttt / MollieApi

This project allows you to easily add the Mollie payment provider to your application.
MIT License
145 stars 84 forks source link

Nullable issue in CreditCardPaymentResponse #373

Closed martijnmelchers closed 16 hours ago

martijnmelchers commented 1 week ago

When getting a payment from the Mollie API we use the following code to communicate Creditcard Failure reason to the user:

if (payment is CreditCardPaymentResponse response && !string.IsNullOrWhiteSpace(response.Details.FailureMessage))
            matchingTransaction.FailureReason = response.Details.FailureMessage;

However when a payment is in the state Expired Details is null thus breaking this implementation. Should this be marked as nullable or should we guard against this better?

Viincenttt commented 1 week ago

Thanks for the headsup! Do you happen to know what the status of the payment is when it returns null for the Details property? I'll try to reproduce this on my end.

martijnmelchers commented 1 week ago

It is null when the creditcard payment is in the expired state

Viincenttt commented 1 day ago

Hi @martijnmelchers

I've done some testing and indeed found that the Details property for all payment responses can be null, so I've marked these properties as nullable in PR #377

Kind regards, Vincent

Viincenttt commented 16 hours ago

Hi @martijnmelchers

I just released version 4.2.0.0 of the library where I've made the Details property nullable.

Thanks for reporting this issue!

Happy coding! Vincent