add: add payment
This commit is contained in:
@@ -85,6 +85,6 @@ class PaymentGenerateLinkApiView(GenericAPIView):
|
|||||||
data = serializer.validated_data
|
data = serializer.validated_data
|
||||||
service = Atmos()
|
service = Atmos()
|
||||||
res = service.create_transaction(data['price'], data['order_number'])
|
res = service.create_transaction(data['price'], data['order_number'])
|
||||||
print(res)
|
link = service.generate_url(res['transaction_id'], 'http://site.com')
|
||||||
return Response(res)
|
return Response(link)
|
||||||
|
|
||||||
|
|||||||
@@ -39,11 +39,10 @@ class Atmos:
|
|||||||
data = {
|
data = {
|
||||||
'amount': amount,
|
'amount': amount,
|
||||||
'account': str(account),
|
'account': str(account),
|
||||||
'store_id': self.store_id
|
'store_id': f'{self.store_id}'
|
||||||
}
|
}
|
||||||
|
|
||||||
res = requests.post(url, headers=headers, json=data)
|
res = requests.post(url, headers=headers, json=data)
|
||||||
print(self.store_id)
|
|
||||||
return res.json()
|
return res.json()
|
||||||
# try:
|
# try:
|
||||||
# data = res.json()
|
# data = res.json()
|
||||||
@@ -55,9 +54,13 @@ class Atmos:
|
|||||||
# return None
|
# return None
|
||||||
|
|
||||||
def generate_url(self, transaction_id, redirect_url):
|
def generate_url(self, transaction_id, redirect_url):
|
||||||
url = f'https://test-checkout.pays.uz/invoice/get?storeId={self.store_id}&transactionId={transaction_id}&redirectLink={redirect_url}'
|
url = f'http://test-checkout.pays.uz/invoice/get?storeId={self.store_id}&transactionId={transaction_id}&redirectLink={redirect_url}'
|
||||||
|
access_token = self.login()
|
||||||
res = requests.get(url)
|
headers = {
|
||||||
|
'Authorization': f'Bearer {access_token}',
|
||||||
|
}
|
||||||
|
print(url)
|
||||||
|
res = requests.post(url, headers=headers)
|
||||||
return res.json()
|
return res.json()
|
||||||
|
|
||||||
|
|
||||||
@@ -35,6 +35,10 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
- redis
|
- redis
|
||||||
|
dns:
|
||||||
|
- 8.8.8.8
|
||||||
|
- 8.8.4.4
|
||||||
|
- 1.1.1.1
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: postgres:17
|
image: postgres:17
|
||||||
|
|||||||
Reference in New Issue
Block a user