Current section
2 Versions
Jump to
Current section
2 Versions
Compare versions
4
files changed
+381
additions
-69
deletions
| @@ -2,8 +2,8 @@ | |
| 2 2 | {<<"build_tools">>,[<<"mix">>]}. |
| 3 3 | {<<"description">>,<<"TENDER Smart Tender Prozorro Middleware">>}. |
| 4 4 | {<<"files">>, |
| 5 | - [<<"lib">>,<<"lib/upload.ex">>,<<"lib/download.ex">>,<<"lib/app.ex">>, |
| 6 | - <<"lib/plan.txt">>,<<"mix.exs">>]}. |
| 5 | + [<<"lib">>,<<"lib/app.ex">>,<<"lib/download.ex">>,<<"lib/upload.ex">>, |
| 6 | + <<"mix.exs">>]}. |
| 7 7 | {<<"licenses">>,[<<"ISC">>]}. |
| 8 8 | {<<"links">>,[{<<"GitHub">>,<<"https://github.com/erpuno/tender">>}]}. |
| 9 9 | {<<"name">>,<<"tender">>}. |
| @@ -18,4 +18,4 @@ | |
| 18 18 | {<<"optional">>,false}, |
| 19 19 | {<<"repository">>,<<"hexpm">>}, |
| 20 20 | {<<"requirement">>,<<"~> 8.12.1">>}]]}. |
| 21 | - {<<"version">>,<<"0.11.0">>}. |
| 21 | + {<<"version">>,<<"0.12.0">>}. |
| @@ -3,6 +3,10 @@ defmodule TENDER do | |
| 3 3 | require N2O |
| 4 4 | use Application |
| 5 5 | |
| 6 | + def verify() do |
| 7 | + {:ssl, [{:verify, :verify_none}]} |
| 8 | + end |
| 9 | + |
| 6 10 | def start(_, _) do |
| 7 11 | :logger.add_handlers(:n2o) |
| 8 12 | app = Supervisor.start_link([], strategy: :one_for_one, name: TENDER) |
| @@ -92,7 +96,7 @@ defmodule TENDER do | |
| 92 96 | accept = 'application/json' |
| 93 97 | headers = [{'Authorization',bearer},{'accept',accept}] |
| 94 98 | {:ok,{{_,status,_},_headers,body}} = :httpc.request(:post, {url, headers, accept, :jsone.encode(json)}, |
| 95 | - [{:timeout,100000}], [{:body_format,:binary}]) |
| 99 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 96 100 | |
| 97 101 | info '~p', [{body}] |
| 98 102 | case status do |
| @@ -109,6 +113,58 @@ defmodule TENDER do | |
| 109 113 | end |
| 110 114 | end |
| 111 115 | |
| 116 | + def downloadFile(tender,file) do |
| 117 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'Tenders/' ++ to_list(tender) ++ '/documents/' ++ to_list(file) |
| 118 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 119 | + accept = 'text/plain' |
| 120 | + headers = [{'Authorization',bearer},{'accept',accept}] |
| 121 | + {:ok,{{_,status,_},_headers,body}} = :httpc.request(:get, {url, headers}, |
| 122 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 123 | + |
| 124 | + case status do |
| 125 | + 200 -> |
| 126 | + case decode(body) do |
| 127 | + y when is_map(y) -> |
| 128 | + [ |
| 129 | + id: convert(:maps.get("id", y, [])), |
| 130 | + title: convert(:maps.get("title", y, [])), |
| 131 | + url: convert(:maps.get("url", y, [])), |
| 132 | + dateModified: convert(:maps.get("dateModified", y, [])), |
| 133 | + ] |
| 134 | + _ -> [] |
| 135 | + end |
| 136 | + _ -> info 'ERROR/downloadFile: ~p', [status] |
| 137 | + |
| 138 | + end |
| 139 | + end |
| 140 | + |
| 141 | + def listFiles(id) do |
| 142 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'Tenders/' ++ to_list(id) ++ '/documents' |
| 143 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 144 | + accept = 'text/plain' |
| 145 | + headers = [{'Authorization',bearer},{'accept',accept}] |
| 146 | + {:ok,{{_,status,_},_headers,body}} = :httpc.request(:get, {url, headers}, |
| 147 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 148 | + |
| 149 | + case status do |
| 150 | + 200 -> |
| 151 | + case decode(body) do |
| 152 | + x when is_list(x) -> |
| 153 | + :lists.map(fn y -> |
| 154 | + [ |
| 155 | + id: convert(:maps.get("id", y, [])), |
| 156 | + title: convert(:maps.get("title", y, [])), |
| 157 | + url: convert(:maps.get("url", y, [])), |
| 158 | + dateModified: convert(:maps.get("dateModified", y, [])), |
| 159 | + ] |
| 160 | + end, x) |
| 161 | + _ -> [] |
| 162 | + end |
| 163 | + _ -> info 'ERROR/listFiles: ~p', [status] |
| 164 | + |
| 165 | + end |
| 166 | + end |
| 167 | + |
| 112 168 | def addFile(id) do |
| 113 169 | |
| 114 170 | json = [ |
| @@ -125,7 +181,7 @@ defmodule TENDER do | |
| 125 181 | accept = 'application/json' |
| 126 182 | headers = [{'Authorization',bearer},{'accept',accept}] |
| 127 183 | {:ok,{{_,status,_},_headers,body}} = :httpc.request(:post, {url, headers, accept, file}, |
| 128 | - [{:timeout,100000}], [{:body_format,:binary}]) |
| 184 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 129 185 | |
| 130 186 | info '~p', [{url,file}] |
| 131 187 | case status do |
| @@ -179,7 +235,7 @@ defmodule TENDER do | |
| 179 235 | accept = 'application/json' |
| 180 236 | headers = [{'Authorization',bearer},{'accept','text/plain'},{'Content-Type',accept}] |
| 181 237 | {:ok,{{_,status,_},_headers,body}} = :httpc.request(:post, {url, headers, accept, :jsone.encode(json)}, |
| 182 | - [{:timeout,100000}], [{:body_format,:binary}]) |
| 238 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 183 239 | |
| 184 240 | case status do |
| 185 241 | 201 -> |
| @@ -238,7 +294,7 @@ defmodule TENDER do | |
| 238 294 | accept = 'application/json' |
| 239 295 | headers = [{'Authorization',bearer},{'accept','text/plain'},{'Content-Type',accept}] |
| 240 296 | {:ok,{{_,status,_},_headers,body}} = :httpc.request(:post, {url, headers, accept, :jsone.encode(json)}, |
| 241 | - [{:timeout,100000}], [{:body_format,:binary}]) |
| 297 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 242 298 | |
| 243 299 | case status do |
| 244 300 | 201 -> |
| @@ -268,7 +324,7 @@ defmodule TENDER do | |
| 268 324 | bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 269 325 | headers = [{'Authorization',bearer},{'accept','text/plain'}] |
| 270 326 | {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 271 | - [{:timeout,100000}], [{:body_format,:binary}]) |
| 327 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 272 328 | json = case decode(body) do |
| 273 329 | x when is_map(x) -> |
| 274 330 | [ mode: :maps.get("mode", x, []), |
| @@ -296,7 +352,7 @@ defmodule TENDER do | |
| 296 352 | bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 297 353 | headers = [{'Authorization',bearer},{'accept','text/plain'}] |
| 298 354 | {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 299 | - [{:timeout,100000}], [{:body_format,:binary}]) |
| 355 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 300 356 | json = case decode(body) do |
| 301 357 | x when is_map(x) -> |
| 302 358 | [ |
| @@ -326,7 +382,7 @@ defmodule TENDER do | |
| 326 382 | bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 327 383 | headers = [{'Authorization',bearer},{'accept','text/plain'}] |
| 328 384 | {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 329 | - [{:timeout,100000}], [{:body_format,:binary}]) |
| 385 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 330 386 | json = case :jsone.decode(body) do |
| 331 387 | x = %{} -> x |
| 332 388 | _ -> [] |
| @@ -345,7 +401,7 @@ defmodule TENDER do | |
| 345 401 | bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 346 402 | headers = [{'Authorization',bearer},{'accept','text/plain'}] |
| 347 403 | {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 348 | - [{:timeout,100000}], [{:body_format,:binary}]) |
| 404 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 349 405 | json = case :jsone.decode(body) do |
| 350 406 | x = %{} -> x |
| 351 407 | _ -> [] |
| @@ -359,4 +415,317 @@ defmodule TENDER do | |
| 359 415 | [lastDateModified: lastDateModified, data: list] |
| 360 416 | end |
| 361 417 | |
| 418 | + def catTenderStatuses() do |
| 419 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/tenderStatuses' |
| 420 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 421 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 422 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 423 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 424 | + json = :jsone.decode(body) |
| 425 | + :lists.map fn map -> |
| 426 | + title = :maps.get "title", map, [] |
| 427 | + id = :maps.get "id", map, [] |
| 428 | + {id,title} end, json |
| 429 | + end |
| 430 | + |
| 431 | + def catLotStatuses() do |
| 432 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/lotStatuses' |
| 433 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 434 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 435 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 436 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 437 | + json = :jsone.decode(body) |
| 438 | + :lists.map fn map -> |
| 439 | + title = :maps.get "title", map, [] |
| 440 | + id = :maps.get "id", map, [] |
| 441 | + {id,title} end, json |
| 442 | + end |
| 443 | + |
| 444 | + def catUnits() do |
| 445 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/units' |
| 446 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 447 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 448 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 449 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 450 | + json = :jsone.decode(body) |
| 451 | + :lists.map fn map -> |
| 452 | + title = :maps.get "title", map, [] |
| 453 | + shortTitle = :maps.get "shortTitle", map, [] |
| 454 | + id = :maps.get "id", map, [] |
| 455 | + {id,shortTitle,title} end, json |
| 456 | + end |
| 457 | + |
| 458 | + def catCurrencies() do |
| 459 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/currencies' |
| 460 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 461 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 462 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 463 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 464 | + json = :jsone.decode(body) |
| 465 | + :lists.map fn map -> |
| 466 | + title = :maps.get "title", map, [] |
| 467 | + id = :maps.get "id", map, [] |
| 468 | + {id,title} end, json |
| 469 | + end |
| 470 | + |
| 471 | + def catCurrencies() do |
| 472 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/currencies' |
| 473 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 474 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 475 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 476 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 477 | + json = :jsone.decode(body) |
| 478 | + :lists.map fn map -> |
| 479 | + title = :maps.get "title", map, [] |
| 480 | + id = :maps.get "id", map, [] |
| 481 | + {id,title} end, json |
| 482 | + end |
| 483 | + |
| 484 | + def catTradeGoalTypes() do |
| 485 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/tradeGoalTypes' |
| 486 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 487 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 488 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 489 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 490 | + json = :jsone.decode(body) |
| 491 | + :lists.map fn map -> |
| 492 | + title = :maps.get "title", map, [] |
| 493 | + id = :maps.get "id", map, [] |
| 494 | + {id,title} end, json |
| 495 | + end |
| 496 | + |
| 497 | + def catProcurementMethodTypes() do |
| 498 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/procurementMethodTypes' |
| 499 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 500 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 501 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 502 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 503 | + json = :jsone.decode(body) |
| 504 | + :lists.map fn map -> |
| 505 | + title = :maps.get "title", map, [] |
| 506 | + id = :maps.get "id", map, [] |
| 507 | + {id,title} end, json |
| 508 | + end |
| 509 | + |
| 510 | + def catProcurementMethodRationales() do |
| 511 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/procurementMethodRationales' |
| 512 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 513 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 514 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 515 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 516 | + json = :jsone.decode(body) |
| 517 | + :lists.map fn map -> |
| 518 | + title = :maps.get "title", map, [] |
| 519 | + id = :maps.get "id", map, [] |
| 520 | + {id,title} end, json |
| 521 | + end |
| 522 | + |
| 523 | + def catIdentifierSchemes() do |
| 524 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/identifierSchemes' |
| 525 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 526 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 527 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 528 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 529 | + json = :jsone.decode(body) |
| 530 | + :lists.map fn map -> |
| 531 | + title = :maps.get "title", map, [] |
| 532 | + id = :maps.get "id", map, [] |
| 533 | + {id,title} end, json |
| 534 | + end |
| 535 | + |
| 536 | + def catClassificationSchemes() do |
| 537 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/classificationSchemes' |
| 538 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 539 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 540 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 541 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 542 | + json = :jsone.decode(body) |
| 543 | + :lists.map fn map -> |
| 544 | + title = :maps.get "title", map, [] |
| 545 | + id = :maps.get "id", map, [] |
| 546 | + {id,title} end, json |
| 547 | + end |
| 548 | + |
| 549 | + def catClassificationSchemes() do |
| 550 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/classificationSchemes' |
| 551 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 552 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 553 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 554 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 555 | + json = :jsone.decode(body) |
| 556 | + :lists.map fn map -> |
| 557 | + title = :maps.get "title", map, [] |
| 558 | + id = :maps.get "id", map, [] |
| 559 | + {id,title} end, json |
| 560 | + end |
| 561 | + |
| 562 | + def classificationSchemes(id) do |
| 563 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/classificationSchemes/' ++ URI.encode(id) |
| 564 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 565 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 566 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 567 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 568 | + json = :jsone.decode(body) |
| 569 | + :lists.map fn map -> |
| 570 | + title = :maps.get "title", map, [] |
| 571 | + id = :maps.get "id", map, [] |
| 572 | + {id,title} end, json |
| 573 | + end |
| 574 | + |
| 575 | + def catCities() do |
| 576 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/cities' |
| 577 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 578 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 579 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 580 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 581 | + json = :jsone.decode(body) |
| 582 | + :lists.map fn map -> |
| 583 | + cn = :maps.get "countryName", map, [] |
| 584 | + region = :maps.get "region", map, [] |
| 585 | + locality = :maps.get "locality", map, [] |
| 586 | + {cn,region,locality} end, json |
| 587 | + end |
| 588 | + |
| 589 | + def catMainProcurementCategories() do |
| 590 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/mainProcurementCategories' |
| 591 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 592 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 593 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 594 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 595 | + json = :jsone.decode(body) |
| 596 | + :lists.map fn map -> |
| 597 | + title = :maps.get "title", map, [] |
| 598 | + id = :maps.get "id", map, [] |
| 599 | + {id,title} end, json |
| 600 | + end |
| 601 | + |
| 602 | + def catDayTypes() do |
| 603 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/dayTypes' |
| 604 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 605 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 606 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 607 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 608 | + json = :jsone.decode(body) |
| 609 | + :lists.map fn map -> |
| 610 | + title = :maps.get "title", map, [] |
| 611 | + id = :maps.get "id", map, [] |
| 612 | + {id,title} end, json |
| 613 | + end |
| 614 | + |
| 615 | + def catPaymentTermEvents() do |
| 616 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/paymentTermEvents' |
| 617 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 618 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 619 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 620 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 621 | + json = :jsone.decode(body) |
| 622 | + :lists.map fn map -> |
| 623 | + title = :maps.get "title", map, [] |
| 624 | + id = :maps.get "id", map, [] |
| 625 | + {id,title} end, json |
| 626 | + end |
| 627 | + |
| 628 | + def catPaymentTermTypes() do |
| 629 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/paymentTermTypes' |
| 630 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 631 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 632 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 633 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 634 | + json = :jsone.decode(body) |
| 635 | + :lists.map fn map -> |
| 636 | + title = :maps.get "title", map, [] |
| 637 | + id = :maps.get "id", map, [] |
| 638 | + {id,title} end, json |
| 639 | + end |
| 640 | + |
| 641 | + def catComplaintTypes() do |
| 642 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/complaintTypes' |
| 643 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 644 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 645 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 646 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 647 | + json = :jsone.decode(body) |
| 648 | + :lists.map fn map -> |
| 649 | + title = :maps.get "title", map, [] |
| 650 | + id = :maps.get "id", map, [] |
| 651 | + {id,title} end, json |
| 652 | + end |
| 653 | + |
| 654 | + def catComplaintStatuses() do |
| 655 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/complaintStatuses' |
| 656 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 657 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 658 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 659 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 660 | + json = :jsone.decode(body) |
| 661 | + :lists.map fn map -> |
| 662 | + title = :maps.get "title", map, [] |
| 663 | + id = :maps.get "id", map, [] |
| 664 | + {id,title} end, json |
| 665 | + end |
| 666 | + |
| 667 | + def catBidStatuses() do |
| 668 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/bidStatuses' |
| 669 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 670 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 671 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 672 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 673 | + json = :jsone.decode(body) |
| 674 | + :lists.map fn map -> |
| 675 | + title = :maps.get "title", map, [] |
| 676 | + id = :maps.get "id", map, [] |
| 677 | + {id,title} end, json |
| 678 | + end |
| 679 | + |
| 680 | + def catAwardStatuses() do |
| 681 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/awardStatuses' |
| 682 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 683 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 684 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 685 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 686 | + json = :jsone.decode(body) |
| 687 | + :lists.map fn map -> |
| 688 | + title = :maps.get "title", map, [] |
| 689 | + id = :maps.get "id", map, [] |
| 690 | + {id,title} end, json |
| 691 | + end |
| 692 | + |
| 693 | + def catContractStatuses() do |
| 694 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/contractStatuses' |
| 695 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 696 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 697 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 698 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 699 | + json = :jsone.decode(body) |
| 700 | + :lists.map fn map -> |
| 701 | + title = :maps.get "title", map, [] |
| 702 | + id = :maps.get "id", map, [] |
| 703 | + {id,title} end, json |
| 704 | + end |
| 705 | + |
| 706 | + def catPreQualificationStatuses() do |
| 707 | + url = :application.get_env(:n2o, :tender_upload, []) ++ 'ReferenceBooks/preQualificationStatuses' |
| 708 | + bearer = :application.get_env(:n2o, :tender_bearer, []) |
| 709 | + headers = [{'Authorization',bearer},{'accept','*'}] |
| 710 | + {:ok,{status,_headers,body}} = :httpc.request(:get, {url, headers}, |
| 711 | + [{:timeout,100000},verify()], [{:body_format,:binary}]) |
| 712 | + json = :jsone.decode(body) |
| 713 | + :lists.map fn map -> |
| 714 | + title = :maps.get "title", map, [] |
| 715 | + id = :maps.get "id", map, [] |
| 716 | + {id,title} end, json |
| 717 | + end |
| 718 | + |
| 719 | + def dumpDKPP() do |
| 720 | + x = TENDER.classificationSchemes "ДКПП" |
| 721 | + :lists.map fn {x,y} -> :io.format '~ts:~ts~n', [x,y] end, :lists.sort(x) |
| 722 | + length(x) |
| 723 | + end |
| 724 | + |
| 725 | + def dumpDK21() do |
| 726 | + x = TENDER.classificationSchemes "ДК021" |
| 727 | + :lists.map fn {x,y} -> :io.format '~ts:~ts~n', [x,y] end, :lists.sort(x) |
| 728 | + length(x) |
| 729 | + end |
| 730 | + |
| 362 731 | end |
| @@ -1,57 +0,0 @@ | |
| 1 | - { |
| 2 | - "mode":"test", |
| 3 | - "tender":{ |
| 4 | - "procurementMethodType":"aboveThresholdUA", |
| 5 | - "tenderPeriod":{ |
| 6 | - "dateStart":"2021-06-01T00:00:00" |
| 7 | - } |
| 8 | - }, |
| 9 | - "classification":{ |
| 10 | - "scheme":"ДК021", |
| 11 | - "id":"22990000-6" |
| 12 | - }, |
| 13 | - "additionalClassifications":[ |
| 14 | - { |
| 15 | - "scheme":"КЕКВ", |
| 16 | - "id":"2000" |
| 17 | - } |
| 18 | - ], |
| 19 | - "budget":{ |
| 20 | - "year":2021, |
| 21 | - "description":"Test", |
| 22 | - "currency":"UAH", |
| 23 | - "amount":10000, |
| 24 | - "notes":"Notes", |
| 25 | - "yearPeriod":{ |
| 26 | - "yearFrom":2020, |
| 27 | - "yearTo":2020 |
| 28 | - }, |
| 29 | - "financingSources":[ |
| 30 | - { |
| 31 | - "title":"state", |
| 32 | - "description":"Description", |
| 33 | - "amount":12 |
| 34 | - } |
| 35 | - ] |
| 36 | - }, |
| 37 | - "items":[ |
| 38 | - { |
| 39 | - "description":"item description", |
| 40 | - "classification":{ |
| 41 | - "scheme":"ДК021", |
| 42 | - "id":"22990000-6" |
| 43 | - }, |
| 44 | - "unitCode":"H87", |
| 45 | - "quantity":7, |
| 46 | - "deliveryDate":{ |
| 47 | - "dateStart":"2021-06-07T00:00:00", |
| 48 | - "dateEnd":"2022-06-07T00:00:00" |
| 49 | - } |
| 50 | - } |
| 51 | - ], |
| 52 | - "organizer":{ |
| 53 | - "contactPoint":{ |
| 54 | - "login":"test@test.com" |
| 55 | - } |
| 56 | - } |
| 57 | - } |
| \ No newline at end of file |
| @@ -4,7 +4,7 @@ defmodule TENDER.Mixfile do | |
| 4 4 | def project do |
| 5 5 | [ |
| 6 6 | app: :tender, |
| 7 | - version: "0.11.0", |
| 7 | + version: "0.12.0", |
| 8 8 | description: "TENDER Smart Tender Prozorro Middleware", |
| 9 9 | package: package(), |
| 10 10 | deps: deps() |