diff --git a/src/Nfse/Prestador.php b/src/Nfse/Prestador.php index 7592777..bdc3b1a 100644 --- a/src/Nfse/Prestador.php +++ b/src/Nfse/Prestador.php @@ -250,7 +250,7 @@ public static function fromArray($data) if (array_key_exists('nfse', $data)) { $data['nfse'] = Nfse::fromArray($data['nfse']); - } + } return Hydrate::toObject(self::class, $data); } @@ -277,11 +277,14 @@ public function validate() return true; } - public function send(Configuration $configuration) + public function send(Configuration $configuration, $cnpj = null) { $this->validate(); + $method = isset($cnpj) ? 'PATCH' : 'POST'; + $url = isset($cnpj) ? "/empresa/${cnpj}" : '/empresa'; + $communication = $this->getCallApiInstance($configuration); - return $communication->send('POST', '/empresa', $this->toArray(true)); + return $communication->send($method, $url, $this->toArray(true)); } }