<?php
class Signature {
private $salt = '00f40f6dd20548c514e62b666ebb9e98';
public function setSalt($salt) {
$this->salt = $salt;
}
public function generate($orderNumber, $orderAmount) {
if( !empty($orderNumber) && !empty($orderAmount) && isset($this->salt) ) {
$orderId = htmlentities($orderNumber);
$orderAmount = htmlentities($orderAmount);
$amountSum = floatval(str_replace(array(',', ' ', "'", '`'), array('.', '', '', ''), $orderAmount)) * 100;
$salt = $this->salt;
$signature = md5($orderId.'&'.$orderAmount.'&'.$salt);
return $signature;
} else {
throw new Exception("Ошибка: Не верно переданны параметры для генерации сигнатуры", 1);
return 0;
}
}
}
$sign = new Signature;
$firstName = 'Ivan';
$lastName = 'Ivanov';
$email = 'ivan@ivanov.ivn';
$phone = '12345678901';
$orderNumber = 333;
$orderAmount = 300;
$signature = $sign->generate($orderNumber, $orderAmount);
echo 'http://mirusoft.ru/include/payments/aq.php'
.'?Signature='.$signature
.'&Order_ID='.$orderNumber
.'&Subtotal='.$orderAmount
.'&FirstName='.$firstName
.'&LastName='.$lastName
.'&Email='.$email
.'&Phone='.$phone;
preferences:
41.21 ms | 402 KiB | 5 Q