예제 #1
0
 /**
  * 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;
 }
예제 #2
0
 /**
  * User accepted Bankwire Payment -> createOrder
  */
 public function paymentAction()
 {
     //DoPayment
     //$this->session->order = $this->getModule()->createOrder($this->cart, \CoreShop\Model\Order\State::getById(\CoreShop\Model\Configuration::get("SYSTEM.ORDERSTATE.BANKWIRE")), 0, $this->view->language);
     $this->session->order = $this->cart->createOrder(\CoreShop\Model\Order\State::getById(\CoreShop\Model\Configuration::get("SYSTEM.ORDERSTATE.BANKWIRE")), $this->getModule(), 0, $this->view->language);
     $this->redirect($this->getModule()->getConfirmationUrl());
 }
예제 #3
0
 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
 }
예제 #4
0
 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 paymentReturnAction()
 {
     if (!$this->cart instanceof \CoreShop\Model\Cart) {
         $this->redirect($this->view->url(array(), 'coreshop_index'));
     }
     $configkey = \CoreShop\Model\Configuration::get('SOFORTUEBERWEISUNG.KEY');
     $SofortLibTransactionData = new \Sofort\SofortLib\TransactionData($configkey);
     $SofortLibTransactionData->addTransaction($this->cart->getCustomIdentifier());
     $SofortLibTransactionData->sendRequest();
     if ($SofortLibTransactionData->getStatus() === 'received' || $SofortLibTransactionData->getStatus() === 'pending') {
         $order = $this->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 = $p->getPaymentInformation()->getCoreShopPaymentSofortueberweisung();
             if (!$dataBrick) {
                 $dataBrick = new \Pimcore\Model\Object\Objectbrick\Data\CoreShopPaymentSofortueberweisung($p);
             }
             $dataBrick->setTransactionId($this->cart->getCustomIdentifier());
             $dataBrick->setStatus($SofortLibTransactionData->getStatus());
             $dataBrick->setStatusReason($SofortLibTransactionData->getStatusReason());
             $dataBrick->setStatusModifiedTime($SofortLibTransactionData->getStatusModifiedTime());
             $dataBrick->setLanguageCode($SofortLibTransactionData->getLanguageCode());
             $dataBrick->setCurrency($SofortLibTransactionData->getCurrency());
             $p->save();
         }
         $this->redirect($this->getModule()->getConfirmationUrl($order));
     }
     $this->redirect($this->view->url(array(), 'coreshop_index'));
 }
예제 #6
0
 public function init()
 {
     $this->gateway = $this->getParam("gateway");
     $activeProviders = \CoreShop\Model\Configuration::get("OMNIPAY.ACTIVEPROVIDERS");
     if (!is_array($activeProviders)) {
         $activeProviders = array();
     }
     if (!in_array($this->gateway, $activeProviders)) {
         throw new \Exception("Not supported");
     }
     parent::init();
     $gatewayName = strtolower($this->getModule()->getGateway()->getShortName());
     $pluginPath = PIMCORE_PLUGINS_PATH . "/Omnipay/views/scripts/" . $gatewayName;
     $this->view->setScriptPath(array_merge($this->view->getScriptPaths(), array($pluginPath, CORESHOP_TEMPLATE_BASE . '/scripts/omnipay/' . $gatewayName, CORESHOP_TEMPLATE_BASE . '/scripts/coreshop/omnipay/' . $gatewayName, CORESHOP_TEMPLATE_PATH . '/scripts/omnipay/' . $gatewayName, CORESHOP_TEMPLATE_PATH . '/scripts/coreshop/omnipay/' . $gatewayName, PIMCORE_WEBSITE_PATH . '/views/scripts/omnipay/' . $gatewayName, PIMCORE_WEBSITE_PATH . '/views/scripts/coreshop/omnipay/' . $gatewayName)));
 }
예제 #7
0
 public function removeProviderAction()
 {
     $gateway = $this->getParam("provider");
     if (in_array($gateway, \Omnipay\Omnipay::getFactory()->getSupportedGateways())) {
         $activeProviders = Model\Configuration::get("OMNIPAY.ACTIVEPROVIDERS");
         if (!is_array($activeProviders)) {
             $activeProviders = [];
         }
         if (in_array($gateway, $activeProviders)) {
             $index = array_search($gateway, $activeProviders);
             if ($index >= 0) {
                 unset($activeProviders[$index]);
             }
             Model\Configuration::set("OMNIPAY.ACTIVEPROVIDERS", $activeProviders);
             $this->_helper->json(array("success" => true));
         }
     }
     $this->_helper->json(array("success" => false));
 }
예제 #8
0
파일: Shop.php 프로젝트: coreshop/omnipay
 /**
  * @throws \Zend_EventManager_Exception_InvalidArgumentException
  */
 public function attachEvents()
 {
     self::getInstall()->attachEvents();
     $activeProviders = Configuration::get("OMNIPAY.ACTIVEPROVIDERS");
     if (!is_array($activeProviders)) {
         $activeProviders = [];
     }
     foreach ($activeProviders as $provider) {
         $gateway = \Omnipay\Omnipay::getFactory()->create($provider);
         $config = Configuration::get("OMNIPAY." . strtoupper($provider));
         if (is_null($config)) {
             $config = [];
         }
         $shopProvider = new Provider($gateway, $config);
         \Pimcore::getEventManager()->attach("coreshop.payment.getProvider", function ($e) use($shopProvider) {
             return $shopProvider;
         });
     }
 }
예제 #9
0
?>
" method="post">
    <div class="panel panel-smart">
        <div class="panel-heading">
            <h3 class="panel-title"><?php 
echo $this->translate("Bankwire");
?>
</h3>
        </div>
        <div class="panel-body delivery-options">
            <p><?php 
echo sprintf($this->translate("Do you want to pay the amount of %s with Bankwire?", \CoreShop::getTools()->formatPrice($this->cart->getTotal())));
?>
</p>
            <p><?php 
echo html_entity_decode(\CoreShop\Model\Configuration::get("BANKWIRE.TEXT." . strtoupper($this->language)));
?>
</p>
            <div class="row">
                <div class="col-xs-12">
                    <a href="<?php 
echo $this->url(array("lang" => $this->language, "act" => "payment"), "coreshop_checkout");
?>
" class="btn btn-default pull-left">
                        <?php 
echo $this->translate("Back");
?>
                    </a>

                    <button type="submit" class="btn btn-white btn-borderd pull-right">
                        <?php 
예제 #10
0
 /**
  * get payment fee
  *
  * @param Cart $cart
  * @return float
  */
 private function getPaymentFeeForCart(Cart $cart)
 {
     $carrier = $cart->getCarrier();
     if (Configuration::get("COD.CARRIER.PRICE." . $carrier->getId())) {
         return Configuration::get("COD.CARRIER.PRICE." . $carrier->getId());
     }
     return 0;
 }