Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in hookActionSetInvoice function #1

Closed
mathieuhen opened this issue Dec 2, 2021 · 5 comments
Closed

Error in hookActionSetInvoice function #1

mathieuhen opened this issue Dec 2, 2021 · 5 comments

Comments

@mathieuhen
Copy link

Hello,

I installed the plugin and I got an error in the function hookActionSetInvoice on these lines :

$orderInvoice = OrderInvoice::getInvoiceByNumber($params['OrderInvoice']->id);
$orderInvoiceNumber = $orderInvoice->getInvoiceNumberFormatted($order->id_lang, $order->id_shop);

The error :
Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to a member function getInvoiceNumberFormatted() on bool

We are on PS 1.7.7.3.

I changed the line
$orderInvoice = OrderInvoice::getInvoiceByNumber($params['OrderInvoice']->id);
by
$orderInvoice = $params['OrderInvoice'];

And that is OK now.

It seems logical because on the hook ActionSetInvoice in the class Order, the variables sent are

$invoice_number = Hook::exec('actionSetInvoice', [
get_class($this) => $this,
get_class($order_invoice) => $order_invoice,
'use_existing_payment' => (bool) $use_existing_payment,
]);

So the var 'OrderInvoice' is already an object 'OrderInvoice' so no need to refetch again the invoice by number, we already have it.

Or I'm wrong ?

@danielcivit
Copy link
Member

Hello @mathieuhen

Thanks for reporting this issue.
I will be working to confirm this issue and after that I will get back to you with more information.

@mathieuhen
Copy link
Author

OK, thanks.
There is no more error but it's not completely resolved. I realised now that the invoice ID sent to MSP is always : #FA000000.

So I let you check how resolve that ;)

@danielcivit
Copy link
Member

Hello @mathieuhen.

Once again, thanks for reporting this issue.

I am sorry to have delayed an answer during the day of yesterday. A problem related to PrestaShop; was preventing me to install and execute a PrestaShop 1.7.7.3 version to confirm the problem in the same version. Fortunately they have resolved this.

In relation to your problem: I have not been able to reproduce the problem in a clean installation of PrestaShop 1.7.7.3 . For us this is working correctly.

I wonder if some other module may be overwriting the "Order" or "OrderInvoice" object; or maybe some other module is executing actions on this hook; avoiding the invoice id being assigned to the Order. Or we might have some bug or use another hook. In any case; I would like to get to the bottom of this.

Please, could you open a ticket with us at integration@multisafepay.com with a reference to this GitHub issue. I will retake this issue from there. Being our system, we can ask you for a staging environment, while we keep sensitive information safe, and reproduce the error, and finally understand if we should adjust something in the plugin; or maybe it's due to some other conflict in your setup.

I will be waiting your answer to continue my investigation.

@mathieuhen
Copy link
Author

Hello Daniel,

sorry for the delay. I will open a ticket.

Thanks,

@danielcivit
Copy link
Member

Thanks again for your report @mathieuhen.

I am closing this; since it was reported by you in release 5.1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants