/** * Public method called after the customer returns to the shop * * @param string $status * @param string $reason * @param string $transactionId */ public function createOrderAfterRedirect($status, $reason, $transactionId) { // workaround for missing session after creating order $orderVariables = unserialize(Shopware()->Session()->offsetGet('sofortMailVariables')); $user = $this->context->getUser(); $alreadySend = false; $result = false; if (!Shopware()->Session()->sofortOrderExsist) { Shopware()->Session()->sofortSendMail = true; //create Order $result = $this->saveOrder($transactionId, 0); $alreadySend = true; } else { $helper = new Shopware_Plugins_Frontend_SofortPayment_Components_Helpers_Helper(); $helper->database()->changeTransactionId($this->context->getOrderNumber(), $transactionId); $this->setOrderState($transactionId, 0); } $state = $this->context->convertLibState($status, $reason); if ($state !== 0) { $row = $this->getOrderInformation($transactionId); $order = Shopware()->Modules()->Order(); $order->setPaymentStatus($row['id'], $state, false); $this->logger->logManually(__CLASS__, 'Change PaymentStatus for Order #' . $row['ordernumber'] . '(' . $row['id'] . ') to ' . $state); } if (!$alreadySend) { //send Mail $this->sendMail($orderVariables, $user); } }