View Issue Details

IDProjectCategoryView StatusLast Update
0008417Talerwallet-corepublic2024-03-07 20:52
ReporterMarcS Assigned ToMarcS  
PriorityurgentSeveritymajorReproducibilityalways
Status closedResolutionreopened 
Product Version0.9.4 
Target Version0.9.4Fixed in Version0.9.4 
Summary0008417: prepareXYZ wallet-core calls which get passed an URL scanned from QR code must be able to decode percent-encoded data
DescriptionWalletCore#1 sendRequest(request:completionHandler:) {"id":8,"operation":"preparePayForTemplate","args":{"talerPayTemplateUri":"taler:\/\/pay-template\/backend.taler.grothoff.org\/demo?amount=STATER%3A5"}}

Possibly unhandled promise rejection: TypeError: cannot read property 'amount' of undefined
    at preparePayForTemplate (<compiled_js>:29397)
    at dispatchRequestInternal (<compiled_js>:41752)
    at handleCoreApiRequest (<compiled_js>:42163)

TagsNo tags attached.

Activities

Florian Dold

2024-02-16 13:45

manager   ~0021322

There was a required field (templateParams) in the request, but wallet-core didn't validate its presence properly. Fixed now by making the field optional.

commit b70f922fdd928c3ab675522dc8031371909a88ab (HEAD -> master, origin/master, origin/HEAD)
Author: Florian Dold <florian@dold.me>
Date: Fri Feb 16 13:39:18 2024 +0100

    wallet-core: make templateParams optional

MarcS

2024-02-18 20:58

developer   ~0021345

When amount is not fixed in the template definition, not sending the (optional) templateParams lead to an error:

 Controller#1 openURL(_:stack:) taler://pay-template/backend.demo.taler.net/m1?amount=KUDOS&summary=
 WalletCore#1 sendRequest(request:completionHandler:) {"operation":"preparePayForTemplate","id":8,"args":{"talerPayTemplateUri":"taler:\/\/pay-template\/backend.demo.taler.net\/m1?amount=KUDOS&summary="}}

wallet.ts finished wallet core request preparePayForTemplate with error: {
  "code": 7005,
  "when": {
    "t_ms": 1708274592710
  },
  "hint": "Unexpected HTTP status 400 in response",
  "requestUrl": "https://backend.demo.taler.net/templates/m1",
  "requestMethod": "POST",
  "httpStatusCode": 400,
  "errorResponse": {
    "hint": "The JSON in the client's request was malformed. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers.",
    "code": 22,
    "field": "amount",
    "line": 1
  }
}
taler-wallet-embedded/index.ts native listener: sending back error message for operation preparePayForTemplate (8) after 2867 ms
  WalletCore#1 handleMessage(message:) ResponseOrNotification(type: "error", operation: Optional("preparePayForTemplate"), id: Optional(8), result: nil, error: Optional(AnyCodable(["requestUrl": "https://backend.demo.taler.net/templates/m1", "requestMethod": "POST", "errorResponse": ["line": 1, "hint": "The JSON in the client\'s request was malformed. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers.", "code": 22, "field": "amount"], "when": ["t_ms": 1708274592710], "code": 7005, "hint": "Unexpected HTTP status 400 in response", "httpStatusCode": 400])), payload: nil)

Florian Dold

2024-02-19 00:11

manager   ~0021352

This is still a misuse of the API. When the "amount" from the talerPayTemplateUri is a currency without value, the full amount must be provided in the templateParams.

The templateParams is only optional when none of the values therein are mandatory.

I've improved the error message though, in this case the exception now says: "Amount from template URI only has a currency without value. The value must be provided in the templateParams."

MarcS

2024-02-21 22:09

developer   ~0021436

need to pass templateParams.amount when that is not specified

Issue History

Date Modified Username Field Change
2024-02-16 13:00 MarcS New Issue
2024-02-16 13:00 MarcS Status new => assigned
2024-02-16 13:00 MarcS Assigned To => Florian Dold
2024-02-16 13:45 Florian Dold Status assigned => resolved
2024-02-16 13:45 Florian Dold Resolution open => fixed
2024-02-16 13:45 Florian Dold Note Added: 0021322
2024-02-18 20:58 MarcS Status resolved => feedback
2024-02-18 20:58 MarcS Resolution fixed => reopened
2024-02-18 20:58 MarcS Note Added: 0021345
2024-02-19 00:11 Florian Dold Assigned To Florian Dold => MarcS
2024-02-19 00:11 Florian Dold Status feedback => assigned
2024-02-19 00:11 Florian Dold Note Added: 0021352
2024-02-21 22:09 MarcS Status assigned => resolved
2024-02-21 22:09 MarcS Note Added: 0021436
2024-03-07 20:52 Christian Grothoff Fixed in Version => 0.9.4
2024-03-07 20:52 Christian Grothoff Status resolved => closed