Skip to content

Commit

Permalink
add minutes allowed to pay
Browse files Browse the repository at this point in the history
  • Loading branch information
avsh committed Feb 20, 2019
1 parent f51765e commit 38e4f89
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 48 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,2 +1,4 @@

.DS_Store
.tags
.tags1
Binary file modified woocommerce-erip-payments.zip
Binary file not shown.
31 changes: 26 additions & 5 deletions woocommerce-erip-payments/erip-payments-plugin.php
@@ -1,5 +1,4 @@
<?php

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
Expand Down Expand Up @@ -181,6 +180,13 @@ public function init_form_fields() {
'default' => __( 'description_erip_order_pay_default', 'woocommerce-erip-payments' ),
'css' => 'max-width:80%;'
),
// сколько минут дать на оплату
'payment_valid' => array(
'title' => __( 'Payment valid (minutes)', 'woocommerce-erip-payments' ),
'type' => 'text',
'description' => __( 'The value sets a period of time within which an order must be paid', 'woocommerce-erip-payments' ),
'default' => '60'
),
//Создание счета в ЕРИП
'type_sposoba_oplati' => array(
'title' => __( 'type_invoice_create_title', 'woocommerce-erip-payments' ),
Expand Down Expand Up @@ -216,6 +222,7 @@ public function create_invoice_with_erip(&$order_sybmol_link) {
"email" => $order_sybmol_link->billing_email,
"ip" => Tools::getIp(),
"order_id" => $order_sybmol_link->get_id(),
"expired_at" => date("c", (int)$this->get_option('payment_valid') * 60 + time() + 1),
"notification_url" => $notification_url,
"tracking_id" => $order_sybmol_link->order_key,
"customer" => [
Expand All @@ -229,7 +236,7 @@ public function create_invoice_with_erip(&$order_sybmol_link) {
],
"payment_method" => [
"type" => "erip",
"account_number" => $order_sybmol_link->get_order_number(),
"account_number" => $order_sybmol_link->get_id(),
"service_no" => $this->get_option( 'erip_kod_uslugi' ),
"service_info" => [
"Оплата заказа ".$order_sybmol_link->get_order_number()
Expand Down Expand Up @@ -261,20 +268,20 @@ public function create_invoice_with_erip(&$order_sybmol_link) {
$response = curl_exec($ch);

if ($response === false) {
wc_add_notice( curl_errno($ch) . ': ' . curl_error($ch), 'error' );
$this->_add_notice( curl_errno($ch) . ': ' . curl_error($ch), 'error' );
curl_close($ch);
return false;
}
curl_close($ch);
$response = json_decode($response);

if (is_null($response) || $response === false) {
wc_add_notice( 'Ошибка обработки JSON-ответа', 'error' );
$this->_add_notice( 'Ошибка обработки JSON-ответа', 'error' );
return false;
}

if ($response->transaction->status != 'pending') {
wc_add_notice( 'Ошибка регистрации счета в ЕРИП', 'error' );
$this->_add_notice( 'Ошибка регистрации счета в ЕРИП', 'error' );
return false;
}

Expand All @@ -285,6 +292,20 @@ public function create_invoice_with_erip(&$order_sybmol_link) {
return true;
}

private function _add_notice($message) {
if (is_admin()) {
ob_start();
echo "
<div class=\"notice notice-error\">
<p>{$message}</p>
</div>
";
echo ob_get_clean();
} else {
wc_add_notice($message);
}
}

/*
Отправка сообщения с инструкцией об оплате
*/
Expand Down
Binary file not shown.
Expand Up @@ -3,8 +3,8 @@ msgstr ""
"Project-Id-Version: Woocommerce Erip Payments - WooCommerce Gateway "
"Payments\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-06-16 08:54+0300\n"
"PO-Revision-Date: 2016-06-16 09:00+0300\n"
"POT-Creation-Date: 2019-02-20 09:58+0300\n"
"PO-Revision-Date: 2019-02-20 09:58+0300\n"
"Last-Translator: NTL <sdfsdf@dfsfd.sdfsfd>\n"
"Language-Team: \n"
"Language: ru\n"
Expand All @@ -21,102 +21,102 @@ msgstr ""
"esc_attr__:1;esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;"
"esc_html_x:1,2c;comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2\n"
"X-Loco-Target-Locale: ru_RU\n"
"X-Generator: Poedit 1.8.8\n"
"X-Generator: Poedit 1.8.12\n"
"X-Poedit-SearchPath-0: ..\n"

#: ../erip-payments-plugin.php:74
#: ../erip-payments-plugin.php:29
msgid "plugin_method_title"
msgstr "ЕРИП"

#: ../erip-payments-plugin.php:77
#: ../erip-payments-plugin.php:32
msgid "plugin_method_description"
msgstr ""
"Плагин для приёма платежей через систему \"Расчёт\" (ЕРИП), используя "
"взаимодействие с арегатором bePaid."

#: ../erip-payments-plugin.php:140
#: ../erip-payments-plugin.php:97
msgid "enable_disable_payments_gateway"
msgstr "Оплата через ЕРИП"

#: ../erip-payments-plugin.php:141
#: ../erip-payments-plugin.php:98
msgid "enable_disable_payments_gateway_label"
msgstr "Разрешить"

#: ../erip-payments-plugin.php:147
#: ../erip-payments-plugin.php:104
msgid "erip_id_magazin_title"
msgstr "ID магазина"

#: ../erip-payments-plugin.php:149
#: ../erip-payments-plugin.php:106
msgid "erip_id_magazin_desk"
msgstr "Введите ID магазина в системе bePaid"

#: ../erip-payments-plugin.php:154
#: ../erip-payments-plugin.php:111
msgid "erip_API_key_title"
msgstr "Ключ магазина"

#: ../erip-payments-plugin.php:156
#: ../erip-payments-plugin.php:113
msgid "erip_API_key_desk"
msgstr "Введите ключ магазина в системе bePaid"

#: ../erip-payments-plugin.php:161
#: ../erip-payments-plugin.php:118
msgid "erip_API_domain_title"
msgstr "Домен API"

#: ../erip-payments-plugin.php:163
#: ../erip-payments-plugin.php:120
msgid "erip_API_domain_desk"
msgstr "Введите домен для доступа к API системы bePaid"

#: ../erip-payments-plugin.php:168
#: ../erip-payments-plugin.php:125
msgid "erip_kod_uslugi_title"
msgstr "Код услуги в системе ЕРИП"

#: ../erip-payments-plugin.php:170
#: ../erip-payments-plugin.php:127
msgid "erip_kod_uslugi_desk"
msgstr "Введите код услуги в системе ЕРИП, присвоенный bePaid"

#: ../erip-payments-plugin.php:175
#: ../erip-payments-plugin.php:132
msgid "erip_name_provider_uslugi_title"
msgstr "Название поставщика услуг"

#: ../erip-payments-plugin.php:177
#: ../erip-payments-plugin.php:134
msgid "erip_name_provider_uslugi_desk"
msgstr "Введите Ваше название поставщика услуг в системе ЕРИП"

#: ../erip-payments-plugin.php:182
#: ../erip-payments-plugin.php:139
msgid "info_message_in_check_title"
msgstr "Сообщение в чеке после оплаты"

#: ../erip-payments-plugin.php:184
#: ../erip-payments-plugin.php:141
msgid "info_message_in_check_desk"
msgstr "Введите сообщение, которой будет выводиться в чеке после оплаты заказа"

#: ../erip-payments-plugin.php:185
#: ../erip-payments-plugin.php:142
msgid "info_message_in_check_default"
msgstr "Спасибо за оплату"

#: ../erip-payments-plugin.php:189
#: ../erip-payments-plugin.php:146
msgid "name_sposoba_oplati_title"
msgstr "Название способа оплаты"

#: ../erip-payments-plugin.php:191
#: ../erip-payments-plugin.php:148
msgid "name_sposoba_oplati_desk"
msgstr ""
"Введите название способа оплаты, который будет отображаться у пользователя в "
"списке вариантов оплаты"

#: ../erip-payments-plugin.php:192
#: ../erip-payments-plugin.php:149
msgid "name_sposoba_oplati_default"
msgstr "Оплата через АИС \"Расчет\" (ЕРИП)"

#: ../erip-payments-plugin.php:196
#: ../erip-payments-plugin.php:153
msgid "description_sposoba_oplati_title"
msgstr "Описание способа оплаты для покупателя"

#: ../erip-payments-plugin.php:198
#: ../erip-payments-plugin.php:155
msgid "description_sposoba_oplati_desk"
msgstr "Введите описание способа оплаты для пользователя"

#: ../erip-payments-plugin.php:199
#: ../erip-payments-plugin.php:156
msgid "description_sposoba_oplati_default"
msgstr ""
"Система \"Расчет\" (ЕРИП) позволяет произвести оплату в любом удобном для "
Expand All @@ -129,29 +129,29 @@ msgstr ""
"обслуживания банков, которые оказывают услуги по приему платежей, а также "
"посредством инструментов дистанционного банковского обслуживания."

#: ../erip-payments-plugin.php:204
#: ../erip-payments-plugin.php:161
msgid "description_confiration_manual_mode_title"
msgstr "Текст-подтверждение заказа для ручного режима"

#: ../erip-payments-plugin.php:206
#: ../erip-payments-plugin.php:163
msgid "description_confiration_manual_mode_desk"
msgstr "Введите текст-подтверждение заказа для ручного режима"

#: ../erip-payments-plugin.php:207
#: ../erip-payments-plugin.php:164
msgid "description_confiration_manual_mode_default"
msgstr ""
"Спасибо за Ваш заказ. Наш менеджер свяжется с Вами для уточнения заказа и "
"сообщит номер заказа и инструкции как его оплатить в системе ЕРИП."

#: ../erip-payments-plugin.php:212
#: ../erip-payments-plugin.php:169
msgid "description_confiration_auto_mode_title"
msgstr "Текст-подтверждение заказа для автоматического режима"

#: ../erip-payments-plugin.php:214
#: ../erip-payments-plugin.php:171
msgid "description_confiration_auto_mode_desk"
msgstr "Введите текст-подтверждение заказа для автоматического режима"

#: ../erip-payments-plugin.php:215
#: ../erip-payments-plugin.php:172
msgid "description_confiration_auto_mode_default"
msgstr ""
"Спасибо за заказ.\n"
Expand All @@ -163,16 +163,16 @@ msgstr ""
"4.​ Проверить корректность информации\n"
"5.​ Совершить платеж."

#: ../erip-payments-plugin.php:220
#: ../erip-payments-plugin.php:177
msgid "description_erip_order_pay_title"
msgstr "Текст для e-mail сообщения с инструкцией об оплате"

#: ../erip-payments-plugin.php:222
#: ../erip-payments-plugin.php:179
msgid "description_erip_order_pay_desk"
msgstr ""
"Введите текст сообщения, которое Ваш покупатель получит после создания заказа"

#: ../erip-payments-plugin.php:223
#: ../erip-payments-plugin.php:180
msgid "description_erip_order_pay_default"
msgstr ""
"Здравствуйте, {{fio}}!\n"
Expand Down Expand Up @@ -200,26 +200,38 @@ msgstr ""
"\n"
"5.​ Совершить платеж."

#: ../erip-payments-plugin.php:228
#: ../erip-payments-plugin.php:185
msgid "Payment valid (minutes)"
msgstr "Оплата действительна (минуты)"

#: ../erip-payments-plugin.php:187
msgid "The value sets a period of time within which an order must be paid"
msgstr "Укажите количество минут, в течение которых заказ должен быть оплачен"

#: ../erip-payments-plugin.php:192
msgid "type_invoice_create_title"
msgstr "Создание счета в ЕРИП"

#: ../erip-payments-plugin.php:229
#: ../erip-payments-plugin.php:193
msgid "type_invoice_create_desk"
msgstr "Выберите тип создания счета для пользователя"

#: ../erip-payments-plugin.php:235
#: ../erip-payments-plugin.php:199
msgid "manual_type_create_invoice_title"
msgstr "Ручное создание счета"

#: ../erip-payments-plugin.php:236
#: ../erip-payments-plugin.php:200
msgid "auto_type_create_invoice_title"
msgstr "Автоматическое создание счета"

#: ../erip-payments-plugin.php:356
#: ../erip-payments-plugin.php:352
msgid "manual_mode_order_processing_title"
msgstr "Заказ требует уточнения остатков и обратного звонка клиенту."

#: ../erip-payments-plugin.php:380
msgid "Ожидается оплата заказа"
msgstr ""

#: ../woocommerce-erip-payments.php:44
#, php-format
msgid "Shipped <span class=\"count\">(%s)</span>"
Expand All @@ -232,6 +244,6 @@ msgstr[2] ""
msgid "settings"
msgstr "Настройки"

#: ../woocommerce-erip-payments.php:101
#: ../woocommerce-erip-payments.php:91
msgid "Ожидание оплаты"
msgstr ""
4 changes: 2 additions & 2 deletions woocommerce-erip-payments/woocommerce-erip-payments.php
Expand Up @@ -8,8 +8,8 @@
Plugin Name: WooCommerce ERIP Gateway Payments
Plugin URI: https://github.com/begateway/woocommerce-erip-payment-module
Description: Модуль оплаты для системы "Расчёт" (ЕРИП) через агрегатора bePaid.by
Version: 3.0.2
Author: Markun Vladislav
Version: 3.1.1
Author: eComCharge
Author Email: techsupport@bepaid.by
Text Domain: woocommerce-erip-payments
*/
Expand Down

0 comments on commit 38e4f89

Please sign in to comment.