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

UpdatePaymentStatusAsync expects wrong HTTP status code #7

Closed
Fandermill opened this issue Jan 9, 2023 · 1 comment
Closed

UpdatePaymentStatusAsync expects wrong HTTP status code #7

Fandermill opened this issue Jan 9, 2023 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@Fandermill
Copy link

Hi there!

Thank you for the great work on the client, it works without hassle so far. But now I do run into a problem...

When I update a payment status through the IBricklinkClient.UpdatePaymentStatusAsync method, I get a BricklinkHttpErrorException telling me that status code 200 was expected, but 204 was received.

I checked the source code and I found that the method is using the PutEnsureNoResponseDataAsync extension method, which in turn states that it expects the 200 status code.

I'm no expert in the Bricklink API and I'm not sure there are any endpoints that respond with a 200 for a PUT request. I can't change the expected code to 204 without knowing this, otherwise I would have submitted a PR.

Hope you can help!

@gebirgslok
Copy link
Owner

Heyho,

thanks for reporting this issue.

There are 3 endpoints the PutEnsureNoResponseDataAsync is used for:

  • UpdateOrderStatusAsync
  • UpdatePaymentStatusAsync
  • SendDriveThruAsync

Do you have the possibility to check whether they all return 204? Currently I don't have access to active orders.
I remember that the API had some inconsistencies when I wrote this lib. It might be that some endpoints return 200 while others return 204.

If all (3) endpoints return 204 then the expectedCode can simply be replaced. Otherwise the expectedCode must be passed to the PutEnsureNoResponseDataAsync.

As a rapid workaround you can do the following:

        try
        {
            await client.UpdatePaymentStatusAsync(orderId, status);
        }
        catch (BricklinkHttpErrorException e)
        {
            if (e.ReceivedCode != 204)
            {
                throw e;
            }
        }

@gebirgslok gebirgslok added bug Something isn't working help wanted Extra attention is needed labels Jan 9, 2023
@Fandermill Fandermill mentioned this issue Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants