Skip to content

Commit

Permalink
Remove product type of subscription_types
Browse files Browse the repository at this point in the history
First step before removing whole column `subscription_types.type`.
This change affects only our internal instances (product type was never
mentioned in documentation).

Reasons for removing `product` type:

- SubscriptionsModule shouldn't be aware of anything product related.
- `subscription_types.type` column's original purpose was separation of
  subscriptions type with access to archive (`time_archive`) and types
  without access to archive (`time`). Type `product` was originally
  temporary fix until proper products (ProductsModule) were introduced.
- Removing `subscription_types.type` column. Archive was part of
  external service (Coverpage). It's not implemented within CRM itself.

remp/crm#747
  • Loading branch information
markoph committed Sep 10, 2019
1 parent 1167a99 commit 2b55b6e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/events/PaymentStatusChangeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Crm\PaymentsModule\Repository\PaymentsRepository;
use Crm\SubscriptionsModule\Events\SubscriptionStartsEvent;
use Crm\SubscriptionsModule\Repository\SubscriptionsRepository;
use Crm\SubscriptionsModule\Repository\SubscriptionTypesRepository;
use Crm\UsersModule\Repository\AddressesRepository;
use DateTime;
use League\Event\AbstractListener;
Expand Down Expand Up @@ -50,11 +49,11 @@ public function handle(EventInterface $event)
return;
}

if ($payment->subscription_type->type == SubscriptionTypesRepository::TYPE_PRODUCT) {
if ($payment->subscription_type->no_subscription) {
return;
}

if (in_array($payment->status, [PaymentsRepository::STATUS_PAID, PaymentsRepository::STATUS_PREPAID]) && !$payment->subscription_type->no_subscription) {
if (in_array($payment->status, [PaymentsRepository::STATUS_PAID, PaymentsRepository::STATUS_PREPAID])) {
$this->createSubscriptionFromPayment($payment, $event);
}
}
Expand Down

0 comments on commit 2b55b6e

Please sign in to comment.