You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- <?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();
- }
- }
- }
- }
|