Commit e6cea6c22a93fab60e00c9eb2f19685d37215af0

Authored by AlexDiatlov
1 parent 17b763d0

add payment_wrapper/client, payment keyword, chahge output of complaint creation

... ... @@ -70,8 +70,17 @@ Library openprocurement_client.utils
70 70 Log ${auth_ds}
71 71
72 72 ${ds_config}= Create Dictionary host_url=${ds_host_url} auth_ds=${auth_ds}
73   - ${plan_api_wrapper}= prepare_plan_api_wrapper ${USERS.users['${username}'].api_key} PLANS ${API_HOST_URL} ${API_VERSION}
74   - ${tender_api_wrapper}= prepare_api_wrapper ${USERS.users['${username}'].api_key} TENDERS ${API_HOST_URL} ${API_VERSION} ${ds_config}
  73 + ${plan_api_wrapper}= prepare_plan_api_wrapper
  74 + ... ${USERS.users['${username}'].api_key}
  75 + ... PLANS
  76 + ... ${API_HOST_URL}
  77 + ... ${API_VERSION}
  78 + ${tender_api_wrapper}= prepare_api_wrapper
  79 + ... ${USERS.users['${username}'].api_key}
  80 + ... TENDERS
  81 + ... ${API_HOST_URL}
  82 + ... ${API_VERSION}
  83 + ... ${ds_config}
75 84 ${tender_create_wrapper}= prepare_tender_create_wrapper
76 85 ... ${USERS.users['${username}'].api_key}
77 86 ... PLANS
... ... @@ -91,7 +100,17 @@ Library openprocurement_client.utils
91 100 ... ${API_HOST_URL}
92 101 ... ${API_VERSION}
93 102 ... ${ds_config}
94   - ${agreement_wrapper}= prepare_agreement_api_wrapper ${USERS.users['${username}'].api_key} AGREEMENTS ${API_HOST_URL} ${API_VERSION} ${ds_config}
  103 + ${agreement_wrapper}= prepare_agreement_api_wrapper
  104 + ... ${USERS.users['${username}'].api_key}
  105 + ... AGREEMENTS
  106 + ... ${API_HOST_URL}
  107 + ... ${API_VERSION}
  108 + ... ${ds_config}
  109 + ${payment_wrapper}= prepare_payment_wrapper
  110 + ... ${USERS.users['${username}'].api_key}
  111 + ... PUSH
  112 + ... ${PAYMENT_API}
  113 + ... ${PAYMENT_API_VERSION}
95 114 Set To Dictionary ${USERS.users['${username}']} client=${tender_api_wrapper}
96 115 Set To Dictionary ${USERS.users['${username}']} plan_client=${plan_api_wrapper}
97 116 Set To Dictionary ${USERS.users['${username}']} tender_create_client=${tender_create_wrapper}
... ... @@ -99,11 +118,17 @@ Library openprocurement_client.utils
99 118 Set To Dictionary ${USERS.users['${username}']} dasu_client=${dasu_api_wraper}
100 119 Set To Dictionary ${USERS.users['${username}']} access_token=${EMPTY}
101 120 Set To Dictionary ${USERS.users['${username}']} amcu_client=${amcu_api_wrapper}
  121 + Set To Dictionary ${USERS.users['${username}']} payment_client=${payment_wrapper}
102 122 ${id_map}= Create Dictionary
103 123 Set To Dictionary ${USERS.users['${username}']} id_map=${id_map}
104 124 Log ${EDR_HOST_URL}
105 125 Log ${EDR_VERSION}
106   - ${edr_wrapper}= prepare_edr_wrapper ${EDR_HOST_URL} ${EDR_VERSION} ${USERS.users['${username}'].auth_edr[0]} ${USERS.users['${username}'].auth_edr[1]}
  126 + ${edr_wrapper}= prepare_edr_wrapper
  127 + ... ${EDR_HOST_URL}
  128 + ... ${EDR_VERSION}
  129 + ... ${USERS.users['${username}'].auth_edr[0]}
  130 + ... ${USERS.users['${username}'].auth_edr[1]}
  131 + Log ${edr_wrapper}
107 132 Set To Dictionary ${USERS.users['${username}']} edr_client=${edr_wrapper}
108 133 #Variables for contracting_management module
109 134 ${contract_api_wrapper}= prepare_contract_api_wrapper ${USERS.users['${username}'].api_key} CONTRACTS ${api_host_url} ${api_version} ${ds_config}
... ... @@ -902,8 +927,8 @@ Library openprocurement_client.utils
902 927
903 928 Створити чернетку скарги про виправлення умов закупівлі
904 929 [Documentation] Створює скаргу у статусі "draft"
905   - [Arguments] ${username} ${tender_uaid} ${complaint}
906   - Log ${complaint}
  930 + [Arguments] ${username} ${tender_uaid} ${complaint_data}
  931 + Log ${complaint_data}
907 932 ${tender}= openprocurement_client.Пошук тендера по ідентифікатору
908 933 ... ${username}
909 934 ... ${tender_uaid}
... ... @@ -911,11 +936,11 @@ Library openprocurement_client.utils
911 936 ... ${USERS.users['${username}'].client}
912 937 ... create_complaint
913 938 ... ${tender.data.id}
914   - ... ${complaint}
  939 + ... ${complaint_data}
915 940 ... access_token=${tender.access.token}
916 941 Log ${reply}
917 942 Set To Dictionary ${USERS.users['${username}']} complaint_access_token=${reply.access.token}
918   - [return] ${reply.data.complaintID}
  943 + [return] ${reply.data}
919 944
920 945
921 946 Створити чернетку вимоги про виправлення умов лоту
... ... @@ -1232,6 +1257,14 @@ Library openprocurement_client.utils
1232 1257 Log ${reply}
1233 1258
1234 1259
  1260 +Виконати оплату скарги
  1261 + [Documentation] Виконує запит на push в liqpay
  1262 + [Arguments] ${username} ${payment_data}
  1263 + ${payment}= Run Keyword And Ignore Error call method ${USERS.users['${username}'].payment_client} create_payment
  1264 + ... ${payment_data}
  1265 + Log ${payment}
  1266 +
  1267 +
1235 1268 Змінити статус скарги
1236 1269 [Documentation] Переводить скаргу в tender/lot в інший статус
1237 1270 [Arguments] ${username} ${tender_uaid} ${complaintID} ${confirmation_data}
... ...
... ... @@ -12,6 +12,7 @@ from time import sleep
12 12 import os
13 13 import urllib
14 14 from openprocurement_client.resources.tenders import TenderCreateClient
  15 +from openprocurement_client.resources.tenders import PaymentClient
15 16
16 17
17 18 def retry_if_request_failed(exception):
... ... @@ -208,8 +209,7 @@ class StableTenderCreateClient(TenderCreateClient):
208 209
209 210
210 211 def prepare_tender_create_wrapper(key, resource, host_url, api_version, ds_config=None):
211   - return StableTenderCreateClient(key, resource, host_url, api_version,
212   - ds_config=ds_config)
  212 + return StableTenderCreateClient(key, resource, host_url, api_version, ds_config=ds_config)
213 213
214 214
215 215 class StableClientAmcu(Client):
... ... @@ -221,3 +221,14 @@ class StableClientAmcu(Client):
221 221
222 222 def prepare_amcu_api_wrapper(key, resource, host_url, api_version, ds_config=None):
223 223 return StableClientAmcu(key, resource, host_url, api_version, ds_config=ds_config)
  224 +
  225 +
  226 +class StableClientPayment(PaymentClient):
  227 + @retry(stop_max_attempt_number=100, wait_random_min=500,
  228 + wait_random_max=4000, retry_on_exception=retry_if_request_failed)
  229 + def request(self, *args, **kwargs):
  230 + return super(StableClientPayment, self).request(*args, **kwargs)
  231 +
  232 +
  233 +def prepare_payment_wrapper(key, resource, host_url, api_version):
  234 + return StableClientPayment(key, resource, host_url, api_version)
... ...
Please register or login to post a comment