Guest User

Untitled

a guest
Aug 25th, 2020
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.74 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4. class PAGALOCARD_Payment_Gateway extends WC_Payment_Gateway
  5. {
  6. // Setup our Gateway's id, description and other values
  7. function __construct()
  8. {
  9. // The global ID for this Payment method
  10. $this->id = "pagalocard_payment";
  11.  
  12. // The Title shown on the top of the Payment Gateways Page next to all the other Payment Gateways
  13. $this->method_title = __("PAGALOCARD GATEWAY", 'PAGALOCARD-payment');
  14.  
  15. // The description for this Payment Gateway, shown on the actual Payment options page on the PAGALOCARDkend
  16. $this->method_description = __("Pagalocard Payment Gateway Plug-in for WooCommerce", 'PAGALOCARD-payment');
  17.  
  18. // The title to be used for the vertical tabs that can be ordered top to bottom
  19. $this->title = __("PAGALOCARD Payment Gateway", 'PAGALOCARD-payment');
  20.  
  21. // If you want to show an image next to the gateway's name on the frontend, enter a URL to an image.
  22. $this->icon = plugin_dir_url( __FILE__ ).'assets/images/tarjetas.png';
  23.  
  24.  
  25. // Bool. Can be set to true if you want payment fields to show on the checkout
  26. // if doing a direct integration, which we are doing in this case
  27. $this->has_fields = true;
  28.  
  29. // Supports the default credit card form
  30. $this->supports = array('default_credit_card_form');
  31.  
  32. // This basically defines your settings which are then loaded with init_settings()
  33. $this->init_form_fields();
  34.  
  35. // After init_settings() is called, you can get the settings and load them into variables, e.g:
  36. // $this->title = $this->get_option( 'title' );
  37. $this->init_settings();
  38.  
  39. // Turn these settings into variables we can use
  40. foreach ($this->settings as $setting_key => $value) {
  41. $this->$setting_key = $value;
  42. }
  43.  
  44. // Lets check for SSL
  45. add_action('admin_notices', array($this, 'do_ssl_check'));
  46.  
  47. // Save settings
  48. if (is_admin()) {
  49. // Versions over 2.0
  50. // Save our administration options. Since we are not going to be doing anything special
  51. // we have not defined 'process_admin_options' in this class so the method in the parent
  52. // class will be used instead
  53. add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
  54. }
  55. } // End __construct()
  56.  
  57.  
  58. // Build the administration fields for this specific Gateway
  59. public function init_form_fields()
  60. {
  61. $domain = $_SERVER['SERVER_NAME'];
  62. $this->form_fields = array(
  63. 'enabled' => array(
  64. 'title' => __('Activar / Desactivar', 'PAGALOCARD-payment'),
  65. 'label' => __('Activar este metodo de pago', 'PAGALOCARD-payment'),
  66. 'type' => 'checkbox',
  67. 'default' => 'no',
  68. ),
  69. 'title' => array(
  70. 'title' => __('Título', 'PAGALOCARD-payment'),
  71. 'type' => 'text',
  72. 'desc_tip' => __('Título de pago que el cliente verá durante el proceso de pago.', 'PAGALOCARD-payment'),
  73. 'default' => __('Tarjeta de crédito', 'PAGALOCARD-payment'),
  74. ),
  75.  
  76. 'description' => array(
  77. 'title' => __('Descripción', 'PAGALOCARD-payment'),
  78. 'type' => 'textarea',
  79. 'desc_tip' => __('Descripción de pago que el cliente verá durante el proceso de pago.', 'PAGALOCARD-payment'),
  80. 'default' => __('Pague con seguridad usando su tarjeta de crédito.', 'PAGALOCARD-payment'),
  81. 'css' => 'max-width:350px;'
  82. ),
  83.  
  84.  
  85. 'developer' => array(
  86. 'title' => __('Credenciales NWORLDT.NET', 'PAGALOCARD-payment'),
  87. 'type' => 'title',
  88. 'description' => 'Ingresa a tu cuenta de NWORLDT.NET para obtener NUMERO DE ORDEN <a href="https://www.nworldt.net" target="_blank">Ir a NWORLDT.NET</a> ',
  89. ),
  90. 'domain' => array(
  91. 'title' => __('Domiain', 'PAGALOCARD-payment'),
  92. 'type' => 'text',
  93. 'desc_tip' => __('Url de dominio.', 'PAGALOCARD-payment'),
  94. 'default' => __($domain, 'PAGALOCARD-payment'),
  95. ),
  96. 'orderIdNWT' => array(
  97. 'title' => __('No. de Orden NWORLDT.NET', 'PAGALOCARD-payment'),
  98. 'type' => 'text',
  99. 'desc_tip' => __('No. de Orden. de NWORLDT.NET', 'PAGALOCARD-payment'),
  100. 'default' => __('', 'PAGALOCARD-payment'),
  101. ),
  102. 'PAGALO' => array(
  103. 'title' => __('Credenciales PAGALO', 'PAGALOCARD-payment'),
  104. 'type' => 'title',
  105. 'description' => 'Ingresa a tu cuenta de PAGALO para obtener las credenciales <a href="https://app.pagalocard.com" target="_blank">Ir a PAGALO</a> ',
  106. ),
  107. 'id_en_empresa' => array(
  108. 'title' => __('IdenEmpresa', 'PAGALOCARD-payment'),
  109. 'type' => 'text',
  110. 'desc_tip' => __('Clave IdenEmpresa.', 'PAGALOCARD-payment'),
  111. 'default' => '',
  112. ),
  113.  
  114. 'token' => array(
  115. 'title' => __('Token', 'PAGALOCARD-payment'),
  116. 'type' => 'text',
  117. 'desc_tip' => __('Token de seguridad del panel de control del comerciante.', 'PAGALOCARD-payment'),
  118. 'default' => '',
  119. ),
  120.  
  121.  
  122. 'public_api_key' => array(
  123. 'title' => __('Public Key', 'PAGALOCARD-payment'),
  124. ...............................................................................
  125. ..........................................
  126. .................
Add Comment
Please, Sign In to add comment