Skip to content

Commit 7a35d56

Browse files
added signature support
1 parent 0eea09b commit 7a35d56

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

unitpay/unitpay.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ public function generate_form($order_id){
103103
$currency = $order->get_order_currency();
104104
$cur_locale = get_locale();
105105
$locale = $cur_locale == 'ru_RU'?'ru':'en';
106+
$signature = hash('sha256', join('{up}', array(
107+
$account,
108+
$currency,
109+
$desc,
110+
$sum,
111+
$this->secret_key
112+
)));
106113

107114
return
108115
'<form action="https://unitpay.ru/pay/' . $this->public_key . '" method="POST" id="unitpay_form">'.
@@ -111,6 +118,7 @@ public function generate_form($order_id){
111118
'<input type="hidden" name="desc" value="' . $desc . '" />'.
112119
'<input type="hidden" name="currency" value="' . $currency . '" />'.
113120
'<input type="hidden" name="locale" value="' . $locale . '" />'.
121+
'<input type="hidden" name="signature" value="' . $signature . '" />'.
114122
'<input type="submit" class="button alt" id="submit_unitpay_form" value="'.__('Pay', 'unitpay').'" />
115123
<a class="button cancel" href="'.$order->get_cancel_order_url().'">'.__('Cancel payment and return back to card', 'unitpay').'</a>'."\n".
116124
'</form>';

0 commit comments

Comments
 (0)