Payment configuration parameter returning a corrupted value

  • Posts: 11
  • Thank you received: 0
5 months 4 weeks ago #361249

-- HikaShop version -- : 4.7.1
-- Joomla version -- : 4.2.8
-- PHP version -- : 8.0.30

Hi,
I've implemented a Payment plugin based on your example, perfectly working on sandbox, but not working in production for coding problems.
After a lot of checks my Bank support found that the problem is that the Terminal ID sent on initialization and on payment notification is sent not as simple string (a number) but some special charcters are added.

I initiate my plugin parameters through pluginConfig array:

var $pluginConfig = array(
		// Sandbox / Production
		'enviroment' => array('Ambiente di lavoro', 'list', array(
			'production' => 'Production',
			'sandbox' => 'Sandbox',
		)),
		'url_sandbox' => array('URL sandbox', 'input','https://testapif.netsgroup.com/UNI_CG_SERVICES/services'),
		'tid_sandbox' => array('ID sandbox', 'input', 'UNI_SEL'),
		'kSig_sandbox' => array('API key sandbox', 'input', 'UNI_TESTKEY'),
		'payment_url' => array('URL production', 'input', 'https://pagamenti.unicredit.it/UNI_CG_SERVICES/services'),
		'tid' => array('ID production', 'input', ''),
		'kSig' => array('API key production', 'input', ''),
		'debug' => array('DEBUG', 'boolean','0'),
		// ... other stuff
	);

On database I checked that my values are memorized correctly:
O:8:"stdClass":31:{s:10:"enviroment";s:10:"production";s:11:"url_sandbox";s:55:"https://testapif.netsgroup.com/UNI_CG_SERVICES/services";s:11:"tid_sandbox";s:7:"UNI_SEL";s:12:"kSig_sandbox";s:11:"UNI_TESTKEY";s:11:"payment_url";s:55:"https://pagamenti.unicredit.it/UNI_CG_SERVICES/services";s:3:"tid";s:14:"‪30888470‬";s:4:"kSig";s:32:"******************";s:12:"notification";s:1:"0";s:5:"debug";s:1:"1";

The problem is that, when I call them to initiate the transaction process with this call:
$tid = ($this->payment_params->enviroment == 'sandbox') ? $this->payment_params->tid_sandbox : $this->payment_params->tid;
$kSig = ($this->payment_params->enviroment == 'sandbox') ? $this->payment_params->kSig_sandbox : $this->payment_params->kSig;
$payment_url = ($this->payment_params->enviroment == 'sandbox') ? $this->payment_params->url_sandbox : $this->payment_params->payment_url;

$tid is sent as <U+202A>30888470<U+202C>
instead of 30888470
So that the payment system doesn't recognize the terminal ID and payment fails.
On logs is rendered as 30888470

All other parameters renders as they should be, included the Ksign (the API key).
If I bypass plugin parameter and write it as a string everythig works.
I could make a function to "clean" the erroneus value, but I would like to understand why this parameter is modified and why only this!

Thanks for help.

Please Log in or Create an account to join the conversation.

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
5 months 4 weeks ago #361250

Hi,

The U+202A and U+202C are unicode control characters for direction:
www.fileformat.info/info/unicode/char/202a/index.htm
www.fileformat.info/info/unicode/char/202c/index.htm
I think this is used when you have text in right to left direction, and inside it, you have left to right text.
And control characters like this might not appear, since they are control characters, not meant to appear on the screen, but change the behavior of the text being displayed.
So this could be the result of a copy/paste gone awry.
There is probably nothing wrong with your plugin code, nor with HikaShop or Joomla.

The following user(s) said Thank You: longhiba

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 0
5 months 4 weeks ago #361269

Hi,
it was exactly like this.
Thank you so much.

Please Log in or Create an account to join the conversation.

Time to create page: 0.053 seconds
Powered by Kunena Forum