/**
  * @param AMQPMessage $msg The message
  * @return mixed false to reject and requeue, any other value to aknowledge
  */
 public function execute(AMQPMessage $msg)
 {
     $msgBody = json_decode($msg->body);
     $erpOrderId = $msgBody->payload->erpOrderId;
     $shopifyOrderId = $msgBody->payload->shopifyOrderId;
     $storeId = $msgBody->payload->storeId;
     try {
         $store = $this->store->getStore($storeId);
         $order = $this->erpClient->getOrder($store, $erpOrderId);
         $erpShipment = $this->erpClient->getShipment($store, $order);
         $shopifyOrder = $this->shopifyApiClient->getOrder($store, $shopifyOrderId);
         $isShipmentFulfilled = $this->erpShipmentService->isShipmentFulfilled($erpShipment, $shopifyOrder);
         $this->erpShipmentService->setFulfilledItems($erpShipment, $shopifyOrder);
         //Send the order off to be updated
         $this->shopifyApiClient->updateOrCreateFulfillments($store, $shopifyOrder, $erpShipment);
         if ($isShipmentFulfilled) {
             //Send the order off for completion
             $this->shopifyApiClient->completeOrder($store, $shopifyOrder);
         }
     } catch (ErpOrderNotFound $e) {
         return false;
     } catch (ErpShipmentNotFound $e) {
         return false;
     } catch (\Exception $e) {
         return false;
     }
 }
 /**
  * @param StoreEntity $store
  */
 public function checkHandlingFeeProductAndCreateIt(StoreEntity $store)
 {
     try {
         if ($store->getShopifyHandlingFeeProductId()) {
             $this->shopifyClient->checkHandlingFeeProduct($store);
         } else {
             $erpProduct = ErpProductEntity::createHandlingFeeProduct();
             $product = $this->shopifyClient->saveProduct($store, $erpProduct);
             $store->setShopifyHandlingFeeProductId($product->getVariantId());
             $this->storeRepository->save($store);
         }
     } catch (NoShopifyProductFound $e) {
         //Add the handling fee product
         $erpProduct = ErpProductEntity::createHandlingFeeProduct();
         $product = $this->shopifyClient->saveProduct($store, $erpProduct);
         $store->setShopifyHandlingFeeProductId($product->getVariantId());
         $this->storeRepository->save($store);
     }
 }