Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supportv3 #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
],
"minimum-stability": "stable",
"require": {
"omnipay/common": "3.0-beta.1",
"php-http/guzzle6-adapter": "^1.1"
"omnipay/common": "^3"
},
"require-dev": {
"omnipay/tests": "3.0-beta.1"
"omnipay/tests": "^3"
},
"autoload": {
"psr-4": { "Omnipay\\IPay88\\" : "src/" }
Expand Down
13 changes: 12 additions & 1 deletion src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public function getDefaultParameters()
return [
'merchantKey' => '',
'merchantCode' => '',
'backendUrl' => ''
'backendUrl' => '',
'returnUrl' => '',
];
}

Expand Down Expand Up @@ -55,6 +56,16 @@ public function setBackendUrl($backendUrl)
{
return $this->setParameter('backendUrl', $backendUrl);
}

public function getReturnUrl()
{
return $this->getParameter('returnUrl');
}

public function setReturnUrl($returnUrl)
{
return $this->setParameter('returnUrl', $returnUrl);
}

public function purchase(array $parameters = array())
{
Expand Down
11 changes: 1 addition & 10 deletions src/Message/AbstractRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,6 @@ 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);
}
}
2 changes: 1 addition & 1 deletion src/Message/CompletePurchaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

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

public function getData()
{
Expand Down
5 changes: 3 additions & 2 deletions src/Message/PurchaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ public function getData()
'ProdDesc' => $this->getDescription(),
'UserName' => $this->getCard()->getBillingName(),
'UserEmail' => $this->getCard()->getEmail(),
'UserContact' => $this->getCard()->getNumber(),
'UserContact' => $this->getCard()->getBillingPhone(),
'Remark' => '',
'Lang' => '',
'Lang' => 'UTF-8',
'SignatureType' => 'SHA256',
'Signature' => $this->signature(
$this->getMerchantKey(),
$this->getMerchantCode(),
Expand Down
2 changes: 1 addition & 1 deletion src/Message/PurchaseResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

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