Plugin Directory

Changeset 2343158


Ignore:
Timestamp:
07/19/2020 11:12:29 PM (6 years ago)
Author:
al5dy
Message:

Update version

Location:
paykassa
Files:
12 added
3 edited

Legend:

Unmodified
Added
Removed
  • paykassa/trunk/includes/paykassa_sci.class.php

    r1847931 r2343158  
    11<?php
    22class 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;
    1211
    13         $this->url = "https://paykassa.pro/sci/".$this->version."/index.php";
    14     }
     12    $this->url = "https://paykassa.pro/sci/".$this->version."/index.php";
     13  }
    1514
    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' => $postdata
    23                           )
    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  }
    2827
    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  }
    3938
    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  }
    4645
    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  }
    5452
    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  }
    5959
    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  }
    6667
    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  }
    7072
    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  }
    7479
    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  }
    8183
    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  }
    8887
    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  }
    95108}
  • paykassa/trunk/paykassa.php

    r1848838 r2343158  
    44 * Plugin URI: https://paykassa.pro/?lng=en
    55 * Description: This plugin is the gateway for PayKassa system of WooCommerce
    6  * Version: 1.0.1
     6 * Version: 1.0.2
    77 * Author: al5dy
    88 * Author URI: https://ziscod.com
    9  *
    109 * License: GPLv3
    1110 * License URI: https://www.gnu.org/licenses/gpl-3.0.html
    12 
    1311 * Text Domain: paykassa
    1412 * Domain Path: /languages/
     
    1816
    1917if ( ! defined( 'ABSPATH' ) ) {
    20     exit; // Exit if accessed directly.
     18  exit; // Exit if accessed directly.
    2119}
    2220
    2321// Define PK_PLUGIN_FILE.
    2422if ( ! defined( 'PK_PLUGIN_FILE' ) ) {
    25     define( 'PK_PLUGIN_FILE', __FILE__ );
     23  define( 'PK_PLUGIN_FILE', __FILE__ );
    2624}
    2725
    2826// Include the main PayKassa class.
    2927if ( ! class_exists( 'PayKassa' ) ) {
    30     include_once dirname( __FILE__ ) . '/includes/class-paykassa.php';
     28  include_once dirname( __FILE__ ) . '/includes/class-paykassa.php';
    3129}
    3230
    3331/**
    3432 * Main instance of PayKassa.
    35  *
    3633 * Returns the main instance of PayKassa to prevent the need to use globals.
    3734 *
     35 * @return PayKassa
    3836 * @since  1.0.0
    39  * @return PayKassa
    4037 */
    4138if ( ! function_exists( 'paykassa' ) ) {
    42     function paykassa() {
    43         return PayKassa::instance();
    44     }
     39  function paykassa() {
     40    return PayKassa::instance();
     41  }
    4542
    46     // Global for backwards compatibility.
    47     $GLOBALS['paykassa'] = paykassa();
     43  // Global for backwards compatibility.
     44  $GLOBALS['paykassa'] = paykassa();
    4845}
  • paykassa/trunk/readme.txt

    r1848838 r2343158  
    11=== PayKassa ===
    22Contributors: al5dy
    3 Donate link: https://www.paypal.me/al5dy/5usd
     3Donate link: https://money.yandex.ru/to/410012328678499
    44Tags: bitcoin, cryptocurrency, woocommerce, gateway, paykassa
    55Requires at least: 4.7
    6 Tested up to: 4.9
    7 Stable tag: 1.0.1
     6Tested up to: 5.4.2
     7Stable tag: 1.0.2
    88Requires PHP: 5.3
    99License: GPLv3
     
    4343
    4444* 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)
    4645* WooCommerce 3.0.0 requires WordPress 4.7+
    4746
     
    5251
    5352== Changelog ==
     53
     54= 1.0.2 - 2020-07-20 =
     55Update main SCI class
    5456
    5557= 1.0.1 - 2018-03-29 =
Note: See TracChangeset for help on using the changeset viewer.