View Issue Details

IDProjectCategoryView StatusLast Update
0006577Talermerchant backendpublic2024-01-12 13:04
ReporterFlorian Dold Assigned ToFlorian Dold Resolution deadline
ImplementerReviewer 
Release signed byDeployed by 
VerifierCommunicator 
Data protection authority notification requiredNo  
CSIRT notification requiredNo  
Estimated effort (hours)Actual effort (hours)0 
Fast-trackNo
Work packagenone
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.

Required notifications

Address or linkRemarkAdded byNotifiedActions

Activities

Christian Grothoff

2020-09-06 10:57

manager   ~0016877

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

Christian Grothoff

2020-09-06 11: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 11: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 11: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 11: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 11: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 11: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 11: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 11: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 14: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 ModifiedUsernameFieldChange
2020-09-06 10:22Florian DoldNew Issue
2020-09-06 10:22Florian DoldStatusnew => assigned
2020-09-06 10:22Florian DoldAssigned To => MS
2020-09-06 10:22Florian DoldAssigned ToMS => Christian Grothoff
2020-09-06 10:57Christian GrothoffNote Added: 0016877
2020-09-06 11:15Christian GrothoffNote Added: 0016878
2020-09-06 11:15Christian GrothoffAssigned ToChristian Grothoff => Florian Dold
2020-09-06 11:21Florian DoldAssigned ToFlorian Dold => Christian Grothoff
2020-09-06 11:22Florian DoldNote Added: 0016879
2020-09-06 11:23Florian DoldNote Added: 0016880
2020-09-06 11:26Florian DoldSummarymerchand responds to public /orders/{id}/refunds request with HTTP 504 => merchant responds to public /orders/{id}/refunds request with HTTP 504
2020-09-06 11:30Christian GrothoffNote Added: 0016881
2020-09-06 11:32Christian GrothoffNote Added: 0016882
2020-09-06 11:32Christian GrothoffAssigned ToChristian Grothoff => Florian Dold
2020-09-06 11:35Florian DoldNote Added: 0016883
2020-09-06 11:35Florian DoldAssigned ToFlorian Dold => Christian Grothoff
2020-09-06 11:38Christian GrothoffNote Added: 0016884
2020-09-06 11:39Florian DoldNote Added: 0016885
2020-09-06 11:39Christian GrothoffAssigned ToChristian Grothoff => Florian Dold
2020-09-06 14:50Florian DoldStatusassigned => informing
2020-09-06 14:50Florian DoldResolutionopen => fixed
2020-09-06 14:50Florian DoldNote Added: 0016887
2020-09-06 14:58Christian GrothoffFixed in Version => 0.8
2021-08-24 14:23Christian GrothoffStatusinforming => closed
2024-01-12 13:04Christian GrothoffCategorymerchant backend API (C) => mechant backend
2025-03-22 13:09Christian GrothoffCategorymechant backend => merchant backend