Пример #1
0
 /**
  * Updates or inserts an invoice
  * @param Service $service
  * @return self
  * @throws NotValidException
  */
 public function save(Service $service)
 {
     if (!$this->validate()) {
         throw new NotValidException('Unable to validate invoice');
     }
     return $this->reload($service->save($this));
 }
Пример #2
0
 /**
  * Updates or inserts a contact
  * @param Service $service
  * @return self
  * @throws NotValidException
  */
 public function save(Service $service)
 {
     if (!$this->sepaActive) {
         $valid = $this->validate();
     } else {
         $oldRequired = $this->_requiredAttr;
         $this->_requiredAttr[] = 'sepaIban';
         $this->_requiredAttr[] = 'sepaIbanAccountName';
         $this->_requiredAttr[] = 'sepaBic';
         $this->_requiredAttr[] = 'sepaMandateId';
         $this->_requiredAttr[] = 'sepaMandateDate';
         $this->_requiredAttr[] = 'sepaSequenceType';
         $valid = $this->validate();
         $this->_requiredAttr = $oldRequired;
     }
     if (!$valid) {
         throw new NotValidException('Unable to validate contact');
     }
     return $this->reload($service->save($this));
 }