Jump to content
thirty bees forum
  • 0

URGENT: Some payment modules are unable to generate orders


Question

Posted

I get the following log and the customers get an error 500:
 

Decoded exception

Can't load Order status

in file classes/module/PaymentModule.php at line 408

Source file: classes/module/PaymentModule.php

389:            $this->context = Context::getContext();
390:        }
391:        $this->context->cart = new Cart((int) $idCart);
392:        $this->context->customer = new Customer((int) $this->context->cart->id_customer);
393:        // The tax cart is loaded before the customer so re-cache the tax calculation method
394:        $this->context->cart->setTaxCalculationMethod();
395:
396:        $this->context->language = new Language((int) $this->context->cart->id_lang);
397:        $this->context->shop = ($shop ? $shop : new Shop((int) $this->context->cart->id_shop));
398:        ShopUrl::resetMainDomainCache();
399:        $idCurrency = $currencySpecial ? (int) $currencySpecial : (int) $this->context->cart->id_currency;
400:        $this->context->currency = new Currency((int) $idCurrency, null, (int) $this->context->shop->id);
401:        if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_delivery') {
402:            $contextCountry = $this->context->country;
403:        }
404:
405:        $orderStatus = new OrderState((int) $idOrderState, (int) $this->context->language->id);
406:        if (!Validate::isLoadedObject($orderStatus)) {
407:            Logger::addLog('PaymentModule::validateOrder - Order Status cannot be loaded', 3, null, 'Cart', (int) $idCart, true);
408:            throw new PrestaShopException('Can\'t load Order status');
409:        }
410:
411:        if (!$this->active) {
412:            Logger::addLog('PaymentModule::validateOrder - Module is not active', 3, null, 'Cart', (int) $idCart, true);
413:            die(Tools::displayError());
414:        }
415:
416:        // Does order already exists ?
417:        if (Validate::isLoadedObject($this->context->cart) && $this->context->cart->OrderExists() == false) {
418:            if ($secureKey !== false && $secureKey != $this->context->cart->secure_key) {

Stack trace

1. modules/paybyphone/controllers/front/validation.php:46 source PaymentModuleCore->validateOrder(arguments)
2. classes/controller/Controller.php:197 source paybyphoneValidationModuleFrontController->postProcess()
178:        } else {
179:            $this->$property = $value;
180:        }
181:    }
182:
183:    /**
184:     * Starts the controller process
185:     *
186:     * @since   1.0.0
187:     * @version 1.0.0 Initial version
188:     */
189:    public function run()
190:    {
191:        $this->init();
192:        if ($this->checkAccess()) {
193:            if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {
194:                $this->setMedia();
195:            }
196:
197:            $this->postProcess();
198:
199:            if (!empty($this->redirect_after)) {
200:                $this->redirect();
201:            }
202:
203:            if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {
204:                $this->initHeader();
205:            }
206:
207:            if ($this->viewAccess()) {
3. classes/controller/FrontController.php:253 source ControllerCore->run()
234:     * @see     Controller::run()
235:     * @since   1.0.0
236:     *
237:     * @version 1.0.0 Initial version
238:     */
239:    public function postProcess()
240:    {
241:    }
242:
243:    /**
244:     * Starts the controller process
245:     *
246:     * Overrides Controller::run() to allow full page cache
247:     *
248:     * @since   1.0.7
249:     */
250:    public function run()
251:    {
252:        if (! PageCache::isEnabled()) {
253:            return parent::run();
254:        }
255:
256:        $debug = Configuration::get('TB_PAGE_CACHE_DEBUG');
257:        $cacheEntry = PageCache::get();
258:        if (! $cacheEntry->exists()) {
259:            if ($debug) {
260:                header('X-thirtybees-PageCache: MISS');
261:            }
262:            return parent::run();
263:        }
4. classes/Dispatcher.php:852 source FrontControllerCore->run()
833:                    return;
834:                }
835:                break;
836:
837:            default:
838:                throw new PrestaShopException('Bad front controller chosen');
839:        }
840:
841:        // Instantiate controller
842:        try {
843:            // Loading controller
844:            $controller = Controller::getController($controllerClass);
845:
846:            // Execute hook dispatcher
847:            if (isset($paramsHookActionDispatcher)) {
848:                Hook::exec('actionDispatcher', $paramsHookActionDispatcher);
849:            }
850:
851:            // Running controller
852:            $controller->run();
853:        } catch (PrestaShopException $e) {
854:            $e->displayMessage();
855:        }
856:    }
857:
858:    /**
859:     * Retrieve the controller from url or request uri if routes are activated
860:     *
861:     * @param int|null $idShop
862:     *
5. ./index.php:33 source DispatcherCore->dispatch()
14: * If you did not receive a copy of the license and are unable to
15: * obtain it through the world-wide-web, please send an email
16: * to [email protected] so we can send you a copy immediately.
17: *
18: * DISCLAIMER
19: *
20: * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
21: * versions in the future. If you wish to customize PrestaShop for your
22: * needs please refer to https://www.thirtybees.com for more information.
23: *
24: *  @author    thirty bees <[email protected]>
25: *  @author    PrestaShop SA <[email protected]>
26: *  @copyright 2017-2018 thirty bees
27: *  @copyright 2007-2016 PrestaShop SA
28: *  @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
29: *  PrestaShop is an internationally registered trademark & property of PrestaShop SA
30: */
31:
32:require(dirname(__FILE__).'/config/config.inc.php');
33:Dispatcher::getInstance()->dispatch()


 

7 answers to this question

Recommended Posts

  • 0
Posted (edited)
6 minutes ago, datakick said:

Module paybyphone calls core method with invalid order status ID - /modules/paybyphone/controllers/front/validation.php line 46. 

 

First, thank you so much for answering.

So I need to change the order status ID? It used to work fine so I am not sure what changed there.

This is line 46
        $this->module->validateOrder($cart->id, Configuration::get('PAYBYPHONE_OS_CALL'), $total, $this->module->displayName, null, $mailVars, (int)$currency->id, false, $customer->secure_key);

Edited by movieseals
  • 0
Posted
26 minutes ago, movieseals said:

Configuration::get('PAYBYPHONE_OS_CALL')

The order status is stored in configuration table under the name PAYBYPHONE_OS_CALL. It's likely this settings is exposed in this module configuration page. If not, you will have to change the info in db table directly

  • Like 1
  • 0
Posted
4 minutes ago, datakick said:

The order status is stored in configuration table under the name PAYBYPHONE_OS_CALL. It's likely this settings is exposed in this module configuration page. If not, you will have to change the info in db table directly

Perfect.  Gives me a clearer *for me and my level of knowledge* clue to investigate!  Thanks so much!

  • 0
Posted

@datakick Thank you so much.  I guess the PAYBYPHONE_OS_CALL got changed when we used an old backup - the order status was indeed wrong for some reason and even resetting the module had not fixed it, so changing it straight in the DB fixed it!  Many thanks!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...