Quellcode durchsuchen

Paiement partiel

develop
Guillaume vor 3 Jahren
Ursprung
Commit
d9360e5b91
3 geänderte Dateien mit 37 neuen und 1 gelöschten Zeilen
  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 Datei anzeigen

@@ -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 Datei anzeigen

@@ -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 Datei anzeigen

@@ -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 = [

Laden…
Abbrechen
Speichern