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 common\logic\Payment\Repository;
-
- use common\logic\AbstractRepositoryQuery;
- use common\logic\Order\Order\Model\Order;
- use common\logic\Payment\Service\PaymentDefinition;
- use common\logic\User\User\Model\User;
-
- 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;
- }
- }
|