OpenBazaar / OpenBazaar-Server

(Deprecated) OpenBazaar 1.0 Server daemon for communication with OpenBazaar-Client
MIT License
608 stars 173 forks source link

Expiration_date in Contracts API appends UTC, conflicts with documentation #439

Open sgornick opened 8 years ago

sgornick commented 8 years ago

The documentation for POST Contracts ( https://gist.github.com/drwasho/bd4b28a5a07c5a952e2f ) reads:

expiration_date=[UTC]
 - Sormatted string
 - The date the contract should expire in string formatted UTC datetime
 - Example:
 - -  "2015-11-01T00:00 UTC"
 - - “” if the contract never expires

But the api source code for creating the object actually appends the " UTC" suffix.

https://github.com/OpenBazaar/OpenBazaar-Server/blob/de9a97f44fd8059fed3115acafae03207584f1ca/market/contracts.py#L175

So following the example in the instructions gives: "2015-11-01T00:00 UTC UTC"

And that gets displayed by the OB-Client as no expiry (with that duplicate UTC in the suffix it becomes an invalid UTC date, and thus the result is a soft-fail. [Edited])

So I don't know if the issue is in the documentation (i.e., example should not include " UTC" suffix), or in the handling of the API request. Just reporting that following the documentation provides incorrect results.

OpenBazaar version: v0.2.0 (and master)

Reproducible: Always

Steps to reproduce:

  1. $ python additem.py # See attached

Observed Behavior:

Contract ID: [contract_id]
Expiry after: 2015-11-01T00:00 UTC UTC

Expected Behavior:

Contract ID: [contract_id]
Expiry after: 2015-11-01T00:00 UTC

Additional info: additem.py script: https://gist.github.com/sgornick/f6ddd24eb837affaf04e5070e218a030, or saved as .txt since github doesn't support .py attachments. additem.py.txt

daira commented 8 years ago

Treating an invalid date as meaning no expiry is also a serious silent-failure issue.