payment process
This commit is contained in:
@@ -29,6 +29,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\Base\AddressQuery;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
use Thelia\Model\OrderStatus;
|
||||
use Thelia\Model\Map\OrderTableMap;
|
||||
use Thelia\Model\OrderAddress;
|
||||
@@ -114,6 +115,8 @@ class Order extends BaseAction implements EventSubscriberInterface
|
||||
$deliveryAddress = AddressQuery::create()->findPk($sessionOrder->chosenDeliveryAddress);
|
||||
$invoiceAddress = AddressQuery::create()->findPk($sessionOrder->chosenInvoiceAddress);
|
||||
|
||||
$paymentModule = ModuleQuery::findPk($placedOrder->getPaymentModuleId());
|
||||
|
||||
/* fulfill order */
|
||||
$placedOrder->setCustomerId($customer->getId());
|
||||
$placedOrder->setCurrencyId($currency->getId());
|
||||
@@ -162,21 +165,22 @@ class Order extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
/* fulfill order_products and decrease stock // @todo dispatch event */
|
||||
|
||||
/* discount */
|
||||
|
||||
/* postage */
|
||||
|
||||
/* discount @todo */
|
||||
|
||||
$con->commit();
|
||||
|
||||
|
||||
/* dispatch mail event */
|
||||
/* T1style : dispatch mail event ? */
|
||||
|
||||
/* clear session ? */
|
||||
|
||||
/* call pay method */
|
||||
$paymentModuleReflection = new \ReflectionClass($paymentModule->getFullNamespace());
|
||||
$paymentModuleInstance = $paymentModuleReflection->newInstance();
|
||||
|
||||
$out = true;
|
||||
$paymentModuleInstance->setRequest($this->request);
|
||||
$paymentModuleInstance->setDispatcher($this->dispatcher);
|
||||
|
||||
$paymentModuleInstance->pay();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,6 +188,8 @@ class Order extends BaseAction implements EventSubscriberInterface
|
||||
*/
|
||||
public function setReference(OrderEvent $event)
|
||||
{
|
||||
$x = true;
|
||||
|
||||
$this->setRef($this->generateRef());
|
||||
}
|
||||
|
||||
|
||||
@@ -85,6 +85,13 @@ class OrderDelivery extends BaseForm
|
||||
if(null === $module) {
|
||||
$context->addViolation("Delivery module ID not found");
|
||||
}
|
||||
|
||||
$moduleReflection = new \ReflectionClass($module->getFullNamespace());
|
||||
if ($moduleReflection->isSubclassOf("Thelia\Module\DeliveryModuleInterface") === false) {
|
||||
$context->addViolation(
|
||||
sprintf("delivery module %s is not a Thelia\Module\DeliveryModuleInterface", $module->getCode())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function getName()
|
||||
|
||||
@@ -80,11 +80,18 @@ class OrderPayment extends BaseForm
|
||||
->filterByType(BaseModule::PAYMENT_MODULE_TYPE)
|
||||
->filterByActivate(1)
|
||||
->filterById($value)
|
||||
->find();
|
||||
->findOne();
|
||||
|
||||
if(null === $module) {
|
||||
$context->addViolation("Payment module ID not found");
|
||||
}
|
||||
|
||||
$moduleReflection = new \ReflectionClass($module->getFullNamespace());
|
||||
if ($moduleReflection->isSubclassOf("Thelia\Module\PaymentModuleInterface") === false) {
|
||||
$context->addViolation(
|
||||
sprintf("delivery module %s is not a Thelia\Module\PaymentModuleInterface", $module->getCode())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function getName()
|
||||
|
||||
@@ -17,10 +17,12 @@ class Order extends BaseOrder
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
/*public function postInsert(ConnectionInterface $con = null)
|
||||
public function preInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::ORDER_SET_REFERENCE, new OrderEvent($this));
|
||||
}*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* calculate the total amount
|
||||
|
||||
@@ -56,7 +56,7 @@ class Cheque extends BaseModule implements PaymentModuleInterface
|
||||
|
||||
public function pay()
|
||||
{
|
||||
// TODO: Implement pay() method.
|
||||
// no special process, waiting for the cheque.
|
||||
}
|
||||
|
||||
public function install()
|
||||
|
||||
Reference in New Issue
Block a user