Plugin Directory

Changeset 2837763


Ignore:
Timestamp:
12/22/2022 04:51:18 AM (3 years ago)
Author:
best2pay
Message:

v1.2.0 sbp, installment

Location:
best2pay-payment-method-visamastercard
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • best2pay-payment-method-visamastercard/best2pay-payment_method.php

    r2818298 r2837763  
    1818 * Plugin URI: http://best2pay.net/
    1919 * Description: Receive payments via Visa/Mastercard easily with Best2Pay bank cards processing
    20  * Version: 1.1.6
     20 * Version: 1.2.0
    2121 * Author: Best2Pay
    2222 * Tested up to: 5.7.1
     
    5252            $this->id = 'best2pay';
    5353            $this->method_title = __('Best2Pay', 'best2pay-payment_method');
    54             $this->title = __('Best2Pay', 'best2pay-payment_method');
    55             $this->description = __("Payments with bank cards via the <a href=\"http://www.best2pay.net\" target=\"_blank\">Best2Pay</a> payment system.", 'best2pay-payment_method');
     54            $this->title = __('Оплата банковской картой', 'best2pay-payment_method');
     55            $this->description = __("через платежную систему <a href=\"http://www.best2pay.net\" target=\"_blank\">Best2Pay</a>", 'best2pay-payment_method');
    5656            $this->icon = plugins_url('best2pay.png', __FILE__);
    5757            $this->has_fields = true;
     
    6767            $this->testmode = $this->settings['testmode'];
    6868            $this->twostepsmode = $this->settings['twostepsmode'];
    69             $this->halvaparts = $this->settings['halvaparts'];
    70 
     69            // $this->halvaparts = $this->settings['halvaparts'];
     70            $this->mode = $this->settings['mode'];
     71            switch ($this->mode) {
     72                case 1:
     73                    $this->title = 'Оплатить заказ Частями';
     74                    $this->icon = plugins_url('halva.svg', __FILE__);
     75                    $this->description = '';
     76                    break;
     77                case 2:
     78                    $this->title = 'Оплатить по QR';
     79                    $this->icon = null;
     80                    break;
     81            }
    7182            // actions
    7283            add_action('init', array($this, 'successful_request'));
     
    131142                    'description' => __('Select test or live mode', 'best2pay-payment_method')
    132143                ),
    133                 'halvaparts' => array(
    134                     'title' => __('Only Halva parts', 'best2pay-payment_method'),
     144                /*'mode' => array(
     145                    'title' => __('Payment mode', 'best2pay-payment_method'),
    135146                    'type' => 'select',
    136147                    'options' => array(
    137                         '1' => __('No', 'best2pay-payment_method'),
    138                         '0' => __('Yes', 'best2pay-payment_method')
     148                        '0' => __('Standard acquiring', 'best2pay-payment_method'),
     149                        '1' => __('Just installment', 'best2pay-payment_method'),
     150                        '2' => __('Just purchase by QR', 'best2pay-payment_method')
    139151                    ),
    140                     'description' => __('The module works only for paying for Halva Parts, other payment methods are disabled', 'best2pay-payment_method'),
     152                    'description' => __('Select payment mode', 'best2pay-payment_method'),
     153                ),*/
     154                'mode' => array(
     155                    'title' => __('Режим оплаты', 'best2pay-payment_method'),
     156                    'type' => 'select',
     157                    'options' => array(
     158                        '0' => __('Стандартный эквайринг', 'best2pay-payment_method'),
     159                        '1' => __('Только Халва.Частями', 'best2pay-payment_method'),
     160                        '2' => __('Только СБП', 'best2pay-payment_method')
     161                    ),
     162                    'description' => __('Выберите режим оплаты', 'best2pay-payment_method'),
    141163                ),
    142164                'twostepsmode' => array(
     
    148170                    ),
    149171                    'description' => __('Turn on 2 steps mode', 'best2pay-payment_method')
    150 //                ),
    151 //                'deferred' => array(
    152 //                    'title' => __('Deferred payment', 'best2pay-payment_method'),
    153 //                    'type' => 'select',
    154 //                    'options' => array(
    155 //                        '1' => __('On', 'best2pay-payment_method'),
    156 //                        '0' => __('Off', 'best2pay-payment_method')
    157 //                    ),
    158 //                    'description' => __('Making of an email message with a link to payment (payment is not carried out)', 'best2pay-payment_method')
    159                 )
     172                ),
     173                /*'deferred' => array(
     174                    'title' => __('Deferred payment', 'best2pay-payment_method'),
     175                    'type' => 'select',
     176                    'options' => array(
     177                        '1' => __('On', 'best2pay-payment_method'),
     178                        '0' => __('Off', 'best2pay-payment_method')
     179                    ),
     180                    'description' => __('Making of an email message with a link to payment (payment is not carried out)', 'best2pay-payment_method')
     181                )*/
    160182            );
    161183
     
    183205            if ($this->testmode == "0")
    184206                $best2pay_url = "https://pay.best2pay.net";
    185             $best2pay_operation = "Purchase";
    186             if ($this->twostepsmode == "1")
    187                 $best2pay_operation = "Authorize";
     207
     208            switch (intval($this->mode)) {
     209                case 1:
     210                    $best2pay_operation = 'custom/svkb/PurchaseWithInstallment';
     211                    break;
     212                case 2:
     213                    $best2pay_operation = 'PurchaseSBP';
     214                    break;
     215                default:
     216                    $best2pay_operation = "Purchase";
     217                    if ($this->twostepsmode == "1")
     218                        $best2pay_operation = "Authorize";
     219            }
    188220
    189221            $signature = base64_encode(md5($this->sector . intval($order->get_total() * 100) . $currency . $this->password));
     
    193225            $fiscalPositions = '';
    194226            $fiscalAmount = 0;
    195             $KKT = true;
    196 
    197             if ($KKT) {
    198                 foreach ($items as $item_id => $item) {
    199                     $item_data = $item->get_data();
    200                     $fiscalPositions .= $item_data['quantity'] . ';';
    201                     $elementPrice = $item->get_product()->get_price() * 100;
    202                     $fiscalPositions .= $elementPrice . ';';
    203                     $fiscalPositions .= ($item_data['total_tax']) ?: 6 . ';';   // tax
    204                     $fiscalPositions .= str_ireplace([';', '|'], '', $item_data['name']) . '|';
    205 
    206                     $fiscalAmount += $item_data['quantity'] * $elementPrice;
    207                 }
    208                 if ($wc_order->get_shipping_total()) {
    209                     $fiscalPositions .= '1;' . $wc_order->get_shipping_total() * 100 . ';6;Доставка|';
    210                     $fiscalAmount += $wc_order->get_shipping_total() * 100;
    211                 }
    212                 $fiscalDiff = abs($fiscalAmount - intval($order->get_total() * 100));
    213                 if ($fiscalDiff) {
    214                     $fiscalPositions .= '1;' . $fiscalDiff . ';6;Скидка;14|';
    215                 }
    216                 $fiscalPositions = substr($fiscalPositions, 0, -1);
    217             }
     227
     228            foreach ($items as $item_id => $item) {
     229                $item_data = $item->get_data();
     230                $fiscalPositions .= $item_data['quantity'] . ';';
     231                $elementPrice = $item->get_product()->get_price() * 100;
     232                $fiscalPositions .= $elementPrice . ';';
     233                $fiscalPositions .= ($item_data['total_tax']) ?: 6 . ';';   // tax
     234                $fiscalPositions .= str_ireplace([';', '|'], '', $item_data['name']) . '|';
     235
     236                $fiscalAmount += $item_data['quantity'] * $elementPrice;
     237            }
     238            if ($wc_order->get_shipping_total()) {
     239                $fiscalPositions .= '1;' . $wc_order->get_shipping_total() * 100 . ';6;Доставка|';
     240                $fiscalAmount += $wc_order->get_shipping_total() * 100;
     241            }
     242            $fiscalDiff = abs($fiscalAmount - intval($order->get_total() * 100));
     243            if ($fiscalDiff) {
     244                $fiscalPositions .= '1;' . $fiscalDiff . ';6;Скидка;14|';
     245            }
     246            $fiscalPositions = substr($fiscalPositions, 0, -1);
    218247
    219248            $args = array(
     
    225254                    'description' => sprintf(__('Order #%s', 'best2pay-payment_method'), ltrim($order->get_order_number(), '#')),
    226255                    'email' => $order->get_billing_email(),
    227 //                    'notify_customer' => ($this->deferred) ? 1 : 0,
     256                    // 'notify_customer' => ($this->deferred) ? 1 : 0,
    228257                    'currency' => $currency,
    229258                    'mode' => 1,
     
    233262            );
    234263
     264            die('<pre>' . print_r(array(
     265                'sector' => $this->sector,
     266                'reference' => $order->get_id(),
     267                'amount' => intval($order->get_total() * 100),
     268                'fiscal_positions' => $fiscalPositions,
     269                'description' => sprintf(__('Order #%s', 'best2pay-payment_method'), ltrim($order->get_order_number(), '#')),
     270                'email' => $order->get_billing_email(),
     271                // 'notify_customer' => ($this->deferred) ? 1 : 0,
     272                'currency' => $currency,
     273                'mode' => 1,
     274                'url' => $this->callback_url,
     275                'signature' => $signature
     276            ), true));
     277
    235278            $remote_post = wp_remote_post($best2pay_url . '/webapi/Register', $args);
    236279            $remote_post = (isset($remote_post['body'])) ? $remote_post['body'] : $remote_post;
     
    247290            $signature = base64_encode(md5($this->sector . $b2p_order_id . $this->password));
    248291
    249             // $order->update_status('on-hold');
    250 
    251 //            if ($this->deferred) {
    252 //                wp_redirect($this->get_return_url($wc_order));
    253 //                exit();
    254 //            }
    255 
    256             if(intval($this->halvaparts) == 0){
    257                 $best2pay_operation = 'custom/svkb/PurchaseWithInstallment';
    258             }
     292            $order->update_status('on-hold');
     293
     294            /*if ($this->deferred) {
     295                wp_redirect($this->get_return_url($wc_order));
     296                exit();
     297            }*/
    259298
    260299            return array(
     
    402441                return false;
    403442
    404             if($order->get_date_paid())
     443            if ($order->get_date_paid())
    405444                exit();
    406445
     
    438477         * @param array $details
    439478         */
    440         public function logIt (string $message, array $details = []) {
     479        public function logIt(string $message, array $details = [])
     480        {
    441481            $log = fopen($this->getLogFileName(), 'a+') or die("logging trouble");
    442482            $date = date("d.m.y H:i:s");
     
    446486            }
    447487            $msg .= "\n\n\n";
    448             fprintf($log, chr(0xEF).chr(0xBB).chr(0xBF));
     488            fprintf($log, chr(0xEF) . chr(0xBB) . chr(0xBF));
    449489            fwrite($log, $msg);
    450490            fclose($log);
    451491        }
    452492
    453         public function getLogFileName () {
     493        public function getLogFileName()
     494        {
    454495            $signature = base64_encode($this->sector . $this->password . $_SERVER['HTTP_HOST']);
    455496            $signature = str_ireplace('=', '', $signature);
  • best2pay-payment-method-visamastercard/languages/best2pay-payment_method-ru_RU.po

    r2818298 r2837763  
    88"Report-Msgid-Bugs-To: \n"
    99"POT-Creation-Date: 2015-12-15 04:38+0300\n"
    10 "PO-Revision-Date: 2022-11-07 14:20+0000\n"
     10"PO-Revision-Date: 2022-10-25 06:15+0000\n"
    1111"Last-Translator: \n"
    1212"Language-Team: Русский\n"
     
    2121"X-Loco-Version: 2.6.2; wp-6.0.3"
    2222
    23 #: best2pay-payment_method.php:351
     23#: best2pay-payment_method.php:346
    2424msgid "."
    2525msgstr ""
    2626
    27 #: best2pay-payment_method.php:146
     27#: best2pay-payment_method.php:143
    2828msgid "2 steps payment mode"
    2929msgstr "Двухстадийная оплата"
     
    3131#. Author of the plugin
    3232#: best2pay-payment_method.php:53 best2pay-payment_method.php:54
    33 #: best2pay-payment_method.php:85
     33#: best2pay-payment_method.php:84
    3434msgid "Best2Pay"
    3535msgstr "Best2Pay"
     
    3939msgstr "Оплата с Best2Pay (Виза/МастерКард)"
    4040
    41 #: best2pay-payment_method.php:107
     41#: best2pay-payment_method.php:152
     42msgid "Deferred payment"
     43msgstr "Отсроченный платёж"
     44
     45#: best2pay-payment_method.php:106
    4246msgid "Enable Best2Pay checkout method"
    4347msgstr "Включить использование метода платежа Best2Pay"
    4448
    45 #: best2pay-payment_method.php:105
     49#: best2pay-payment_method.php:104
    4650msgid "Enable/Disable"
    4751msgstr "Включить/Выключить"
    48 
    49 #: best2pay-payment_method.php:141
    50 #, fuzzy
    51 #| msgid "fast payment system"
    52 msgid "Fast payment system"
    53 msgstr "Система быстрых платежей"
    54 
    55 #: best2pay-payment_method.php:140
    56 #, fuzzy
    57 #| msgid "halva-parts"
    58 msgid "Halva Chastyami"
    59 msgstr "Халва Частями"
    6052
    6153#. URI of the plugin
     
    6355msgstr "http://best2pay.net/"
    6456
    65 #: best2pay-payment_method.php:139
    66 #, fuzzy
    67 #| msgid "internet-acquiring"
    68 msgid "Internet-acquiring"
    69 msgstr "Интернет-эквайринг"
     57#: best2pay-payment_method.php:158
     58msgid ""
     59"Making of an email message with a link to payment (payment is not carried "
     60"out)"
     61msgstr ""
     62"Формирование электронного письма со ссылкой на оплату (сама оплата не "
     63"проводится)"
    7064
    71 #: best2pay-payment_method.php:150
     65#: best2pay-payment_method.php:137
     66msgid "No"
     67msgstr "Нет"
     68
     69#: best2pay-payment_method.php:147 best2pay-payment_method.php:156
    7270msgid "Off"
    7371msgstr "Выкл"
    7472
    75 #: best2pay-payment_method.php:149
     73#: best2pay-payment_method.php:146 best2pay-payment_method.php:155
    7674msgid "On"
    7775msgstr "Вкл"
    7876
    79 #: best2pay-payment_method.php:228
     77#: best2pay-payment_method.php:134
     78msgid "Only Halva parts"
     79msgstr "Только Халва Частями"
     80
     81#: best2pay-payment_method.php:225
    8082#, php-format
    8183msgid "Order #%s"
    8284msgstr "Заказ #%s"
    8385
    84 #: best2pay-payment_method.php:119
     86#: best2pay-payment_method.php:118
    8587msgid "Password"
    8688msgstr "Пароль"
    8789
    88 #: best2pay-payment_method.php:121
     90#: best2pay-payment_method.php:120
    8991msgid "Password to use for digital signature"
    9092msgstr "Пароль для цифровой подписи"
    9193
    92 #: best2pay-payment_method.php:425
     94#: best2pay-payment_method.php:417
    9395msgid "Payment completed."
    9496msgstr "Платеж завершен."
    9597
    96 #: best2pay-payment_method.php:136
    97 msgid "Payment method"
    98 msgstr "Метод оплаты"
    99 
    100 #: best2pay-payment_method.php:55 best2pay-payment_method.php:86
     98#: best2pay-payment_method.php:55 best2pay-payment_method.php:85
    10199msgid ""
    102100"Payments with bank cards via the <a href=\"http://www.best2pay.net\" "
     
    106104"href=\"http://www.best2pay.net\" target=\"_blank\">Best2Pay</a>."
    107105
    108 #: best2pay-payment_method.php:130
     106#: best2pay-payment_method.php:129
    109107msgid "Production mode - payments will be processed"
    110108msgstr "Рабочий режим - средства списываются с карты"
     
    118116"помощью системы Best2Pay"
    119117
    120 #: best2pay-payment_method.php:112
     118#: best2pay-payment_method.php:111
    121119msgid "Sector ID"
    122120msgstr "ID сектора"
    123121
    124 #: best2pay-payment_method.php:132
     122#: best2pay-payment_method.php:131
    125123msgid "Select test or live mode"
    126124msgstr "Выберите тестовый или рабочий режим"
    127125
    128 #: best2pay-payment_method.php:126
     126#: best2pay-payment_method.php:125
    129127msgid "Test Mode"
    130128msgstr "Тестовый режим"
    131129
    132 #: best2pay-payment_method.php:129
     130#: best2pay-payment_method.php:128
    133131msgid "Test mode - real payments will not be processed"
    134132msgstr "Тестовый режим - средства не списываются с карты"
    135133
    136 #: best2pay-payment_method.php:143
     134#: best2pay-payment_method.php:140
    137135msgid ""
    138 "The module works only for paying for Halva Chastyami or only SPB(QR) or "
    139 "Payform(cards and other avaible methods)"
     136"The module works only for paying for Halva Parts, other payment methods are "
     137"disabled"
    140138msgstr ""
    141 "Модуль работает только для оплаты Халва Частями или СБП(QR) или форма "
    142 платы(интернет-эквайринг и другие доступные способы)"
     139"Модуль работает только на оплату Халвой Частями, иные способы оплаты "
     140тключены"
    143141
    144 #: best2pay-payment_method.php:353
     142#: best2pay-payment_method.php:348
    145143msgid "The order wasn't paid [1]: "
    146144msgstr "Заказ не был оплачен: "
    147145
    148 #: best2pay-payment_method.php:386
     146#: best2pay-payment_method.php:381
    149147msgid "The order wasn't paid [2]: "
    150148msgstr "Заказ не был оплачен: "
    151149
    152 #: best2pay-payment_method.php:286 best2pay-payment_method.php:288
     150#: best2pay-payment_method.php:281 best2pay-payment_method.php:283
    153151msgid "The order wasn't paid."
    154152msgstr "Заказ не был оплачен."
    155153
    156 #: best2pay-payment_method.php:152
     154#: best2pay-payment_method.php:149
    157155msgid "Turn on 2 steps mode"
    158156msgstr "Включён режим двухстадийной оплаты"
    159157
    160 #: best2pay-payment_method.php:114
     158#: best2pay-payment_method.php:138
     159msgid "Yes"
     160msgstr "Да"
     161
     162#: best2pay-payment_method.php:113
    161163msgid "Your shop identifier at Best2Pay"
    162164msgstr "Идентификатор вашего магазина в системе Best2Pay"
     165
     166#: best2pay-payment_method.php:144
     167msgid "Payment mode"
     168msgstr "Идентификатор вашего магазина в системе Best2Pay"
     169
  • best2pay-payment-method-visamastercard/readme.txt

    r2811190 r2837763  
    22Contributors: best2pay
    33Tags: e-commerce, payments, best2pay, платежные системы
    4 Tested up to: 6.0.1
     4Tested up to: 5.7.1
    55Requires at least: 4.7
    6 Requires PHP: 7.0
    7 Stable tag: 1.1.6
     6Requires PHP: 7.4
     7Stable tag: 1.2.0
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
    1010
    1111== Description ==
    12 Плагин «Best2Pay» — платежное решение для сайтов на Wordpress:
    13     • 4 встроенных способа приема платежей.
    14     • Для юридических лиц и ИП.
    15     • Быстрое поступление денег на счет компании.
    16     • Полное соответствие 54-ФЗ.
    17     • Бесплатное подключение.
    18 == Настройка плагина ==
    19 Чтобы принимать платежи через плагин, подайте заявку на подключение к Best2Pay на сайте best2pay.net. С вами свяжется сотрудник компании и выдаст доступ на подключение.
    20 == Поддержка передачи чека ==
    21     1. Настройте быструю передачу чеков в налоговую из Best2Pay согласно 54-ФЗ.
    22     2. Передавайте чеки через партнеров (облачные кассы «АТОЛ Онлайн», Orange Data, «Бизнес.ру», Kit online).
    23 == Тарифы ==
    24     • Комиссия за прием платежей — от 1%. Комиссия рассчитывается индивидуально для каждого бизнеса. Для корректной оценки тарифа необходимо предоставить информацию по виду деятельности компании, среднему чеку и оборотам в месяц.  
    25 После подключения Best2Pay доступны
    26 == 4 способа приема платежей: ==
    27     • СБП 
    28     • Банковские карты 
    29     • Яндекс Pay
    30     • Халва Частями
     12Плагин «Best2pay» – платежное решение для сайтов на WooCommerce:
     13*  включает 7 cпособов приема платежей,
     14*  подходит для юрлиц и ИП,
     15*  деньги поступают на банковский счет компании.
     16*  Соблюдение 54 ФЗ
    3117
     18Настройка плагина
     19Чтобы принимать платежи через плагин, нужно подать заявку на подключение к Best2pay на сайте https://best2pay.net и заключить договор с компанией.
     20После этого вы получите нужные настройки.
     21Поддержка передачи данных чека:
     221. Через Bes2pay вы настраивали отправку чеков в налоговую (по 54-ФЗ)
     232. Через подключённых партнёров.
    3224
    33     • Личный кабинет, в котором вы сможете видеть все операции, возвращать платежи, выставлять и отправлять счета и обратиться в службу поддержки Best2Pay (служба поддержки Best2Pay работает 24/7).
     25Тарифы
     26Подключение Bes2pay и настройка плагина – бесплатно. Комиссия за прием платежей – от 3,2%.
    3427
     28Все возможности Best2pay
     29После подключения Best2pay доступны:
     30* 12 способов приема платежей. Интернет-банки, СБП, виртуальные карты. Вы сами выбираете, какие способы нужны, и перечисляете их в договоре. Кнопки оплаты можно разместить на своем сайте или на сайте Best2pay: выберите подходящий вариант при настройке плагина.
     31* Личный кабинет на сайте Best2pay. В нем можно делать возвраты платежей, выставлять и отправлять счета, общаться с менеджерами.
    3532
    3633== Screenshots ==
Note: See TracChangeset for help on using the changeset viewer.