ehealth-ua / api-spec

Apache License 2.0
30 stars 24 forks source link

Declaration .status is wrong? #163

Closed pzhuk closed 6 years ago

pzhuk commented 6 years ago

Environment: PROD

We got repsonse, that status was invalid, but actually status was APPROVED, which is correct I have checked request log, and looks correct

Any advice?

Response:

{
            "meta" : {
                "url" : "http://api.ehealth-ukraine.org/api/declaration_requests/20b2b572-c85a-4ad3-8bef-68da5c0d3d14/actions/sign",
                "type" : "object",
                "request_id" : "dpf8fru495gb97da2oetha6dkufh6fgn",
                "code" : 422
            },
            "error" : {
                "type" : "validation_failed",
                "message" : "Validation failed. You can find validators description at our API Manifest: http://docs.apimanifest.apiary.io/#introduction/interacting-with-api/errors.",
                "invalid" : [ 
                    {
                        "rules" : [ 
                            {
                                "rule" : "invalid",
                                "params" : [],
                                "description" : "incorrect status"
                            }
                        ],
                        "entry_type" : "json_data_property",
                        "entry" : "$.status"
                    }
                ]
            }
        }
pzhuk commented 6 years ago

@lymychp very strange - i have checked request and such reponse is unexpected could you pls advice?

lymychp commented 6 years ago

this kind of response means that you are trying to sign declaration request that is not approved. Currently your declaration requests has been signed already. So it looks like everything is fine.

sreva commented 6 years ago

аналогічна проблема

{
            "meta" : {
                "url" : "http://api.ehealth-ukraine.org/api/declaration_requests/f78668ae-a9e4-4201-be2f-230bd924461c/actions/sign",
                "type" : "object",
                "request_id" : "sdkrq0grdlom331nu6q2ii6l9lakcfhn",
                "code" : 422
            },
            "error" : {
                "type" : "validation_failed",
                "message" : "Validation failed. You can find validators description at our API Manifest: http://docs.apimanifest.apiary.io/#introduction/interacting-with-api/errors.",
                "invalid" : [ 
                    {
                        "rules" : [ 
                            {
                                "rule" : "invalid",
                                "params" : [],
                                "description" : "incorrect status"
                            }
                        ],
                        "entry_type" : "json_data_property",
                        "entry" : "$.status"
                    }
                ]
            }
        }
lymychp commented 6 years ago

так в чому проблема? така відповідь передбаачена бізнес-логікою у випадку якщо намагаєтесь підписати декларацію без попереднього підтвердження - approve.

sreva commented 6 years ago

Якщо розшифрувати підписаний контент там декларація не в статусі approve?

lymychp commented 6 years ago

Зараз в БД декларація вже в статусі SIGNED. Тобто ви її успішно підписали.

sreva commented 6 years ago

А чому тоді отримали помилку? Я перевірив лог підписання декларацій з обох прикладів, там статуси APPROVED

lymychp commented 6 years ago

2017-11-15 14:38:55.854289 - дата коли було проставлено статус signed 2017-11-15T14:39:39.058940937Z - timestamp вашого запиту з помилкою. получаєтсья, що Ви підписали декларацію, а потім ще раз спробували її підписати