Skip to content

Commit

Permalink
[Feature] Added headers and content type for celcoin attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
adeildo-jr committed Mar 25, 2024
1 parent e483cfe commit f6bb644
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Common/CelcoinBaseApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/Interfaces/Attachable.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ public function getField(): string;
public function getContents();

public function getFileName();

public function getHeaders(): array;
}
5 changes: 5 additions & 0 deletions src/Types/KYC/KycDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,9 @@ public function getField(): string
{
return $this->field;
}

public function getHeaders(): array
{
return ['Content-Type' => $this->file->getMimeType()];
}
}

0 comments on commit f6bb644

Please sign in to comment.