From c024350882143f6274a921a6c8adab65961265c0 Mon Sep 17 00:00:00 2001 From: max-baranikov Date: Thu, 27 Apr 2023 14:27:18 +0300 Subject: [PATCH] Fixed url deserialization in getFileById() method (#35) * Added tests to reproduce issue * Fixed url deserialization in getFileById() method --- src/Bot/Model/Response/FullFileResponse.php | 2 ++ tests/Bot/Tests/FileTest.php | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/Bot/Model/Response/FullFileResponse.php b/src/Bot/Model/Response/FullFileResponse.php index fc62147..85fdf2b 100644 --- a/src/Bot/Model/Response/FullFileResponse.php +++ b/src/Bot/Model/Response/FullFileResponse.php @@ -10,6 +10,7 @@ namespace RetailCrm\Mg\Bot\Model\Response; +use JMS\Serializer\Annotation\SerializedName; use JMS\Serializer\Annotation\Accessor; use JMS\Serializer\Annotation\SkipWhenEmpty; use JMS\Serializer\Annotation\Type; @@ -55,6 +56,7 @@ class FullFileResponse implements ModelInterface * @var string $url * * @Type("string") + * @SerializedName("Url") * @Accessor(getter="getUrl",setter="setUrl") * @SkipWhenEmpty() */ diff --git a/tests/Bot/Tests/FileTest.php b/tests/Bot/Tests/FileTest.php index d90e584..7dad144 100644 --- a/tests/Bot/Tests/FileTest.php +++ b/tests/Bot/Tests/FileTest.php @@ -116,5 +116,8 @@ class FileTest extends TestCase self::assertInstanceOf(FullFileResponse::class, $response); self::assertEquals($fileId, $response->getId()); + + $fileUrl = 'https://s3.eu-central-1.amazonaws.com/mg-node-files/files/21/b2bdba90-166c-4e0a-829d-69f26a09fd2a'; + self::assertEquals($fileUrl, $response->getUrl()); } }