View Issue Details

IDProjectCategoryView StatusLast Update
0008417Talerwallet-corepublic2024-03-07 19:52
ReporterMarcS Assigned ToMarcS 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
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.

Required notifications

Address or linkRemarkAdded byNotifiedActions

Activities

Florian Dold

2024-02-16 12: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 19: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-18 23: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 21:09

developer   ~0021436

need to pass templateParams.amount when that is not specified

Issue History

Date ModifiedUsernameFieldChange
2024-02-16 12:00MarcSNew Issue
2024-02-16 12:00MarcSStatusnew => assigned
2024-02-16 12:00MarcSAssigned To => Florian Dold
2024-02-16 12:45Florian DoldStatusassigned => informing
2024-02-16 12:45Florian DoldResolutionopen => fixed
2024-02-16 12:45Florian DoldNote Added: 0021322
2024-02-18 19:58MarcSStatusinforming => feedback
2024-02-18 19:58MarcSResolutionfixed => reopened
2024-02-18 19:58MarcSNote Added: 0021345
2024-02-18 23:11Florian DoldAssigned ToFlorian Dold => MarcS
2024-02-18 23:11Florian DoldStatusfeedback => assigned
2024-02-18 23:11Florian DoldNote Added: 0021352
2024-02-21 21:09MarcSStatusassigned => informing
2024-02-21 21:09MarcSNote Added: 0021436
2024-03-07 19:52Christian GrothoffFixed in Version => 0.9.4
2024-03-07 19:52Christian GrothoffStatusinforming => closed