<?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 Auth payment request model.
 */
class WC_Credorax_Model_Request_Payment_Auth extends WC_Credorax_Model_Request_AbstractPayment implements WC_Credorax_Model_RequestInterface
{
    /**
     * Credorax Operation Code
     * @var integer
     */
    const CREDORAX_O = 2;

    /**
     * {@inheritdoc}
     *
     * @return string
     */
    protected function getRequestMethod()
    {
        return WC_Credorax_Model_Request_AbstractPayment::PAYMENT_AUTH_METHOD;
    }

    /**
     * {@inheritdoc}
     *
     * @return string
     */
    protected function getResponseHandlerType()
    {
        return WC_Credorax_Model_Response_AbstractPayment::PAYMENT_AUTH_HANDLER;
    }

    /**
     * {@inheritdoc}
     *
     * @return array
     * @throws \Exception
     */
    protected function getParams()
    {
        return array_replace_recursive(
            parent::getParams(),
            [
                'O' => self::CREDORAX_O,
                'PKey' => $this->_order->get_meta(WC_Credorax_Gateway::KEY_CREDORAX_PKEY),
            ]
        );
    }
}
