Skip to content

Commit

Permalink
Support 'Y-m-d\TH:i:s.vp' date format for GetMyFeesEstimateResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
jlevers committed Jul 7, 2024
1 parent 81045f5 commit 40d5bf2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Traits/Deserializes.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ trait Deserializes
protected static array $validDatetimeFormats = [
'Y-m-d\TH:i:s\Z',
DATE_ATOM,
'Y-m-d\TH:i:s.vp',
'Y-m-d',
];

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Seller\ReportsV20210630\Responses;

use DateTime;
use DateTimeInterface;
use PHPUnit\Framework\TestCase;
use SellingPartnerApi\Seller\ProductFeesV0\Responses\GetMyFeesEstimateResponse;

class GetMyFeesEstimateResponseTest extends TestCase
{
public function testDeserializeDateTime()
{
$now = new DateTime();
$result = GetMyFeesEstimateResponse::deserialize([
'payload' => [
'FeesEstimateResult' => [
'status' => 'Success',
'FeesEstimate' => [
'TimeOfFeesEstimation' => $now->format('Y-m-d\TH:i:s.vp'),
],
],
],
]);
$this->assertNotNull($result);
$this->assertInstanceOf(DateTimeInterface::class, $result->payload->feesEstimateResult->feesEstimate->timeOfFeesEstimation);
}
}

0 comments on commit 40d5bf2

Please sign in to comment.