View Issue Details

IDProjectCategoryView StatusLast Update
0006577Talermechant backendpublic2024-01-12 14:04
ReporterFlorian Dold Assigned ToFlorian Dold  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Target Version0.8Fixed in Version0.8 
Summary0006577: merchant responds to public /orders/{id}/refunds request with HTTP 504
DescriptionSee summary.
Steps To Reproduce$ curl -H "Authorization: ApiKey sandbox" --data '{"order": { "summary": "Schnitzel", "amount": "TESTKUDOS:5" } }' https://backend.test.taler.net/private/instances/blog/orders

$ curl -H "Authorization: ApiKey sandbox" https://backend.test.taler.net/private/instances/blog/orders/{order_id}

< pay with wallet>

$ curl -H "Authorization: ApiKey sandbox" --data '{"refund":"TESTKUDOS:5", "reason": "because"}' https://backend.test.taler.net/private/instances/blog/orders/{order_id}/refund

< scan taler://refund QR code with wallet>

Boom! Check merchant logs.
TagsNo tags attached.

Activities

Christian Grothoff

2020-09-06 12:57

manager   ~0016877

Possible fix in 6bfcf7f..c528a4c (still testing).

Christian Grothoff

2020-09-06 13:15

manager   ~0016878

I have now fixed the merchant, but the wallet keeps repeating the request (despite the exchange giving a 410) and claims something about "invalid JSON". :-(

Florian Dold

2020-09-06 13:22

manager   ~0016879

Eh, the merchant gives the wallet this:

2020-09-06T11:13:51.461Z NodeHttpLib.ts TRACE invalid json: '<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
'


So the error message is correct ;-)

Florian Dold

2020-09-06 13:23

manager   ~0016880

BTW, once the wallet UI shows the error properly, you'd also find the status code of the request there. Maybe we should also log the response content type?!

TRACE Notification [
  {
    "type": "refund-status-error",
    "error": {
      "code": 7002,
      "hint": "Error: WALLET_RECEIVED_MALFORMED_RESPONSE",
      "details": {
        "httpStatusCode": 502,
        "requestUrl": "https://backend.test.taler.net/instances/blog/orders/2020.250-03ECPNGRXSJJP/refund",
        "requestMethod": "POST"
      },
      "message": "invalid JSON"
    }
  }
]

Christian Grothoff

2020-09-06 13:30

manager   ~0016881

Ah, another comma bug! This time from Jonathan ;-). But, the wallet is still unhappy, but I can't read the error message properly, it goes away too quickly on the screen in the 'pending operations' view :-(

Christian Grothoff

2020-09-06 13:32

manager   ~0016882

Stayed longer now, seems to me that you are not able to deal with non-200 embedded exchange status codes within the 200 OK response from the merchant.

Florian Dold

2020-09-06 13:35

manager   ~0016883

Looks like the merchant is returning a https://docs.taler.net/core/api-merchant.html#tsref-type-MerchantCoinRefundSuccessStatus with "type=success" but a non-200 exchange_status?

TRACE Notification [
  {
    "type": "refund-status-error",
    "error": {
      "code": 7002,
      "hint": "Error: WALLET_RECEIVED_MALFORMED_RESPONSE",
      "details": {
        "requestUrl": "https://backend.test.taler.net/instances/blog/orders/2020.250-03RFHXMJF1Y7P/refund",
        "httpStatusCode": 200,
        "validationError": "DecodingError: expected number constant \"200\" at (MerchantCoinRefundSuccessStatus).exchange_status but got number"
      },
      "message": "Response invalid"
    }
  }
]

Christian Grothoff

2020-09-06 13:38

manager   ~0016884

I don't think so. Look at the code. line 695ff in taler-merchant-httpd_post-orders-ID-refund.c.

Florian Dold

2020-09-06 13:39

manager   ~0016885

But I'll anyway add an integration test that causes the refund to be "gone" just in case ...

Florian Dold

2020-09-06 16:50

manager   ~0016887

The wallet now has an integration test for "gone" refunds. The test passes, which also shows that the 504 in the merchant is fixed.

The android wallet with wallet-core v0.7.1-dev.28 should be available in ~1 hour.

Issue History

Date Modified Username Field Change
2020-09-06 12:22 Florian Dold New Issue
2020-09-06 12:22 Florian Dold Status new => assigned
2020-09-06 12:22 Florian Dold Assigned To => MS
2020-09-06 12:22 Florian Dold Assigned To MS => Christian Grothoff
2020-09-06 12:57 Christian Grothoff Note Added: 0016877
2020-09-06 13:15 Christian Grothoff Note Added: 0016878
2020-09-06 13:15 Christian Grothoff Assigned To Christian Grothoff => Florian Dold
2020-09-06 13:21 Florian Dold Assigned To Florian Dold => Christian Grothoff
2020-09-06 13:22 Florian Dold Note Added: 0016879
2020-09-06 13:23 Florian Dold Note Added: 0016880
2020-09-06 13:26 Florian Dold Summary merchand responds to public /orders/{id}/refunds request with HTTP 504 => merchant responds to public /orders/{id}/refunds request with HTTP 504
2020-09-06 13:30 Christian Grothoff Note Added: 0016881
2020-09-06 13:32 Christian Grothoff Note Added: 0016882
2020-09-06 13:32 Christian Grothoff Assigned To Christian Grothoff => Florian Dold
2020-09-06 13:35 Florian Dold Note Added: 0016883
2020-09-06 13:35 Florian Dold Assigned To Florian Dold => Christian Grothoff
2020-09-06 13:38 Christian Grothoff Note Added: 0016884
2020-09-06 13:39 Florian Dold Note Added: 0016885
2020-09-06 13:39 Christian Grothoff Assigned To Christian Grothoff => Florian Dold
2020-09-06 16:50 Florian Dold Status assigned => resolved
2020-09-06 16:50 Florian Dold Resolution open => fixed
2020-09-06 16:50 Florian Dold Note Added: 0016887
2020-09-06 16:58 Christian Grothoff Fixed in Version => 0.8
2021-08-24 16:23 Christian Grothoff Status resolved => closed
2024-01-12 14:04 Christian Grothoff Category merchant backend API (C) => mechant backend