NotificationPlugin.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * This file is part of the Klarna Kp module
  4. *
  5. * (c) Klarna AB
  6. *
  7. * For the full copyright and license information, please view the NOTICE
  8. * and LICENSE files that were distributed with this source code.
  9. */
  10. namespace Klarna\Kp\Plugin\Controller\Api;
  11. use Klarna\Core\Helper\ConfigHelper;
  12. use Klarna\Kp\Model\Payment\Kp;
  13. use Klarna\Ordermanagement\Controller\Api\Notification;
  14. use Magento\Sales\Model\Order;
  15. /**
  16. * Class NotificationPlugin
  17. *
  18. * @package Klarna\Kp\Plugin\Controller\Api
  19. */
  20. class NotificationPlugin
  21. {
  22. /**
  23. * @param Notification $subject
  24. * @param Order $order
  25. * @param String $method
  26. * @param string $status
  27. * @return array
  28. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  29. */
  30. public function beforeSetOrderStatus(
  31. Notification $subject,
  32. $order,
  33. $method,
  34. $status = null
  35. ) {
  36. if ($method !== ConfigHelper::KCO_METHOD_CODE) {
  37. $method = Kp::METHOD_CODE;
  38. }
  39. return [$order, $method, $status];
  40. }
  41. }