Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

78 Zeilen
2.7KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Solver\Credit;
  3. use Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface;
  4. class CreditHistorySolver
  5. {
  6. public function getMeanPaymentInheritedLabel(CreditHistoryInterface $creditHistory): string
  7. {
  8. return 'entity.CreditHistory.fields.meanPaymentOptions.' . $this->getMeanPaymentInherited($creditHistory);
  9. }
  10. public function getAmountInherited(CreditHistoryInterface $creditHistory): float
  11. {
  12. if ($creditHistory->getOrderPayment() !== null) {
  13. return $creditHistory->getOrderPayment()->getAmount();
  14. } else {
  15. if ($creditHistory->getOrderRefund() !== null) {
  16. return $creditHistory->getOrderRefund()->getAmount();
  17. } else {
  18. return $creditHistory->getAmount();
  19. }
  20. }
  21. }
  22. public function getMeanPaymentInherited(CreditHistoryInterface $creditHistory): string
  23. {
  24. if ($creditHistory->getOrderPayment() !== null) {
  25. return $creditHistory->getOrderPayment()->getMeanPayment();
  26. } else {
  27. if ($creditHistory->getOrderRefund() !== null) {
  28. return $creditHistory->getOrderRefund()->getMeanPayment();
  29. } else {
  30. return $creditHistory->getMeanPayment();
  31. }
  32. }
  33. }
  34. public function getPaidAtInherited(CreditHistoryInterface $creditHistory): ?\DateTimeInterface
  35. {
  36. if ($creditHistory->getOrderPayment() !== null) {
  37. return $creditHistory->getOrderPayment()->getPaidAt();
  38. } else {
  39. if ($creditHistory->getOrderRefund() !== null) {
  40. return $creditHistory->getOrderRefund()->getPaidAt();
  41. } else {
  42. return $creditHistory->getPaidAt();
  43. }
  44. }
  45. }
  46. public function getReferenceInherited(CreditHistoryInterface $creditHistory): ?string
  47. {
  48. if ($creditHistory->getOrderPayment() !== null) {
  49. return $creditHistory->getOrderPayment()->getReference();
  50. } else {
  51. if ($creditHistory->getOrderRefund() !== null) {
  52. return $creditHistory->getOrderRefund()->getReference();
  53. } else {
  54. return $creditHistory->getReference();
  55. }
  56. }
  57. }
  58. public function getCommentInherited(CreditHistoryInterface $creditHistory): ?string
  59. {
  60. if ($creditHistory->getOrderPayment() !== null) {
  61. return $creditHistory->getOrderPayment()->getComment();
  62. } else {
  63. if ($creditHistory->getOrderRefund() !== null) {
  64. return $creditHistory->getOrderRefund()->getComment();
  65. } else {
  66. return $creditHistory->getComment();
  67. }
  68. }
  69. }
  70. }