Skip to content

Commit

Permalink
v1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kewldan committed Sep 6, 2024
1 parent d14540e commit 7646a9a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ from aaio import AAIO


async def main():
client = AAIO('MERCHANT ID', 'SECRET KEY', 'API KEY')
client = AAIO('MERCHANT ID', 'SECRET KEY', api_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
print(payment_url) # Prints payment url for customer


# DEPRECATED METHOD
Expand All @@ -108,7 +108,7 @@ from aaio import AAIO


async def main():
client = AAIO('MERCHANT ID', 'SECRET KEY', 'API KEY')
client = AAIO('MERCHANT ID', 'SECRET KEY', api_key='API KEY')
payoff = await client.create_payoff('qiwi', 100.35, '79998887766', 'my_payoff_id')
print(payoff.status) # in_progress

Expand Down
7 changes: 5 additions & 2 deletions src/aaio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AAIO:
API for https://aaio.so/
"""

def __init__(self, merchant_id: str, secret_1: str, secret_2: str | None = None, api_key: str | None = None,
def __init__(self, merchant_id: str, secret_1: str | None = None, secret_2: str | None = None, api_key: str | None = None,
default_currency: str = 'RUB',
base_url: str = 'https://aaio.so'):
"""
Expand Down Expand Up @@ -54,6 +54,9 @@ def __generate_sign(self, amount: float, order_id: str, currency: str) -> str:
"""

if self._secret_1 is None:
raise ValueError('Secret key #1 is required for payment URL generation')

params = f':'.join([
self._merchant_id,
str(amount),
Expand Down Expand Up @@ -160,7 +163,7 @@ async def get_payment_info(self, order_id: str) -> PaymentInfo:
"""

if not self._api_key:
if self._api_key is None:
raise ValueError('API key is required for this method')

params = {
Expand Down
3 changes: 3 additions & 0 deletions src/aaio/models/payment_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class PaymentMethod(BaseModel):
name: str
min: PaymentMethodAmounts
max: PaymentMethodAmounts
commission_percent: float
commission_user_percent: float
commission_merchant_percent: float
commission_type: str


Expand Down

0 comments on commit 7646a9a

Please sign in to comment.