Pārlūkot izejas kodu

Processus de commande

feature/export_comptable
Guillaume pirms 4 gadiem
vecāks
revīzija
018304168e
2 mainītis faili ar 20 papildinājumiem un 0 dzēšanām
  1. +3
    -0
      ShopBundle/Model/OrderPayment.php
  2. +17
    -0
      ShopBundle/Services/OrderUtils.php

+ 3
- 0
ShopBundle/Model/OrderPayment.php Parādīt failu

@@ -11,6 +11,9 @@ use Lc\ShopBundle\Context\ReductionInterface;
*/
abstract class OrderPayment extends AbstractEntity
{
const TYPE_CREDIT_CARD = 'cb' ;
const TYPE_CHEQUE = 'cheque' ;
const TYPE_CREDIT = 'credit' ;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", inversedBy="orderPayments")

+ 17
- 0
ShopBundle/Services/OrderUtils.php Parādīt failu

@@ -7,6 +7,7 @@ use App\Entity\OrderShop;
use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Context\DocumentInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\OrderPaymentInterface;
use Lc\ShopBundle\Context\OrderReductionCartInterface;
use Lc\ShopBundle\Context\OrderProductInterface;
use Lc\ShopBundle\Context\OrderReductionCreditInterface;
@@ -421,4 +422,20 @@ class OrderUtils
return $orderProductsByProductFamily ;
}

public function createOrderPayment($orderShop, $type, $amount, $reference = null, $comment = null, $paidAt = null)
{
$classOrderPayment = $this->em->getClassMetadata(OrderPaymentInterface::class)->getName() ;
$orderPayment = new $classOrderPayment ;

$orderPayment->setOrderShop($orderShop) ;
$orderPayment->setType($type) ;
$orderPayment->setAmount($amount) ;
$orderPayment->setReference($reference) ;
$orderPayment->setComment($comment) ;
$orderPayment->setPaidAt($paidAt) ;
$this->em->persist($orderPayment) ;
$this->em->flush() ;
}

}

Notiek ielāde…
Atcelt
Saglabāt