Your IP : 216.73.216.97


Current Path : /var/www/clients/client3/web2/web/vendor/klarna/module-ordermanagement/Observer/
Upload File :
Current File : /var/www/clients/client3/web2/web/vendor/klarna/module-ordermanagement/Observer/PrepareCapture.php

<?php
/**
 * This file is part of the Klarna Order Management module
 *
 * (c) Klarna Bank AB (publ)
 *
 * For the full copyright and license information, please view the NOTICE
 * and LICENSE files that were distributed with this source code.
 */

namespace Klarna\Ordermanagement\Observer;

use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;

/**
 * Generate item list for payment capture
 */
class PrepareCapture implements ObserverInterface
{

    /**
     * @param Observer $observer
     * @return void
     */
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $payment = $observer->getPayment();

        if (false === strpos($payment->getMethod(), 'klarna_')) {
            return;
        }

        $payment->setInvoice($observer->getInvoice());
    }
}