From f6bb6441dcf594859aab1281aa0f5cb6840dacbd Mon Sep 17 00:00:00 2001 From: Adeildo Amorim Date: Mon, 25 Mar 2024 17:09:41 -0300 Subject: [PATCH] [Feature] Added headers and content type for celcoin attachments --- src/Common/CelcoinBaseApi.php | 7 ++++++- src/Interfaces/Attachable.php | 2 ++ src/Types/KYC/KycDocument.php | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Common/CelcoinBaseApi.php b/src/Common/CelcoinBaseApi.php index 5fcc9d7..c237516 100644 --- a/src/Common/CelcoinBaseApi.php +++ b/src/Common/CelcoinBaseApi.php @@ -115,7 +115,12 @@ public function post(string $endpoint, array $body = [], Attachable $attachment } if ($attachment) { - $request->attach($attachment->getField(), $attachment->getContents(), $attachment->getFileName()); + $request->attach( + $attachment->getField(), + $attachment->getContents(), + $attachment->getFileName(), + $attachment->getHeaders() + ); } return $request->post($this->getFinalUrl($endpoint), $body) diff --git a/src/Interfaces/Attachable.php b/src/Interfaces/Attachable.php index 8abb0f0..043b591 100644 --- a/src/Interfaces/Attachable.php +++ b/src/Interfaces/Attachable.php @@ -9,4 +9,6 @@ public function getField(): string; public function getContents(); public function getFileName(); + + public function getHeaders(): array; } \ No newline at end of file diff --git a/src/Types/KYC/KycDocument.php b/src/Types/KYC/KycDocument.php index 3a0c000..7297c2e 100644 --- a/src/Types/KYC/KycDocument.php +++ b/src/Types/KYC/KycDocument.php @@ -40,4 +40,9 @@ public function getField(): string { return $this->field; } + + public function getHeaders(): array + { + return ['Content-Type' => $this->file->getMimeType()]; + } }