/**
  * Get subscriber balance information for the current month.
  * @param type $subscriberId (optional)
  * @param type $billrunKey (optional)
  * @return boolean
  */
 public function getBalance()
 {
     return Billrun_Factory::balance()->load($this->data['sid'], Billrun_Util::getNextChargeKey(time()));
 }
Beispiel #2
0
 /**
  * Create a subscriber entry if none exists. Uses an update query only if the balance doesn't exist
  * @param type $subscriber
  */
 protected static function createBalanceIfMissing($aid, $sid, $billrun_key, $plan_ref)
 {
     $balance = Billrun_Factory::balance(array('sid' => $sid, 'billrun_key' => $billrun_key));
     if ($balance->isValid()) {
         return $balance;
     } else {
         return Billrun_Balance::createBalanceIfMissing($aid, $sid, $billrun_key, $plan_ref);
     }
 }