Example #1
0
 function index()
 {
     $customer_id = \Yoda\Request::getInt('customer_id');
     $b = new Didww\API2\Balance();
     $b->setCustomerId($customer_id);
     $dids = $b->getBilledServices();
     $this->getView()->setProperties(['dids' => $dids, 'customer_id' => $customer_id])->display();
 }
Example #2
0
File: did.php Project: didww/demo
 /**
  * @param $customer_id
  * @return array
  */
 static function getPBXwwDIDsByCustomerID($customer_id)
 {
     $balance = new Didww\API2\Balance();
     $balance->setCustomerId($customer_id);
     $orders = $balance->getBilledServices();
     $did_numbers = [];
     /** @var $order Didww\API2\Order */
     foreach ($orders as $order) {
         if ($order->hasPBXwwMapping() && $order->getNumber()->isActive()) {
             $did_numbers[] = $order->getNumber()->getDidNumber();
         }
     }
     return $did_numbers;
 }
Example #3
0
 function update()
 {
     $customer_id = \Yoda\Request::getInt('customer_id');
     $amount = \Yoda\Request::getFloat('amount');
     try {
         $balance = new Didww\API2\Balance();
         $balance->setCustomerId($customer_id);
         $balance->changeBalance($amount);
         $this->setMessage($amount . ' points was added to customer ID #' . $customer_id);
     } catch (SoapFault $e) {
         $this->setMessage("Error: (" . $e->faultcode . ") " . $e->faultstring, 'danger');
         $this->redirect('index.php?controller=balance&action=add');
     } catch (Exception $e) {
         $this->setMessage($e->getMessage(), 'danger');
         $this->redirect('index.php?controller=balance&action=add');
     }
     $this->redirect('index.php?controller=customers');
 }
Example #4
0
 function index()
 {
     $balances = Didww\API2\Balance::getBalanceArray();
     $this->getView()->setProperties(['balances' => $balances])->display();
 }