allow possibility for payment module to return a response

This commit is contained in:
Manuel Raynaud
2014-02-06 12:24:52 +01:00
parent c52ec3dbaf
commit a6f0a38a7b
7 changed files with 87 additions and 33 deletions

View File

@@ -24,6 +24,7 @@
namespace Thelia\Core\Event\Order;
use Thelia\Core\Event\ActionEvent;
use Thelia\Core\HttpFoundation\Response;
use Thelia\Model\Order;
class OrderEvent extends ActionEvent
@@ -39,6 +40,11 @@ class OrderEvent extends ActionEvent
protected $status = null;
protected $deliveryRef = null;
/**
* @var Response
*/
protected $response;
/**
* @param Order $order
*/
@@ -206,4 +212,28 @@ class OrderEvent extends ActionEvent
{
return $this->deliveryRef;
}
/**
* @param Response $response
* @return $this
*/
public function setResponse(Response $response)
{
$this->response = $response;
return $this;
}
/**
* @return Response
*/
public function getResponse()
{
return $this->response;
}
public function hasResponse()
{
return null !== $this->response;
}
}

View File

@@ -24,6 +24,7 @@
namespace Thelia\Core\Event\Order;
use Thelia\Core\Event\ActionEvent;
use Thelia\Core\HttpFoundation\Response;
use Thelia\Model\Order;
/**
@@ -38,6 +39,11 @@ class OrderPaymentEvent extends ActionEvent
*/
protected $order;
/**
* @var \Thelia\Core\HttpFoundation\Response
*/
protected $response;
public function __construct(Order $order) {
$this->order = $order;
}
@@ -49,4 +55,29 @@ class OrderPaymentEvent extends ActionEvent
{
return $this->order;
}
/**
* @param \Thelia\Core\HttpFoundation\Response $response
*/
public function setResponse(Response $response)
{
$this->response = $response;
return $this;
}
/**
* @return \Thelia\Core\HttpFoundation\Response
*/
public function getResponse()
{
return $this->response;
}
public function hasResponse()
{
return null !== $this->response;
}
}

View File

@@ -253,26 +253,6 @@ class Session extends BaseSession
return $this->get("thelia.order");
}
/**
* @param Order $order
* @return $this
*/
public function setProcessedOrder(Order $order)
{
$this->set('thelia.order.processed', $order);
return $this;
}
/**
* Return an order already processed, usefull for payment modules
* @return Order
*/
public function getProcessedOrder()
{
return $this->get('thelia.order.processed');
}
/**
* Set consumed coupons by the Customer
*