Skip to content

topup method #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ Python 2.6+ или 3.3+
В случае успеха возвращает объект типа ``Transaction``.


| **Выплата по токену** (`описание <https://cloudpayments.ru/Docs/Api#topup>`__)

.. code:: python

topup(self, token, amount, account_id, currency)

``currency`` — одна из констант, определенных в классе ``Currency``

В случае успеха возвращает объект типа ``Transaction``.


| **Подтверждение оплаты** (`описание <http://cloudpayments.ru/Docs/Api#confirm>`__)

.. code:: python
Expand Down
13 changes: 13 additions & 0 deletions cloudpayments/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down