Ingenico-ePayments / connect-extension-magento2

Ingenico Connect based Shopping Cart Extension for Magento 2.x
https://epayments.developer-ingenico.com/documentation/ecommerce-extensions/magento-2/
MIT License
4 stars 4 forks source link

PHP message: PHP Fatal error: Uncaught Error: Call to a member function getAdditionalInformation() on null in ..../vendor/ingenico-epayments/connect-extension-magento2/Controller/HostedCheckoutPage/Index.php:46 #4

Closed Jitheesh closed 4 years ago

Jitheesh commented 4 years ago

https://github.com/Ingenico-ePayments/connect-extension-magento2/blob/6911d8e0994ac30c5847b7bf12de9d941ea78840/Controller/HostedCheckoutPage/Index.php#L46

kanduvisla commented 4 years ago

Hi @Jitheesh , could you provide us with more information on how we can reproduce this issue?

We've created an internal ticket for this.

Jitheesh commented 4 years ago

https://github.com/Ingenico-ePayments/connect-extension-magento2/blob/6911d8e0994ac30c5847b7bf12de9d941ea78840/Controller/HostedCheckoutPage/Index.php#L46

From above code it is clear that there would be a possibility for this issue. There will be two cases

  1. Last order id is not available in checkout session ( may be due to other session issues) : in this case magento will create empty order object and it will end with above error
  2. Order is loaded but no payment is assoicated
kanduvisla commented 4 years ago

Thank you @Jitheesh ,

I see you're using an older version of the module. Could you try updating to the latest version of the module (2.1.1) to see if that fixes your problem? Also, we expected version 2.1.2 to be released soon.

Could you please let us know if this resolves your issue?

Jitheesh commented 4 years ago

Hi Thank you for your advice, I know I'm using old version, but still you can see your 2.1.1 is also has same code and it will create same issue

kanduvisla commented 4 years ago

Hi @Jitheesh ,

It's correct that the file in question is identical, but that is not the cause of the issue. The problem is that somewhere else the order object is removed from the customer session.

I recall that we ran into a similar issue during development and spent a great deal of time on it to fix this. At this moment I am looking through our internal developer logs, but it's hard to exactly pinpoint where this was.

Please let me know if updating to the latest version resolves this issue for you. Even if it doesn't resolve it, we would still have to create a fix for the patch release after 2.1.2, so eventually you'll have to update the module anyway. The fewer versions you have to bump, the better. ;-)

Jitheesh commented 4 years ago

Okay, I'll try with latest version, but this issue is happening occasionally that's we are having trouble to identify the root cause

kanduvisla commented 4 years ago

Hi @Jitheesh , I was wondering if updating to the latest version resolved your issue?

Garylanda commented 4 years ago

Hi Giel, I hope you are good. Thanks for your comments above. I work with Jitheesh and would like some further assistance on the issue that we are facing:

The issue is related with our customization for Ingenico module for using custom currency on Ingenico payments instead base currency GBP

I can provide a API request/response in logs via Private Messenger (if required)

API return error: "Payment Amount may not have decimal fraction" reason in next request data:

"amountOfMoney": { "amount": 573580, "currencyCode": "JPY" },

but it’s correct data, response is successful for using GBP currency with same amount value. It looks like Ingenico have some specific in work with JPY currency.

Can you provide insights on how to resolve this issue?

Happy to jump on a call if thats an option. thanks, Gary

rikvanthof commented 4 years ago

JPY is a currency that doesn't have decimals. All amounts have to be submitted with 2 decimals towards the Ingenico system. This means that JPY amounts require that the last two digits are 0, so one Japanese Yen needs to be submitted at 100.

Garylanda commented 4 years ago

Thanks for this Rik! Appreciated.

Garylanda commented 4 years ago

@rikvanthof / @kanduvisla

We are experiencing a further issue.

Issue: Intermittently being returned to basket when pressing proceed to payment with error message

Reason: When request contains same session or session ID, it process based on last action.

Steps to replicate:

  1. Add product to basket and checkout
  2. Place order
  3. Click cancel button from Ingenico payment screen
  4. User returns to basket
  5. Quickly fill checkout details and try place order again
  6. User won't redirected to Ingenico payment screen
  7. User will redirected to basket page, with the same cancel action response
  8. From the above scenario we can see that Ingenico is processing the second request based on response from the first one

See an example requests logs here: First request: [2020-02-13 08:47:29] report.INFO: Outgoing request to https://world.preprod.api-ingenico.com (requestId='6c9f1048-3c62-4693-bc1b-6ace630b1e10') GET /v1/xxxx/hostedcheckouts/bf59a30d-bfc2-4c87-ae6c-c1ea99a15419 HTTP/1.1 Content-Type: application/json Date: Thu, 13 Feb 2020 08:47:29 GMT

Response: [2020-02-13 08:47:29] report.INFO: Incoming response from https://world.preprod.api-ingenico.com (requestId='6c9f1048-3c62-4693-bc1b-6ace630b1e10') HTTP/1.1 200 Date: Thu, 13 Feb 2020 08:47:28 GMT

Second Request: [2020-02-13 08:48:05] report.INFO: Outgoing request to https://world.preprod.api-ingenico.com (requestId='5ba5b646-0242-48e9-980a-16238a2afa7c') GET /v1/xxxx/hostedcheckouts/bf59a30d-bfc2-4c87-ae6c-c1ea99a15419 HTTP/1.1 Content-Type: application/json Date: Thu, 13 Feb 2020 08:48:05 GMT Authorization: **** [] []

Response: [2020-02-13 08:48:05] report.INFO: Incoming response from https://world.preprod.api-ingenico.com (requestId='5ba5b646-0242-48e9-980a-16238a2afa7c') HTTP/1.1 200 Date: Thu, 13 Feb 2020 08:48:05 GMT Server: Apache X-OneAgent-JS-Injection: true Content-Type: application/json Set-Cookie: dtCookie=1$3394998C076BB5A2E484F0EFA5FC54F4; Path=/; Domain=.api-ingenico.com Transfer-Encoding: chunked { "status": "CANCELLED_BY_CONSUMER" } [] []

Third request: [2020-02-13 09:02:47] report.INFO: Outgoing request to https://world.preprod.api-ingenico.com (requestId='17fce35e-7a7a-41e6-9d1f-0ab33da8d6cd') GET /v1/xxxx/hostedcheckouts/bf59a30d-bfc2-4c87-ae6c-c1ea99a15419 HTTP/1.1 Content-Type: application/json Date: Thu, 13 Feb 2020 09:02:47 GMT

Response: [2020-02-13 09:02:48] report.INFO: Incoming response from https://world.preprod.api-ingenico.com (requestId='17fce35e-7a7a-41e6-9d1f-0ab33da8d6cd') HTTP/1.1 200 Date: Thu, 13 Feb 2020 09:02:47 GMT Server: Apache X-OneAgent-JS-Injection: true Content-Type: application/json Set-Cookie: dtCookie=26$6A05B09FAEE5E7C7DC5B250BD51BB83B; Path=/; Domain=.api-ingenico.com Transfer-Encoding: chunked { "status": "CANCELLED_BY_CONSUMER" } [] []

We have clicked cancel button only for first request, second and third processed without clicking the cancel button.

From the above case we can see that if request is same, then it will return the same response from server GET /v1/xxxx/hostedcheckouts/bf59a30d-bfc2-4c87-ae6c-c1ea99a15419

If I wait for sometime to re-order then I can see request is changing and it is processing correctly.

[2020-02-13 09:36:41] report.INFO: Outgoing request to https://world.preprod.api-ingenico.com (requestId='a50d8d0a-3f35-426e-963d-5d8de6124639') GET /v1/xxxx/hostedcheckouts/a555253a-7223-4d24-8b33-fcc10a180f8f HTTP/1.1

kanduvisla commented 4 years ago

Hi @Garylanda , I've got the feeling that this issue is currently addressing 3 issues:

  1. The Fatal Error that was triggered (root cause for this issue). Did updating to the latest version resolve this issue? If so, please Close this issue.
  2. API Return error with JPY as currency. Did @rikvanthof 's answer solve this issue? If not, please open a new issue for this.
  3. The issue you mention in your last response. Could you please create a new issue for this?
Garylanda commented 4 years ago

Hey - Would it be possible to set up a Google Hangouts call?

kanduvisla commented 4 years ago

Hi @Garylanda ,

Thanks for creating a separate issue for the third question. Could you also provide an answer on question 1 and 2?

Jitheesh commented 4 years ago

We still have same issue after upgrading Module to 2.1.1 version, looks like somehow session is cleared while creating order.

We have added conditional validation to avoid Fatal error here

https://github.com/Ingenico-ePayments/connect-extension-magento2/blob/6911d8e0994ac30c5847b7bf12de9d941ea78840/Controller/HostedCheckoutPage/Index.php#L46

kanduvisla commented 4 years ago

Hi @Jitheesh ,

In issue #5 you mention that you're using a OneStep checkout module. Could you please check if the problem described in this issue is reproducible using the default Magento Checkout?

kanduvisla commented 4 years ago

Hi @Jitheesh ,

Did you get a chance to check if this issue is reproducible using the Default Magento Checkout?

kanduvisla commented 4 years ago

I'm closing this issue since there has been no activity for the last 3 months.