View Issue Details

IDProjectCategoryView StatusLast Update
0006755Talermechant backendpublic2021-02-18 00:41
Reportersebasjm Assigned Tosebasjm  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Versiongit (master) 
Target Version0.9Fixed in Version0.9 
Summary0006755: The PATCH operation does not work as expected for the "payto_uris" field
DescriptionFrom
https://docs.taler.net/core/api-merchant.html#instance-management

payto_uri field seems to add always the values to the previous one in the account list.

See steps to reproduce the issue
Steps To ReproduceCreate an instance

curl 'http://localhost:9966/private/instances' \
  -H 'Authorization: Bearer secret-token:super_secret' \
  -H 'Content-Type: application/json;charset=UTF-8' \
  --data-raw '{"default_wire_transfer_delay":{"d_ms":2000},"default_pay_delay":{"d_ms":1000},"jurisdiction":{},"address":{},"default_wire_fee_amortization":10,"default_max_wire_fee":"COL:2","default_max_deposit_fee":"COL:1","payto_uris":["payto://x-taler-bank/bank.taler:5882/blogger"],"name":"www","id":"www2"}'

It create the instance with id www2 as expected, and one single account payto://x-taler-bank/bank.taler:5882/blogger

Next, try to remove the payto uri to replace it with another

curl 'http://localhost:9966/private/instances/www2' \
  -X 'PATCH' \
  -H 'Authorization: Bearer secret-token:super_secret' \
  -H 'Content-Type: application/json;charset=UTF-8' \
  --data-raw '{"default_pay_delay":{"d_ms":1000},"name":"www","merchant_pub":"3N4SC26BXAAF4QM9VJ1T6FQK074JN0YCXQK6CJ4MYXPS4TJYN4N0","address":{},"jurisdiction":{},"default_max_wire_fee":"COL:2","default_max_deposit_fee":"COL:1","default_wire_fee_amortization":10,"default_wire_transfer_delay":{"d_ms":2000},"id":"www2","payto_uris":["payto://x-taler-bank/bank.taler:5882/blogger3"]}'

It is not removed, but is added to the existing one. The expected behavior is to replace the previous value with the new one.

An attempt to clean the field also doesnt work as expected:

curl 'http://localhost:9966/private/instances/www2' \
  -X 'PATCH' \
  -H 'Authorization: Bearer secret-token:super_secret' \
  -H 'Content-Type: application/json;charset=UTF-8' \
  --data-raw '{"default_pay_delay":{"d_ms":1000},"name":"www","merchant_pub":"3N4SC26BXAAF4QM9VJ1T6FQK074JN0YCXQK6CJ4MYXPS4TJYN4N0","address":{},"jurisdiction":{},"default_max_wire_fee":"COL:2","default_max_deposit_fee":"COL:1","default_wire_fee_amortization":10,"default_wire_transfer_delay":{"d_ms":2000},"id":"www2","payto_uris":[""]}'
TagsNo tags attached.

Activities

Christian Grothoff

2021-02-17 20:50

manager   ~0017542

f8bc94d..441d1a5 fixes an issue where re-enabling (!) an account would not work. But looking at the code I've not yet seen how it could fail to disable. Investigation continues...

Christian Grothoff

2021-02-17 21:02

manager   ~0017543

I tried it, and it works for me here. Do note that the bank account is never 'deleted', just set to "inactive". So now I have:

$ curl 'http://localhost:8080/private/instances/www2' -H 'Authorization: Bearer secret-token:super_secret' -H 'Content-Type: application/json;charset=UTF-8'
{
  "accounts": [
    {
      "payto_uri": "payto://x-taler-bank/bank.taler:5882/blogger2",
      "h_wire": "CSB7EKYYG8NX6GKMT5HCJ7BAC8700SP2B8693AKJB2RQ3YFXBJCH011P0PYX34FE8N45Q1QR662P6MXPH0CWJMFQF5MYCQ6EEAJRST0",
      "salt": "E9H97C4XZPGYK7HQWM2JBCJR6BWSC2ZK33MZ0FV1J5PTC253MWJGKPTPAZ098Q587PTP7FQ7VS7Q85FSQYD5727F5M8TDCPEVMWW1Z0",
      "active": true
    },
    {
      "payto_uri": "payto://x-taler-bank/bank.taler:5882/blogger",
      "h_wire": "M99W9FA8RZM1Y67MPFW9BH1MTAYCN2CT4AQPZWW1HA028FC6J5P77EZTZCH825HWQSW5VM0M7N2THD7YSSKM088YNFQC59SDVWSV4CR",
      "salt": "EJ6YSNTZ8FM8CJ8MXYHNKC894J195V5Y1S4T9MTGRF6E7KTNTDFDP3GCKXCW5SF65JF6AEGQFYSKT3MFHFVN578T9CCSCW78Y29TF40",
      "active": false
    }
  ],
  "name": "www",
  "merchant_pub": "WRH5QWP0DPRMQ712HBJ5AKMFDKNQ6RXDZNQQHM8KYNMRFWRYXGR0",
  "address": {},
  "jurisdiction": {},
  "default_max_wire_fee": "EUR:2",
  "default_max_deposit_fee": "EUR:1",
  "default_wire_fee_amortization": 10,
  "default_wire_transfer_delay": {
    "d_ms": 2000
  },
  "default_pay_delay": {
    "d_ms": 1000
  }
}

See the "active" : false for the 'blogger'. Fixed?

sebasjm

2021-02-17 21:28

developer   ~0017545

Not in my side, if I send payto_uris with an empty array I expect all to be active: false.
But it has no effect.

Christian Grothoff

2021-02-17 22:20

manager   ~0017547

I just tested it again, and it works fine here. did you try with the lastest merchant? Git c3b87356b2f31f63bb7dfa84cb7a3361fc55debc?

sebasjm

2021-02-17 23:54

developer   ~0017548

Sorry, was not running the last version.
Yes it seems fixed

Issue History

Date Modified Username Field Change
2021-02-17 20:06 sebasjm New Issue
2021-02-17 20:06 sebasjm Status new => assigned
2021-02-17 20:06 sebasjm Assigned To => Christian Grothoff
2021-02-17 20:50 Christian Grothoff Note Added: 0017542
2021-02-17 21:02 Christian Grothoff Note Added: 0017543
2021-02-17 21:02 Christian Grothoff Assigned To Christian Grothoff => sebasjm
2021-02-17 21:02 Christian Grothoff Status assigned => feedback
2021-02-17 21:28 sebasjm Note Added: 0017545
2021-02-17 22:20 Christian Grothoff Note Added: 0017547
2021-02-17 23:54 sebasjm Note Added: 0017548
2021-02-18 00:40 Christian Grothoff Status feedback => resolved
2021-02-18 00:40 Christian Grothoff Resolution open => fixed
2021-02-18 00:40 Christian Grothoff Fixed in Version => 0.9
2021-02-18 00:41 Christian Grothoff Target Version => 0.9