<?php
/**
 * Credorax Payments For WooCommerce
 * https://www.credorax.com/
 *
 * @category Credorax
 * @package  WC_Credorax
 * @author   Girit-Interactive (https://www.girit-tech.com/)
 */

 if (! defined('ABSPATH')) {
     exit; // Exit if accessed directly.
 }

/**
 * Credorax Credorax gateway capture response model.
 */
class WC_Credorax_Model_Response_Gateway_Capture extends WC_Credorax_Model_Response_AbstractGateway implements WC_Credorax_Model_ResponseInterface
{
    /**
     * @return WC_Credorax_Model_Response_Gateway_Capture
     * @throws \Exception
     */
    protected function updateTransaction()
    {
        parent::updateTransaction();

        $this->_order->add_meta_data(
            WC_Credorax_Gateway::KEY_CREDORAX_PAYMENT_STATUS,
            WC_Credorax_Gateway::CREDORAX_PAYMENT_STATUS_CAPTURED,
            true
        );

        if ($this->_responseId) {
            $this->_order->add_meta_data(
                WC_Credorax_Gateway::KEY_CREDORAX_RESPONSE_ID,
                $this->_responseId,
                true
            );
        }

        return $this;
    }
}
