mage2pro/ipay88

Country validator is causing problems

Closed this issue · 6 comments

We are experiencing a problem which occurs maybe once every couple of months.

This is the error message regarding it:-

[df_country_ctn] The argument «Неизвестный параметр» is rejected by the «Df\Zf\Validate\StringT\Iso2» validator. The diagnostic message: Система не смогла распознать значение «» типа «string» как 2-буквенный код страны под стандарту ISO 3166-1

When debugging the affected order I have found a problem in the database table sales_payment_transaction.
In the record with type capture the additional_information field which contains a PHP serialised array always has this in it S_country";s:0:"". So the country code is empty.
My fix for it has been to change the country code in the serialised array to what it should be myself.

When the problem occurs it stops an admin user from being able to print the invoice for the order in the admin. But worse than that it also stops an order's confirmation email from being sent.

Another side affect we are experiencing is that it stops any new orders after the affected order from having their confirmation emails sent either. We have Magento 2 setup so it sends email asynchronously, this means the cron job is responsible for sending out the new order confirmations. My guess is that Magento continually tries to send all new order confirmation emails starting with the oldest order first. It triggers the error above about the country code, errors out and just fails. So the cron job never manages to make it past the order it fails on. I think this is a bad design choice by Magento.

So in regards to your plugin what I think is happening in some cases the payment gateway for some reason is not sending back the two letter country code. I do not know under what circumstances these are but whenever it happens after checking the users billing and shipping address they have in fact provided a country and also the order has been successfully placed and payment taken.

Would it be possible for your plugin to handle the scenario of the two letter country code not being provided in the return output of the payment gateway?

For proof that I am reporting this issue on behalf of a paying customer see this earlier issue - #7

Oh forgot to say, to replicate this issue, try setting the country code to empty in the PHP serialised string in the sales_payment_transaction table on the record with a type of capture in the additional_information field. e.g. S_country";s:0:"".

Then in the admin on the order list select the order and then choose 'Print Invoices' from the Actions dropdown list.

When I do that on an order with no two letter country code set in the sales_payment_transaction table I get the error (see attached image).

skitch 2

What is your website?

Hi Dmitry ,
I have emailed admin@mage2.pro to confirm the website url.

Please provide me:

  1. SSH access to your website's server.
  2. An exact order which reproduces the described problem (without any manual database modifications).

I want to analyse the full order's data to understand why is the country code empty and to implement the best solution.

Sorry Dmitry I won't be able to give you SSH access.
I can debug the issue with you collaboratively over slack or Skype and provide you with data as you request if you wanted to do it that way.

I think the issue is partly ipay88's problem, for some reason it sometimes just doesn't return the two letter country code. From your modules perspective I just think the best fix is to make your plugin be able to handle that. So currently if ipay88 does not provide a two letter country code in it's response your plugin fails.

This scenario is intermittent, it only happens to us about once every two months.

I can dig into your code a bit and try to find a solution myself, if I manage too I can provide you with a pull request.

Fixed in 1.5.2.