Quellcode durchsuchen

New functions of payment

stucked_s vor 4 Monaten
Commit
33e2a606ec
3 geänderte Dateien mit 58 neuen und 0 gelöschten Zeilen
  1. 1 0
      __init__.py
  2. 53 0
      funcPayments.py
  3. 4 0
      testFunc.py

+ 1 - 0
__init__.py

@@ -0,0 +1 @@
+from .funcPayments import *

+ 53 - 0
funcPayments.py

@@ -0,0 +1,53 @@
+import requests
+
+def make_payment(data,headers):
+    url = "https://vtb.rbsuat.com/payment/rest/register.do"
+    try:
+        response = requests.post(url, headers=headers, data=data)
+        return response.json()
+    except requests.exceptions.RequestException as e:
+        print(f"Произошла ошибка при запросе к API: {e}")
+        return None
+
+
+def input_function_payments(orderId):
+    amount = 5000
+    orderNumber = orderId
+    email = "test@test.com"
+    clientId = 1
+    returnUrl = "https://assist.sharix.org/"
+    failUrl = "https://mybestmerchantfailurl.com"
+    data = {
+        "amount": amount,
+        "userName": "assist_sharix-api",
+        "password": "assist_sharix",
+        "orderNumber": orderNumber,
+        "returnUrl": returnUrl,
+        "failUrl": failUrl,
+        "email": "test@test.com",
+        "clientId": clientId,
+        "language": "ru"
+    }
+
+    headers = {
+        "Content-Type": "application/x-www-form-urlencoded"
+    }
+    result = make_payment(data, headers)
+    return result
+
+
+def find_connections(clientId):
+    url = "https://vtb.rbsuat.com/payment/rest/getBindings.do"
+    headers = {
+        'Content-Type': 'application/x-www-form-urlencoded'
+    }
+    data = {
+        "userName": "assist_sharix-api",
+        "password": "assist_sharix",
+        'clientId': 'dos-clientos',
+        'bindingType': 'C'
+    }
+
+    response = requests.post(url, headers=headers, data=data)
+
+    return response

+ 4 - 0
testFunc.py

@@ -0,0 +1,4 @@
+from funcPayments import *
+
+orderId= 2234
+print(input_function_payments(orderId))