Home › Forums › Quform WordPress › Select menu condition and restriction + payment gateway › Reply To: Select menu condition and restriction + payment gateway
April 9, 2019 at 3:30 pm #28974
Goran
Participant
Thanks Ally,
both suggestions work! You are lifesaver!
I got gateway to work but the last thing remains – Signature.
I have public key from bank and there is PHP code provided:
1: <html>
2: <head></head>
3: <body>
4: <?php
5: // variables – webshop log keys
6: $MerchantID="1752441";
7: $TerminalID="E7880241";
8: session_start();
9: $OrderID="123456"; // for each transaction ID needs to be unique
10: $CurrencyID="980";
11: $Amount=100; // fixed amount of transaction
12:
13: $ses = session_id();
14:
15: //preparing data
16: $PurchaseTime = date("ymdHis");
17: $data = "$MerchantID;$TerminalID;$PurchaseTime;$OrderID;$CurrencyID;$Amount;$ses;";
18: //reas RSA key from webshop
19: $fp = fopen("$MerchantID.pem", "r");
20: $priv_key = fread($fp, 8192);
21: fclose($fp);
22: $pkeyid = openssl_get_privatekey($priv_key);
23: //generating signature
24: openssl_sign($data, $signature, $pkeyid);
25: //delete RSA key from memory
26: openssl_free_key($pkeyid);
27: //Coding value in BASE64
28: $b64sign = base64_encode($signature);
29: ?>
30: <form action="https://secure.rba.hr/ecgtesthr/enter" method="POST">
31: <input type="hidden" name="Version" value="1" >
32: <input type="hidden" name="MerchantID" value="<?php echo $MerchantID; ?>">
33: <input type="hidden" name="TerminalID" value="<?php echo $TerminalID; ?>">
34: <input type="hidden" name="PurchaseTime" value="<? echo $PurchaseTime;?>">
35: <input type="hidden" name="OrderID" value="<?php echo $OrderID; ?>">
36: <input type="hidden" name="Currency" value="<?php echo $CurrencyID; ?>">
37: <input type="hidden" name="TotalAmount" value="<?php echo $Amount; ?>">
38: <input type="hidden" name="SD" value="<? echo $ses;?>">
39: <input type="hidden" name="locale" value="hr">
40: <input type="hidden" name="PurchaseDesc" value="Description">
41: <input type="hidden" name="Signature" value="<? echo $b64sign; ?>">
42: <input name="submit" type="submit" value="Confirm order" class="sbmt">
43: </form>
44: </body>
45: </html>
Is there a way to run php script on submit and insert $b64sign into Signature value in form that you helped me make some time ago:
jQuery(function ($) {
$('.quform-form-3').on('quform:successStart', function () {
var $form = $(this);
var form = document.createElement('form');
form.action = 'https://uat.rba.hr/rba/enter';
form.method = 'post';
var fields = [
{ name: 'Version', value: '1' },
{ name: 'MerchantID', value: '1832338' },
{ name: 'TerminalID', value: '12360951' },
{ name: 'TotalAmount', value: $form.find('.quform-field-3_24').val() },
{ name: 'Currency', value: '980' },
{ name: 'Locale', value: 'en' },
{ name: 'OrderID', value: $form.find('.quform-field-3_272').val() },
{ name: 'PurchaseTime', value: kendo.toString(new Date(), 'yyMMddHHmmss') },
{ name: 'PurchaseDesc', value: 'three islands cruise' },
{ name: 'Signature', value: 'baNuGbnzOFh9H6unKTTyJw01ASO7+8Rwgwrm/URuAl1zNtJKJDox88MODpOZyxN5GebOVeyaTro7cgNiTZDEKonCaKkF4BcdQ6C/S2EsXmm0DaEAXZPxOh5b00N/H2hgeYYoLIC/zTpXNk/+cMwU8lLup8/hlTLBkpe/zblOvCY=' }
];
for (var i = 0; i < fields.length; i++) {
var input = document.createElement('input');
input.type = 'hidden';
input.name = fields[i].name;
input.value = fields[i].value;
form.appendChild(input);
}
document.body.appendChild(form);
form.submit();
});
});