Browse Source

Merge branch 'develop' of https://gitea.laclic.fr/Laclic/LcShopBundle into develop

feature/export_comptable
Fab 4 years ago
parent
commit
4dc17b2a28
2 changed files with 20 additions and 0 deletions
  1. +3
    -0
      ShopBundle/Model/OrderPayment.php
  2. +17
    -0
      ShopBundle/Services/OrderUtils.php

+ 3
- 0
ShopBundle/Model/OrderPayment.php View File

*/ */
abstract class OrderPayment extends AbstractEntity 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") * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", inversedBy="orderPayments")

+ 17
- 0
ShopBundle/Services/OrderUtils.php View File

use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Context\DocumentInterface; use Lc\ShopBundle\Context\DocumentInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface; use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\OrderPaymentInterface;
use Lc\ShopBundle\Context\OrderReductionCartInterface; use Lc\ShopBundle\Context\OrderReductionCartInterface;
use Lc\ShopBundle\Context\OrderProductInterface; use Lc\ShopBundle\Context\OrderProductInterface;
use Lc\ShopBundle\Context\OrderReductionCreditInterface; use Lc\ShopBundle\Context\OrderReductionCreditInterface;
return $orderProductsByProductFamily ; 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() ;
}

} }

Loading…
Cancel
Save