<?php


class ControllerPaymentCaptcha extends Controller
{
    public function index() {
      $this->load->dmodel('checkout/order');
      $this->language->load('payment/captcha');
      $this->data['text_captcha'] = $this->language->get('text_captcha');
      $this->data['text_captcha_placeholder'] = $this->language->get('text_captcha_placeholder');

		  /*carregamento do captcha*/
		  $data_atual = new DateTime($this->db->dataAtual(), new DateTimeZone('America/Sao_Paulo'));
		  $data_atual = $data_atual->format("Y-m-d");

      $this->data['captcha_validate'] = false;

			$this->data['site_key'] = $this->config->get('google_recaptcha_site_key');
      $this->data['google_captcha'] = ($this->data['site_key'] && $this->config->get('google_recaptcha_secret_key') && $this->config->get('wg24_google_recaptcha_status')) ? 1 : 0;
      $this->data['captcha_validate'] = true;

      if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/captcha.twig')) {
        $this->template = $this->config->get('config_template') . '/template/payment/captcha.twig';
      }

      $this->response->setOutput($this->render());

    }

	public function loadCaptcha(){
		$this->ftrgeralregistry->loadCaptcha();
	}

}
