Changeset 2343158
- Timestamp:
- 07/19/2020 11:12:29 PM (6 years ago)
- Location:
- paykassa
- Files:
-
- 12 added
- 3 edited
-
tags/1.0.2 (added)
-
tags/1.0.2/includes (added)
-
tags/1.0.2/includes/class-paykassa.php (added)
-
tags/1.0.2/includes/class-paykassa_gateway.php (added)
-
tags/1.0.2/includes/class-paykassa_install.php (added)
-
tags/1.0.2/includes/paykassa_sci.class.php (added)
-
tags/1.0.2/languages (added)
-
tags/1.0.2/languages/paykassa-ru_RU.mo (added)
-
tags/1.0.2/languages/paykassa-ru_RU.po (added)
-
tags/1.0.2/languages/paykassa.pot (added)
-
tags/1.0.2/paykassa.php (added)
-
tags/1.0.2/readme.txt (added)
-
trunk/includes/paykassa_sci.class.php (modified) (1 diff)
-
trunk/paykassa.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
paykassa/trunk/includes/paykassa_sci.class.php
r1847931 r2343158 1 1 <?php 2 2 class PayKassaSCI { 3 public $version = "0.3"; 4 public function __construct ($sci_id, $sci_key, $test=false) { 5 error_reporting(E_ALL); 6 $this->domain = $_SERVER['SERVER_NAME']; 7 $this->params = []; 8 $this->params["sci_id"] = $sci_id; 9 $this->params["sci_key"] = $sci_key; 10 $this->params["test"] = $test; 11 $this->params["domain"] = $this->domain; 3 public $version = "0.4"; 4 public function __construct ($sci_id, $sci_key, $test=false) { 5 $this->domain = $_SERVER['SERVER_NAME']; 6 $this->params = []; 7 $this->params["sci_id"] = $sci_id; 8 $this->params["sci_key"] = $sci_key; 9 $this->params["test"] = $test; 10 $this->params["domain"] = $this->domain; 12 11 13 $this->url = "https://paykassa.pro/sci/".$this->version."/index.php";14 }12 $this->url = "https://paykassa.pro/sci/".$this->version."/index.php"; 13 } 15 14 16 public function post_json_request($url, $data=[]) {17 $postdata = http_build_query($data);18 $opts = array('http' =>19 array(20 'method' => 'POST',21 'header' => 'Content-type: application/x-www-form-urlencoded',22 'content' => $postdata23 )24 );25 $context = stream_context_create($opts);26 return json_decode(file_get_contents($url, false, $context), true);27 }15 public function post_json_request($url, $data=[]) { 16 $postdata = http_build_query($data); 17 $opts = array('http' => 18 array( 19 'method' => 'POST', 20 'header' => 'Content-type: application/x-www-form-urlencoded', 21 'content' => $postdata 22 ) 23 ); 24 $context = stream_context_create($opts); 25 return json_decode(file_get_contents($url, false, $context), true); 26 } 28 27 29 private function query($url, $data=[]) {30 $result = $this->post_json_request($url, $data + $this->params);31 if ($result === false || $result === null) {32 return [33 "error" => true,34 "message" => "Ошибка запроса к сервису!",35 ];36 }37 return $result;38 }28 private function query($url, $data=[]) { 29 $result = $this->post_json_request($url, $data + $this->params); 30 if ($result === false || $result === null) { 31 return [ 32 "error" => true, 33 "message" => "Ошибка запроса к сервису!", 34 ]; 35 } 36 return $result; 37 } 39 38 40 public function sci_create_order($amount, $currency, $order_id="", $comment="", $system=0, $phone=false) {41 $fields = ["amount", "currency", "order_id", "comment", "system", "phone",];42 return $this->query($this->url, [43 "func" => "sci_create_order",44 ] + compact($fields));45 }39 public function sci_create_order($amount, $currency, $order_id="", $comment="", $system=0, $phone=false, $paid_commission="") { 40 $fields = ["amount", "currency", "order_id", "comment", "system", "phone", "paid_commission"]; 41 return $this->query($this->url, [ 42 "func" => "sci_create_order", 43 ] + compact($fields)); 44 } 46 45 47 public function sci_confirm_order() { 48 $private_hash = $this->request("private_hash"); 49 $fields = ["private_hash",]; 50 return $this->query($this->url, [ 51 "func" => "sci_confirm_order", 52 ] + compact($fields)); 53 } 46 public function sci_create_order_merchant($amount, $currency, $order_id="", $comment="", $system=0, $phone=false, $paid_commission="") { 47 $fields = ["amount", "currency", "order_id", "comment", "system", "phone", "paid_commission"]; 48 return $this->query($this->url, [ 49 "func" => "sci_create_order_merchant", 50 ] + compact($fields)); 51 } 54 52 55 public function alert($message) { ?> 56 <script>window.alert("<?php echo $message; ?>");</script> 57 <?php 58 } 53 public function sci_create_order_get_data($amount, $currency, $order_id="", $comment="", $system=0, $phone=false, $paid_commission="") { 54 $fields = ["amount", "currency", "order_id", "comment", "system", "phone", "paid_commission"]; 55 return $this->query($this->url, [ 56 "func" => "sci_create_order_get_data", 57 ] + compact($fields)); 58 } 59 59 60 public function format_currency($money, $currency) { 61 if (strtolower($currency) === "btc") { 62 return format_btc($money); 63 } 64 return format_money($money); 65 } 60 public function sci_confirm_order() { 61 $private_hash = $this->request("private_hash"); 62 $fields = ["private_hash",]; 63 return $this->query($this->url, [ 64 "func" => "sci_confirm_order", 65 ] + compact($fields)); 66 } 66 67 67 public function format_btc($money) { 68 return sprintf("%01.8f", $money); 69 } 68 public function alert($message) { ?> 69 <script>window.alert("<?php echo $message; ?>");</script> 70 <?php 71 } 70 72 71 public function format_money($money) { 72 return sprintf("%01.2f", $money); 73 } 73 public function format_currency($money, $currency) { 74 if (strtolower($currency) === "btc") { 75 return format_btc($money); 76 } 77 return format_money($money); 78 } 74 79 75 public function post($key, $value=false) { 76 if ($value) { 77 $_POST[$key] = $value; 78 } 79 return isset($_POST[(string)$key]) ? $_POST[(string)$key] : ""; 80 } 80 public function format_btc($money) { 81 return sprintf("%01.8f", $money); 82 } 81 83 82 public function get($key, $value=false) { 83 if ($value) { 84 $_GET[$key] = $value; 85 } 86 return isset($_GET[(string)$key]) ? $_GET[(string)$key] : ""; 87 } 84 public function format_money($money) { 85 return sprintf("%01.2f", $money); 86 } 88 87 89 public function request($key, $value=false) { 90 if ($value) { 91 $_REQUEST[$key] = $value; 92 } 93 return isset($_REQUEST[(string)$key]) ? $_REQUEST[(string)$key] : ""; 94 } 88 public function post($key, $value=false) { 89 if ($value) { 90 $_POST[$key] = $value; 91 } 92 return isset($_POST[(string)$key]) ? $_POST[(string)$key] : ""; 93 } 94 95 public function get($key, $value=false) { 96 if ($value) { 97 $_GET[$key] = $value; 98 } 99 return isset($_GET[(string)$key]) ? $_GET[(string)$key] : ""; 100 } 101 102 public function request($key, $value=false) { 103 if ($value) { 104 $_REQUEST[$key] = $value; 105 } 106 return isset($_REQUEST[(string)$key]) ? $_REQUEST[(string)$key] : ""; 107 } 95 108 } -
paykassa/trunk/paykassa.php
r1848838 r2343158 4 4 * Plugin URI: https://paykassa.pro/?lng=en 5 5 * Description: This plugin is the gateway for PayKassa system of WooCommerce 6 * Version: 1.0. 16 * Version: 1.0.2 7 7 * Author: al5dy 8 8 * Author URI: https://ziscod.com 9 *10 9 * License: GPLv3 11 10 * License URI: https://www.gnu.org/licenses/gpl-3.0.html 12 13 11 * Text Domain: paykassa 14 12 * Domain Path: /languages/ … … 18 16 19 17 if ( ! defined( 'ABSPATH' ) ) { 20 exit; // Exit if accessed directly.18 exit; // Exit if accessed directly. 21 19 } 22 20 23 21 // Define PK_PLUGIN_FILE. 24 22 if ( ! defined( 'PK_PLUGIN_FILE' ) ) { 25 define( 'PK_PLUGIN_FILE', __FILE__ );23 define( 'PK_PLUGIN_FILE', __FILE__ ); 26 24 } 27 25 28 26 // Include the main PayKassa class. 29 27 if ( ! class_exists( 'PayKassa' ) ) { 30 include_once dirname( __FILE__ ) . '/includes/class-paykassa.php';28 include_once dirname( __FILE__ ) . '/includes/class-paykassa.php'; 31 29 } 32 30 33 31 /** 34 32 * Main instance of PayKassa. 35 *36 33 * Returns the main instance of PayKassa to prevent the need to use globals. 37 34 * 35 * @return PayKassa 38 36 * @since 1.0.0 39 * @return PayKassa40 37 */ 41 38 if ( ! function_exists( 'paykassa' ) ) { 42 function paykassa() {43 return PayKassa::instance();44 }39 function paykassa() { 40 return PayKassa::instance(); 41 } 45 42 46 // Global for backwards compatibility.47 $GLOBALS['paykassa'] = paykassa();43 // Global for backwards compatibility. 44 $GLOBALS['paykassa'] = paykassa(); 48 45 } -
paykassa/trunk/readme.txt
r1848838 r2343158 1 1 === PayKassa === 2 2 Contributors: al5dy 3 Donate link: https:// www.paypal.me/al5dy/5usd3 Donate link: https://money.yandex.ru/to/410012328678499 4 4 Tags: bitcoin, cryptocurrency, woocommerce, gateway, paykassa 5 5 Requires at least: 4.7 6 Tested up to: 4.97 Stable tag: 1.0. 16 Tested up to: 5.4.2 7 Stable tag: 1.0.2 8 8 Requires PHP: 5.3 9 9 License: GPLv3 … … 43 43 44 44 * PHP version 5.3 or greater (PHP 7.2 or greater is recommended) 45 * MySQL version 5.5 or greater (MySQL 5.6 or greater is recommended)46 45 * WooCommerce 3.0.0 requires WordPress 4.7+ 47 46 … … 52 51 53 52 == Changelog == 53 54 = 1.0.2 - 2020-07-20 = 55 Update main SCI class 54 56 55 57 = 1.0.1 - 2018-03-29 =
Note: See TracChangeset
for help on using the changeset viewer.