]> _ Git - adangelis.git/commitdiff
wait #4994 @0.5 master
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 24 Dec 2021 10:59:50 +0000 (11:59 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 24 Dec 2021 10:59:50 +0000 (11:59 +0100)
.idea/deployment.xml
framework/application/controllers/PaymentController.php

index 60dbce01ff1b5ba4865eb259c802ca4fb93bd2dc..9992c458c6df3af506fb5ddde33cec60e058a6eb 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
-  <component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false">
+  <component name="PublishConfigData" autoUpload="Always" serverName="www.adangelis.com" remoteFilesAllowedToDisappearOnAutoupload="false">
     <serverData>
       <paths name="apps.fluidbook.com">
         <serverdata>
       <paths name="www.adangelis.com">
         <serverdata>
           <mappings>
-            <mapping local="$PROJECT_DIR$" web="/" />
+            <mapping deploy="/" local="$PROJECT_DIR$" web="/" />
           </mappings>
         </serverdata>
       </paths>
         </serverdata>
       </paths>
     </serverData>
+    <option name="myAutoUpload" value="ALWAYS" />
   </component>
 </project>
\ No newline at end of file
index b104b7d70c6cee0b0839ecf810e8ac2c9a1ade67..ebf0b4c118b73079d022de22ef7b096c859e452f 100644 (file)
 <?php
 
-class PaymentController extends CubeIT_Controller_PageController {
-
-       public function okAction() {
-               //$this->_sendFakeResponse(true);
-               $this->redirect($this->getNavigation()->findOneByName('commander/confirmation')->getHref());
-       }
-
-       protected function _getPaymentManager() {
-               $o = $this->_getPaymentOptions();
-               if ($o['system'] == 'cmcic') {
-                       return new CubeIT_Payment_CMCIC();
-               } else if ($o['system'] == 'postfinance') {
-                       return new CubeIT_Payment_Postfinance();
-               }
-       }
-
-       protected function _getPaymentOptions() {
-               $p = $this->getOption('payment');
-               $res = $this->getOption($p);
-               $res['system'] = $p;
-               return $res;
-       }
-
-       protected function _sendFakeResponse($ok) {
-               $o = $this->_getPaymentOptions();
-               if (!$o['test']) {
-                       return;
-               }
-               $session = $this->getSession();
-               $datas = array('reference' => $session->commande, 'summary' => 'test response');
-               if ($ok) {
-                       $this->accepted($datas);
-               } else {
-                       $this->refused($datas);
-               }
-       }
-
-       public function nokAction() {
-               $this->_sendFakeResponse(true);
-               $this->redirect($this->getNavigation()->findOneByName('commander/confirmation')->getHref());
-       }
-
-       public function autoAction() {
-               $this->disableLayout();
-               $this->getResponse()->setHeader('Content-type', 'text/plain');
-
-               $manager = $this->_getPaymentManager();
-               echo $manager->receipt(array($this, 'accepted'), array($this, 'refused'));
-       }
-
-       public function accepted($datas) {
-               // Get next facture number
-               $db = $this->getDb();
-               $f = $db->select()->from('commande', array('facture' => 'MAX(facture)+1'))->query()->fetch();
-
-               $commande = $this->_updateCommande($datas, array('status' => 1, 'facture' => $f->facture));
-
-               for ($i = 1; $i <= $commande->getQuantite(); $i++) {
-                       // Création du médaillon
-                       $medaillon = new Adangelis_Model_Medaillon();
-                       $medaillon->setCommande($commande->getId());
-                       $medaillon->save();
-
-                       // Création    du mémorial
-                       $memorial = new Adangelis_Model_Memorial();
-                       $memorial->setMedaillon($medaillon->getId());
-                       $memorial->save();
-               }
-               $mailing = new Adangelis_Mailing($this->view);
-               $mailing->confirmationCommande($commande->getId());
-       }
-
-       public function refused($datas) {
-               $this->_updateCommande($datas, array('status' => 3));
-       }
-
-       /**
-        *
-        * @param array $datas
-        * @param array $bind
-        * @return Adangelis_Model_Commande
-        */
-       protected function _updateCommande($datas, $bind) {
-               $bind = array_merge($bind, array('infospaiement' => $datas['summary'], 'date_paiement' => Zend_Date::now()));
-               $commande = new Adangelis_Model_Commande();
-               $commande->selectById($datas['reference']);
-               $commande->inject($bind);
-               $commande->save();
-
-               return $commande;
-       }
+class PaymentController extends CubeIT_Controller_PageController
+{
+
+    public function okAction()
+    {
+        //$this->_sendFakeResponse(true);
+        $this->redirect($this->getNavigation()->findOneByName('commander/confirmation')->getHref());
+    }
+
+    protected function _getPaymentManager()
+    {
+        $o = $this->_getPaymentOptions();
+        if ($o['system'] == 'cmcic') {
+            return new CubeIT_Payment_CMCIC();
+        } else if ($o['system'] == 'postfinance') {
+            return new CubeIT_Payment_Postfinance();
+        }
+    }
+
+    protected function _getPaymentOptions()
+    {
+        $p = $this->getOption('payment');
+        $res = $this->getOption($p);
+        $res['system'] = $p;
+        return $res;
+    }
+
+    protected function _sendFakeResponse($ok)
+    {
+        $o = $this->_getPaymentOptions();
+        if (!$o['test']) {
+            return;
+        }
+        $session = $this->getSession();
+        $datas = array('reference' => $session->commande, 'summary' => 'test response');
+        if ($ok) {
+            $this->accepted($datas);
+        } else {
+            $this->refused($datas);
+        }
+    }
+
+    public function nokAction()
+    {
+        $this->_sendFakeResponse(true);
+        $this->redirect($this->getNavigation()->findOneByName('commander/confirmation')->getHref());
+    }
+
+    public function autoAction()
+    {
+        $this->disableLayout();
+        $this->getResponse()->setHeader('Content-type', 'text/plain');
+
+        $manager = $this->_getPaymentManager();
+        echo $manager->receipt(array($this, 'accepted'), array($this, 'refused'));
+    }
+
+    public function accepted($datas)
+    {
+        // Get next facture number
+        $db = $this->getDb();
+        $f = $db->select()->from('commande', [new Zend_Db_Expr('MAX(facture)+1 AS facture')])->query()->fetch();
+
+        $commande = $this->_updateCommande($datas, array('status' => 1, 'facture' => $f->facture));
+
+        for ($i = 1; $i <= $commande->getQuantite(); $i++) {
+            // Création du médaillon
+            $medaillon = new Adangelis_Model_Medaillon();
+            $medaillon->setCommande($commande->getId());
+            $medaillon->save();
+
+            // Création       du mémorial
+            $memorial = new Adangelis_Model_Memorial();
+            $memorial->setMedaillon($medaillon->getId());
+            $memorial->save();
+        }
+        $mailing = new Adangelis_Mailing($this->view);
+        $mailing->confirmationCommande($commande->getId());
+    }
+
+    public function refused($datas)
+    {
+        $this->_updateCommande($datas, array('status' => 3));
+    }
+
+    /**
+     *
+     * @param array $datas
+     * @param array $bind
+     * @return Adangelis_Model_Commande
+     */
+    protected function _updateCommande($datas, $bind)
+    {
+        $bind = array_merge($bind, array('infospaiement' => $datas['summary'], 'date_paiement' => Zend_Date::now()));
+        $commande = new Adangelis_Model_Commande();
+        $commande->selectById($datas['reference']);
+        $commande->inject($bind);
+        $commande->save();
+
+        return $commande;
+    }
 
 }