From 0b13751e5b4b692edb52cde6034d9322dfcf6f24 Mon Sep 17 00:00:00 2001 From: Guilherme Henrique Date: Fri, 30 Apr 2021 20:15:55 -0300 Subject: [PATCH] Add Update Company --- src/Nfse/Prestador.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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)); } }