¨4.0.1¨

This commit is contained in:
¨NW¨
2023-12-03 14:07:47 +00:00
parent c08b36d1b6
commit f35052522d
1112 changed files with 43019 additions and 24987 deletions

View File

@@ -13,7 +13,7 @@ class AuthorizenetResponse extends GatewayResponse implements HasTransactionRefe
private $clientResponse;
public function __construct(Order $order,object $clientResponse)
public function __construct(Order $order, object $clientResponse)
{
$this->order = $order;
$this->clientResponse = $clientResponse;

View File

@@ -3,7 +3,6 @@
namespace Modules\Payment\Responses;
use Modules\Order\Entities\Order;
use Modules\Payment\Gateways\MercadoPago;
use Modules\Payment\ShouldRedirect;
use Modules\Payment\GatewayResponse;
use Modules\Payment\HasTransactionReference;
@@ -13,29 +12,34 @@ class FlutterwaveResponse extends GatewayResponse implements ShouldRedirect, Has
private $order;
private $clientResponse;
public function __construct(Order $order, array|object $clientResponse)
{
$this->order = $order;
$this->clientResponse = $clientResponse;
}
public function getOrderId()
{
return $this->order->id;
}
public function getRedirectUrl()
{
return $this->clientResponse['redirect_url'];
}
public function getTransactionReference()
{
return $this->clientResponse['tx_ref'];
}
public function toArray()
{
return (array) $this->clientResponse;
return (array)$this->clientResponse;
}
}

View File

@@ -12,22 +12,26 @@ class InstamojoResponse extends GatewayResponse implements ShouldRedirect, HasTr
private $order;
private $clientResponse;
public function __construct(Order $order, array $clientResponse)
{
$this->order = $order;
$this->clientResponse = $clientResponse;
}
public function getOrderId()
{
return $this->order->id;
}
public function getRedirectUrl()
{
return $this->clientResponse['redirectUrl'];
return $this->clientResponse['longurl'];
}
public function getTransactionReference()
{
return $this->clientResponse['payment_id'];

View File

@@ -12,27 +12,32 @@ class MercadoPagoResponse extends GatewayResponse implements ShouldRedirect, Has
private $order;
private $clientResponse;
public function __construct(Order $order, object $clientResponse)
{
$this->order = $order;
$this->clientResponse = $clientResponse;
}
public function getOrderId()
{
return $this->order->id;
}
public function getRedirectUrl()
{
return $this->clientResponse->back_urls->success;
}
public function getTransactionReference()
{
return $this->clientResponse->external_reference;
}
public function toArray()
{
return [

View File

@@ -9,11 +9,13 @@ class NullResponse extends GatewayResponse
{
private $order;
public function __construct(Order $order)
{
$this->order = $order;
}
public function getOrderId()
{
return $this->order->id;

View File

@@ -12,22 +12,26 @@ class PayPalResponse extends GatewayResponse implements HasTransactionReference
private $order;
private $httpResponse;
public function __construct(Order $order, HttpResponse $httpResponse)
{
$this->order = $order;
$this->httpResponse = $httpResponse;
}
public function getOrderId()
{
return $this->order->id;
}
public function getTransactionReference()
{
return $this->httpResponse->result->purchase_units[0]->payments->captures[0]->id;
}
public function toArray()
{
return parent::toArray() + ['resourceId' => $this->httpResponse->result->id];

View File

@@ -3,7 +3,6 @@
namespace Modules\Payment\Responses;
use Modules\Order\Entities\Order;
use Modules\Payment\ShouldRedirect;
use Modules\Payment\GatewayResponse;
use Modules\Payment\HasTransactionReference;
@@ -11,21 +10,25 @@ class PaystackResponse extends GatewayResponse implements HasTransactionReferenc
{
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 [

View File

@@ -10,21 +10,25 @@ class RazorpayResponse extends GatewayResponse implements HasTransactionReferenc
{
private $razorpayOrder;
public function __construct(RazorpayOrder $razorpayOrder)
{
$this->razorpayOrder = $razorpayOrder;
}
public function getOrderId()
{
return $this->razorpayOrder->receipt;
}
public function getTransactionReference()
{
return $this->razorpayOrder->razorpay_payment_id;
}
public function toArray()
{
return $this->razorpayOrder->toArray();

View File

@@ -12,22 +12,26 @@ class StripeResponse extends GatewayResponse implements HasTransactionReference
private $order;
private $intent;
public function __construct(Order $order, PaymentIntent $intent)
{
$this->order = $order;
$this->intent = $intent;
}
public function getOrderId()
{
return $this->order->id;
}
public function getTransactionReference()
{
return $this->intent->id;
}
public function toArray()
{
return parent::toArray() + ['clientSecret' => $this->intent->client_secret];