Sfoglia il codice sorgente

ajuste cadastro prestador + remove log

Gustavo Zanatta 2 giorni fa
parent
commit
c6cff961e8

+ 0 - 12
app/Http/Requests/RegisterProviderRequest.php

@@ -8,18 +8,6 @@ use Illuminate\Validation\Rule;
 
 class RegisterProviderRequest extends FormRequest
 {
-  protected function prepareForValidation(): void
-  {
-    \Log::error('[register-provider] request chegou', [
-      'content_type' => $this->header('Content-Type'),
-      'keys'         => array_keys($this->all()),
-      'files'        => array_keys($this->allFiles()),
-      'has_email'    => $this->has('email'),
-      'has_phone'    => $this->has('phone'),
-      'has_name'     => $this->has('name'),
-    ]);
-  }
-
   public function rules(): array
   {
     $rules = [

+ 4 - 1
app/Services/ProviderService.php

@@ -226,7 +226,10 @@ class ProviderService
 
             $provider->save();
 
-            if (! empty($data['recipient_name']) && ! empty($data['recipient_default_bank_account']) && empty($provider->recipient_id)) {
+            $bankAccount = $data['recipient_default_bank_account'] ?? [];
+            $hasBankData = ! empty($bankAccount['bank']) && ! empty($bankAccount['account_number']);
+
+            if (! empty($data['recipient_name']) && $hasBankData && empty($provider->recipient_id)) {
                 $this->pagarmeRecipientService->createRecipientForProvider($provider, $data);
             }