first upload all files
This commit is contained in:
41
Modules/Payment/Responses/PaytmResponse.php
Normal file
41
Modules/Payment/Responses/PaytmResponse.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Payment\Responses;
|
||||
|
||||
use Modules\Order\Entities\Order;
|
||||
use Modules\Payment\GatewayResponse;
|
||||
use Modules\Payment\HasTransactionReference;
|
||||
|
||||
class PaytmResponse extends GatewayResponse implements HasTransactionReference
|
||||
{
|
||||
private $order;
|
||||
private $clientResponse;
|
||||
|
||||
|
||||
public function __construct(Order $order, $clientResponse)
|
||||
{
|
||||
$this->order = $order;
|
||||
$this->clientResponse = $clientResponse;
|
||||
}
|
||||
|
||||
|
||||
public function getOrderId()
|
||||
{
|
||||
return $this->order->id;
|
||||
}
|
||||
|
||||
|
||||
public function getTransactionReference()
|
||||
{
|
||||
return 'ref' . time();
|
||||
}
|
||||
|
||||
|
||||
public function toArray()
|
||||
{
|
||||
return parent::toArray() + [
|
||||
'amount' => $this->order->total->convertToCurrentCurrency()->round()->amount(),
|
||||
'txnToken' => $this->clientResponse['txnToken'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user