-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from lolkofka/lolkofka
add method get_pay_url
- Loading branch information
Showing
19 changed files
with
111 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
/src/aaio.egg-info | ||
/dist/ | ||
/site/ | ||
main.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,13 +19,13 @@ | |
|
||
## About | ||
|
||
This library is a wrapper for the https://aaio.so API **from enthusiasts**. All methods are described and all types are | ||
This library is a wrapper for the https://aaio.so API **from enthusiast**. All methods are described and all types are | ||
**explicitly** defined. Methods that create requests to | ||
aaio.so | ||
return a pydantic's models for each response. Please write about all problems related to the library | ||
to [issues](https://github.com/kewldan/AAIO/issues) | ||
|
||
API is up-to-date as of *01 March 2024*. | ||
API is up-to-date as of *07 August 2024*. | ||
|
||
* PyPl - https://pypi.org/project/aaio/ | ||
* Github - https://github.com/kewldan/AAIO | ||
|
@@ -79,10 +79,21 @@ from aaio import AAIO | |
|
||
async def main(): | ||
client = AAIO('MERCHANT ID', 'SECRET KEY', 'API KEY') | ||
|
||
|
||
# New way to create payments | ||
payment_url = await client.get_pay_url(100, 'my_order_id', 'My order description', 'qiwi', '[email protected]', | ||
'referral code', currency='USD', | ||
language='en') | ||
print(payment_url['url']) # Prints payment url for customer | ||
|
||
|
||
# DEPRECATED METHOD | ||
payment_url = client.create_payment(100, 'my_order_id', 'My order description', 'qiwi', '[email protected]', | ||
'referral code', currency='USD', | ||
language='en') | ||
print(payment_url) # Prints payment url for customer | ||
print(payment_url) | ||
################### | ||
|
||
|
||
asyncio.run(main()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
[build-system] | ||
requires = ["setuptools>=61.0"] | ||
build-backend = "setuptools.build_meta" | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[tool.hatch.build.targets.wheel] | ||
packages = ["src/aaio"] | ||
|
||
[project] | ||
name = "aaio" | ||
version = "1.3.1" | ||
version = "1.4.0" | ||
description = "Async AAIO api wrapper for python" | ||
readme = "README.md" | ||
authors = [{ name = "kewldan", email = "[email protected]" }] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,4 @@ | ||
from .AAIO import create_invoice, is_valid_payoff_webhook, AAIO | ||
from .exceptions.aaio_bad_request import AAIOBadRequest | ||
from .types.balance import Balance | ||
from .types.create_payoff import CreatePayoff | ||
from .types.payment_info import PaymentInfo | ||
from .types.payment_methods import PaymentMethods, PaymentMethod, PaymentMethodAmounts | ||
from .types.payment_webhook import PaymentWebhookData | ||
from .types.payoff_info import PayoffInfo | ||
from .types.payoff_methods import PayoffMethods, PayoffMethod | ||
from .types.payoff_rates import PayoffRates | ||
from .types.payoff_webhook import PayoffWebhookData | ||
from .client import AAIO | ||
from .exceptions import AAIOBadRequest | ||
from .models import * | ||
from .utils import create_invoice, is_valid_payoff_webhook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .bad_request import AAIOBadRequest |
2 changes: 1 addition & 1 deletion
2
src/aaio/exceptions/aaio_bad_request.py → src/aaio/exceptions/bad_request.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from .balance import Balance | ||
from .create_payoff import CreatePayoff | ||
from .payment_info import PaymentInfo | ||
from .payment_methods import PaymentMethods, PaymentMethod, PaymentMethodAmounts | ||
from .payment_webhook import PaymentWebhookData | ||
from .payoff_info import PayoffInfo | ||
from .payoff_methods import PayoffMethods, PayoffMethod | ||
from .payoff_rates import PayoffRates | ||
from .payoff_sbp_banks import PayoffSbpBanks, SbpBank | ||
from .payoff_webhook import PayoffWebhookData |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import hashlib | ||
|
||
import aiohttp | ||
|
||
from .models import PayoffWebhookData | ||
|
||
|
||
async def create_invoice(payment_url: str): | ||
async with aiohttp.ClientSession() as session: | ||
async with session.get(payment_url) as request: | ||
return request.url | ||
|
||
|
||
def is_valid_payoff_webhook(data: PayoffWebhookData, secret_key: str) -> bool: | ||
return hashlib.sha256( | ||
f'{data.id}:{secret_key}:{data.amount_down}'.encode()).hexdigest() == data.sign |