public function sourceStatusChange(Source $invoiceSource)
    {
        $result = $this->getInvoiceResult('InvoiceManager::sourceStatusChange()');
        $status = $invoiceSource->getStatus();
        $shopEventSettings = $this->getConfig()->getShopEventSettings();
        if ($invoiceSource->getType() === Source::Order) {
            $doSend = in_array($status, $shopEventSettings['triggerOrderStatus']);
            $arguments = array($status, implode(',', $shopEventSettings['triggerOrderStatus']));
            $notSendReason = Result::NotSent_WrongStatus;
        } else {
            $doSend = $shopEventSettings['triggerCreditNoteEvent'] === PluginConfig::TriggerCreditNoteEvent_Create;
            $arguments = array();
            $notSendReason = Result::NotSent_TriggerCreditNoteEventNotEnabled;
        }
        if ($doSend) {
            $result = $this->createAndSend($invoiceSource, $result);
            // Add argument to send status, this will add the current status and
            // the set of statuses on which to send to the log line.
            $result->setSendStatus($result->getSendStatus(), $arguments);
        } else {
            $result->setSendStatus($notSendReason, $arguments);
        }
        $this->getLog()->notice($this->getSendResultLogText($invoiceSource, $result));
        return $result;
    }