Difference between revisions of "MOR API voucher use"
From Kolmisoft Wiki
Jump to navigationJump to search
(Created page with '-') |
|||
Line 1: | Line 1: | ||
- | - | ||
=Description= | |||
<!---This functionality is available in MOR X5 and MOR X6---> | |||
[[MOR API]] Voucher use | |||
Please note that admin can delete his phonebooks and his users phonebooks. | |||
Users can delete only the phonebooks they created themselves | |||
<br><br> | |||
=Usage= | |||
* Call: /api/voucher_use | |||
* Methods: POST, GET(if allowed, not recomended) | |||
<br><br> | |||
===Parametres=== | |||
* u – username to login. '''Required'''. | |||
* voucher_number – this specifies id of phonebook record which will be deleted. '''Required'''. | |||
* user_id - this is the id of the user whose balance will be updated. '''Optional''' | |||
* [[MOR API hash construction | hash]] – SHA1 hash constructed using '''voucher_number''' and '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''. | |||
<br><br> | |||
===Request=== | |||
We have API Secret Key = 123456, voucher_number = 1234567890 <br /> | |||
We send: | |||
HTML POST: http://<server_ip>/billing/api/voucher_use?u=admin&user_id=2&voucher_number=10007&test=1&hash= d180bb861a4ee06850bc2fe40e2b8d2ab369e27f | |||
'''* Note that username and password are not included in hash''' | |||
<br><br> | |||
===Returns=== | |||
'''Success''' | |||
<page> | |||
<status> | |||
<status>Voucher used to update balance</status> | |||
<voucher_number>10007</voucher_number> | |||
<voucher_id>11</voucher_id> | |||
<credit_with_tax>20.0</credit_with_tax> | |||
<credit_without_tax>20.0</credit_without_tax> | |||
<currency>USD</currency> | |||
<credit_in_default_currency>20.0</credit_in_default_currency> | |||
<user_id>2</user_id> | |||
<balance_after_voucher_use>20.0</balance_after_voucher_use> | |||
<payment_id>10</payment_id> | |||
</status> | |||
</page> | |||
<br><br> | |||
---- | |||
'''Errors''' | |||
* <error>Voucher was not found</error> – Voucher was not found (Might be expired or already used). | |||
* <error>Vouchers Disabled</error> – Vouchers are disabled. | |||
* <error>Access Denied</error> – username (u) is not admins user or admin. | |||
* <error>User was not found</error> – username (u) is admin and specified user_id is not available. | |||
* <error>Incorrect hash</error> – Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string. | |||
<br><br> | |||
=See also= | |||
* [[MOR API]] |
Revision as of 13:54, 4 March 2015
-
Description
MOR API Voucher use
Please note that admin can delete his phonebooks and his users phonebooks. Users can delete only the phonebooks they created themselves
Usage
- Call: /api/voucher_use
- Methods: POST, GET(if allowed, not recomended)
Parametres
- u – username to login. Required.
- voucher_number – this specifies id of phonebook record which will be deleted. Required.
- user_id - this is the id of the user whose balance will be updated. Optional
- hash – SHA1 hash constructed using voucher_number and API_Secret_Key ( More described in Constructing hash). Required.
Request
We have API Secret Key = 123456, voucher_number = 1234567890
We send:
HTML POST: http://<server_ip>/billing/api/voucher_use?u=admin&user_id=2&voucher_number=10007&test=1&hash= d180bb861a4ee06850bc2fe40e2b8d2ab369e27f
* Note that username and password are not included in hash
Returns
Success
<page>
<status> <status>Voucher used to update balance</status> <voucher_number>10007</voucher_number> <voucher_id>11</voucher_id> <credit_with_tax>20.0</credit_with_tax> <credit_without_tax>20.0</credit_without_tax> <currency>USD</currency> <credit_in_default_currency>20.0</credit_in_default_currency> <user_id>2</user_id> <balance_after_voucher_use>20.0</balance_after_voucher_use> <payment_id>10</payment_id> </status>
</page>
Errors
- <error>Voucher was not found</error> – Voucher was not found (Might be expired or already used).
- <error>Vouchers Disabled</error> – Vouchers are disabled.
- <error>Access Denied</error> – username (u) is not admins user or admin.
- <error>User was not found</error> – username (u) is admin and specified user_id is not available.
- <error>Incorrect hash</error> – Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.