Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PISHPS-311: added custom event and cart collector for subscriptions #801

Merged
merged 3 commits into from
Aug 21, 2024

Conversation

m-muxfeld-diw
Copy link
Contributor

No description provided.

@m-muxfeld-diw
Copy link
Contributor Author

@BlackScorp can be tested with this patch

Index: src/Subscriber/OrderDeliverySubscriber.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/Subscriber/OrderDeliverySubscriber.php b/src/Subscriber/OrderDeliverySubscriber.php
--- a/src/Subscriber/OrderDeliverySubscriber.php	(revision 9e1fa93e083290440433789acf788843ef0cf41a)
+++ b/src/Subscriber/OrderDeliverySubscriber.php	(date 1723028422423)
@@ -3,6 +3,7 @@
 namespace Kiener\MolliePayments\Subscriber;
 
 use Kiener\MolliePayments\Components\ShipmentManager\ShipmentManager;
+use Kiener\MolliePayments\Event\MollieSubscriptionCartItemAddedEvent;
 use Kiener\MolliePayments\Repository\OrderTransaction\OrderTransactionRepositoryInterface;
 use Kiener\MolliePayments\Service\OrderService;
 use Kiener\MolliePayments\Service\SettingsService;
@@ -64,6 +65,7 @@
     {
         return [
             'state_machine.order_delivery.state_changed' => 'onOrderDeliveryChanged',
+            MollieSubscriptionCartItemAddedEvent::class => 'test'
         ];
     }
 
@@ -123,4 +125,9 @@
             return;
         }
     }
+
+    public function test(MollieSubscriptionCartItemAddedEvent $event)
+    {
+        $a = 1;
+    }
 }

*/
private function lineItemIsSubscriptionProduct(CheckoutCartLineItem $lineItem): bool
{
$customFields = $lineItem->getPayloadValue('customFields');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use here LineItemAttributes the class accepts lineItem as constructor parameter and has a method to define if the line item is subscription

…determine if a product is a subscription product
use Kiener\MolliePayments\Struct\LineItem\LineItemAttributes;
use Shopware\Core\Checkout\Cart\LineItem\LineItem as CheckoutCartLineItem;

class SubscriptionProductIdentifier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we dont need the interface here, just use the attribute class

@BlackScorp BlackScorp merged commit bcbda5b into mollie:master Aug 21, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants