-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSigner.php
42 lines (40 loc) · 1.11 KB
/
Signer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace Dfe\IPay88;
/**
* 2017-04-10
* @see \Dfe\IPay88\Signer\Request
* @see \Dfe\IPay88\Signer\Response
* @method Settings s()
*/
abstract class Signer extends \Df\PaypalClone\Signer {
/**
* 2017-04-10
* @used-by self::sign()
* @see \Dfe\IPay88\Signer\Request::values()
* @see \Dfe\IPay88\Signer\Response::values()
* @return string[]
*/
abstract protected function values():array;
/**
* 2017-04-10
* @override
* @see \Df\PaypalClone\Signer::adjust()
* @used-by \Df\PaypalClone\Signer::_sign()
* @param array(string => mixed) $v
* @return array(string => mixed)
*/
final protected function adjust(array $v):array {return ['Amount' => df_string_clean($v['Amount'], '.', ',')] + $v;}
/**
* 2017-04-10
* 2022-10-27
* https://3v4l.org/ZVTE9
* https://stackoverflow.com/a/50056467
* php.net/manual/function.hex2bin.php
* @override
* @see \Df\PaypalClone\Signer::sign()
* @used-by \Df\PaypalClone\Signer::_sign()
*/
final protected function sign():string {return base64_encode(hex2bin(sha1(df_cc('',
$this->s()->privateKey(), $this->v('MerchantCode'), $this->values()
))));}
}