{"id":332267,"date":"2022-04-22T09:00:13","date_gmt":"2022-04-22T09:00:13","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=332267"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=332267","title":{"rendered":"<span>Platform V DataSpace: \u043f\u0438\u0448\u0435\u043c \u043a\u043e\u0434 \u043d\u0430 Java \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e SDK<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412 <a href=\"https:\/\/habr.com\/ru\/company\/sberbank\/blog\/655817\/\">\u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 frontend \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Platform V DataSpace. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u044b\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d TypeScript, \u043d\u043e, \u043a\u0430\u043a \u043c\u044b \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438, \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c backend-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Java \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 Platform V Functions \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 DataSpace SDK.<\/p>\n<p>Platform V Functions \u2014 \u044d\u0442\u043e FaaS-\u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 \u0432\u0438\u0434\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 OpenShift\/k8s \u0431\u0435\u0437 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f docker-\u043e\u0431\u0440\u0430\u0437\u043e\u0432 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041d\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0443\u0434\u0435\u043b\u0438\u043c \u0434\u0430\u0436\u0435 \u043d\u0435 Functions, \u0430 DataSpace SDK. \u042d\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 DataSpace \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 <a href=\"https:\/\/www.jsonrpc.org\/specification\">JSON-RPC<\/a>. \u041f\u043e \u0445\u043e\u0434\u0443 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0444\u0438\u0447\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 DataSpace SDK \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 Java-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/619\/b30\/2a2\/619b302a298233fd5372e1756be5293f.png\" width=\"1200\" height=\"630\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/619\/b30\/2a2\/619b302a298233fd5372e1756be5293f.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u00ab\u041f\u0440\u043e\u043c\u043e\u0430\u043a\u0446\u0438\u044f\u00bb<\/h2>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441\u043d\u043e\u0432\u0430 \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u00ab\u041f\u0440\u043e\u043c\u043e\u0430\u043a\u0446\u0438\u044f\u00bb \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>\u0418\u0437\u043c\u0435\u043d\u0438\u043c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0440\u0430\u0437\u0431\u0438\u0432 \u0435\u0433\u043e \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u044b \u0438 \u043f\u043e\u0434\u0430\u0440\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u0435\u0441\u0442\u0438\u0441\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438, \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0441\u0432\u043e\u0439 DataSpace \u0441\u043e \u0441\u0432\u043e\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f29\/d94\/0ee\/f29d940eeb8b9ccbccdab3f5159532b5.png\" width=\"2495\" height=\"1134\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f29\/d94\/0ee\/f29d940eeb8b9ccbccdab3f5159532b5.png\"\/><figcaption><\/figcaption><\/figure>\n<p><strong>Function 1 Vouchers<\/strong> \u2014 backend-\u0441\u0435\u0440\u0432\u0438\u0441, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u043e\u0432.<\/p>\n<p><strong>Function 2 Gifts<\/strong> \u2014 backend-\u0441\u0435\u0440\u0432\u0438\u0441, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0430\u0440\u043a\u043e\u0432.<\/p>\n<p><strong>Function 3 Report<\/strong> \u2014 backend-\u0441\u0435\u0440\u0432\u0438\u0441, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0442\u0447\u0451\u0442\u044b \u043e \u043f\u043e\u0434\u0430\u0440\u043a\u0430\u0445.<\/p>\n<h2>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/h2>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u0434\u0432\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430:<\/p>\n<ul>\n<li>\n<p>\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a Vouchers \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u0430\u043c\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a Gifts \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0434\u0430\u0440\u043a\u0430\u043c\u0438.<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 DataSpace \u0432 \u0441\u0432\u043e\u0451\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0432 SmartMarket Studio. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/sberbank\/blog\/655817\/\">\u0437\u0434\u0435\u0441\u044c<\/a>, \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u00ab\u0420\u0430\u0431\u043e\u0442\u0430\u00bb \u0432 SmartMarket Studio.<\/p>\n<p>\u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e DataSpace \u0431\u0443\u0434\u0435\u0442 \u0441\u0432\u043e\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/confluence.sberbank.ru\/download\/attachments\/6953210819\/model.xml?api=v2&amp;modificationDate=1646146471219&amp;version=2\">vouchers_model.xml<\/a> \u2014 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f\u00a0DataSpace Vouchers;<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/confluence.sberbank.ru\/download\/attachments\/6953210819\/model.xml?api=v2&amp;modificationDate=1646146471219&amp;version=2\">gifts_model.xml<\/a> \u2014 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f\u00a0DataSpace Gifts.<\/p>\n<\/li>\n<\/ul>\n<p>Voucher \u0438 Gift \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u043c\u0435\u044e\u0442 \u0441\u0432\u044f\u0437\u044c OneToOne. \u041d\u043e \u0442\u0438\u043f \u044d\u0442\u043e\u0439 \u0441\u0432\u044f\u0437\u0438 \u00ab\u0438\u0437 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b\u00bb, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u044f\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0441\u0435\u0440\u0432\u0438\u0441\u044b DataSpace \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432.<\/p>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a Vouchers\u00a0\u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0432 \u0441\u0432\u043e\u0451\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9d3\/360\/c67\/9d3360c67803f8876649b9d7fee5faad.png\" width=\"837\" height=\"755\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9d3\/360\/c67\/9d3360c67803f8876649b9d7fee5faad.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a Gifts\u00a0\u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0432 \u0441\u0432\u043e\u0451\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Gifts Function, Reports Function:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cce\/89c\/958\/cce89c958ea040bfc56d664a3e419739.png\" width=\"790\" height=\"754\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cce\/89c\/958\/cce89c958ea040bfc56d664a3e419739.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f43\/338\/efc\/f43338efcd05c182617d87e1135be9f6.png\" width=\"773\" height=\"748\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f43\/338\/efc\/f43338efcd05c182617d87e1135be9f6.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u00ab\u043d\u0430\u0447\u0438\u043d\u043a\u0438\u00bb \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u2014 \u044d\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0445\u043e\u0440\u043e\u0448\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u0432\u0441\u0435\u043c Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<h2>\u0421\u0435\u0440\u0432\u0438\u0441 Voucher<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0432\u043a\u043b\u0430\u0434\u043a\u0443 \u00ab<em>\u0414\u0435\u0442\u0430\u043b\u0438\u00bb<\/em> \u0438 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 DataSpace SDK \u2014 \u043e\u043d \u0431\u044b\u043b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u043f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 DataSpace Vouchers.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c0c\/f0c\/07f\/c0cf0c07ffba9e3b18916f5c62d1ab7a.png\" width=\"1882\" height=\"609\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c0c\/f0c\/07f\/c0cf0c07ffba9e3b18916f5c62d1ab7a.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u0437\u0430 \u043e\u0441\u043d\u043e\u0432\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439-\u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043e\u043a. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u0445 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0443\u043d\u043a\u0442 \u00ab\u042d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u00bb:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0d9\/b23\/669\/0d9b23669144d5d7b5fc66ef00da9ea3.png\" width=\"1880\" height=\"644\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0d9\/b23\/669\/0d9b23669144d5d7b5fc66ef00da9ea3.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 src\/libs jar, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0438\u0437 \u0441\u043a\u0430\u0447\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u043d\u0435\u0435 \u0430\u0440\u0445\u0438\u0432\u0430. <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f java-sdk-core \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0438 REST-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 ak\/sk. \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u043f\u043e <a href=\"https:\/\/support.hc.sbercloud.ru\/devg\/apisign\/api-sign-sdk-java.html\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>, \u0434\u043e\u0441\u0442\u0430\u0451\u043c \u0438\u0437 \u0430\u0440\u0445\u0438\u0432\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u00a0src\/libs \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8f8\/83d\/fa9\/8f883dfa9e2efa5fd21c284e28e9d331.png\" width=\"416\" height=\"354\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8f8\/83d\/fa9\/8f883dfa9e2efa5fd21c284e28e9d331.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412 pom.xml \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u0432<em>\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0434 \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445.<br \/>\u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0441\u0442\u0440\u043e\u0433\u043e\u0439 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430.<\/em><\/p>\n<pre><code class=\"java\">        &lt;dependency>             &lt;groupId>sbp.com.sbt.dataspace&lt;\/groupId>             &lt;artifactId>m7063364230573391874-model-sdk&lt;\/artifactId>             &lt;version>0.0.1&lt;\/version>             &lt;scope>system&lt;\/scope>             &lt;systemPath>${project.basedir}\/src\/libs\/m7063364230573391874-model-sdk-0.0.3.jar&lt;\/systemPath>         &lt;\/dependency>          \u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b DataSpace SDK         &lt;dependency>             &lt;groupId>org.apache.httpcomponents&lt;\/groupId>             &lt;artifactId>httpclient&lt;\/artifactId>         &lt;\/dependency>         &lt;dependency>             &lt;groupId>io.projectreactor.netty&lt;\/groupId>             &lt;artifactId>reactor-netty&lt;\/artifactId>         &lt;\/dependency>         &lt;dependency>             &lt;groupId>org.springframework&lt;\/groupId>             &lt;artifactId>spring-webflux&lt;\/artifactId>         &lt;\/dependency>         &lt;dependency>             &lt;groupId>org.apache.commons&lt;\/groupId>             &lt;artifactId>commons-lang3&lt;\/artifactId>         &lt;\/dependency>         &lt;dependency>             &lt;groupId>com.google.guava&lt;\/groupId>             &lt;artifactId>guava&lt;\/artifactId>             &lt;version>26.0-jre&lt;\/version>         &lt;\/dependency>   \u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0438 REST-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 ak\/sk         &lt;dependency>             &lt;groupId>sbp.ts.faas&lt;\/groupId>             &lt;artifactId>java-sdk-core&lt;\/artifactId>             &lt;version>3.1.2&lt;\/version>             &lt;scope>system&lt;\/scope>             &lt;systemPath>${project.basedir}\/src\/libs\/java-sdk-core-3.1.2.jar&lt;\/systemPath>         &lt;\/dependency>   \u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b java-sdk-core         &lt;dependency>             &lt;groupId>joda-time&lt;\/groupId>             &lt;artifactId>joda-time&lt;\/artifactId>             &lt;version>2.10.3&lt;\/version>         &lt;\/dependency> <\/code><\/pre>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 Vouchers \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c REST API, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434 \u0438 \u0442\u0438\u043f \u043f\u043e\u0434\u0430\u0440\u043a\u0430. \u0412 \u043e\u0442\u0432\u0435\u0442 \u043e\u043d \u043e\u0442\u0434\u0430\u0451\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0434\u0430\u0440\u043a\u0430.<\/p>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c API \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435:<\/p>\n<pre><code class=\"java\">@RestController public class VouchersController {     @Autowired     private VouchersService vouchersService;       @RequestMapping(value = \"\/getGiftByPromoCode\")     public ResponseEntity&lt;String> getGiftByPromoCode(@RequestParam String voucherCode, @RequestParam String giftKind) {         return ResponseEntity.ok()                 .contentType(MediaType.TEXT_PLAIN)                 .body(vouchersService.getGift(voucherCode, giftKind));     } }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.\u00a0\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u044b DataspaceCorePacketClient \u0438 DataspaceCoreSearchClient. \u041d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0430\u0434\u0440\u0435\u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 DataSpace \u0438 ak\/sk \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 API gateway. \u0412\u0441\u0435 \u044d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0437 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 DATASPACE_URL, APP_KEY, APP_SECRET.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f RestTemplate \u0434\u043b\u044f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0443 Gifts:<\/p>\n<pre><code class=\"java\">@Configuration public class Config {       @Value(\"${DATASPACE_URL}\")     private String dataSpaceUrl;     @Value(\"${APP_KEY}\")     private String appKey;     @Value(\"${APP_SECRET}\")     private String appSecret;       @Bean     public RestTemplate restTemplate() {         return new RestTemplate();     }       @Bean     public DataspaceCoreSearchClient searchClient() {         return new DataspaceCoreSearchClient(dataSpaceUrl,                 DataspaceSdkApiClientConfiguration.of(builder ->                         builder                                 .setApiGatewayConfiguration(AKSKApiGatewayConfiguration.of(appKey, appSecret))                 )         );     }       @Bean     public DataspaceCorePacketClient packetClient() {         return new DataspaceCorePacketClient(dataSpaceUrl,                 DataspaceSdkApiClientConfiguration.of(builder ->                         builder                                 .setApiGatewayConfiguration(AKSKApiGatewayConfiguration.of(appKey, appSecret))                 )         );     }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>\u0430\u0434\u0440\u0435\u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u0430;<\/p>\n<\/li>\n<li>\n<p>appKey;<\/p>\n<\/li>\n<li>\n<p>appSecret.<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430\u0439\u0442\u0438 \u044d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/52d\/2a3\/feb\/52d2a3febc7ab93837786e8b7b89a324.png\" width=\"513\" height=\"337\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/52d\/2a3\/feb\/52d2a3febc7ab93837786e8b7b89a324.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9e0\/a7e\/d37\/9e0a7ed37fac99eae0de1c28cebdbdc8.png\" width=\"735\" height=\"488\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9e0\/a7e\/d37\/9e0a7ed37fac99eae0de1c28cebdbdc8.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 config.yaml \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438:<\/p>\n<pre><code class=\"java\">gifts.url: https:\/\/gw-ift-sm.pv-api-test.sbc.space\/fn_fa969687_4694_4b3e_a871_5g42q56he710 gifts.appKey: d9ad1de7d38f493793c407061dc1111e gifts.appSecret: a418e8315cf0222fbf4784811fe3dc8a<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 VoucherService.<\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0437\u0430\u043a\u0430\u0437\u0430 \u043f\u043e\u0434\u0430\u0440\u043a\u0430 \u043f\u043e \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u0443 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<ol>\n<li>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0441 \u0444\u0440\u043e\u043d\u0442\u0430 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441 Vouchers, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0448\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0441\u0435\u0440\u0432\u0438\u0441 Vouchers \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 Gifts \u043f\u043e REST.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 Gifts \u0434\u043e\u043b\u0436\u0435\u043d \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043f\u043e\u0434\u0430\u0440\u043e\u043a \u0438 \u0437\u0430\u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043b\u0438\u0431\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u0442\u0432\u0435\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u043f\u043e\u0434\u0430\u0440\u043a\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 Vouchers \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u043e\u0434\u0430\u0440\u043a\u0430, \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0435\u0433\u043e \u043a \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u0443 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0441 \u0441\u0435\u0440\u0438\u0439\u043d\u044b\u043c \u043d\u043e\u043c\u0435\u0440\u043e\u043c \u043f\u043e\u0434\u0430\u0440\u043a\u0430 \u0438 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u0434\u0430\u0440\u043e\u043a \u043d\u0435 \u0431\u044b\u043b \u043d\u0430\u0439\u0434\u0435\u043d, \u0441\u0435\u0440\u0432\u0438\u0441 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043e\u0442\u0432\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0443:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">    public String getGiftByPromoCode(String code,                                      String giftKind) {         try {             String voucherId = verifyPromoCode(code);               JsonNode giftResponse = getGift(giftKind, voucherId);               JsonNode error = giftResponse.get(\"error\");             if (error != null) {                 return error.textValue();             }               updateVoucher(voucherId, giftResponse.get(\"giftId\").textValue());             return \"You have been given a gift from \" + giftResponse.get(\"vendor\") + \". Serial number: \" + giftResponse.get(\"serialNumber\");         } catch (Exception e) {             LOG.error(e.getMessage());             return e.getMessage();         }     }<\/code><\/pre>\n<p>\u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 getGiftsByPromoCode \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434 \u0432\u0430\u043b\u0438\u0434\u0435\u043d. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434 \u0441 \u0442\u0430\u043a\u0438\u043c \u043a\u043e\u0434\u043e\u043c \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438 \u043e\u043d \u043d\u0435 \u0431\u044b\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0440\u0430\u043d\u0435\u0435.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043c\u0435\u0442\u043e\u0434 verifyPromoCode:<\/p>\n<pre><code class=\"java\">    public String verifyPromoCode(String code) throws SdkJsonRpcClientException {         try {             VoucherGet voucher = searchClient.getVoucher(voucherWith ->                     voucherWith                             .withCode()                             .withStatusForVoucherMain(StatusWithLinkable::withCode)                             .withGift()                               .setWhere(where -> where.codeEq(code)));               if (voucher.getGift().getEntityId() != null ||                     !voucher.getStatusForVoucherMain().getCode().equals(VoucherVoucherMainStatus.OPEN.getValue())) {                 throw new GiftAlreadyIssuedException(code);             }               return voucher.getObjectId();         } catch (ObjectNotFoundException objectNotFoundException) {             throw new VoucherNotFoundException(code);         }     }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 DataspaceCoreSearchClient#getVoucher \u0438\u0437 \u0441\u043e\u0441\u0442\u0430\u0432\u0430 DataSpace SDK \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0443 DataSpace Vouchers.<\/p>\n<p>\u0412 \u043b\u044f\u043c\u0431\u0434\u0430-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0441 \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u043f\u043e\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432 \u043e\u0442\u0432\u0435\u0442\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u0434\u0430\u0451\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043f\u043e\u0438\u0441\u043a\u0430.<\/p>\n<p>Get-\u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435 ObjectNotFoundException \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u0448\u043b\u043e\u0441\u044c.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0443 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u0430 \u043d\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0443\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0430\u0440\u043e\u043a, \u0430 \u0441\u0442\u0430\u0442\u0443\u0441 \u2014 \u00ab\u041e\u0422\u041a\u0420\u042b\u0422\u00bb. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434 \u0443\u0436\u0435 \u0431\u044b\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d.<\/p>\n<p>\u041c\u044b \u043f\u0440\u043e\u0432\u0435\u043b\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0435\u0433\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043f\u043e\u0434\u0430\u0440\u043e\u043a.<\/p>\n<p>\u0412 <strong>\u043c\u0435\u0442\u043e\u0434\u0435 getGift<\/strong>\u00a0\u0432\u044b\u0437\u043e\u0432\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441 Gifts \u043f\u043e REST. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u0434\u043f\u0438\u0448\u0435\u043c \u043d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043b\u044e\u0447\u0435\u0439 ak\/sk \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 ApiGateway:<\/p>\n<pre><code class=\"java\">    private JsonNode getGift(String giftKind, String voucherId) throws Exception {         final String GET_GIFT_URL = giftsFunctionUrl + GET_GIFT_ENDPOINT;           Request request = new Request();         request.setMethod(\"GET\");         request.setBody(\"\");         request.setKey(appKey);         request.setSecret(appSecret);         request.setUrl(GET_GIFT_URL);         request.addQueryStringParam(\"voucherId\", voucherId);         request.addQueryStringParam(\"giftKind\", giftKind);         new Signer().sign(request);           HttpHeaders requestHeaders = new HttpHeaders();         request.getHeaders().forEach((k, v) -> requestHeaders.put(k, Collections.singletonList(v)));           String urlTemplate = UriComponentsBuilder.fromHttpUrl(GET_GIFT_URL)                 .queryParam(\"voucherId\", \"{voucherId}\")                 .queryParam(\"giftKind\", \"{giftKind}\")                 .encode()                 .toUriString();           Map&lt;String, String> params = new HashMap&lt;>();         params.put(\"voucherId\", voucherId);         params.put(\"giftKind\", giftKind);           ResponseEntity&lt;JsonNode> response = restTemplate.exchange(                 urlTemplate, HttpMethod.GET, new HttpEntity&lt;>(requestHeaders), JsonNode.class, params);           return response.getBody();     }<\/code><\/pre>\n<p>\u0412 \u043e\u0442\u0432\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0440\u043e\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u0430 \u0444\u0440\u043e\u043d\u0442, \u0438\u043b\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0437\u0430\u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0430\u0440\u043a\u0430.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u043e\u0442 Gifts, \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0438 \u0437\u0430 \u043d\u0438\u043c \u0437\u0430\u043a\u0440\u0435\u043f\u043b\u0451\u043d \u043f\u043e\u0434\u0430\u0440\u043e\u043a.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043c\u0435\u0442\u043e\u0434 updateVoucher:<\/p>\n<pre><code class=\"java\">    public void updateVoucher(String voucherId,                               String giftId) throws SdkJsonRpcClientException {         UpdateVoucherParam updateVoucherParam =                 UpdateVoucherParam.create()                         .setStatusForVoucherMain(VoucherVoucherMainStatus.ISSUED)                         .setGift(GiftReference.of(giftId));           Packet updatePacket = new Packet(voucherId);           updatePacket.voucher.update(VoucherRef.of(voucherId), updateVoucherParam);           packetClient.execute(updatePacket);     }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 DataspaceCorePacketClient#execute \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u0442\u0438\u043f\u0430 Packet. Packet \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 UnitOfWork. \u0412\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435\u0441\u044f \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0433\u043e Packet, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 DataSpace.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0431\u044a\u0435\u043a\u0442 Packet. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0437\u0430\u0434\u0430\u0451\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <em>idempotencePacketId<\/em> \u2014 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043d\u0430\u0434\u0435\u043b\u044f\u0435\u043c Packet \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u0438\u0434\u0435\u043c\u043f\u043e\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p><em>IdempotencePacketId<\/em> \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043a\u043b\u044e\u0447\u043e\u043c \u0438\u0434\u0435\u043c\u043f\u043e\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0430 \u0432\u0441\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u044b Packet c \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043a\u043b\u044e\u0447\u043e\u043c DataSpace \u0432\u0435\u0440\u043d\u0451\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u0430\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0411\u0414 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u043d\u0435 \u0431\u0443\u0434\u0443\u0442. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043b\u044e\u0447\u0430 \u0438\u0434\u0435\u043c\u043f\u043e\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 Voucher.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 Packet \u043a\u043e\u043c\u0430\u043d\u0434\u0443 update \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 Voucher. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c.<\/p>\n<p>\u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 DataspaceCorePacketClient#execute, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 DataSpace.<\/p>\n<p>\u0412 \u043c\u0435\u0442\u043e\u0434\u0435\u00a0getGiftByPromoCode \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0430 \u0444\u0440\u043e\u043d\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c \u043f\u043e\u0434\u0430\u0440\u043a\u0435 \u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0443.<\/p>\n<h2>\u0421\u0435\u0440\u0432\u0438\u0441 Gifts<\/h2>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c jar \u0441 DataSpace SDK, \u043d\u043e \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0438\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 DataSpace Gifts:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ae8\/9e1\/410\/ae89e1410b0ca28c62c790f95f7837fb.png\" width=\"1859\" height=\"605\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ae8\/9e1\/410\/ae89e1410b0ca28c62c790f95f7837fb.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0440\u043e\u0435\u043a\u0442, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c Vouchers:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f34\/511\/588\/f34511588c457eaac11d463233c99d38.png\" width=\"427\" height=\"303\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f34\/511\/588\/f34511588c457eaac11d463233c99d38.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 Gift \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c REST API, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u0430 \u0438 \u0442\u0438\u043f \u043f\u043e\u0434\u0430\u0440\u043a\u0430.<\/p>\n<p>\u0412 \u043e\u0442\u0432\u0435\u0442 \u043e\u043d \u043e\u0442\u0434\u0430\u0451\u0442 JSON, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0437\u0430\u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043f\u043e\u0434\u0430\u0440\u043a\u0435 \u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0430.<\/p>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c API \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435:<\/p>\n<pre><code class=\"java\">@RestController public class GiftsController {       @Autowired     private GiftsService giftsService;       @RequestMapping(value = \"\/getGift\")     public ResponseEntity&lt;JsonNode> getGift(@RequestParam String voucherId, @RequestParam String giftKind) {         return ResponseEntity.ok()                 .contentType(MediaType.APPLICATION_JSON)                 .body(giftsService.getGift(voucherId, giftKind));     } }<\/code><\/pre>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u044b DataspaceCorePacketClient \u0438 DataspaceCoreSearchClient. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438\u0437 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 DATASPACE_URL, APP_KEY, APP_SECRET.<\/p>\n<pre><code class=\"java\">@Configuration public class Config {     @Value(\"${DATASPACE_URL}\")     private String dataSpaceUrl;     @Value(\"${APP_KEY}\")     private String appKey;     @Value(\"${APP_SECRET}\")     private String appSecret;       @Bean     public DataspaceCoreSearchClient searchClient() {         return new DataspaceCoreSearchClient(dataSpaceUrl,                 DataspaceSdkApiClientConfiguration.of(builder ->                         builder                                 .setApiGatewayConfiguration(AKSKApiGatewayConfiguration.of(appKey, appSecret))                 )         );     }       @Bean     public DataspaceCorePacketClient packetClient() {         return new DataspaceCorePacketClient(dataSpaceUrl,                 DataspaceSdkApiClientConfiguration.of(builder ->                         builder                                 .setApiGatewayConfiguration(AKSKApiGatewayConfiguration.of(appKey, appSecret))                 )         );     } }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 GiftsService.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 GiftsService#getGift:<\/p>\n<pre><code class=\"java\">    public JsonNode getGift(String voucherId, String kind) {         ObjectNode response = objectMapper.createObjectNode();         try {             updateRequestCount(voucherId, kind);             GraphCollection&lt;GiftGet> gifts = searchClient.searchGift(giftWith ->                     giftWith                             .withKind()                             .withVendor(GiftVendorWithLinkable::withName)                             .withSerialNumber()                             .setWhere(where ->                                     where                                             .kindEq(GiftKind.valueOf(kind))                                             .and(where.voucherIsNull().or(where.voucherEq(voucherId)))                             )             );               if (gifts.isEmpty()) {                 LOG.error(\"Available gift not found\");                 response.put(\"error\", \"Available gift not found\");                 return response;             }               GiftGet gift = gifts.get(0);             String giftId = gift.getObjectId();               Packet packet = new Packet(giftId);             packet.gift.update(GiftRef.of(giftId),                     update -> update                             .setVoucher(VoucherReference.of(voucherId)));               packetClient.execute(packet);               response.put(\"giftId\", giftId);             response.put(\"vendor\", gift.getVendor().getName());             response.put(\"serialNumber\", gift.getSerialNumber());           } catch (IdempotencyException idempotencyException) {             LOG.error(idempotencyException.getMessage());             return getGift(voucherId, kind);           } catch (Exception exception) {             LOG.error(exception.getMessage());             response.put(\"error\", exception.getMessage());         }           return response;     }<\/code><\/pre>\n<p>\u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0435\u0433\u043e \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e.\u00a0<\/p>\n<p>\u0412 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 Gifts \u043f\u043e\u043c\u0438\u043c\u043e \u0441\u0430\u043c\u0438\u0445 \u043f\u043e\u0434\u0430\u0440\u043a\u043e\u0432 \u0438 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0439 \u0432\u0435\u0434\u0451\u0442\u0441\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c GiftRequestCounter, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0445\u0440\u0430\u043d\u0438\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0432\u0448\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043f\u043e\u0434\u0430\u0440\u043a\u0430.<\/p>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0432 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0442\u0447\u0451\u0442\u0430\u0445:<\/p>\n<pre><code class=\"java\">    private void updateRequestCount(String voucherId, String kind) {         String idempotencePacketId = voucherId + kind;         Packet packet = new Packet(idempotencePacketId);           CreateGiftRequestCounterParam createGiftRequestCounterParam =                 CreateGiftRequestCounterParam.create()                         .setKind(GiftKind.valueOf(kind))                         .setLastRequest(LocalDateTime.now());           GiftRequestCounterRef giftRequestCounter = packet.giftRequestCounter.updateOrCreate(                 createGiftRequestCounterParam, KeyGiftRequestCounter.KIND);           UpdateGiftRequestCounterReq updateGiftRequestCounterReq =                 UpdateGiftRequestCounterReq.create()                         .setInc(IncGiftRequestCounterParam.create().setCounter(1));           packet.giftRequestCounter.update(giftRequestCounter, updateGiftRequestCounterReq);           packetClient.executeAsync(packet).subscribe();     }<\/code><\/pre>\n<p>\u0412 \u043c\u0435\u0442\u043e\u0434\u0435 updateRequestCount \u043c\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430 GiftRequestCounter \u0432 \u0441\u0435\u0440\u0432\u0438\u0441 DataSpace Gifts.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c Packet \u0441 \u043a\u043b\u044e\u0447\u043e\u043c \u0438\u0434\u0435\u043c\u043f\u043e\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u043c \u0438\u0437 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u0430 \u0438 \u0442\u0438\u043f\u0430 \u043f\u043e\u0434\u0430\u0440\u043a\u0430, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043b\u0438\u0448\u043d\u0435\u0433\u043e \u043d\u0430\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430 \u043f\u0440\u0438 \u0440\u0435\u0442\u0440\u0430\u044f\u0445.<\/p>\n<p>\u0412 Packet \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 UpdateOrCreate. \u042d\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430 \u043e\u0434\u0438\u043d \u0432\u044b\u0437\u043e\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0432 \u0411\u0414 \u0438 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0451, \u0430 \u0435\u0441\u043b\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u043d\u0435\u0442, \u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c. \u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 update \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u043d\u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430. \u0417\u0430\u0442\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 DataspaceCorePacketClient#executeAsync.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 getGift \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c \u043f\u043e\u0438\u0441\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0430\u0440\u043a\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043c\u0435\u0442\u043e\u0434 DataspaceCoreSearchClient#searchGift:<\/p>\n<pre><code class=\"java\">            GraphCollection&lt;GiftGet> gifts = searchClient.searchGift(giftWith ->                     giftWith                             .withKind()                             .withVendor(GiftVendorWithLinkable::withName)                             .withSerialNumber()                             .setWhere(where ->                                     where                                             .kindEq(GiftKind.valueOf(kind))                                             .and(where.voucherIsNull().or(where.voucherEq(voucherId)))                             )             );<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u043f\u043e\u0434\u0430\u0440\u043a\u0438 \u043d\u0435 \u0431\u044b\u043b\u0438 \u043d\u0430\u0439\u0434\u0435\u043d\u044b, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043e\u0442\u0432\u0435\u0442 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439:<\/p>\n<pre><code class=\"java\">            if (gifts.isEmpty()) {                 LOG.error(\"Available gift not found\");                 response.put(\"error\", \"Available gift not found\");                 return response;             }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043f\u043e\u0434\u0430\u0440\u043a\u0438 \u043d\u0430\u0448\u043b\u0438\u0441\u044c, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0432 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0432\u0430\u0443\u0447\u0435\u0440.<\/p>\n<p>\u0421\u043d\u043e\u0432\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c DataspaceCorePacketClient. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c Packet \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0435\u0433\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 Gift.<\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0438\u0434\u0435\u043c\u043f\u043e\u0442\u0435\u043d\u0442\u043d\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043b\u044e\u0447\u0430 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u043e\u0434\u0430\u0440\u043a\u0430.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043f\u043e\u0434\u0430\u0440\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0430\u0443\u0447\u0435\u0440\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043b\u0438\u0448\u043d\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043f\u0440\u0438 \u0440\u0435\u0442\u0440\u0430\u044f\u0445:<\/p>\n<pre><code class=\"java\">GiftGet gift = gifts.get(0);             String giftId = gift.getObjectId();                                      Packet packet = new Packet(giftId);             packet.gift.update(GiftRef.of(giftId),                     update -> update                             .setVoucher(VoucherReference.of(voucherId)));               packetClient.execute(packet);<\/code><\/pre>\n<h2>\u0421\u0435\u0440\u0432\u0438\u0441 Reports<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 API \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0447\u0451\u0442\u043e\u0432.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0442\u0447\u0451\u0442\u044b \u043e \u043f\u043e\u0434\u0430\u0440\u043a\u0430\u0445, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f jar DataSpace SDK \u0438\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 DataSpace Gifts.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/68c\/3ba\/a51\/68c3baa51ba6e9432364ba8043f062a5.png\" width=\"451\" height=\"299\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/68c\/3ba\/a51\/68c3baa51ba6e9432364ba8043f062a5.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c API \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043e\u0442\u0447\u0451\u0442\u0430:<\/p>\n<p>\u041a\u043e\u043c\u043f\u0430\u043d\u0438\u044f | \u0442\u0438\u043f \u043f\u043e\u0434\u0430\u0440\u043a\u0430 | \u043a\u043e\u043b-\u0432\u043e \u043f\u043e\u0434\u0430\u0440\u043a\u043e\u0432:<\/p>\n<pre><code class=\"java\">@RestController public class ReportController {     @Autowired     private ReportService reportService;       @RequestMapping(value = \"\/getGiftsReport\")     public ResponseEntity&lt;JsonNode> getGiftsReport() {         return ResponseEntity.ok()                 .contentType(MediaType.APPLICATION_JSON)                 .body(reportService.getGiftsReport());     } }<\/code><\/pre>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 ReportService#getGiftsReport \u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c DataSpace SDK:<\/p>\n<pre><code class=\"java\">    public JsonNode getGiftsReport() {         ObjectNode response = objectMapper.createObjectNode();         try {               SelectionWith&lt;? extends GiftGrasp> selectionWith = GiftGraph.createSelection()                     .$withGroup(\"vendor\", groupSelector -> groupSelector.none(giftGrasp -> giftGrasp.vendor().name()))                     .$withGroup(\"kind\", groupSelector -> groupSelector.none(GiftGrasp::kind))                     .$withGroup(\"giftsCount\", groupSelector -> groupSelector.count(GiftGrasp::kind))                       .$addGroupBy(groupBy -> groupBy.vendor().name())                       .$addGroupBy(GiftGrasp::kind);               GraphCollection&lt;Selection> selections = searchClient.selectionSearch(selectionWith);               ArrayNode reportRows = objectMapper.createArrayNode();             selections.forEach(selection -> {                 ObjectNode objectNode = objectMapper.createObjectNode();                 objectNode.put(\"vendor\", selection.$getCalculated(\"vendor\", String.class));                 objectNode.put(\"kind\", selection.$getCalculated(\"kind\", String.class));                 objectNode.put(\"giftsCount\", selection.$getCalculated(\"giftsCount\", Integer.class));                 reportRows.add(objectNode);             });             response.set(\"report\", reportRows);           } catch (SdkJsonRpcClientException e) {             LOG.error(e.getMessage());             response.put(\"error\", e.getMessage());         }           return response;     }<\/code><\/pre>\n<p>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f SelectionWith \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430\u043c\u0438.<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 $withGroup \u043f\u0435\u0440\u0432\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u043b\u0438\u0430\u0441 \u043f\u043e\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0451\u043d \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435. \u0412\u0442\u043e\u0440\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c $withGroup \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 groupSelector, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u0434\u0430\u043d\u043d\u044b\u0435, \u0431\u0443\u0434\u044c \u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u043a\u0430\u043a \u043e\u043d\u043e \u0435\u0441\u0442\u044c \u0438\u043b\u0438 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f.<\/p>\n<p>\u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 $addGroupBy \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u044f, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 SelectionWith \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0432\u044b\u0437\u043e\u0432 DataspaceCoreSearchClient#selectionSearch. \u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c JSON-\u043e\u0442\u0432\u0435\u0442. \u041c\u0435\u0442\u043e\u0434 Selection#$getCalculated \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Selection, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0438\u0445 \u043a \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u043c\u0443 \u0442\u0438\u043f\u0443 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<h2>\u041f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0433\u043e\u0442\u043e\u0432\u044b, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0435 \u0432 zip-\u0430\u0440\u0445\u0438\u0432 \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 SmartMarket Studio:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/confluence.sberbank.ru\/download\/attachments\/6953210819\/vouchers.zip?api=v2&amp;modificationDate=1648714931755&amp;version=1\">vouchers.zip<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/confluence.sberbank.ru\/download\/attachments\/6953210819\/gifts.zip?api=v2&amp;modificationDate=1648714945544&amp;version=1\">gifts.zip<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/confluence.sberbank.ru\/download\/attachments\/6953210819\/report.zip?api=v2&amp;modificationDate=1648714953581&amp;version=1\">report.zip<\/a><\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/499\/5bb\/4cb\/4995bb4cbc23551a4bd956df4c5429ce.png\" width=\"1882\" height=\"813\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/499\/5bb\/4cb\/4995bb4cbc23551a4bd956df4c5429ce.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0430\u0442\u0435\u043c \u0436\u043c\u0451\u043c \u043a\u043d\u043e\u043f\u043a\u0443 \u00ab<em>\u041e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c\u00bb<\/em> \u0438 \u0436\u0434\u0451\u043c, \u043f\u043e\u043a\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0437\u0430\u0434\u0435\u043f\u043b\u043e\u044f\u0442\u0441\u044f.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0434\u0435\u043f\u043b\u043e\u044f \u043d\u0430 \u0432\u043a\u043b\u0430\u0434\u043a\u0435 \u00ab<em>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u00bb\u00a0<\/em>\u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0448\u0438\u0445 API:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/099\/a77\/f11\/099a77f11f1f1c2baa7db03222d56c5b.png\" width=\"1869\" height=\"779\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/099\/a77\/f11\/099a77f11f1f1c2baa7db03222d56c5b.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0418\u0442\u043e\u0433<\/h2>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Platform V Functions \u0438 DataSpace SDK \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0438 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u043b\u0438 \u0434\u0432\u0430 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0445 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430:<\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u0434\u0430\u0440\u043a\u0438:<\/p>\n<\/li>\n<\/ul>\n<p>a) \u0412\u0435\u0434\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0439-\u0441\u043f\u043e\u043d\u0441\u043e\u0440\u043e\u0432 \u0438 \u0438\u0445 \u043f\u043e\u0434\u0430\u0440\u043a\u043e\u0432. <\/p>\n<p>b)\u00a0 \u0410\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0443\u0447\u0451\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. <\/p>\n<ul>\n<li>\n<p>\u00b7\u041f\u0440\u043e\u043c\u043e\u0430\u043a\u0446\u0438\u0438:<\/p>\n<\/li>\n<\/ul>\n<p>a)\u00a0 \u0412\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u043c\u043e\u0430\u043a\u0446\u0438\u0439 \u0438 \u0432\u0430\u0443\u0447\u0435\u0440\u043e\u0432 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430. <\/p>\n<p>b) \u0420\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u0430\u0440\u043a\u043e\u0432 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u0440\u043e\u043c\u043e\u0430\u043a\u0446\u0438\u0439 (\u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c \u00ab\u041f\u043e\u0434\u0430\u0440\u043a\u0438\u00bb).<\/p>\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0441\u043a\u0440\u043e\u0435\u043c \u0444\u0438\u0447\u0438 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Platform V Functions \u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a \u0435\u0449\u0451 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b Platform V.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/sberbank\/blog\/662397\/\"> https:\/\/habr.com\/ru\/company\/sberbank\/blog\/662397\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412 <a href=\"https:\/\/habr.com\/ru\/company\/sberbank\/blog\/655817\/\">\u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 frontend \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Platform V DataSpace. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u044b\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d TypeScript, \u043d\u043e, \u043a\u0430\u043a \u043c\u044b \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438, \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c backend-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Java \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 Platform V Functions \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 DataSpace SDK.<\/p>\n<p>Platform V Functions \u2014 \u044d\u0442\u043e FaaS-\u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 \u0432\u0438\u0434\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 OpenShift\/k8s \u0431\u0435\u0437 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f docker-\u043e\u0431\u0440\u0430\u0437\u043e\u0432 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041d\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0443\u0434\u0435\u043b\u0438\u043c \u0434\u0430\u0436\u0435 \u043d\u0435 Functions, \u0430 DataSpace SDK. \u042d\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 DataSpace \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 <a href=\"https:\/\/www.jsonrpc.org\/specification\">JSON-RPC<\/a>. \u041f\u043e \u0445\u043e\u0434\u0443 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0444\u0438\u0447\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 DataSpace SDK \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 Java-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u00ab\u041f\u0440\u043e\u043c\u043e\u0430\u043a\u0446\u0438\u044f\u00bb<\/h2>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441\u043d\u043e\u0432\u0430 \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u00ab\u041f\u0440\u043e\u043c\u043e\u0430\u043a\u0446\u0438\u044f\u00bb \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>\u0418\u0437\u043c\u0435\u043d\u0438\u043c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0440\u0430\u0437\u0431\u0438\u0432 \u0435\u0433\u043e \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u044b \u0438 \u043f\u043e\u0434\u0430\u0440\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u0435\u0441\u0442\u0438\u0441\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438, \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0441\u0432\u043e\u0439 DataSpace \u0441\u043e \u0441\u0432\u043e\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p><strong>Function 1 Vouchers<\/strong> \u2014 backend-\u0441\u0435\u0440\u0432\u0438\u0441, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u043e\u0432.<\/p>\n<p><strong>Function 2 Gifts<\/strong> \u2014 backend-\u0441\u0435\u0440\u0432\u0438\u0441, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0430\u0440\u043a\u043e\u0432.<\/p>\n<p><strong>Function 3 Report<\/strong> \u2014 backend-\u0441\u0435\u0440\u0432\u0438\u0441, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0442\u0447\u0451\u0442\u044b \u043e \u043f\u043e\u0434\u0430\u0440\u043a\u0430\u0445.<\/p>\n<h2>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/h2>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u0434\u0432\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430:<\/p>\n<ul>\n<li>\n<p>\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a Vouchers \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u0430\u043c\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a Gifts \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0434\u0430\u0440\u043a\u0430\u043c\u0438.<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 DataSpace \u0432 \u0441\u0432\u043e\u0451\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0432 SmartMarket Studio. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/sberbank\/blog\/655817\/\">\u0437\u0434\u0435\u0441\u044c<\/a>, \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u00ab\u0420\u0430\u0431\u043e\u0442\u0430\u00bb \u0432 SmartMarket Studio.<\/p>\n<p>\u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e DataSpace \u0431\u0443\u0434\u0435\u0442 \u0441\u0432\u043e\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/confluence.sberbank.ru\/download\/attachments\/6953210819\/model.xml?api=v2&amp;modificationDate=1646146471219&amp;version=2\">vouchers_model.xml<\/a> \u2014 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f\u00a0DataSpace Vouchers;<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/confluence.sberbank.ru\/download\/attachments\/6953210819\/model.xml?api=v2&amp;modificationDate=1646146471219&amp;version=2\">gifts_model.xml<\/a> \u2014 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f\u00a0DataSpace Gifts.<\/p>\n<\/li>\n<\/ul>\n<p>Voucher \u0438 Gift \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u043c\u0435\u044e\u0442 \u0441\u0432\u044f\u0437\u044c OneToOne. \u041d\u043e \u0442\u0438\u043f \u044d\u0442\u043e\u0439 \u0441\u0432\u044f\u0437\u0438 \u00ab\u0438\u0437 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b\u00bb, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u044f\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0441\u0435\u0440\u0432\u0438\u0441\u044b DataSpace \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432.<\/p>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a Vouchers\u00a0\u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0432 \u0441\u0432\u043e\u0451\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a Gifts\u00a0\u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0432 \u0441\u0432\u043e\u0451\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Gifts Function, Reports Function:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u00ab\u043d\u0430\u0447\u0438\u043d\u043a\u0438\u00bb \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u2014 \u044d\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0445\u043e\u0440\u043e\u0448\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u0432\u0441\u0435\u043c Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<h2>\u0421\u0435\u0440\u0432\u0438\u0441 Voucher<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0432\u043a\u043b\u0430\u0434\u043a\u0443 \u00ab<em>\u0414\u0435\u0442\u0430\u043b\u0438\u00bb<\/em> \u0438 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 DataSpace SDK \u2014 \u043e\u043d \u0431\u044b\u043b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u043f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 DataSpace Vouchers.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u0437\u0430 \u043e\u0441\u043d\u043e\u0432\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439-\u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043e\u043a. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u0445 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0443\u043d\u043a\u0442 \u00ab\u042d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u00bb:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 src\/libs jar, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0438\u0437 \u0441\u043a\u0430\u0447\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u043d\u0435\u0435 \u0430\u0440\u0445\u0438\u0432\u0430. <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f java-sdk-core \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0438 REST-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 ak\/sk. \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u043f\u043e <a href=\"https:\/\/support.hc.sbercloud.ru\/devg\/apisign\/api-sign-sdk-java.html\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>, \u0434\u043e\u0441\u0442\u0430\u0451\u043c \u0438\u0437 \u0430\u0440\u0445\u0438\u0432\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u00a0src\/libs \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 pom.xml \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u0432<em>\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0434 \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445.<br \/>\u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0441\u0442\u0440\u043e\u0433\u043e\u0439 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430.<\/em><\/p>\n<pre><code class=\"java\">        &lt;dependency>             &lt;groupId>sbp.com.sbt.dataspace&lt;\/groupId>             &lt;artifactId>m7063364230573391874-model-sdk&lt;\/artifactId>             &lt;version>0.0.1&lt;\/version>             &lt;scope>system&lt;\/scope>             &lt;systemPath>${project.basedir}\/src\/libs\/m7063364230573391874-model-sdk-0.0.3.jar&lt;\/systemPath>         &lt;\/dependency>          \u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b DataSpace SDK         &lt;dependency>             &lt;groupId>org.apache.httpcomponents&lt;\/groupId>             &lt;artifactId>httpclient&lt;\/artifactId>         &lt;\/dependency>         &lt;dependency>             &lt;groupId>io.projectreactor.netty&lt;\/groupId>             &lt;artifactId>reactor-netty&lt;\/artifactId>         &lt;\/dependency>         &lt;dependency>             &lt;groupId>org.springframework&lt;\/groupId>             &lt;artifactId>spring-webflux&lt;\/artifactId>         &lt;\/dependency>         &lt;dependency>             &lt;groupId>org.apache.commons&lt;\/groupId>             &lt;artifactId>commons-lang3&lt;\/artifactId>         &lt;\/dependency>         &lt;dependency>             &lt;groupId>com.google.guava&lt;\/groupId>             &lt;artifactId>guava&lt;\/artifactId>             &lt;version>26.0-jre&lt;\/version>         &lt;\/dependency>   \u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0438 REST-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 ak\/sk         &lt;dependency>             &lt;groupId>sbp.ts.faas&lt;\/groupId>             &lt;artifactId>java-sdk-core&lt;\/artifactId>             &lt;version>3.1.2&lt;\/version>             &lt;scope>system&lt;\/scope>             &lt;systemPath>${project.basedir}\/src\/libs\/java-sdk-core-3.1.2.jar&lt;\/systemPath>         &lt;\/dependency>   \u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b java-sdk-core         &lt;dependency>             &lt;groupId>joda-time&lt;\/groupId>             &lt;artifactId>joda-time&lt;\/artifactId>             &lt;version>2.10.3&lt;\/version>         &lt;\/dependency> <\/code><\/pre>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 Vouchers \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c REST API, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434 \u0438 \u0442\u0438\u043f \u043f\u043e\u0434\u0430\u0440\u043a\u0430. \u0412 \u043e\u0442\u0432\u0435\u0442 \u043e\u043d \u043e\u0442\u0434\u0430\u0451\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0434\u0430\u0440\u043a\u0430.<\/p>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c API \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435:<\/p>\n<pre><code class=\"java\">@RestController public class VouchersController {     @Autowired     private VouchersService vouchersService;       @RequestMapping(value = \"\/getGiftByPromoCode\")     public ResponseEntity&lt;String> getGiftByPromoCode(@RequestParam String voucherCode, @RequestParam String giftKind) {         return ResponseEntity.ok()                 .contentType(MediaType.TEXT_PLAIN)                 .body(vouchersService.getGift(voucherCode, giftKind));     } }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.\u00a0\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u044b DataspaceCorePacketClient \u0438 DataspaceCoreSearchClient. \u041d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0430\u0434\u0440\u0435\u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 DataSpace \u0438 ak\/sk \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 API gateway. \u0412\u0441\u0435 \u044d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0437 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 DATASPACE_URL, APP_KEY, APP_SECRET.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f RestTemplate \u0434\u043b\u044f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0443 Gifts:<\/p>\n<pre><code class=\"java\">@Configuration public class Config {       @Value(\"${DATASPACE_URL}\")     private String dataSpaceUrl;     @Value(\"${APP_KEY}\")     private String appKey;     @Value(\"${APP_SECRET}\")     private String appSecret;       @Bean     public RestTemplate restTemplate() {         return new RestTemplate();     }       @Bean     public DataspaceCoreSearchClient searchClient() {         return new DataspaceCoreSearchClient(dataSpaceUrl,                 DataspaceSdkApiClientConfiguration.of(builder ->                         builder                                 .setApiGatewayConfiguration(AKSKApiGatewayConfiguration.of(appKey, appSecret))                 )         );     }       @Bean     public DataspaceCorePacketClient packetClient() {         return new DataspaceCorePacketClient(dataSpaceUrl,                 DataspaceSdkApiClientConfiguration.of(builder ->                         builder                                 .setApiGatewayConfiguration(AKSKApiGatewayConfiguration.of(appKey, appSecret))                 )         );     }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>\u0430\u0434\u0440\u0435\u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u0430;<\/p>\n<\/li>\n<li>\n<p>appKey;<\/p>\n<\/li>\n<li>\n<p>appSecret.<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430\u0439\u0442\u0438 \u044d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 config.yaml \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438:<\/p>\n<pre><code class=\"java\">gifts.url: https:\/\/gw-ift-sm.pv-api-test.sbc.space\/fn_fa969687_4694_4b3e_a871_5g42q56he710 gifts.appKey: d9ad1de7d38f493793c407061dc1111e gifts.appSecret: a418e8315cf0222fbf4784811fe3dc8a<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 VoucherService.<\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0437\u0430\u043a\u0430\u0437\u0430 \u043f\u043e\u0434\u0430\u0440\u043a\u0430 \u043f\u043e \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u0443 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<ol>\n<li>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0441 \u0444\u0440\u043e\u043d\u0442\u0430 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441 Vouchers, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0448\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0441\u0435\u0440\u0432\u0438\u0441 Vouchers \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 Gifts \u043f\u043e REST.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 Gifts \u0434\u043e\u043b\u0436\u0435\u043d \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043f\u043e\u0434\u0430\u0440\u043e\u043a \u0438 \u0437\u0430\u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043b\u0438\u0431\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u0442\u0432\u0435\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u043f\u043e\u0434\u0430\u0440\u043a\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 Vouchers \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u043e\u0434\u0430\u0440\u043a\u0430, \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0435\u0433\u043e \u043a \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u0443 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0441 \u0441\u0435\u0440\u0438\u0439\u043d\u044b\u043c \u043d\u043e\u043c\u0435\u0440\u043e\u043c \u043f\u043e\u0434\u0430\u0440\u043a\u0430 \u0438 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u0434\u0430\u0440\u043e\u043a \u043d\u0435 \u0431\u044b\u043b \u043d\u0430\u0439\u0434\u0435\u043d, \u0441\u0435\u0440\u0432\u0438\u0441 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043e\u0442\u0432\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0443:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">    public String getGiftByPromoCode(String code,                                      String giftKind) {         try {             String voucherId = verifyPromoCode(code);               JsonNode giftResponse = getGift(giftKind, voucherId);               JsonNode error = giftResponse.get(\"error\");             if (error != null) {                 return error.textValue();             }               updateVoucher(voucherId, giftResponse.get(\"giftId\").textValue());             return \"You have been given a gift from \" + giftResponse.get(\"vendor\") + \". Serial number: \" + giftResponse.get(\"serialNumber\");         } catch (Exception e) {             LOG.error(e.getMessage());             return e.getMessage();         }     }<\/code><\/pre>\n<p>\u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 getGiftsByPromoCode \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434 \u0432\u0430\u043b\u0438\u0434\u0435\u043d. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434 \u0441 \u0442\u0430\u043a\u0438\u043c \u043a\u043e\u0434\u043e\u043c \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438 \u043e\u043d \u043d\u0435 \u0431\u044b\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0440\u0430\u043d\u0435\u0435.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043c\u0435\u0442\u043e\u0434 verifyPromoCode:<\/p>\n<pre><code class=\"java\">    public String verifyPromoCode(String code) throws SdkJsonRpcClientException {         try {             VoucherGet voucher = searchClient.getVoucher(voucherWith ->                     voucherWith                             .withCode()                             .withStatusForVoucherMain(StatusWithLinkable::withCode)                             .withGift()                               .setWhere(where -> where.codeEq(code)));               if (voucher.getGift().getEntityId() != null ||                     !voucher.getStatusForVoucherMain().getCode().equals(VoucherVoucherMainStatus.OPEN.getValue())) {                 throw new GiftAlreadyIssuedException(code);             }               return voucher.getObjectId();         } catch (ObjectNotFoundException objectNotFoundException) {             throw new VoucherNotFoundException(code);         }     }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 DataspaceCoreSearchClient#getVoucher \u0438\u0437 \u0441\u043e\u0441\u0442\u0430\u0432\u0430<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-332267","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/332267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=332267"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/332267\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=332267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=332267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=332267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}