public function paymentReturnAction() { $returnvalue = $_REQUEST['PROCESSING_RESULT']; if ($returnvalue) { $transactionIdentification = $_REQUEST['IDENTIFICATION_TRANSACTIONID']; $cart = \CoreShop\Model\Cart::findByCustomIdentifier($transactionIdentification); if ($cart instanceof \CoreShop\Model\Cart) { if (strstr($returnvalue, "ACK")) { $order = $cart->createOrder(\CoreShop\Model\Order\State::getById(\CoreShop\Model\Configuration::get("SYSTEM.ORDERSTATE.PAYMENT")), $this->getModule(), $cart->getTotal(), $this->view->language); $payments = $order->getPayments(); foreach ($payments as $p) { $dataBrick = new CoreShopPaymentPayunity($p); $dataBrick->setIdentificationUniqeId($_POST['IDENTIFICATION_UNIQUEID']); $dataBrick->setIdentificationShortId($_POST['IDENTIFICATION_SHORTID']); $p->save(); } echo Pimcore\Tool::getHostUrl() . $this->getModule()->getConfirmationUrl($order); } else { echo Pimcore\Tool::getHostUrl() . $this->getModule()->getErrorUrl(); } } else { echo Pimcore\Tool::getHostUrl() . $this->getModule()->getErrorUrl(); } } else { echo Pimcore\Tool::getHostUrl() . $this->getModule()->getErrorUrl(); } exit; //We only need to output a URL for Payunity }
public function paymentReturnAction() { $transaction = $_REQUEST['reference']; $status = $_REQUEST['transStatus']; if ($status === 'Y') { if ($transaction) { $cart = \CoreShop\Model\Cart::findByCustomIdentifier($transaction); if ($cart instanceof \CoreShop\Model\Cart) { $order = $cart->createOrder(\CoreShop\Model\Order\State::getById(\CoreShop\Model\Configuration::get("SYSTEM.ORDERSTATE.PAYMENT")), $this->getModule(), $this->cart->getTotal(), $this->view->language); $payments = $order->getPayments(); foreach ($payments as $p) { $dataBrick = new \Pimcore\Model\Object\Objectbrick\Data\CoreShopPaymentOmnipay($p); $dataBrick->setTransactionId($transaction); $p->save(); } $this->view->redirectUrl = Pimcore\Tool::getHostUrl() . $this->getModule()->getConfirmationUrl($order); } else { $this->view->redirectUrl = Pimcore\Tool::getHostUrl() . $this->getModule()->getErrorUrl(); } } else { $this->view->redirectUrl = Pimcore\Tool::getHostUrl() . $this->getModule()->getErrorUrl(); } } else { $this->view->redirectUrl = Pimcore\Tool::getHostUrl() . $this->getModule()->getErrorUrl(); } $this->disableLayout(); }
public function paymentAction() { $configkey = \CoreShop\Model\Configuration::get('SOFORTUEBERWEISUNG.KEY'); $sofort = new \Sofort\SofortLib\Sofortueberweisung($configkey); $sofort->setAmount(Tool::numberFormat($this->cart->getTotal())); $sofort->setVersion('CoreShop ' . \CoreShop\Version::getVersion()); $sofort->setReason('Buy Order (CoreShop)'); $sofort->setCurrencyCode(Tool::getCurrency()->getIsoCode()); $sofort->setSuccessUrl(Pimcore\Tool::getHostUrl() . $this->getModule()->url($this->getModule()->getIdentifier(), 'payment-return')); $sofort->setAbortUrl(Pimcore\Tool::getHostUrl() . $this->getModule()->url($this->getModule()->getIdentifier(), 'payment-return-abort')); $sofort->sendRequest(); if ($sofort->isError()) { var_dump($sofort); die('error'); } else { $transactionId = $sofort->getTransactionId(); $this->cart->setCustomIdentifier($transactionId); $this->cart->save(); $this->redirect($sofort->getPaymentUrl()); } }
public function getNicePathAction() { $source = \Zend_Json::decode($this->getParam("source")); if ($source["type"] != "object") { throw new \Exception("currently only objects as source elements are supported"); } $result = []; $id = $source["id"]; $source = Object\Concrete::getById($id); if ($this->getParam("context")) { $context = \Zend_Json::decode($this->getParam("context")); } else { $context = []; } $ownerType = $context["containerType"]; $fieldname = $context["fieldname"]; if ($ownerType == "object") { $fd = $source->getClass()->getFieldDefinition($fieldname); } elseif ($ownerType == "localizedfield") { $fd = $source->getClass()->getFieldDefinition("localizedfields")->getFieldDefinition($fieldname); } elseif ($ownerType == "objectbrick") { $fdBrick = Object\Objectbrick\Definition::getByKey($context["containerKey"]); $fd = $fdBrick->getFieldDefinition($fieldname); } elseif ($ownerType == "fieldcollection") { $containerKey = $context["containerKey"]; $fdCollection = Object\Fieldcollection\Definition::getByKey($containerKey); if ($context["subContainerType"] == "localizedfield") { $fdLocalizedFields = $fdCollection->getFieldDefinition("localizedfields"); $fd = $fdLocalizedFields->getFieldDefinition($fieldname); } else { $fd = $fdCollection->getFieldDefinition($fieldname); } } if (method_exists($fd, "getPathFormatterClass")) { $formatterClass = $fd->getPathFormatterClass(); if (Pimcore\Tool::classExists($formatterClass)) { $targets = \Zend_Json::decode($this->getParam("targets")); $result = call_user_func($formatterClass . "::formatPath", $result, $source, $targets, ["fd" => $fd, "context" => $context]); } else { Logger::error("Formatter Class does not exist: " . $formatterClass); } } $this->_helper->json(["success" => true, "data" => $result]); }
/** * This Action can be called via Frontend * @throws \CoreShop\Exception * @throws \CoreShop\Exception\ObjectUnsupportedException */ public function paymentReturnAction() { $requestData = $this->parseRequestData(); $this->disableLayout(); $this->disableViewAutoRender(); \Pimcore\Logger::notice('OmniPay paymentReturn [Postfinance]. TransactionID: ' . $requestData['transaction'] . ', Status: ' . $requestData['status']); $redirectUrl = ''; if ($requestData['status'] === 5) { if (!empty($requestData['transaction'])) { $cart = \CoreShop\Model\Cart::findByCustomIdentifier($requestData['transaction']); if ($cart instanceof \CoreShop\Model\Cart) { \Pimcore\Logger::notice('OmniPay paymentReturn [Postfinance]: create order with: ' . $requestData['transaction']); $order = $cart->createOrder(\CoreShop\Model\Order\State::getById(\CoreShop\Model\Configuration::get("SYSTEM.ORDERSTATE.PAYMENT")), $this->getModule(), $cart->getTotal(), $this->view->language); $payments = $order->getPayments(); foreach ($payments as $p) { $dataBrick = new \Pimcore\Model\Object\Objectbrick\Data\CoreShopPaymentOmnipay($p); $dataBrick->setTransactionId($requestData['transaction']); $p->save(); } $redirectUrl = Pimcore\Tool::getHostUrl() . $this->getModule()->getConfirmationUrl($order); } else { \Pimcore\Logger::notice('OmniPay paymentReturn [Postfinance]: Cart with identifier' . $requestData['transaction'] . 'not found'); $redirectUrl = Pimcore\Tool::getHostUrl() . $this->getModule()->getErrorUrl('cart with identifier' . $requestData['transaction'] . 'not found'); } } else { \Pimcore\Logger::notice('OmniPay paymentReturn [Postfinance]: No valid transaction id given'); $redirectUrl = Pimcore\Tool::getHostUrl() . $this->getModule()->getErrorUrl('no valid transaction id given'); } } else { \Pimcore\Logger::notice('OmniPay paymentReturn [Postfinance]: Error Status: ' . $requestData['status']); $redirectUrl = Pimcore\Tool::getHostUrl() . $this->getModule()->getErrorUrl('Postfinance returned with an error. Error Status: ' . $requestData['status']); } $this->redirect($redirectUrl); exit; }
/** * Get all required Params for gateway. * extend this in your custom omnipay controller. * * @return array */ public function getGatewayParams() { $cardParams = $this->getParam("card", []); $params = $this->getAllParams(); $params['returnUrl'] = Pimcore\Tool::getHostUrl() . $this->getModule()->url($this->getModule()->getIdentifier(), "payment-return"); $params['cancelUrl'] = Pimcore\Tool::getHostUrl() . $this->getModule()->url($this->getModule()->getIdentifier(), "payment-return-abort"); $params['amount'] = $this->cart->getTotal(); $params['currency'] = \Coreshop::getTools()->getCurrency()->getIsoCode(); $params['transactionId'] = uniqid(); if (count($cardParams) > 0) { $params['card'] = new \Omnipay\Common\CreditCard($cardParams); } return $params; }