razcrypto 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- razcrypto/__init__.py +4 -0
- razcrypto/client.py +32 -0
- razcrypto/resources/__init__.py +0 -0
- razcrypto/resources/payment.py +13 -0
- razcrypto/webhook.py +19 -0
- razcrypto-1.0.0.dist-info/METADATA +18 -0
- razcrypto-1.0.0.dist-info/RECORD +9 -0
- razcrypto-1.0.0.dist-info/WHEEL +5 -0
- razcrypto-1.0.0.dist-info/top_level.txt +1 -0
razcrypto/__init__.py
ADDED
razcrypto/client.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
from .resources.payment import Payment
|
|
3
|
+
|
|
4
|
+
class Client:
|
|
5
|
+
def __init__(self, gateway_id, secret_key):
|
|
6
|
+
if not gateway_id or not secret_key:
|
|
7
|
+
raise ValueError("Gateway ID and Secret Key are required.")
|
|
8
|
+
self.gateway_id = gateway_id
|
|
9
|
+
self.secret_key = secret_key
|
|
10
|
+
self.base_url = "https://razcryptogateway.com/api/v2"
|
|
11
|
+
self.payment = Payment(self)
|
|
12
|
+
|
|
13
|
+
def request(self, method, path, data=None):
|
|
14
|
+
url = path if path.startswith("http") else f"{self.base_url}{path}"
|
|
15
|
+
headers = {
|
|
16
|
+
"Content-Type": "application/json",
|
|
17
|
+
"Accept": "application/json",
|
|
18
|
+
"X-Gateway-Id": self.gateway_id,
|
|
19
|
+
"X-Secret-Key": self.secret_key
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
response = requests.request(method, url, json=data, headers=headers)
|
|
23
|
+
|
|
24
|
+
try:
|
|
25
|
+
result = response.json()
|
|
26
|
+
except Exception:
|
|
27
|
+
raise Exception(f"Invalid JSON Response: {response.text}")
|
|
28
|
+
|
|
29
|
+
if response.status_code >= 400:
|
|
30
|
+
raise Exception(result.get("message", f"API Error: HTTP {response.status_code}"))
|
|
31
|
+
|
|
32
|
+
return result
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class Payment:
|
|
2
|
+
def __init__(self, client):
|
|
3
|
+
self.client = client
|
|
4
|
+
|
|
5
|
+
def create(self, params):
|
|
6
|
+
return self.client.request("POST", "/payments/create", params)
|
|
7
|
+
|
|
8
|
+
def fetch(self, payment_id):
|
|
9
|
+
full_url = f"https://razcryptogateway.com/api/v1/payments/status/{payment_id}"
|
|
10
|
+
return self.client.request("GET", full_url)
|
|
11
|
+
|
|
12
|
+
def webhook_status(self, payment_id, auth_key):
|
|
13
|
+
return self.client.request("GET", f"/webhooks/{payment_id}/status?auth_key={auth_key}")
|
razcrypto/webhook.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import hmac
|
|
2
|
+
import hashlib
|
|
3
|
+
|
|
4
|
+
class Webhook:
|
|
5
|
+
@staticmethod
|
|
6
|
+
def verify_signature(raw_payload, signature, secret_key):
|
|
7
|
+
if isinstance(raw_payload, str):
|
|
8
|
+
raw_payload = raw_payload.encode('utf-8')
|
|
9
|
+
if isinstance(secret_key, str):
|
|
10
|
+
secret_key = secret_key.encode('utf-8')
|
|
11
|
+
|
|
12
|
+
expected_signature = hmac.new(
|
|
13
|
+
secret_key,
|
|
14
|
+
raw_payload,
|
|
15
|
+
hashlib.sha256
|
|
16
|
+
).hexdigest()
|
|
17
|
+
|
|
18
|
+
# Timing attack से बचने के लिए compare_digest का यूज़
|
|
19
|
+
return hmac.compare_digest(expected_signature, signature)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: razcrypto
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: RazCrypto Payment Gateway Python SDK
|
|
5
|
+
Author: RazCrypto
|
|
6
|
+
Keywords: razcrypto,payment,gateway,crypto,usdt
|
|
7
|
+
Requires-Python: >=3.6
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: requests
|
|
10
|
+
Dynamic: author
|
|
11
|
+
Dynamic: description
|
|
12
|
+
Dynamic: description-content-type
|
|
13
|
+
Dynamic: keywords
|
|
14
|
+
Dynamic: requires-dist
|
|
15
|
+
Dynamic: requires-python
|
|
16
|
+
Dynamic: summary
|
|
17
|
+
|
|
18
|
+
Accept cryptocurrency payments (USDT, USDC, DAI) on BSC and Ethereum chains with ease using the official RazCrypto Python SDK.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
razcrypto/__init__.py,sha256=H9m33S4DSNfo8UW25X9QUSV2gnmyXmWY3_uwereZmRA,88
|
|
2
|
+
razcrypto/client.py,sha256=G9D8I_DUtZayV42aK61Pc5SHPb5Rdig_YndVGZQFw2Y,1125
|
|
3
|
+
razcrypto/webhook.py,sha256=mWbKKgcucdlXaDRqPw3YI_HhSS0980mcDGXBZ9-XDn4,607
|
|
4
|
+
razcrypto/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
razcrypto/resources/payment.py,sha256=agIpBWhQaInMoaNcXyeCv4W3IQz7lBogdDzZbnF-McE,499
|
|
6
|
+
razcrypto-1.0.0.dist-info/METADATA,sha256=0fKnGSNoHcoqzG-qkCmALLxQCBXGc7gHILLcyLsZ8Ys,534
|
|
7
|
+
razcrypto-1.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
8
|
+
razcrypto-1.0.0.dist-info/top_level.txt,sha256=HUJi64chiWYrRyUrJc5litL2oRNPf3-uR28sAjBmQm8,10
|
|
9
|
+
razcrypto-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
razcrypto
|