Skip to content

Commit

Permalink
skip not existing order item
Browse files Browse the repository at this point in the history
  • Loading branch information
Pfabeck committed Feb 13, 2020
1 parent c94e165 commit 9260af9
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@ private function getOrderItems(array $entry): array
$result = [];

foreach ($entry['orderItems'] as $item) {

$number = $this->getNumberFromVariation($item['itemVariationId']);

if (empty($number)) {
Expand Down Expand Up @@ -759,20 +760,15 @@ private function getOrderItemPrice(array $item): float
return $price;
}

/**
* @param $variationId
*
* @return string
*/
private function getNumberFromVariation($variationId): string
private function getNumberFromVariation($variationId): ?string
{
static $variations;

if (!isset($variations[$variationId])) {
$response = $this->client->request('GET', 'items/variations', ['id' => $variationId]);

if (empty($response)) {
return '';
return null;
}

$variation = array_shift($response);
Expand Down

0 comments on commit 9260af9

Please sign in to comment.