This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
2021:rd_topup [2021/10/10 21:19] – [Profile Requirements For The Top-Up System] admin | 2021:rd_topup [2021/11/09 07:44] (current) – admin | ||
---|---|---|---|
Line 20: | Line 20: | ||
* The Top-Up Manager applet which can be found under the Users section of RADIUSdesk. | * The Top-Up Manager applet which can be found under the Users section of RADIUSdesk. | ||
* Any 3rd Party System using the API | * Any 3rd Party System using the API | ||
- | * Every *Create*, *Update* and *Delete* transaction on the top-ups table will have a ripple effect to adjust the corresponding FreeRADIUS attribute of the associated Permanent User. Let us take a practical example: | + | * Every **Create**, **Update** and **Delete** transaction on the top-ups table will have a ripple effect to adjust the corresponding FreeRADIUS attribute of the associated Permanent User. Let us take a practical example: |
* A 3rd Party system creates a Permanent User with a profile for data Top-Ups. | * A 3rd Party system creates a Permanent User with a profile for data Top-Ups. | ||
* The Rd-Total-Data attribute will be missing since there is no Top-Up loaded for this user. | * The Rd-Total-Data attribute will be missing since there is no Top-Up loaded for this user. | ||
Line 45: | Line 45: | ||
{{ : | {{ : | ||
+ | |||
+ | ===== Top-Up Manager Applet ===== | ||
+ | * RADIUSdesk includes an applet that allows you to manually manage Top-Ups. | ||
+ | * You can do the standard CRUD (Create Read Update and Delete) functions on the listed Top-Ups. | ||
+ | * The applet has two tabs. The **Home** tab is used to do the standard CRUD. | ||
+ | * There is also a **Transaction History** tab which can be used for audit purposes. | ||
+ | {{: | ||
+ | * **Transaction History** tab | ||
+ | {{: | ||
+ | |||
+ | ===== API For Third Party Systems ===== | ||
+ | * If you have a 3rd party system which will interact with RADIUSdesk to add Top-Ups then this section is for you. | ||
+ | * | ||
+ | <file php add_top_up.php> | ||
+ | <? | ||
+ | |||
+ | print(" | ||
+ | /* | ||
+ | |||
+ | * = required | ||
+ | |||
+ | == Adding a 1Gb Data top-up == | ||
+ | |||
+ | comment | ||
+ | *data_unit | ||
+ | *permanent_user_id 187 (alternatively you can use ' | ||
+ | *token | ||
+ | *type | ||
+ | *value | ||
+ | *user_id | ||
+ | |||
+ | == Adding a 50 minutes Time top-up == | ||
+ | |||
+ | comment | ||
+ | *time_unit | ||
+ | *permanent_user_id | ||
+ | *sel_language | ||
+ | *token | ||
+ | *type | ||
+ | *value | ||
+ | *user_id | ||
+ | |||
+ | */ | ||
+ | |||
+ | $comment | ||
+ | $data_unit | ||
+ | $permanent_user_id | ||
+ | $permanent_user | ||
+ | $token | ||
+ | $user_id | ||
+ | $type = ' | ||
+ | $value | ||
+ | |||
+ | $url = ' | ||
+ | |||
+ | // The data to send to the API | ||
+ | $postData = array( | ||
+ | ' | ||
+ | ' | ||
+ | //' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | |||
+ | // Setup cURL | ||
+ | $ch = curl_init($url); | ||
+ | curl_setopt_array($ch, | ||
+ | |||
+ | CURLOPT_POST | ||
+ | CURLOPT_RETURNTRANSFER | ||
+ | CURLOPT_HTTPHEADER => array( | ||
+ | ' | ||
+ | ), | ||
+ | CURLOPT_POSTFIELDS => json_encode($postData) | ||
+ | )); | ||
+ | |||
+ | // Send the request | ||
+ | $response = curl_exec($ch); | ||
+ | |||
+ | // Check for errors | ||
+ | if($response === FALSE){ | ||
+ | die(curl_error($ch)); | ||
+ | } | ||
+ | |||
+ | // Decode the response | ||
+ | $responseData = json_decode($response, | ||
+ | print_r($responseData); | ||
+ | |||
+ | ?> | ||
+ | </ | ||