first upload all files
This commit is contained in:
31
Modules/Payment/GatewayResponse.php
Normal file
31
Modules/Payment/GatewayResponse.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Payment;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
abstract class GatewayResponse implements JsonSerializable
|
||||
{
|
||||
abstract public function getOrderId();
|
||||
|
||||
public function toArray()
|
||||
{
|
||||
$data = ['orderId' => $this->getOrderId()];
|
||||
|
||||
if ($this instanceof ShouldRedirect) {
|
||||
$data['redirectUrl'] = $this->getRedirectUrl();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode($this->jsonSerialize());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user