/**
  * @param Queue $queue
  * @param \Magento\Sales\Api\Data\InvoiceInterface|\Magento\Sales\Api\Data\CreditmemoInterface $entity
  * @param \ClassyLlama\AvaTax\Api\Data\GetTaxResponseInterface $processSalesResponse
  */
 protected function completeQueueProcessing(Queue $queue, $entity, GetTaxResponseInterface $processSalesResponse)
 {
     $message = __('%1 #%2 was submitted to AvaTax', ucfirst($queue->getEntityTypeCode()), $entity->getIncrementId());
     $queueMessage = '';
     if ($processSalesResponse->getIsUnbalanced()) {
         $adjustmentMessage = null;
         if ($entity instanceof CreditmemoInterface) {
             if (abs($entity->getBaseAdjustmentNegative()) > 0 || abs($entity->getBaseAdjustmentPositive()) > 0) {
                 $adjustmentMessage = __('The difference was at least partly caused by the fact that the creditmemo ' . 'contained an adjustment of %1 and Magento doesn\'t factor that into its calculation, ' . 'but AvaTax does.', $entity->getBaseAdjustment());
             }
         }
         $queueMessage = __('Unbalanced Response - Collected: %1, AvaTax Actual: %2', $entity->getBaseTaxAmount(), $processSalesResponse->getBaseAvataxTaxAmount());
         if ($adjustmentMessage) {
             $queueMessage .= ' — ' . $adjustmentMessage;
         }
         // add comment about unbalanced amount
         $message .= '<br/>' . __('When submitting the %1 to AvaTax the amount calculated for tax differed from what was' . ' recorded in Magento.', $queue->getEntityTypeCode()) . '<br/>' . __('There was a difference of %1', $entity->getBaseTaxAmount() - $processSalesResponse->getBaseAvataxTaxAmount()) . '<br/>';
         if ($adjustmentMessage) {
             $message .= '<strong>' . $adjustmentMessage . '</strong><br/>';
         }
         $message .= __('Magento listed a tax amount of %1', $entity->getBaseTaxAmount()) . '<br/>' . __('AvaTax calculated the tax to be %1', $processSalesResponse->getBaseAvataxTaxAmount()) . '<br/>';
     }
     $queue->setMessage($queueMessage);
     $queue->setQueueStatus(Queue::QUEUE_STATUS_COMPLETE);
     $queue->save();
     // Add comment to order
     $this->addOrderComment($entity->getOrderId(), $message);
 }