<?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 Sale payment response model.
 */
class WC_Credorax_Model_Response_Payment_Sale extends WC_Credorax_Model_Response_AbstractPayment implements WC_Credorax_Model_ResponseInterface
{
    /**
     * @return WC_Credorax_Model_Response_Payment_Sale
     * @throws \Exception
     * @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
        );

        return $this;
    }

    /**
     * @return array
     */
    protected function getRequiredResponseDataKeys()
    {
        return array_merge_recursive(
            parent::getRequiredResponseDataKeys(),
            [
                'K',
                'O',
                'z1',
            ]
        );
    }
}
