PrestaShopCorp / vtpayment

Accept payments with UnionPay cards by using VTPayment
2 stars 2 forks source link

Return value of install() & uninstall() #10

Closed Quetzacoalt91 closed 10 years ago

Quetzacoalt91 commented 10 years ago

In unionpay.php, neither install() nor uninstall() return a value when they are executed. They MUST return a boolean, or PrestaShop won't be able to know if everything went as expected. In my case, when I click on the install button, I can try to install it a second time because the function didn't return true (same thing for uninstall).

Please add a return value for these function. false if there is a problem, true if everything went good.

Quetzacoalt91 commented 10 years ago

It's better, but not perfect. Your functions parent::install(), registerHook(...) etc. also return a boolean which allow you to know if each of them succeed. Use them to return the value from install().

ex.:

    public function install()
    {
        return parent::install() && $this->registerHook('payment') && $this->registerHook('paymentReturn');
    }