Hi,
You've quite a bit of problems in the plugin.
1. The function getPaymentDefaultValues is defined inside the function onAfterOrderConfirm.
First, that means that this getPaymentDefaultValues function won't be found by HikaShop. And second, having functions inside functions, while allowed by PHP is not a good practice.
2. In the function onAfterOrderConfirm, you initialize the $vars array with the data you need in your end file, however, you don't pass the $vars variable to end.
If you look at the example payment plugin we provide in the developer documentation, you can see that we do this:
just before calling:
return $this->showPage('end');
so that $this->vars is then available in the end file.
That way, in your end file, you can replace for example:
by:
merchant: "'.$this->vars['IDENTIFIER'].'",
and you'll get your data in your javascript.
3. You use addScript in both the onAfterOrderConfirm and the end file to add two different JS files. If you need only one, I would recommend having it only in the end file, and if you need both, then put both in the end file.
4. The code:
$class = hikashop_get('class.cart');
$cart = $class->loadFullCart();
in the function onAfterOrderConfirm might not work as, depending on how you configure your HikaShop settings, the cart already be cleared from the user session. But you already have all the data of the order in $order anyway, so you don't need that.
5. All the code after the closing of the class plgHikashoppaymentevopayment should be removed as it doesn't do anything good.
All the code you put outside of the class definition in a Joomla plugin will run each time the plugins of that group are loaded by Joomla.
So you'll end having that code run in the backend, when the plugin is being configured, during the checkout, when the payment methods list is being displayed, or when the cart is being loaded, etc.
And you don't want that.