PK APOCALYPSE V1

APOCALYPSE V1

Current Path : /home/wallqcyy/www/wp-content/plugins/checkout-plugins-stripe-woo/gateway/stripe/
Upload File :
Current File : //home/wallqcyy/www/wp-content/plugins/checkout-plugins-stripe-woo/gateway/stripe/p24.php

<?php
/**
 * Przelewy24 Gateway
 *
 * @package checkout-plugins-stripe-woo
 * @since 1.3.0
 */

namespace CPSW\Gateway\Stripe;

use CPSW\Inc\Helper;
use CPSW\Inc\Traits\Get_Instance;
use CPSW\Gateway\Local_Gateway;

/**
 * Przelewy24 gateway
 *
 * @since 1.3.0
 */
class P24 extends Local_Gateway {

	use Get_Instance;

	/**
	 * Gateway id
	 *
	 * @var string
	 */
	public $id = 'cpsw_p24';

	/**
	 * Payment method types
	 *
	 * @var string
	 */
	public $payment_method_types = 'p24';

	/**
	 * Constructor
	 *
	 * @since 1.3.0
	 */
	public function __construct() {
		parent::__construct();
		add_action( 'init', [ $this, 'init_gateway' ] );
	}

	/**
	 * Initializes the gateway.
	 *
	 * Sets up the gateway's properties and settings.
	 *
	 * @since 1.11.0
	 */
	public function init_gateway() {
		$this->method_title       = __( 'Przelewy24', 'checkout-plugins-stripe-woo' );
		$this->method_description = $this->method_description();
		$this->has_fields         = true;

		$this->init_supports();
		$this->init_form_fields();
		$this->init_settings();

		$this->title             = $this->get_option( 'title' );
		$this->description       = $this->get_option( 'description' );
		$this->order_button_text = $this->get_option( 'order_button_text' );
	}

	/**
	 * Description for p24 gateway
	 *
	 * @since 1.3.0
	 *
	 * @return string
	 */
	public function method_description() {
		$payment_description = $this->payment_description();

		return sprintf(
			/* translators: %1$s: Break, %2$s: HTML entities */
			__( 'Accept payments using Przelewy24. %1$s %2$s', 'checkout-plugins-stripe-woo' ),
			'<br/>',
			$payment_description
		);
	}

	/**
	 * Checks whether this gateway is available.
	 *
	 * @since 1.3.0
	 *
	 * @return boolean
	 */
	public function is_available() {
		if ( ! in_array( $this->get_currency(), $this->get_supported_currency(), true ) ) {
			return false;
		}
		return parent::is_available();
	}

	/**
	 * Returns all supported currencies for this payment method.
	 *
	 * @since 1.3.0
	 *
	 * @return array
	 */
	public function get_supported_currency() {
		return apply_filters(
			'cpsw_p24_supported_currencies',
			[
				'EUR',
				'PLN',
			]
		);
	}

	/**
	 * Add more gateway form fields
	 *
	 * @since 1.3.0
	 *
	 * @return array
	 */
	public function get_default_settings() {
		$local_settings = parent::get_default_settings();

		$local_settings['allowed_countries']['default']  = 'specific';
		$local_settings['specific_countries']['default'] = [ 'PL' ];

		return $local_settings;
	}

	/**
	 * Creates markup for payment form for P24
	 *
	 * @since 1.3.0
	 *
	 * @return void
	 */
	public function payment_fields() {
		/**
		 * Action before payment field.
		 *
		 * @since 1.3.0
		 */
		do_action( $this->id . '_before_payment_field_checkout' );

		echo '<div class="status-box"></div>';
		echo '<div class="cpsw_stripe_p24_form">';
		if ( $this->description ) {
			echo wp_kses_post( $this->description );
		}
		echo '<div class="cpsw_stripe_p24_select"></div>';
		echo '<div class="cpsw_stripe_p24_error"></div>';
		if ( 'test' === Helper::get_payment_mode() ) {
			echo '<div class="cpsw_stripe_test_description">';
			echo wp_kses_post( $this->get_test_mode_description() );
			echo '</div>';
		}
		echo '</div>';

		/**
		 * Action after payment field.
		 *
		 * @since 1.3.0
		 */
		do_action( $this->id . '_after_payment_field_checkout' );
	}
}


if you don't want to be vaporized in a nuclear explosion, i simply have to become nuclear myself… i am atomic