Skip to content

Commit 622a2ac

Browse files
Merge pull request #8 from ko1es/master
topup method
2 parents 0a299db + 228ca71 commit 622a2ac

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

README.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,17 @@ Python 2.6+ или 3.3+
9595
В случае успеха возвращает объект типа ``Transaction``.
9696

9797

98+
| **Выплата по токену** (`описание <https://cloudpayments.ru/Docs/Api#topup>`__)
99+
100+
.. code:: python
101+
102+
topup(self, token, amount, account_id, currency)
103+
104+
``currency`` — одна из констант, определенных в классе ``Currency``
105+
106+
В случае успеха возвращает объект типа ``Transaction``.
107+
108+
98109
| **Подтверждение оплаты** (`описание <http://cloudpayments.ru/Docs/Api#confirm>`__)
99110
100111
.. code:: python

cloudpayments/client.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,19 @@ def refund(self, transaction_id, amount):
137137
if not response['Success']:
138138
raise CloudPaymentsError(response)
139139

140+
def topup(self, token, amount, account_id, currency):
141+
params = {
142+
'Token': token,
143+
'Amount': amount,
144+
'AccountId': account_id,
145+
'Currency': currency
146+
}
147+
response = self._send_request('payments/cards/topup', params)
148+
149+
if not response['Success']:
150+
raise CloudPaymentsError(response)
151+
152+
140153
def find_payment(self, invoice_id):
141154
params = {'InvoiceId': invoice_id}
142155
response = self._send_request('payments/find', params)

0 commit comments

Comments
 (0)