瀏覽代碼

Paiement partiel

develop
Guillaume 3 年之前
父節點
當前提交
d9360e5b91
共有 3 個檔案被更改,包括 37 行新增1 行删除
  1. +27
    -0
      ShopBundle/Services/Order/OrderUtils.php
  2. +9
    -0
      ShopBundle/Services/Order/OrderUtilsPaymentTrait.php
  3. +1
    -1
      ShopBundle/Services/Utils.php

+ 27
- 0
ShopBundle/Services/Order/OrderUtils.php 查看文件

@@ -4,6 +4,7 @@ namespace Lc\ShopBundle\Services\Order;

use App\Entity\OrderProductReductionCatalog;
use App\Entity\OrderShop;
use App\Entity\OrderStatus;
use Lc\ShopBundle\Context\DocumentInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\OrderReductionCreditInterface;
@@ -267,6 +268,7 @@ class OrderUtils
$data['count'] = $this->countQuantities($order);
$data['total_with_tax'] = $this->priceUtils->getTotalWithTax($order);
$data['order_products_by_category'] = $this->getOrderProductsByParentCategory($order);
$data['total_remaining_to_be_paid'] = $this->getTotalRemainingToBePaid($order) ;
}
return $data;
}
@@ -405,5 +407,30 @@ class OrderUtils

}

public function addPayment($orderShop, $meanPayment, $amount)
{
$this->createOrderPayment([
'orderShop' => $orderShop,
'meanPayment' => $meanPayment,
'amount' => $amount
]) ;
$this->em->refresh($orderShop) ;

if($this->isOrderPaid($orderShop)) {
$nextStatus = OrderStatus::ALIAS_PAID ;
}
else {
$nextStatus = OrderStatus::ALIAS_PARTIAL_PAYMENT ;
}

if($orderShop->getOrderStatus()->getAlias() != $nextStatus) {
$orderShop = $this->changeOrderStatus(
$nextStatus,
$orderShop
);
}

return $orderShop ;
}

}

+ 9
- 0
ShopBundle/Services/Order/OrderUtilsPaymentTrait.php 查看文件

@@ -64,4 +64,13 @@ trait OrderUtilsPaymentTrait
return $this->priceUtils->getTotalWithTax($order) - $this->getTotalOrderPayments($order) ;
}

public function isOrderShopPositiveAmountRemainingToBePaid($orderShop)
{
return $this->getTotalRemainingToBePaid($orderShop) > 0 ;
}

public function addPayment()
{

}
}

+ 1
- 1
ShopBundle/Services/Utils.php 查看文件

@@ -377,7 +377,7 @@ class Utils
return $this->getNextDay($this->getDayByNumber($number, 'en'));
}

public function getDayByNumber($number, $lang = 'fr')
public static function getDayByNumber($number, $lang = 'fr')
{
if ($lang == 'fr') {
$daysArray = [

Loading…
取消
儲存