Actually, I write a new payment module for Fianet, called ReceiveAndPay.
A new French payment solution.
Everything going right but I block on small things :
- I lost the checkout session during return to the store although customer are still connected to his account.
Customer are redirected to cart page, but I want to redirected him to the checkout success page.
- How do I desactive the module from payment process if, per example, the service are unavailable ?
I look for var or function, not all code.
This is my StandardController for the return :
<?php /** * When a customer chooses ReceiveAndPay on Checkout/Payment page * */ public function redirectAction() { $session = Mage::getSingleton('checkout/session'); $session->setReceiveandpayStandardQuoteId($session->getQuoteId()); $this->getResponse()->setBody($this->getLayout()->createBlock('receiveandpay/standard_redirect')->toHtml()); $session->unsQuoteId(); }
public function customerAction() { $session = Mage::getSingleton('checkout/session'); $session->setQuoteId($session->getReceiveandpayStandardQuoteId(true)); /** * set the quote as inactive after back from ReceiveAndPay */ Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
/** * Response from ReceiveAndPay * * @return void */ public function systemAction() { /* Pas de reponse POST de la part de ReceiveAndPay Vérification importante si quelqu'un tape l'adresse directement dans la barre d'adresse */ if (!$this->getRequest()->isPost()) { $this->_redirect(''); return; }
// Enregistre le retour du serveur ReceiveAndPay if ( $this->getDebug() ) { $debug = Mage::getModel('receiveandpay/api_debug') ->setApiEndpoint($this->getStandard()->getReceiveAndPayUrl()) ->setRequestBody(print_r($this->getRequest()->getPost(), 1)) ->save(); } }
It’s almost done, so some helps are VERY appreciated !
I just think about testing how paypal module implements return callback and return action for the customer.
And I am little astonished !
It’s exactly the same controller so I don’t see where I wrong ?
I tried paypal module just to check out and when you are on paypal side and you click on “return to the shop ****”
it redirect me to the empty shopping cart page ...
It display the cart without items…
I think it’s bug ? Somebody have noticed that ?
@ryu007: do you have ‘active’ configuration flag for your module?
Yes, of course !
I have just finished the module right now,
but I have to know how do I desactive the module by code if ReceiveAndPay server is unavailable !
For further information, this is my new controller :
<?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * @category Mage * @package Mage_ReceiveAndPay * @copyright Copyright (c) 2004-2007 Irubin Consulting Inc. DBA Varien (http://www.varien.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* ReceiveAndPay Form Method Front Controller * * @category Mage * @package Mage_ReceiveAndPay * @name Mage_ReceiveAndPay_StandardController **/
class Mage_ReceiveAndPay_StandardController extends Mage_Core_Controller_Front_Action { /** * Get singleton with ReceiveAndPay strandard * * @return object Mage_ReceiveAndPay_Model_Standard */ public function getStandard() { return Mage::getSingleton('receiveandpay/standard'); }
/** * Get Api Key Model * * @return object Mage_ReceiveAndPay_Model_Config */ public function getApiKey() { return $this->getStandard()->getApiKey(); }
/** * Get Config model * * @return object Mage_ReceiveAndPay_Model_Config */ public function getConfig() { return $this->getStandard()->getConfig(); }
/** * Return debug flag * * @return boolean */ public function getDebug() { return $this->getStandard()->getDebug(); }
/** * When a customer chooses ReceiveAndPay on Checkout/Payment page * */ public function redirectAction() { $session = Mage::getSingleton('checkout/session'); $session->setReceiveandpayStandardQuoteId($session->getQuoteId()); $this->getResponse()->setBody($this->getLayout()->createBlock('receiveandpay/standard_redirect')->toHtml()); $session->unsQuoteId(); }
/** * Customer Response from ReceiveAndPay * * @return void */ public function customerAction() { $session = Mage::getSingleton('checkout/session'); $session->setQuoteId($session->getReceiveandpayStandardQuoteId(true));
if ($checkHash != $this->getRequest()->getPost('HashControl')) { Mage::throwException('Hash value doesn\'t according to Merchant'); $this->_redirect('checkout/onepage'); }
// Verification si la commande n'a pas été avortée ou refusée pour fraude if ($this->getRequest()->getPost('Tag') != 0 && $this->getRequest()->getPost('Tag') != 2) { /** * send confirmation email to customer */ $order = Mage::getModel('sales/order'); $order->loadByIncrementId($this->getRequest()->getPost('RefID'));
if ($order->getId()) { $order->sendNewOrderEmail(); }
/** * PUSH Response from ReceiveAndPay * * @return void */ public function systemAction() { // Pas de reponse POST de la part de ReceiveAndPay if (!$this->getRequest()->isPost()) { Mage::throwException('Callback data are not present'); $this->_redirect(''); return; }
if ($checkHash != $this->getRequest()->getPost('HashControl')) { Mage::throwException('Hash value doesn\'t according to Merchant'); $this->_redirect(''); return; }
// Enregistre le retour du serveur ReceiveAndPay si Mode Debug if ( $this->getDebug() ) { $debug = Mage::getModel('receiveandpay/api_debug) ->setApiEndpoint($this->getStandard()->getReceiveAndPayUrl()) ->setRequestBody(print_r($this->getRequest()->getPost(), 1)) ->save(); } } }
I am sorry for a question that is not 100% related to this topic but i’ve been looking for help everywhere and no one seems to know what to do about this problem. I am even starting to think of giving up on magento all together and just stick with os commerce.
My problem is:
If a user comes to buy something for the first time they are asked if they want to register or check out as a guest.
Lets say the user types in their registration details and move in step by step to the final page before it is redirected to the paypal payments standard uk page, the problem starts when the redirected paypal website loads up and the price information has not been transferred, so pay pal will ask the user to put in the price information themselves.
The same problem does not happen if the user is already registered or tries to check out as a guest, the price will be sent over to paypal without any problems.
/** * Return true if the method can be used at this time * * @return bool */ public function isAvailable() { return false; }
I may be misunderstanding, but if you want to deactivate the module, you wouldnt want to mess with the base code as that will kill all the other modules as well.
You should have in your system.xml file something like this:
Simply setting the default <active> to 0 instead of 1 will deactive the module. You can also go into the admin configuration area and select Enabled: No and that will do it as well.