Commit fb3ab65c by Camoo Sarl

Balance Module added

parent f1e53dcc
<?php
require_once('src/autoload.php');
$oBalance = new \CAMOO\Balance\Balance('592595095gh57', '4e32da5979879b89479847b9798479494984');
// get current CAMOO Balance
var_dump($oBalance->current());
// recharge account via MTN Mobile Money Cameroon
$hData = ['phonenumber' => '671234567', 'amount' => 1000];
var_dump($oBalance->add($hData));
......@@ -6,7 +6,7 @@ namespace CAMOO\Authentifications;
* @copyright (c) camoo.cm
* @license: You are not allowed to sell or distribute this software without permission
* Copyright reserved
* File: src/CAMOO/Authentifications/Credentials.php
* File: src/CAMOO/Authentifications/Token.php
* updated: Mai 2017
* Created by: Epiphane Tchabom (e.tchabom@camoo.cm)
* Description: CAMOO API generate auth Token
......
<?php
namespace CAMOO\Balance;
/**
*
* CAMOO SARL: http://www.camoo.cm
* @copyright (c) camoo.cm
* @license: You are not allowed to sell or distribute this software without permission
* Copyright reserved
* File: src/CAMOO/Balance/Balance.php
* updated: Mai 2017
* Created by: Epiphane Tchabom (e.tchabom@camoo.cm)
* Description: CAMOO Airtime API
*
* @link http://www.camoo.cm
*/
use CAMOO\Client;
class Balance extends Client{
public function __construct ($api_key, $api_secret) {
parent::__construct($api_key, $api_secret, __CLASS__);
}
/**
* read the current user balance
* @return mixed Balance
*/
public function current() {
return $this->get();
}
/**
* Initiate a recharge for an user account
* Only available for MTN Mobile Money Cameroon
*
* @param $hData, ['phonenumber' => '671234567', 'amount' => 1000]
* @return mixed Trx
*/
public function add($hData) {
$this->oHttpClient->setResourceName('topup');
return $this->post($hData);
}
}
......@@ -88,7 +88,7 @@ class Base {
/**
* Target version for "Classic" Camoo API
*/
protected $camooClassicApiVersion = 'v1';
protected $camooClassicApiVersion = 'v2';
/**
* Returns the CAMOO API URL
*-
......
......@@ -26,7 +26,7 @@ class CamooHttpClient extends Base {
const REQUEST_GET = 'GET';
const REQUEST_POST = 'POST';
const HTTP_NO_CONTENT = 204;
const CLIENT_VERSION = '1.2.0';
const CLIENT_VERSION = '2.0.0';
/**
* @var string
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment