Need help with Virtual Merchant module
apparently Virtual Merchant is the next genesis of the whole viaklix thing.
I needed to set up a connection to them, so i took the viaklix module available at http://www.modyourzencart.com/free-o...ayment-modules and attempted to modify it to work with Virtual Merchant.
The results have not been quite satisfactory, as i can't get it to work :)
Here's what i have so far: http://www.frozenplanet.com/bestnatu...alMerchant.zip
I've made changes for the new url and name changes of some of the payment fields. However, i don't seem to be able to get it to work. Nothing is showing up in the Virtual Merchant transaction log, but if i build an html file by hand that sends the query, it works.
wireshark shows that data is being sent to www.myvirtualmerchant.com on port 443, but i'm not clever enough to decipher what is being sent.
i'm assuming this has something to do with my lack of curl knowlege, as i can see that the variables are all being assigned properly.
here's part of the html that sends things properly:
<form action="https://www.myvirtualmerchant.com/VirtualMerchant/process.do" method="POST">
<input type="hidden" name="ssl_merchant_id" value="xxxxxx">
<input type="hidden" name="ssl_user_id" value="xxxxxxxx">
<input type="hidden" name="ssl_pin" value="xxxxxx">
<input type="hidden" name="ssl_transaction_type" value="ccsale">
<input type="hidden" name="ssl_card_number" value="5424000000000015">
<input type="hidden" name="ssl_exp_date" value="1008">
<input type="hidden" name="ssl_amount" value="1.55">
<input type="hidden" name="ssl_show_form" value="false">
<input type="hidden" name="ssl_cvv2" value="present"> <!--CVV2 Indicator -->
<input type="hidden" name="ssl_cvv2cvc2" value="123"> <!--CVV2 Data -->
that works fine.
here's the curl statement to send the data to the server. all i know about curl i learned today, but i'm not sure that it is sending the data in the proper format. here's what i think is the relevant snippet:
for ($i = 0; $i <= sizeof($post['key'])-1; $i++) {$string .= $post['key'][$i].'='.$post['value'][$i].'&';}//build post vars
$string = substr($string, 0, -1); // not needed
$ch = curl_init();//init curl options
curl_setopt ($ch, CURLOPT_URL, $this->url);
curl_setopt ($ch, CURLOPT_FRESH_CONNECT, 1); //no cache connection
curl_setopt ($ch, CURLOPT_POST, 1); //enable the post of vars
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_TIMEOUT, 8 ); // seconds to wait for timeout
curl_setopt ($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $string );//posted vars in fromat key1=value1&key2=value2&
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); //enable return response
$content = parse_response(curl_exec($ch));
anyway, sorry for the novel, but if someone can give me a hand here, i'd be happy to package this up for the next sucker who is stuck dealing with Virtual Merchant.
thanks,
d.
Re: Need help with Virtual Merchant module
I am currently working on this, well for Klix, but once Klix is done I'll also have VM as well
Re: Need help with Virtual Merchant module
i noticed in the viaklix thread that you were running into some difficulties. now that i've spent way too much time on this, perhaps we can be of assistance to one another?
d.
Re: Need help with Virtual Merchant module
I found some PHP errors that had to be changed. My problem now is the redirect back to Zen; I'm not at a location where I can post my files thus far.
What do you know about the leg back to Zen? I can get it to Klix and get an approval; it's just getting it back to the right place.
Re: Need help with Virtual Merchant module
are you referring to something like this? http://www.zen-cart.com/forum/showpo...2&postcount=35
or are you wanting info on the klix fields and/or php/curl stuff to make it happen? i haven't gotten that far in mine, so i can only surmise what must be done.
Re: Need help with Virtual Merchant module
Quote:
Originally Posted by
urbanx
yea that is what i was referring too; let me try that and see what I end up with
Re: Need help with Virtual Merchant module
Do you guys have an update on this module?
Thanks in advance.
Re: Need help with Virtual Merchant module
I'm afraid not; something is crapping out when the data is sent back to ZenCart. I don't think . . . well I KNOW it's not a problem with Zen, something in their code must be jacked in regards to where it reports back to.
In earlier posts we saw the statement that you would need to put http://www.yoursiteurl.com/payment_process.php as the return address for the REDG statement. Both in KLIX and VM this can be done via a control panel.
But something else that bugs the crap out of me; the string
$this->url = 'https://www.viaKLIX.com/process.asp';
is what points to the URL where we're going to post our variables. Now, if I'm going to a demo version of KLIX (which I am)
$this->url = 'https://demo.viaKLIX.com/process.asp';
And that works just fine as the orders show up in my Klix demo account. So, changing the URL changes where the variables are posted. Now, I also know that there is a third URL out there:
$this->url = 'https://www.viaKLIX.com/test_tran.asp';
Now that URL should return a list of key value pairs and display them in your browser. It generates a 2 column table with the Keys on the left and values on the right. But when you use this URL you don't get that; you get the a-typical 'Problem with Order' blah blah blah . . .
My thought is this . . . I think that somewhere in their 3 files they are trying to parse the data before a response has been received from Klix.
Please understand, Klix and VirtualMerchant are interchangeable terms. While there are slight differences in the field names the code is essentially the same. VM doesn't get complicated until you start adding peripherals for a retail environment.
For ease of reading I'll post the changes I made to their code in a separate post. I'll also be posting this to the Klix string I had going earlier due to their similarities. If we can get one working, we'll have the other.
Re: Need help with Virtual Merchant module
ThePatch,
Thanks for the response.
I will keep checking back soon.
Thanks in advance.
Re: Need help with Virtual Merchant module
I also found these items that needed changing after referencing VirtualMerchant's dev specs.
ssl_transaction_type should be set to "CCSALE"
ssl_cvv2 should actually be labelled ssl_cvv2cvc2_indicator
ssl_ship_to_address should be ssl_ship_to_address1
the if(MODULE_PAYMENT_VIAKLIX_TESTMODE == 'Test') should set ssl_test_mode to "TRUE" if true, not "TEST"
That's all I can find, but I still can't get boo back from VM. I set up several queries to try to return the results I'm getting from them, and not one singe GET or POST comes back from them that I can see.
I'll try working with the VM tech support folks to see if I can get anywhere with their help.
Godspeed.