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

GetPaymentListAsync Cannot deserialize the current JSON #388

Open
baer999 opened this issue Aug 1, 2024 · 5 comments
Open

GetPaymentListAsync Cannot deserialize the current JSON #388

baer999 opened this issue Aug 1, 2024 · 5 comments

Comments

@baer999
Copy link

baer999 commented Aug 1, 2024

Hello,

Using newest version (4.3.0) of the Mollie.API library.
I've got an error while downloading via PaymentClient | GetPaymentListAsync:

image

Newtonsoft.Json.JsonSerializationException: "Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Mollie.Api.Models.Payment.PaymentAddressDetails' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly. To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array. Path 'shippingAddress', line 1, position 28949."

Seems to be JSON Data Type problem, is there anything I can do to fix it?

Kind Regards,
Andreas

@Viincenttt
Copy link
Owner

Hi @baer999 ,

Could you show me the exact JSON that the Mollie API returns for this API call? Then I should be able to reproduce this issue in a unit/integration test. Feel free to redact any sensitive information

Kind regards,
Vincent

@baer999
Copy link
Author

baer999 commented Aug 1, 2024

Hi Viincentt,
i "fixed" it if I don't load too old data (think the API send other format in very old data units).
So for me it is not a problem any more in case when loading just last few months and not any more.
Think we can close the issue here from my side.

Kind regards,
Andreas

@baer999 baer999 closed this as completed Aug 1, 2024
@thoemy
Copy link

thoemy commented Sep 27, 2024

I have the same problem with a payment embedded in a refund. So far I have not yet discovered a pattern.

The problematic JSON is

{
            "shippingAddress": [],
            "billingAddress": [],
}

Full JSON response.

{
  "_embedded": {
    "refunds": [
      {
        "resource": "refund",
        "id": "re_7U3xxxx",
        "amount": {
          "value": "34.95",
          "currency": "EUR"
        },
        "status": "refunded",
        "createdAt": "2024-06-21T07:19:30+00:00",
        "description": "nYUMXiX2hCxxxxxxxxxxx",
        "metadata": {
          "shopify_refund_id": "iStyjYM9zxxxxxxx"
        },
        "paymentId": "tr_2Rxxx",
        "settlementId": "stl_xxxx",
        "settlementAmount": {
          "value": "-34.95",
          "currency": "EUR"
        },
        "_embedded": {
          "payment": {
            "resource": "payment",
            "id": "tr_2Rxxx",
            "mode": "live",
            "createdAt": "2024-06-10T11:38:31+00:00",
            "amount": {
              "value": "39.90",
              "currency": "EUR"
            },
            "description": "nYUMXiXxxxxxxxxxxx",
            "method": "creditcard",
            "metadata": {
              "origin_domain": "xxxx",
              "shopify_payment_id": "nYUMXiXxxxxxxxxxx"
            },
            "status": "paid",
            "paidAt": "2024-06-10T11:40:05+00:00",
            "amountRefunded": {
              "value": "34.95",
              "currency": "EUR"
            },
            "amountRemaining": {
              "value": "4.95",
              "currency": "EUR"
            },
            "locale": "de_DE",
            "countryCode": "DE",
            "profileId": "pfl_VKxxxx",
            "settlementId": "stl_57nxxx",
            "sequenceType": "oneoff",
            "redirectUrl": "",
            "cancelUrl": "",
            "webhookUrl": "",
            "settlementAmount": {
              "value": "39.90",
              "currency": "EUR"
            },
            "shippingAddress": [],
            "billingAddress": [],
            "details": {
              "cardToken": "tkn_xxx",
              "cardFingerprint": "xxx",
              "cardNumber": "3000",
              "cardHolder": "xxxx",
              "cardAudience": "consumer",
              "cardLabel": "American Express",
              "cardCountryCode": "DE",
              "cardSecurity": "3dsecure",
              "feeRegion": "amex-intra-eea"
            },
            "_links": {
              "self": {
                "href": "https://api.mollie.com/v2/payments/tr_2Rxxx",
                "type": "application/hal+json"
              },
              "dashboard": {
                "href": "https://my.mollie.com/dashboard/org_xxxx/payments/tr_2Rxxx",
                "type": "text/html"
              },
              "settlement": {
                "href": "https://api.mollie.com/v2/settlements/stl_57nxxx",
                "type": "application/hal+json"
              },
              "refunds": {
                "href": "https://api.mollie.com/v2/payments/tr_2Rxxx/refunds",
                "type": "application/hal+json"
              }
            }
          }
        },
        "_links": {
          "self": {
            "href": "https://api.mollie.com/v2/payments/tr_2Rxxx/refunds/re_7U3xxxx",
            "type": "application/hal+json"
          },
          "payment": {
            "href": "https://api.mollie.com/v2/payments/tr_2Rxxx",
            "type": "application/hal+json"
          },
          "settlement": {
            "href": "https://api.mollie.com/v2/settlements/stl_xxxx",
            "type": "application/hal+json"
          }
        }
      }
    ]
  },
  "count": 1,
  "_links": {
    "documentation": {
      "href": "https://docs.mollie.com/reference/v2/settlements-api/list-settlement-refunds",
      "type": "text/html"
    },
    "self": {
      "href": "https://api.mollie.com/v2/settlements/stl_xxxx/refunds?embed=payment\u0026limit=250",
      "type": "application/hal+json"
    },
    "previous": null,
    "next": null
  }
}

@Viincenttt
Copy link
Owner

Hi Thoemy,

Strange that the billing/shipping address properties are arrays instead of objects. I'd like to contact Mollie regarding this and it helps if I can share the Mollie payment id with them. Would you be willing to share that?

You can also send it to me on LinkedIn if you don't want to share it here. My LinkedIn profile is mentioned in the readme.md.

Kind regards,
Vincent

@Viincenttt Viincenttt reopened this Sep 28, 2024
@joosttk
Copy link

joosttk commented Oct 11, 2024

@thoemy I tried to reproduce the behaviour, but for me it does not return the billingAddress and shippingAddress if it was not provided.

Can you let me know exactly what steps you took that got to this response from our API?

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

No branches or pull requests

4 participants