From 228ca715358f21bf9c8a3b600905f14939e7d60b Mon Sep 17 00:00:00 2001 From: Nikita Kolesnikov Date: Wed, 21 Mar 2018 16:42:28 +0300 Subject: [PATCH] topup method --- README.rst | 11 +++++++++++ cloudpayments/client.py | 13 +++++++++++++ 2 files changed, 24 insertions(+) diff --git a/README.rst b/README.rst index a078f8d..2488114 100644 --- a/README.rst +++ b/README.rst @@ -95,6 +95,17 @@ Python 2.6+ или 3.3+ В случае успеха возвращает объект типа ``Transaction``. +| **Выплата по токену** (`описание `__) + +.. code:: python + + topup(self, token, amount, account_id, currency) + +``currency`` — одна из констант, определенных в классе ``Currency`` + +В случае успеха возвращает объект типа ``Transaction``. + + | **Подтверждение оплаты** (`описание `__) .. code:: python diff --git a/cloudpayments/client.py b/cloudpayments/client.py index 0b3aec8..4522ad9 100644 --- a/cloudpayments/client.py +++ b/cloudpayments/client.py @@ -137,6 +137,19 @@ def refund(self, transaction_id, amount): if not response['Success']: raise CloudPaymentsError(response) + def topup(self, token, amount, account_id, currency): + params = { + 'Token': token, + 'Amount': amount, + 'AccountId': account_id, + 'Currency': currency + } + response = self._send_request('payments/cards/topup', params) + + if not response['Success']: + raise CloudPaymentsError(response) + + def find_payment(self, invoice_id): params = {'InvoiceId': invoice_id} response = self._send_request('payments/find', params)