Skip to content

Commit

Permalink
Merge pull request #26 from GetResponse/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
BartStep authored Jun 6, 2019
2 parents 8714777 + bc79590 commit 731490f
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 6 deletions.
1 change: 0 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ composer install:php56:
- apt-get update
- apt-get install -y git
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php -r "if (hash_file('SHA384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
- php composer-setup.php
- php -r "unlink('composer-setup.php');"
script:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 7.0.1
*(2019-05-24)*

* Fixed bugs:
* Issue with updating order

## 7.0.0
*(2018-12-04)*

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"license": "MIT",
"description": "Share code plugin",
"type": "library",
"version": "7.0.1",
"authors": [
{
"name": "GetResponse",
Expand Down
14 changes: 9 additions & 5 deletions src/Order/OrderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ public function updateOrder(EditOrderCommand $editOrderCommand)
{
$order = $editOrderCommand->getOrder();

$grOrderId = $this->dbRepository->getGrOrderIdFromMapping(
$editOrderCommand->getShopId(),
$order->getExternalOrderId()
);

if (!$grOrderId) {
return;
}

$orderPayload = $this->orderPayloadFactory->create(
$order,
$this->productService->getProductsVariants(
Expand All @@ -115,11 +124,6 @@ public function updateOrder(EditOrderCommand $editOrderCommand)
)
);

$grOrderId = $this->dbRepository->getGrOrderIdFromMapping(
$editOrderCommand->getShopId(),
$order->getExternalOrderId()
);

if ($this->hasPayloadChanged($orderPayload, $editOrderCommand->getShopId(), $order->getExternalOrderId())) {
return;
}
Expand Down
21 changes: 21 additions & 0 deletions tests/Unit/Domain/Order/OrderServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,25 @@ public function shouldNotUpdateOrderIfPayloadDoesntChange()
$this->sut->updateOrder($editOrderCommand);
}

/**
* @test
* @throws GetresponseApiException
*/
public function shouldNotUpdateOrderIfOrderIsNotMapped()
{
$editOrderCommand = Generator::createEditOrderCommand();

$this->dbRepositoryMock
->expects(self::once())
->method('getGrOrderIdFromMapping')
->with($editOrderCommand->getShopId(), $editOrderCommand->getOrder()->getExternalOrderId())
->willReturn(null);

$this->grApiClientMock
->expects(self::never())
->method('updateOrder');

$this->sut->updateOrder($editOrderCommand);
}

}

0 comments on commit 731490f

Please sign in to comment.