<?php
/**
 * Webkul Software.
 *
 * @category  Webkul
 * @package   Webkul_MpPayPal
 * @author    Webkul
 * @copyright Copyright (c) Webkul Software Private Limited (https://webkul.com)
 * @license   https://store.webkul.com/license.html
 */
namespace Webkul\MpPayPal\Gateway\Http\Client;

class TransactionSale extends AbstractTransaction
{

    public function __construct(
        \Webkul\MpPayPal\Model\PayPal\Adapter $adapter,
        \Magento\Framework\Json\Helper\Data $jsonHelper,
        \Webkul\MpPayPal\Helper\Data $helper
    ) {
        $this->helper = $helper;
        $this->jsonHelper = $jsonHelper;
        $this->adapter = $adapter;
    }

    /**
     * @inheritdoc
     */
    protected function process(array $data)
    {
        $this->helper->logDataInLogger('TransactionSale'.$this->jsonHelper->jsonEncode($data));
        $paymentData = $data['seller'];
        $result = [];
        $result[] = $this->adapter->captureOrder($paymentData[0]);
        $obj = new \Magento\Framework\DataObject();
        $obj->setItem($result);
        $this->helper->logDataInLogger('TransactionSale result'.$this->jsonHelper->jsonEncode($result));
        return $result;
    }
}
