Finialized plugin
This commit is contained in:
parent
807384620c
commit
a0ab203f93
@ -48,7 +48,7 @@ repository.
|
|||||||
));
|
));
|
||||||
|
|
||||||
// Start the purchase
|
// Start the purchase
|
||||||
if (!isset($_GET['trxid'])) {
|
if (!isset($_GET['trxid']) && !isset($_GET['error'])) {
|
||||||
$url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
|
$url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
|
||||||
$response = $gateway->purchase(array(
|
$response = $gateway->purchase(array(
|
||||||
'amount' => "1.50",
|
'amount' => "1.50",
|
||||||
@ -67,6 +67,8 @@ repository.
|
|||||||
// payment failed: display message to customer
|
// payment failed: display message to customer
|
||||||
return "Error " .$response->getError();
|
return "Error " .$response->getError();
|
||||||
}
|
}
|
||||||
|
} elseif (isset($_GET['error'])) {
|
||||||
|
echo "Error " . $_GET['error'];
|
||||||
} else {
|
} else {
|
||||||
/**
|
/**
|
||||||
* Because the 'status' GET parameter is present, this is a return URL request and the purchase should be completed.
|
* Because the 'status' GET parameter is present, this is a return URL request and the purchase should be completed.
|
||||||
@ -81,6 +83,9 @@ repository.
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Server response
|
||||||
|
After sending the purchaseRequest, the server at Inforbank will return a POST body with the redirect URL. After redirecting to the redirect URL, the user will interact with Inforbank. Inforbank will then, depending on user interaction and configuration, return to your application with either ?trxid={ID} or ?error={ERRORMESSAGE}.
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
If you are having general issues with Omnipay, we suggest posting on
|
If you are having general issues with Omnipay, we suggest posting on
|
||||||
|
@ -19,6 +19,6 @@ abstract class AbstractResponse extends BaseAbstractResponse
|
|||||||
|
|
||||||
public function getError()
|
public function getError()
|
||||||
{
|
{
|
||||||
return $this['error'];
|
return $this->error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,11 @@ namespace Omnipay\Inforbank\Message;
|
|||||||
|
|
||||||
class CompletePurchaseRequest extends AbstractRequest
|
class CompletePurchaseRequest extends AbstractRequest
|
||||||
{
|
{
|
||||||
protected $endpoint = "http://localhost:8080/api/statusRequest";
|
protected $endpoint = "http://sgni.nl/~113004/index.php/api/statusRequest";
|
||||||
|
|
||||||
protected function generateSignature()
|
protected function generateSignature()
|
||||||
{
|
{
|
||||||
return sha1(
|
return hash("sha256",
|
||||||
$this->getTransactionReference() . $this->getClientSecret()
|
$this->getTransactionReference() . $this->getClientSecret()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -23,7 +23,7 @@ class CompletePurchaseRequest extends AbstractRequest
|
|||||||
$data = array(
|
$data = array(
|
||||||
"clientId" => $this->getClientId(),
|
"clientId" => $this->getClientId(),
|
||||||
"transactionId" => $this->getTransactionReference(),
|
"transactionId" => $this->getTransactionReference(),
|
||||||
"sha1" => $this->generateSignature()
|
"hash" => $this->generateSignature()
|
||||||
);
|
);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
@ -6,7 +6,7 @@ class CompletePurchaseResponse extends PurchaseResponse
|
|||||||
{
|
{
|
||||||
public function isSuccessful()
|
public function isSuccessful()
|
||||||
{
|
{
|
||||||
return ($this->data['transaction']['status'] === "Success");
|
return ($this->data['transaction']['status'] === 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isRedirect()
|
public function isRedirect()
|
||||||
|
@ -4,11 +4,11 @@ namespace Omnipay\Inforbank\Message;
|
|||||||
|
|
||||||
class PurchaseRequest extends AbstractRequest
|
class PurchaseRequest extends AbstractRequest
|
||||||
{
|
{
|
||||||
protected $endpoint = "http://localhost:8080/api/transactionRequest";
|
protected $endpoint = "http://sgni.nl/~113004/index.php/api/transactionRequest";
|
||||||
|
|
||||||
protected function generateSignature()
|
protected function generateSignature()
|
||||||
{
|
{
|
||||||
return sha1(
|
return hash("sha256",
|
||||||
$this->getTransactionId() . $this->getAmountInteger() . $this->getClientSecret()
|
$this->getTransactionId() . $this->getAmountInteger() . $this->getClientSecret()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ class PurchaseRequest extends AbstractRequest
|
|||||||
"amount" => $this->getAmountInteger(),
|
"amount" => $this->getAmountInteger(),
|
||||||
"description" => $this->getDescription(),
|
"description" => $this->getDescription(),
|
||||||
"returnUrl" => $this->getReturnUrl(),
|
"returnUrl" => $this->getReturnUrl(),
|
||||||
"sha1" => $this->generateSignature()
|
"hash" => $this->generateSignature()
|
||||||
);
|
);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
Reference in New Issue
Block a user