first upload all files
This commit is contained in:
40
Modules/Payment/Responses/PaystackResponse.php
Normal file
40
Modules/Payment/Responses/PaystackResponse.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Payment\Responses;
|
||||
|
||||
use Modules\Order\Entities\Order;
|
||||
use Modules\Payment\ShouldRedirect;
|
||||
use Modules\Payment\GatewayResponse;
|
||||
use Modules\Payment\HasTransactionReference;
|
||||
|
||||
class PaystackResponse extends GatewayResponse implements HasTransactionReference
|
||||
{
|
||||
private $order;
|
||||
|
||||
public function __construct(Order $order)
|
||||
{
|
||||
$this->order = $order;
|
||||
}
|
||||
|
||||
public function getOrderId()
|
||||
{
|
||||
return $this->order->id;
|
||||
}
|
||||
|
||||
public function getTransactionReference()
|
||||
{
|
||||
return request('reference');
|
||||
}
|
||||
|
||||
public function toArray()
|
||||
{
|
||||
return [
|
||||
'key' => setting('paystack_public_key'),
|
||||
'email' => $this->order->customer_email,
|
||||
'amount' => $this->order->total->convertToCurrentCurrency()->subunit(),
|
||||
'ref' => 'ref' . time(),
|
||||
'currency' => currency(),
|
||||
'order_id' => $this->order->id,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user