How to add fields like firstdata payment plugin

  • Posts: 12
  • Thank you received: 0
3 years 8 months ago #330389

Hi.

I had some attempts to make some fields type file in the backend config form (I added those fields in plugin.xml file), but it was impossible to access files inside my plugin (in the onAfterOrderConfirm method).
On those fields the admin of the page would have to add it's certificates for the payment (ca, cert, key; which fields are visible only in admin page).

I saw firstdata plugin, in which there were some similar fields in the ''Specific Configuration'' section, and their values was stored in $this->payment_params (this->payment_params->pem_file, this->payment_params->key_file in their case).

My question is: how can I make something like that, how is this possible, or can I add those fields or form programatically as I mentioned above?

There is documentation of Firstdata plugin:
www.hikashop.com/support/documentation/9...-firstdata-form.html

Lirim.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 8 months ago #330394

Hi,

Yes, you can add such fields there too.
Check the file plugins/hikashoppayment/firstdata/firstdata.php
There, you can see near the top such code:

var $pluginConfig = array(
		'login' => array('Store ID', 'input'),
		'password' => array('API Password', 'input'),
		'domain' => array('Payment Server', 'list',array(
			'ws.firstdataglobalgateway.com' => 'Production Server',
			'ws.merchanttest.firstdataglobalgateway.com' => 'Test Server'
		)),
		'pem_file' => array('PEM file', 'input'),
		'key_file' => array('KEY file', 'input'),
		'key_passwd' => array('KEY password', 'input'),
		'ask_ccv' => array('Ask CCV', 'boolean','1'),
		'debug' => array('DEBUG', 'boolean','0'),
		'return_url' => array('RETURN_URL', 'input'),
		'verified_status' => array('VERIFIED_STATUS', 'orderstatus')
	);
This defines the list of options the shop owner will see when creating/editing the payment method. And you can see the "key_file" and "key_passwd" lines.
Please note that these will generate a text input field where the shop owner will have to enter the path of the file which he will have previously uploaded.

Now, if you want to have upload fields there, instead of text input fields, it's possible too but much more complex. You need to not have that pluginConfig variable in your class, and instead you need to add a configuration PHP file to specify the HTML of your specific options. Then, you also need a onPaymentConfigurationSave function in your plugin to store the files and process the settings. A good example of that is the ATOS plugin: www.hikashop.com/support/documentation/8...yment-atos-form.html
You can check its file plugins/hikashoppayment/atos/atos_configuration.php and the function onPaymentConfigurationSave in the file plugins/hikashoppayment/atos/atos.php for an example of what to do.

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

Time to create page: 0.055 seconds
Powered by Kunena Forum