|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
-
- namespace Lc\CaracoleBundle\Solver\Credit;
-
- use Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface;
-
- class CreditHistorySolver
- {
- public function getMeanPaymentInheritedLabel(CreditHistoryInterface $creditHistory): string
- {
- return 'entity.CreditHistory.fields.meanPaymentOptions.' . $this->getMeanPaymentInherited($creditHistory);
- }
-
- public function getAmountInherited(CreditHistoryInterface $creditHistory): float
- {
- if ($creditHistory->getOrderPayment() !== null) {
- return $creditHistory->getOrderPayment()->getAmount();
- } else {
- if ($creditHistory->getOrderRefund() !== null) {
- return $creditHistory->getOrderRefund()->getAmount();
- } else {
- return $creditHistory->getAmount();
- }
- }
- }
-
- public function getMeanPaymentInherited(CreditHistoryInterface $creditHistory): string
- {
- if ($creditHistory->getOrderPayment() !== null) {
- return $creditHistory->getOrderPayment()->getMeanPayment();
- } else {
- if ($creditHistory->getOrderRefund() !== null) {
- return $creditHistory->getOrderRefund()->getMeanPayment();
- } else {
- return $creditHistory->getMeanPayment();
- }
- }
- }
-
- public function getPaidAtInherited(CreditHistoryInterface $creditHistory): ?\DateTimeInterface
- {
- if ($creditHistory->getOrderPayment() !== null) {
- return $creditHistory->getOrderPayment()->getPaidAt();
- } else {
- if ($creditHistory->getOrderRefund() !== null) {
- return $creditHistory->getOrderRefund()->getPaidAt();
- } else {
- return $creditHistory->getPaidAt();
- }
- }
- }
-
- public function getReferenceInherited(CreditHistoryInterface $creditHistory): ?string
- {
- if ($creditHistory->getOrderPayment() !== null) {
- return $creditHistory->getOrderPayment()->getReference();
- } else {
- if ($creditHistory->getOrderRefund() !== null) {
- return $creditHistory->getOrderRefund()->getReference();
- } else {
- return $creditHistory->getReference();
- }
- }
- }
-
- public function getCommentInherited(CreditHistoryInterface $creditHistory): ?string
- {
- if ($creditHistory->getOrderPayment() !== null) {
- return $creditHistory->getOrderPayment()->getComment();
- } else {
- if ($creditHistory->getOrderRefund() !== null) {
- return $creditHistory->getOrderRefund()->getComment();
- } else {
- return $creditHistory->getComment();
- }
- }
- }
- }
|