Skip to content

Commit

Permalink
update according to ipay88 doc 1.6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
nava-3b committed Dec 22, 2020
1 parent c321075 commit 71032f7
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function getDefaultParameters()
return [
'merchantKey' => '',
'merchantCode' => '',
'backendUrl' => ''
'backendUrl' => '',
];
}

Expand Down Expand Up @@ -66,4 +66,4 @@ public function completePurchase(array $parameters = array())
return $this->createRequest('\Omnipay\IPay88\Message\CompletePurchaseRequest', $parameters);
}

}
}
24 changes: 12 additions & 12 deletions src/Message/AbstractRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ protected function guardParameters()

protected function createSignatureFromString($fullStringToHash)
{
return base64_encode($this->hex2bin(sha1($fullStringToHash)));
}

private function hex2bin($hexSource)
{
$bin = '';
for ($i = 0; $i < strlen($hexSource); $i = $i + 2) {
$bin .= chr(hexdec(substr($hexSource, $i, 2)));
}
return $bin;
}
}
return hash('sha256', $fullStringToHash);
}

// private function hex2bin($hexSource)
// {
// $bin = '';
// for ($i = 0; $i < strlen($hexSource); $i = $i + 2) {
// $bin .= chr(hexdec(substr($hexSource, $i, 2)));
// }
// return $bin;
// }
}
11 changes: 4 additions & 7 deletions src/Message/CompletePurchaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@

namespace Omnipay\IPay88\Message;


use Omnipay\Common\Currency;

class CompletePurchaseRequest extends AbstractRequest
{
protected $endpoint = 'https://www.mobile88.com/epayment/enquiry.asp';
protected $endpoint = 'https://payment.ipay88.com.my/epayment/entry.asp';

public function getData()
{
Expand All @@ -31,11 +28,11 @@ public function getData()
public function sendData($data)
{
$data['ReQueryStatus'] = $this->httpClient
->request('post', $this->endpoint.'?'.http_build_query([
->request('post', $this->endpoint . '?' . http_build_query([
'MerchantCode' => $this->getMerchantCode(),
'RefNo' => $data['RefNo'],
'Amount' => $data['Amount']
]), [], json_encode([]))
'Amount' => $data['Amount'],
]), [], json_encode([]))
->getBody()
->getContents();

Expand Down
4 changes: 2 additions & 2 deletions src/Message/PurchaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Omnipay\IPay88\Message;


class PurchaseRequest extends AbstractRequest
{
public function getData()
Expand All @@ -21,6 +20,7 @@ public function getData()
'UserContact' => $this->getCard()->getNumber(),
'Remark' => '',
'Lang' => '',
'SignatureType' => 'SHA256',
'Signature' => $this->signature(
$this->getMerchantKey(),
$this->getMerchantCode(),
Expand All @@ -47,4 +47,4 @@ private function signature($merchantKey, $merchantCode, $refNo, $amount, $curren
return $this->createSignatureFromString(implode('', $paramsInArray));
}

}
}
5 changes: 2 additions & 3 deletions src/Message/PurchaseResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

namespace Omnipay\IPay88\Message;


use Omnipay\Common\Message\AbstractResponse;

class PurchaseResponse extends AbstractResponse
{
protected $endpoint = 'https://www.mobile88.com/ePayment/entry.asp';
protected $endpoint = 'https://payment.ipay88.com.my/epayment/entry.asp';

public function getTransactionId()
{
Expand Down Expand Up @@ -44,4 +43,4 @@ public function getRedirectData()
return $this->data;
}

}
}

0 comments on commit 71032f7

Please sign in to comment.