SettingsTpayCards

Created by PhpStorm.

Defined (1)

The class is defined in the following location(s).

/includes/settingsTpayCards.php  
  1. class SettingsTpayCards 
  2. const TITLE = 'title'; 
  3.  
  4. const TYPE = 'type'; 
  5.  
  6. const DEFAULT_SETTING = 'default'; 
  7.  
  8. const DESCRIPTION = 'description'; 
  9.  
  10. const WOOCOMMERCE = 'woocommerce'; 
  11.  
  12. const GATEWAY_NAME = 'WC_Gateway_Tpay_Cards'; 
  13.  
  14. const SELECT = 'select'; 
  15.  
  16. const OPTIONS = 'options'; 
  17.  
  18. const DESC_TIP = 'desc_tip'; 
  19.  
  20. const HTTP = 'http:'; 
  21.  
  22. const HTTPS = 'https:'; 
  23.  
  24. public function getSettings() 
  25. if ((isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') 
  26. || ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on')) 
  27. ) { 
  28. $domain = str_replace(static::HTTP, static::HTTPS, home_url('/')); 
  29. $notify_link = add_query_arg('wc-api', static::GATEWAY_NAME, $domain); 
  30. } else { 
  31. $domain = str_replace(static::HTTPS, static::HTTP, home_url('/')); 
  32. $notify_link = add_query_arg('wc-api', static::GATEWAY_NAME, $domain); 
  33.  
  34. $options = array('enabled' => array( 
  35. static ::TITLE => __('W**cz/Wy**cz', static ::WOOCOMMERCE),  
  36. static ::TYPE => 'checkbox',  
  37. 'label' => __('W**cz metod* p*atno*ci kartami przez tpay.com.', static ::WOOCOMMERCE),  
  38. static ::DEFAULT_SETTING => 'no',  
  39. static ::DESCRIPTION => sprintf(__(' <a href="%s" TARGET="_blank">Zarejestruj konto w systemie 
  40. tpay.com</a>.', static ::WOOCOMMERCE), 'https://secure.tpay.com/panel/rejestracja.html'),  
  41. ),  
  42. 'doc_link' => array( 
  43. static ::TITLE => __('Instrukcja', static ::WOOCOMMERCE),  
  44. static ::TYPE => static ::TITLE,  
  45. static ::DESCRIPTION => sprintf(__(' <a href="%s" TARGET="_blank">Instrukcja konfiguracji 
  46. </a>', static ::WOOCOMMERCE), 'https://secure.tpay.com/integration/instruction/64'),  
  47. ),  
  48. static ::TITLE => array( 
  49. static ::TITLE => __('Nazwa metody p*atno*ci', static ::WOOCOMMERCE),  
  50. static ::TYPE => 'text',  
  51. static ::DEFAULT_SETTING => __('tpay.com credit cards', static ::WOOCOMMERCE),  
  52. static ::DESC_TIP => true,  
  53. ),  
  54. 'midNumber' => array( 
  55. static ::TITLE => __("Numer MID'u", static ::WOOCOMMERCE),  
  56. static ::TYPE => static ::SELECT,  
  57. static ::DEFAULT_SETTING => '0',  
  58. static ::OPTIONS => array(),  
  59. ),  
  60. 'resp_link' => array( 
  61. static ::TITLE => __('Link powiadomie* do panelu odbiorcy p*atno*ci',  
  62. static ::WOOCOMMERCE),  
  63. static ::TYPE => static ::TITLE,  
  64. static ::DESCRIPTION => __(add_query_arg(array('type' => 'sale'), $notify_link),  
  65. static ::WOOCOMMERCE),  
  66. ),  
  67. 'debugMode' => array( 
  68. static ::TITLE => __('Tryb debugowania',  
  69. static ::WOOCOMMERCE),  
  70. static ::TYPE => 'checkbox',  
  71. static ::DEFAULT_SETTING => 'no',  
  72. static ::DESCRIPTION => __('Wy**cz w trybie produkcyjnym.' 
  73. ),  
  74. ); 
  75. for ($i = 1; $i < 11; $i++) { 
  76.  
  77. $array = array( 
  78. 'midOn' . $i => array( 
  79. static ::TITLE => __('W**cz MID', static ::WOOCOMMERCE),  
  80. static ::TYPE => 'checkbox',  
  81. 'label' => __("U*ywaj tego MID'u", static ::WOOCOMMERCE),  
  82. static ::DEFAULT_SETTING => 'no',  
  83. ),  
  84. 'midType' . $i => array( 
  85. static ::TITLE => __('Konto wielowalutowe', static ::WOOCOMMERCE),  
  86. static ::TYPE => static ::SELECT,  
  87. static ::DEFAULT_SETTING => '0',  
  88. static ::OPTIONS => array( 
  89. '0' => __('NIE - tylko PLN', static ::WOOCOMMERCE),  
  90. '1' => __('TAK - wszystkie obs*ugiwane waluty', static ::WOOCOMMERCE),  
  91. ),  
  92. ),  
  93. 'midDomain' . $i => array( 
  94. static ::TITLE => __("Domena przypisana do MID'u", static ::WOOCOMMERCE),  
  95. static ::TYPE => 'text',  
  96. static ::DEFAULT_SETTING => $domain,  
  97. ),  
  98. 'midCurrency' . $i => array( 
  99. static ::TITLE => __("Waluty, dla ktrych ma by* u*ywany MID oddzielone przecinkiem 
  100. np. EUR, USD (puste je*li wszystkie)" 
  101. , static ::WOOCOMMERCE),  
  102. static ::TYPE => 'text',  
  103. static ::DEFAULT_SETTING => '',  
  104. ),  
  105.  
  106. static ::DESCRIPTION . $i => array( 
  107. static ::TITLE => __('Opis', static ::WOOCOMMERCE),  
  108. static ::TYPE => 'textarea',  
  109. static ::DESCRIPTION => __('Ustawia opis bramki, ktry widzi u*ytkownik 
  110. przy tworzeniu zamwienia.' 
  111. , static ::WOOCOMMERCE),  
  112. static ::DEFAULT_SETTING => __('System p*atno*ci tpay.com to bezpieczny i szybki sposb p*atno*ci,  
  113. ktry zosta* wybrany przez Odbiorc* p*atno*ci w celu przyj*cia od Ciebie zap*aty.' 
  114. , static ::WOOCOMMERCE) 
  115. ),  
  116. 'opis' . $i => array( 
  117. static ::TITLE => __('Tytu* transakcji', static ::WOOCOMMERCE),  
  118. static ::TYPE => 'text',  
  119. static ::DESCRIPTION => __('Ustawia opis transakcji, do ktrego zostanie autoamtycznie 
  120. dodane "Zamwienie nr (ID)".' 
  121. , static ::WOOCOMMERCE),  
  122. static ::DEFAULT_SETTING => __('' 
  123. , static ::WOOCOMMERCE) 
  124. ),  
  125. 'seller_id' . $i => array( 
  126. static ::TITLE => __('ID sprzedawcy', static ::WOOCOMMERCE),  
  127. static ::TYPE => 'text',  
  128. static ::DESCRIPTION => __('Twoje ID sprzedawcy w systemie tpay.com. 
  129. Liczba co najmniej czterocyfrowa (mo*e by* pi*ciocyfowa), np. 12345', static ::WOOCOMMERCE),  
  130. static ::DEFAULT_SETTING => __('0', static ::WOOCOMMERCE),  
  131. static ::DESC_TIP => true,  
  132. ),  
  133. 'security_code' . $i => array( 
  134. static ::TITLE => __('Kod bezpiecze*stwa', static ::WOOCOMMERCE),  
  135. static ::TYPE => 'text',  
  136. static ::DESCRIPTION => __('Kod bezpiecze*stwa Twojego konta na tpay.com.',  
  137. static ::WOOCOMMERCE),  
  138. static ::DEFAULT_SETTING => __('0', static ::WOOCOMMERCE),  
  139. static ::DESC_TIP => true,  
  140. ),  
  141.  
  142. 'cardApiKey' . $i => array( 
  143. static ::TITLE => __('Klucz API', static ::WOOCOMMERCE),  
  144. static ::TYPE => 'text',  
  145. static ::DESCRIPTION => __('Klucz API wygenerowany w panelu odbiorcy p*atno*ci tpay.com.' 
  146. , static ::WOOCOMMERCE),  
  147. static ::DEFAULT_SETTING => __('0', static ::WOOCOMMERCE),  
  148. static ::DESC_TIP => true,  
  149. ),  
  150. 'cardApiPassword' . $i => array( 
  151. static ::TITLE => __('Has*o API', static ::WOOCOMMERCE),  
  152. static ::TYPE => 'text',  
  153. static ::DESCRIPTION => __('Has*o do klucza API', static ::WOOCOMMERCE),  
  154. static ::DEFAULT_SETTING => __('0', static ::WOOCOMMERCE),  
  155. static ::DESC_TIP => true,  
  156. ),  
  157. 'verificationCode' . $i => array( 
  158. static ::TITLE => __('Kod weryfikacyjny', static ::WOOCOMMERCE),  
  159. static ::TYPE => 'text',  
  160. static ::DESCRIPTION => __('Kod weryfikacyjny', static ::WOOCOMMERCE),  
  161. static ::DEFAULT_SETTING => __('0', static ::WOOCOMMERCE),  
  162. static ::DESC_TIP => true,  
  163. ),  
  164. 'hashAlg' . $i => array( 
  165. static ::TITLE => __('Typ hash', static ::WOOCOMMERCE),  
  166. static ::TYPE => static ::SELECT,  
  167. static ::DEFAULT_SETTING => 'sha1',  
  168. static ::OPTIONS => array( 
  169. 'sha1' => __('sha1', static ::WOOCOMMERCE),  
  170. 'sha256' => __('sha256', static ::WOOCOMMERCE),  
  171. 'sha512' => __('sha512', static ::WOOCOMMERCE),  
  172. 'ripemd160' => __('ripemd160', static ::WOOCOMMERCE),  
  173. 'ripemd320' => __('ripemd320', static ::WOOCOMMERCE),  
  174. 'md5' => __('md5', static ::WOOCOMMERCE),  
  175. ),  
  176. ),  
  177. 'keyRSA' . $i => array( 
  178. static ::TITLE => __('Klucz RSA', static ::WOOCOMMERCE),  
  179. static ::TYPE => 'textarea',  
  180. static ::DESCRIPTION => __('Klucz publiczny RSA', static ::WOOCOMMERCE),  
  181. static ::DEFAULT_SETTING => __('0', static ::WOOCOMMERCE),  
  182. static ::DESC_TIP => true,  
  183. ),  
  184. 'doplata' . $i => array( 
  185. static ::TITLE => __('Dop*ata doliczana za korzystanie z metody p*atno*ci' 
  186. , static ::WOOCOMMERCE),  
  187. static ::TYPE => static ::SELECT,  
  188. static ::DEFAULT_SETTING => '0',  
  189. static ::OPTIONS => array( 
  190. '0' => __('NIE', static ::WOOCOMMERCE),  
  191. '1' => __('PLN', static ::WOOCOMMERCE),  
  192. '2' => __('%', static ::WOOCOMMERCE),  
  193. ),  
  194. ),  
  195. 'kwota_doplaty' . $i => array( 
  196. static ::TITLE => __('Kwota dop*aty', static ::WOOCOMMERCE),  
  197. static ::TYPE => "text",  
  198. static ::DESCRIPTION => __('Kwota jaka zostanie doliczona do zamwienia. 
  199. Jako separator liczb nale*y wykorzysta* kropk*', static ::WOOCOMMERCE),  
  200. static ::DEFAULT_SETTING => __('0', static ::WOOCOMMERCE),  
  201. static ::DESC_TIP => true,  
  202. ),  
  203.  
  204.  
  205. ); 
  206. $options['midNumber'][static::OPTIONS][$i] = __((string)$i, static::WOOCOMMERCE); 
  207. $options = array_merge($options, $array); 
  208.  
  209. return $options;