|
1234567891011121314151617181920212223242526272829303132333435 |
- <?php
-
- namespace domain\Payment;
-
- use domain\Order\Order\Order;
- use domain\User\User\User;
- use domain\_\AbstractRepositoryQuery;
-
- class PaymentRepositoryQuery extends AbstractRepositoryQuery
- {
- protected PaymentDefinition $definition;
-
- public function loadDependencies(): void
- {
- $this->loadDefinition(PaymentDefinition::class);
- }
-
- public function filterByOrder(Order $order): self
- {
- $this->andWhere(['id_order' => $order->id]);
- return $this;
- }
-
- public function filterByUser(User $user): self
- {
- $this->andWhere(['id_user' => $user->id]);
- return $this;
- }
-
- public function filterIsCredit()
- {
- $this->andWhere("payment.type = 'initial-credit' OR payment.type = 'credit' OR payment.type = 'debit' OR (payment.type = 'payment' AND payment.mean_payment = 'credit') OR (payment.type = 'refund' AND payment.mean_payment = 'credit')");
- return $this;
- }
- }
|