Giter Site home page Giter Site logo

тест2 /api/legal_entities накладання ЕЦП і відправка Статус http 422 замість 200 about api-spec HOT 3 CLOSED

ehealth-ua avatar ehealth-ua commented on May 12, 2024
тест2 /api/legal_entities накладання ЕЦП і відправка Статус http 422 замість 200

from api-spec.

Comments (3)

pieskov avatar pieskov commented on May 12, 2024 2

Структура JSON не соответствует заявленной в документации.
Вот это лишнее, возможно из за этого и возникает ошибка:
"doctype": 12, "doc_id": 157, "parent_id": 157, "created": 1497077049611, "docbody_id": 157, "updated": 1497077049611

У меня такая структура. и все работает на ура:
{ "name":"КНП „Перший Черкаський міський центр первинної медико-санітарної допомоги”", "short_name":"КНП „Перший Черкаський міський ЦПМСД”", "public_name":"КНП „Перший Черкаський міський центр первинної медико-санітарної допомоги”", "type":"MSP", "owner_property_type":"PRIVATE", "legal_form":"150", "edrpou":"38469862", "email":"[email protected]", "kveds":[ "86.10" ], "addresses":[ { "type":"REGISTRATION", "country":"UA", "area":"Черкаська область", "region":"Черкаська область", "settlement":"Черкаси", "settlement_type":"CITY", "settlement_id":"43432432", "street_type":"STREET", "street":"Дахнівська", "building":"34" }, { "type":"RESIDENCE", "country":"UA", "area":"Черкаська область", "region":"Черкаська область", "settlement":"Черкаси", "settlement_type":"CITY", "settlement_id":"43432432", "street_type":"STREET", "street":"Дахнівська", "building":"34" } ], "phones":[ { "type":"LAND_LINE", "number":"+380674023650" } ], "owner":{ "first_name":"First", "last_name":"Last", "second_name":"Second", "tax_id":"1111111111", "birth_date":"1982-12-12", "birth_place":"birth_place", "gender":"MALE", "email":"[email protected]", "position":"P3", "documents":[ { "type":"PASSPORT", "number":"111" } ], "phones":[ { "type":"LAND_LINE", "number":"+380674023650" } ] }, "medical_service_provider":{ "licenses":[ { "license_number":"Lic", "issued_by":"issued_by", "issued_date":"2014-01-01", "expiry_date":"2020-01-01", "active_from_date":"2020-01-01", "what_licensed":"what_licensed" }, { "license_number":"Lic2", "issued_by":"issued_by2", "issued_date":"2014-01-02", "expiry_date":"2020-01-02", "active_from_date":"2020-01-02", "what_licensed":"what_licensed2" } ], "accreditation":{ "category":"FIRST", "issued_date":"2014-01-03", "expiry_date":"2020-01-03", "order_no":"1235we", "order_date":"2020-01-03" } }, "security":{ "redirect_uri":"https:\/\/google.com.ua" }, "public_offer":{ "consent":true, "consent_text":"consent_text" } }

from api-spec.

DPashchenko avatar DPashchenko commented on May 12, 2024

@romanm доброго времени суток!
Проверьте сериализацию JSON'а.
Данные которые вы подписываете выглядят следующим образом:
\ufeff{\n\t\"name\": \"Hello World! - Клініка Адоніс 123\",\n\t\"short_name\": \"Адоніс\",\n\t\"public_name\": \"Адоніс\",\n\t\"type\": \"MSP\",\n\t\"owner_property_type\": \"STATE\",\n\t\"legal_form\": \"140\",\n\t\"edrpou\": \"1560503515\",\n\t\"kveds\": [\n\t\t\"86.10\"\n\t],\n\t\"addresses\": [\n\t\t{\n\t\t\t\"type\": \"RESIDENCE\",\n\t\t\t\"country\": \"UA\",\n\t\t\t\"area\": \"Житомирська\",\n\t\t\t\"region\": \"Бердичівський\",\n\t\t\t\"settlement\": \"Київ\",\n\t\t\t\"settlement_type\": \"CITY\",\n\t\t\t\"settlement_id\": \"43432432\",\n\t\t\t\"street_type\": \"STREET\",\n\t\t\t\"street\": \"вул. Ніжинська\",\n\t\t\t\"building\": \"15\",\n\t\t\t\"apartment\": \"23\",\n\t\t\t\"zip\": \"02090\"\n\t\t}\n\t],\n\t\"phones\": [\n\t\t{\n\t\t\t\"type\": \"MOBILE\",\n\t\t\t\"number\": \"+380503410870\"\n\t\t}\n\t],\n\t\"email\": \"[email protected]\",\n\t\"owner\": {\n\t\t\"first_name\": \"Петро\",\n\t\t\"last_name\": \"Іванов\",\n\t\t\"second_name\": \"Миколайович\",\n\t\t\"tax_id\": \"3015492565\",\n\t\t\"birth_date\": \"1991-08-19\",\n\t\t\"birth_place\": \"Вінниця, Україна\",\n\t\t\"gender\": \"MALE\",\n\t\t\"email\": \"[email protected]\",\n\t\t\"documents\": [\n\t\t\t{\n\t\t\t\t\"type\": \"PASSPORT\",\n\t\t\t\t\"number\": \"120518\"\n\t\t\t}\n\t\t],\n\t\t\"phones\": [\n\t\t\t{\n\t\t\t\t\"type\": \"MOBILE\",\n\t\t\t\t\"number\": \"+380503410870\"\n\t\t\t}\n\t\t],\n\t\t\"position\": \"Голова правління\"\n\t},\n\t\"medical_service_provider\": {\n\t\t\"licenses\": [\n\t\t\t{\n\t\t\t\t\"license_number\": \"fd123443\",\n\t\t\t\t\"issued_by\": \"Кваліфікацйна комісія\",\n\t\t\t\t\"issued_date\": \"1991-08-19\",\n\t\t\t\t\"expiry_date\": \"1991-08-19\",\n\t\t\t\t\"kved\": \"86.10\",\n\t\t\t\t\"what_licensed\": \"реалізація наркотичних засобів\"\n\t\t\t}\n\t\t],\n\t\t\"accreditation\": {\n\t\t\t\"category\": \"FIRST\",\n\t\t\t\"issued_date\": \"1991-08-19\",\n\t\t\t\"expiry_date\": \"1991-08-19\",\n\t\t\t\"order_no\": \"fd123443\",\n\t\t\t\"order_date\": \"1991-08-19\"\n\t\t}\n\t},\n\t\"security\": {\n\t\t\"redirect_uri\": \"redirect_uri\"\n\t},\n\t\"public_offer\": {\n\t\t\"consent\": true,\n\t\t\"consent_text\": \"Consent text\"\n\t},\n\t\"doctype\": 12,\n\t\"doc_id\": 157,\n\t\"parent_id\": 157,\n\t\"created\": 1497077049611,\n\t\"docbody_id\": 157,\n\t\"updated\": 1497077049611\n}
Переносы и табуляция скорей всего пройдут, но как минимум \ufeff необходимо убрать.
http://www.charbase.com/feff-unicode-zero-width-no-break-space

from api-spec.

romanm avatar romanm commented on May 12, 2024

Дійсно символ \ufeff був винний, який створювався FileSaver.saveAs .
До того всього він ще і не видимий.
Можна обійтись і без нього
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
a.download = this.registryMspFileName();
var dataJson = $scope.api__legal_entities;
['doc_id','doctype','parent_id','created','docbody_id','updated'].forEach(function(k){
delete dataJson[k]
});
var json = JSON.stringify(dataJson),
blob = new Blob([json], {type: "octet/stream"}),
url = window.URL.createObjectURL(blob);
a.href = url;
a.click();
window.URL.revokeObjectURL(url);

Дякую всім за допомогу.

from api-spec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.