diff --git a/README.md b/README.md index 2dcc0a3..6402f65 100644 --- a/README.md +++ b/README.md @@ -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', 'support@aaio.so', '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 @@ -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 diff --git a/src/aaio/client.py b/src/aaio/client.py index 5035009..219b2aa 100644 --- a/src/aaio/client.py +++ b/src/aaio/client.py @@ -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'): """ @@ -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), @@ -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 = { diff --git a/src/aaio/models/payment_methods.py b/src/aaio/models/payment_methods.py index b4a2f97..bf8f358 100644 --- a/src/aaio/models/payment_methods.py +++ b/src/aaio/models/payment_methods.py @@ -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