protected function markCompleted($endStatus, ServiceResponse $serviceResponse, $gatewayMessage)
    {
        $this->payment->Status = $endStatus;
        if ($gatewayMessage && ($reference = $gatewayMessage->getTransactionReference())) {
            $this->payment->TransactionReference = $reference;
        }
        $this->payment->write();
    }