public function unpublish($preBill) { if ($preBill instanceof PreBillModel) { $mapper = PreBillMapper::getInstance(); $result = $mapper->unpublish($preBill->getId()); if ($result) { \App::audit('Unpublished prebill with Id ' . $preBill->getId(), $preBill); return $result; } } else { throw new AppEx\ValidateException('Invalid prebill'); } }
public function testUpdate() { $obj = new Model\PreBillUpdateModel(array('id' => '1', 'externalId' => 'weq121e1', 'adjusts' => array(array('description' => 'desc1', 'value' => 1), array('description' => 'desc2', 'value' => 2)), 'discounts' => array('addedDiscounts' => array(array('name' => 'name1', 'value' => 1), array('name' => 'name2', 'value' => 2)), 'removedDiscounts' => array('general' => array(array('name' => 'name3', 'value' => 3)), 'baSubscriptions' => array(), 'customerSubscriptions' => array(), 'expense' => array(), 'consumptionVoice' => array(), 'consumptionSms' => array(), 'consumptionData' => array()), 'modifiedDiscounts' => array('general' => array(), 'baSubscriptions' => array(array('name' => 'name4', 'value' => 4)), 'customerSubscriptions' => array(), 'expense' => array(), 'consumptionVoice' => array(array('name' => 'name5', 'value' => 5)), 'consumptionSms' => array(), 'consumptionData' => array())), 'taxes' => array('addedTaxes' => array(array('description' => 'tax1', 'value' => 1)), 'removedTaxes' => array('tax1', 'tax3')), 'customCharges' => array(array('customServiceId' => 'srvid1', 'customChargeName' => 'cname1', 'timesCharged' => 12)))); $this->_mapper->update($obj); }