This commit is contained in:
David Bomba 2021-09-29 10:34:02 +10:00
parent ad4413018f
commit fbe4ac3fb6
2 changed files with 31 additions and 2 deletions

View File

@ -94,7 +94,7 @@ class Token
// $header['signature'] = md5( $this->generate_parameter_string(array_merge($header, $body), false) );
$header['signature'] = $this->genSig(array_merge($body, $header));
$header['signature'] = $this->payfast->generateTokenSignature(array_merge($body, $header));
nlog($header['signature']);

View File

@ -123,7 +123,36 @@ class PayFastPaymentDriver extends BaseDriver
return (new Token($this))->tokenBilling($cgt, $payment_hash);
}
public function generateSignature($data)
public function generateTokenSignature($data)
{
$fields = [];
$keys = [
'merchant-id',
'version',
'timestamp',
'amount',
'item_name',
'item_description',
'itn',
'm_payment_id',
'cc_css',
'split_payment'
];
foreach($keys as $key)
{
if (!empty($data[$key])) {
$fields[$key] = $data[$key];
}
}
nlog(http_build_query($fields));
return md5(http_build_query($fields));
}
public function generateSignature($data)
{
$fields = array();