Skip to content

Commit

Permalink
Make order increment id camelcase
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Wanyoike committed Jun 17, 2021
1 parent 4503658 commit 8c0c1f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/ShipmentData.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ public static function fromJson(array $json): self
{
/** @var ShipmentData $result */
$result = self::create();
$result->orderIncrement = $json['order_increment_id'] ?? null;
$result->orderIncrement = $json['orderIncrementId'] ?? null;
$result->arguments = Argument::fromJson($json['arguments'] ?? []);
$result->notify = $json['notify'] ?? false;
$result->appendComment = $json['append_comment'] ?? false;
$result->appendComment = $json['appendComment'] ?? false;
$result->comments = CommentCollection::fromJson($json['comments'] ?? []);
$result->items = ItemCollection::fromJson($json['items']);
$result->packages = PackageCollection::fromJson($json['packages'] ?? []);
Expand All @@ -212,7 +212,7 @@ public function toJson() : array
$json = [];

if ($this->getOrderIncrement()) {
$json['order_increment_id'] = $this->getOrderIncrement();
$json['orderIncrementId'] = $this->getOrderIncrement();
}
if (!$this->getTracks()->isEmpty()) {
$json['tracks'] = $this->getTracks()->toJson();
Expand All @@ -233,7 +233,7 @@ public function toJson() : array
$json['notify'] = $this->getNotify();
}
if ($this->getAppendComment()) {
$json['append_comment'] = $this->getAppendComment();
$json['appendComment'] = $this->getAppendComment();
}

return $json;
Expand Down
4 changes: 2 additions & 2 deletions test/unit/ShipmentDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ public function testEquals()
private function getShipmentsJson()
{
return [
"order_increment_id" => "100",
"orderIncrementId" => "100",
"arguments" => Argument::create()->withExtensionAttributes(
ExtensionAttributeSet::of([
ExtensionAttribute::of('code1', 'value1'),
ExtensionAttribute::of('code2', 'value2')
])
)->toJson(),
"notify" => true,
"append_comment" => true,
"appendComment" => true,
"comments" => CommentCollection::create()->with(Comment::create()
->withComment("test comment")
->withIsCustomerNotified(1)
Expand Down

0 comments on commit 8c0c1f0

Please sign in to comment.