Changeset 3036869
- Timestamp:
- 02/16/2024 01:42:38 PM (2 years ago)
- Location:
- paygine
- Files:
-
- 38 added
- 6 edited
-
tags/2.1.5 (added)
-
tags/2.1.5/assets (added)
-
tags/2.1.5/assets/fonts (added)
-
tags/2.1.5/assets/fonts/Montserrat-Bold.eot (added)
-
tags/2.1.5/assets/fonts/Montserrat-Bold.ttf (added)
-
tags/2.1.5/assets/fonts/Montserrat-Bold.woff (added)
-
tags/2.1.5/assets/fonts/Montserrat-Medium.eot (added)
-
tags/2.1.5/assets/fonts/Montserrat-Medium.ttf (added)
-
tags/2.1.5/assets/fonts/Montserrat-Medium.woff (added)
-
tags/2.1.5/assets/fonts/Montserrat-Regular.eot (added)
-
tags/2.1.5/assets/fonts/Montserrat-Regular.ttf (added)
-
tags/2.1.5/assets/fonts/Montserrat-Regular.woff (added)
-
tags/2.1.5/assets/fonts/Montserrat-SemiBold.eot (added)
-
tags/2.1.5/assets/fonts/Montserrat-SemiBold.ttf (added)
-
tags/2.1.5/assets/fonts/Montserrat-SemiBold.woff (added)
-
tags/2.1.5/assets/fonts/montserrat-v25-latin-regular.eot (added)
-
tags/2.1.5/assets/fonts/montserrat-v25-latin-regular.svg (added)
-
tags/2.1.5/assets/fonts/montserrat-v25-latin-regular.ttf (added)
-
tags/2.1.5/assets/fonts/montserrat-v25-latin-regular.woff (added)
-
tags/2.1.5/assets/fonts/montserrat-v25-latin-regular.woff2 (added)
-
tags/2.1.5/assets/fonts/montserrat.css (added)
-
tags/2.1.5/assets/img (added)
-
tags/2.1.5/assets/img/halva.svg (added)
-
tags/2.1.5/assets/img/halva_logo.svg (added)
-
tags/2.1.5/assets/img/paygine.png (added)
-
tags/2.1.5/assets/js (added)
-
tags/2.1.5/assets/js/scripts.js (added)
-
tags/2.1.5/halva_widget.php (added)
-
tags/2.1.5/languages (added)
-
tags/2.1.5/languages/paygine-payment_method-ru_RU.mo (added)
-
tags/2.1.5/languages/paygine-payment_method-ru_RU.po (added)
-
tags/2.1.5/languages/paygine-payment_method.pot (added)
-
tags/2.1.5/paygine-payment_method.php (added)
-
tags/2.1.5/readme.txt (added)
-
trunk/assets/img/paygine.png (modified) (previous)
-
trunk/assets/img/svkb.svg (added)
-
trunk/assets/img/svkb_logo.svg (added)
-
trunk/assets/js/admin.js (added)
-
trunk/languages/paygine-payment_method-ru_RU.mo (modified) (previous)
-
trunk/languages/paygine-payment_method-ru_RU.po (modified) (5 diffs)
-
trunk/languages/paygine-payment_method.pot (modified) (3 diffs)
-
trunk/paygine-payment_method.php (modified) (56 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/svkb_widget.php (added)
Legend:
- Unmodified
- Added
- Removed
-
paygine/trunk/languages/paygine-payment_method-ru_RU.po
r3011342 r3036869 6 6 "Report-Msgid-Bugs-To: \n" 7 7 "POT-Creation-Date: 2023-11-20T20:39:42+03:00\n" 8 "PO-Revision-Date: 202 3-11-20T20:39:42+03:00\n"8 "PO-Revision-Date: 2024-02-07T15:58:00+03:00\n" 9 9 "Last-Translator: Paygine\n" 10 10 "Language-Team: ru_RU <[email protected]>\n" … … 19 19 20 20 #. Plugin Name of the plugin 21 msgid "Paygine payment m ethod (Visa/MasterCard/MIR)"22 msgstr " Оплата с Paygine (Visa/MasterCard/МИР)"21 msgid "Paygine payment module" 22 msgstr "Модуль оплаты Paygine" 23 23 24 24 #. Plugin URI of the plugin … … 31 31 32 32 #. Author of the plugin 33 #: paygine-payment_method.php:110 34 #: paygine-payment_method.php:111 35 #: paygine-payment_method.php:855 33 #: paygine-payment_method.php:117 34 #: paygine-payment_method.php:1063 36 35 msgid "Paygine" 37 36 msgstr "Paygine" 38 37 38 #: paygine-payment_method.php:119 39 39 msgid "To accept payments through the plugin, you need to apply to connect to Paygine on the website <a href=\"%1$s\" target=\"_blank\">%1$s</a> and enter into an agreement with the company.<br/>Support email: <a href=\"mailto:%2$s\">%2$s</a>" 40 40 msgstr "" … … 42 42 "<a href=\"%1$s\" target=\"_blank\">%1$s</a> и заключить договор с компанией.<br/>Электронная почта службы поддержки: <a href=\"mailto:%2$s\">%2$s</a>" 43 43 44 #: paygine-payment_method.php:1 1245 #: paygine-payment_method.php: 85644 #: paygine-payment_method.php:137 45 #: paygine-payment_method.php:1064 46 46 msgid "Payments with bank cards via the <a href=\"%s\" target=\"_blank\">Paygine</a> payment system." 47 47 msgstr "" … … 49 49 "href=\"%s\" target=\"_blank\">Paygine</a>." 50 50 51 #: paygine-payment_method.php:1 4551 #: paygine-payment_method.php:166 52 52 msgid "Pay for your order in installments" 53 53 msgstr "Оплатите заказ частями" 54 54 55 #: paygine-payment_method.php: 15256 msgid " Pay by QR"57 msgstr " Оплата по QR"58 59 #: paygine-payment_method.php: 17755 #: paygine-payment_method.php:221 56 msgid "Remove logo" 57 msgstr "Удалить логотип" 58 59 #: paygine-payment_method.php:241 60 60 msgid "Enable/Disable" 61 61 msgstr "Включить/Выключить" 62 62 63 #: paygine-payment_method.php: 17963 #: paygine-payment_method.php:243 64 64 msgid "Enable Paygine checkout method" 65 65 msgstr "Включить использование метода платежа Paygine" 66 66 67 #: paygine-payment_method.php:184 67 #: paygine-payment_method.php:247 68 msgid "Title" 69 msgstr "Название" 70 71 #: paygine-payment_method.php:249 72 msgid "Custom title for payment type" 73 msgstr "Свое название для типа платежа" 74 75 #: paygine-payment_method.php:255 76 msgid "Description" 77 msgstr "Описание" 78 79 #: paygine-payment_method.php:257 80 msgid "Custom description for payment type" 81 msgstr "Свое описание для типа платежа" 82 83 #: paygine-payment_method.php:263 84 msgid "Logo" 85 msgstr "Логотип" 86 87 #: paygine-payment_method.php:265 88 msgid "Custom logo for payment type" 89 msgstr "Свой логотип для типа платежа" 90 91 #: paygine-payment_method.php:270 68 92 msgid "Sector ID" 69 93 msgstr "Sector ID" 70 94 71 #: paygine-payment_method.php: 18695 #: paygine-payment_method.php:272 72 96 msgid "Your shop identifier at Paygine" 73 97 msgstr "Идентификатор вашего магазина в системе Paygine" 74 98 75 #: paygine-payment_method.php: 19299 #: paygine-payment_method.php:277 76 100 msgid "Password" 77 101 msgstr "Пароль" 78 102 79 #: paygine-payment_method.php: 194103 #: paygine-payment_method.php:279 80 104 msgid "Password to use for digital signature" 81 105 msgstr "Пароль для цифровой подписи" 82 106 83 #: paygine-payment_method.php:2 00107 #: paygine-payment_method.php:284 84 108 msgid "Test Mode" 85 109 msgstr "Тестовый режим" 86 110 87 #: paygine-payment_method.php:2 03111 #: paygine-payment_method.php:287 88 112 msgid "Test mode - real payments will not be processed" 89 113 msgstr "Тестовый режим - средства с карты не списываются" 90 114 91 #: paygine-payment_method.php:2 04115 #: paygine-payment_method.php:288 92 116 msgid "Production mode - payments will be processed" 93 117 msgstr "Рабочий режим - средства списываются с карты" 94 118 95 #: paygine-payment_method.php:2 06119 #: paygine-payment_method.php:290 96 120 msgid "Select test or live mode" 97 121 msgstr "Выберите тестовый или рабочий режим" 98 122 99 #: paygine-payment_method.php:2 11123 #: paygine-payment_method.php:294 100 124 msgid "Payment method" 101 125 msgstr "Способ оплаты" 102 126 103 #: paygine-payment_method.php:2 14127 #: paygine-payment_method.php:297 104 128 msgid "Standard acquiring (one-stage payment)" 105 129 msgstr "Стандартный эквайринг (одностадийная оплата)" 106 130 107 #: paygine-payment_method.php:2 15131 #: paygine-payment_method.php:298 108 132 msgid "Standard acquiring (two-stage payment)" 109 133 msgstr "Стандартный эквайринг (двухстадийная оплата)" 110 134 111 #: paygine-payment_method.php:2 16112 msgid " Halva Chastyami(one-stage payment)"135 #: paygine-payment_method.php:299 136 msgid "Plait (one-stage payment)" 113 137 msgstr "Только Халва Частями (одностадийная оплата)" 114 138 115 #: paygine-payment_method.php: 217116 msgid " Halva Chastyami(two-stage payment)"139 #: paygine-payment_method.php:300 140 msgid "Plait (two-stage payment)" 117 141 msgstr "Только Халва Частями (двухстадийная оплата)" 118 142 119 #: paygine-payment_method.php: 218143 #: paygine-payment_method.php:301 120 144 msgid "Fast Payment System" 121 145 msgstr "Система Быстрых Платежей (СБП)" 122 146 123 #: paygine-payment_method.php: 219147 #: paygine-payment_method.php:302 124 148 msgid "Loan" 125 149 msgstr "Кредитование" 126 150 127 #: paygine-payment_method.php: 221151 #: paygine-payment_method.php:304 128 152 msgid "Payment occurs after confirmation by the manager in the personal account" 129 153 msgstr "Оплата происходит после подтверждения менеджером в ЛК" 130 154 131 #: paygine-payment_method.php: 226155 #: paygine-payment_method.php:308 132 156 msgid "TAX" 133 157 msgstr "Налог" 134 158 135 #: paygine-payment_method.php: 229159 #: paygine-payment_method.php:311 136 160 msgid "VAT rate 20%" 137 161 msgstr "ставка НДС 20%" 138 162 139 #: paygine-payment_method.php: 230163 #: paygine-payment_method.php:312 140 164 msgid "VAT rate 10%" 141 165 msgstr "ставка НДС 10%" 142 166 143 #: paygine-payment_method.php: 231167 #: paygine-payment_method.php:313 144 168 msgid "VAT rate calc. 20/120" 145 169 msgstr "ставка НДС расч. 20/120" 146 170 147 #: paygine-payment_method.php: 232171 #: paygine-payment_method.php:314 148 172 msgid "VAT rate calc. 10/110" 149 173 msgstr "ставка НДС расч. 10/110" 150 174 151 #: paygine-payment_method.php: 233175 #: paygine-payment_method.php:315 152 176 msgid "VAT rate 0%" 153 177 msgstr "ставка НДС 0%" 154 178 155 #: paygine-payment_method.php: 234179 #: paygine-payment_method.php:316 156 180 msgid "Not subject to VAT" 157 181 msgstr "НДС не облагается" 158 182 159 #: paygine-payment_method.php: 240183 #: paygine-payment_method.php:321 160 184 msgid "Notify URL" 161 185 msgstr "URL для уведомлений" 162 186 163 #: paygine-payment_method.php: 242187 #: paygine-payment_method.php:323 164 188 msgid "Report this URL to Paygine technical support to receive payment notifications" 165 189 msgstr "Сообщите в службу технической поддержки Paygine этот URL для получения уведомлений о платеже" 166 190 167 #: paygine-payment_method.php: 251191 #: paygine-payment_method.php:331 168 192 msgid "Data encryption algorithm" 169 193 msgstr "Алгоритм шифрования данных" 170 194 171 #: paygine-payment_method.php: 257195 #: paygine-payment_method.php:337 172 196 msgid "Must match your sector encryption settings in your personal account" 173 197 msgstr "Должен соответствовать настройкам шифрования вашего сектора в личном кабинете" 174 198 175 #: paygine-payment_method.php: 263199 #: paygine-payment_method.php:342 176 200 msgid "Custom statuses for orders" 177 201 msgstr "Настраиваемые статусы для заказов" 178 202 179 #: paygine-payment_method.php: 269203 #: paygine-payment_method.php:346 180 204 msgid "Order registered" 181 205 msgstr "Заказ зарегистрирован" 182 206 183 #: paygine-payment_method.php: 274207 #: paygine-payment_method.php:351 184 208 msgid "Order authorized" 185 209 msgstr "Средства захолдированы" 186 210 187 #: paygine-payment_method.php: 279211 #: paygine-payment_method.php:356 188 212 msgid "Loan agreement approved but not signed" 189 213 msgstr "Кредитный договор одобрен, но не подписан" 190 214 191 #: paygine-payment_method.php: 284215 #: paygine-payment_method.php:361 192 216 msgid "Order successfully paid" 193 217 msgstr "Заказ успешно оплачен" 194 218 195 #: paygine-payment_method.php: 289219 #: paygine-payment_method.php:366 196 220 msgid "Order canceled" 197 221 msgstr "Платеж отменен" 198 222 199 #: paygine-payment_method.php:317 223 #: paygine-payment_method.php:371 224 msgid "Issuing an invoice for payment" 225 msgstr "Выставление счёта на оплату" 226 227 #: paygine-payment_method.php:373 228 msgid "Enable issuing an invoice for payment by email of the payer" 229 msgstr "Включить выставление счёта на оплату на email плательщика" 230 231 #: paygine-payment_method.php:377 232 msgid "Order agreement" 233 msgstr "Заказ на согласовании" 234 235 #: paygine-payment_method.php:383 236 msgid "Payment expected" 237 msgstr "Ожидается оплата" 238 239 #: paygine-payment_method.php:409 200 240 msgid "Order #%s" 201 241 msgstr "Заказ №%s" 202 242 203 #: paygine-payment_method.php: 333243 #: paygine-payment_method.php:431 204 244 msgid "Failed to register order" 205 245 msgstr "Не удалось зарегистрировать заказ" 206 246 207 #: paygine-payment_method.php: 345247 #: paygine-payment_method.php:444 208 248 msgid "Order registered successfully" 209 249 msgstr "Заказ успешно зарегистрирован" 210 250 211 #: paygine-payment_method.php:378 212 #: paygine-payment_method.php:545 213 msgid "Failed to get Best2pay order ID" 214 msgstr "Не удалось получить ID заказа Best2pay" 215 216 #: paygine-payment_method.php:381 217 msgid "Failed to get Best2pay operation ID" 218 msgstr "Не удалось получить ID операции Best2pay" 219 220 #: paygine-payment_method.php:384 221 #: paygine-payment_method.php:452 222 #: paygine-payment_method.php:539 251 #: paygine-payment_method.php:520 252 msgid "Order successfully create" 253 msgstr "Заказ успешно создан" 254 255 #: paygine-payment_method.php:559 256 #: paygine-payment_method.php:741 257 msgid "Failed to get Paygine order ID" 258 msgstr "Не удалось получить ID заказа Paygine" 259 260 #: paygine-payment_method.php:563 261 msgid "Failed to get Paygine operation ID" 262 msgstr "Не удалось получить ID операции Paygine" 263 264 #: paygine-payment_method.php:567 265 #: paygine-payment_method.php:647 266 #: paygine-payment_method.php:733 223 267 msgid "Undefined order ID" 224 268 msgstr "Неопределенный ID заказа" 225 269 226 #: paygine-payment_method.php: 387227 #: paygine-payment_method.php: 455228 #: paygine-payment_method.php: 542270 #: paygine-payment_method.php:571 271 #: paygine-payment_method.php:651 272 #: paygine-payment_method.php:737 229 273 msgid "Failed to get order information" 230 274 msgstr "Не удалось получить информацию о заказе" 231 275 232 #: paygine-payment_method.php:400 276 #: paygine-payment_method.php:575 277 msgid "Request data is not valid" 278 msgstr "Данные запроса не валидны" 279 280 #: paygine-payment_method.php:588 233 281 msgid "Could not find operation" 234 282 msgstr "Не удалось найти операцию" 235 283 236 #: paygine-payment_method.php: 409284 #: paygine-payment_method.php:599 237 285 msgid "Failed to pay for the order" 238 286 msgstr "Не удалось оплатить заказ" 239 287 240 #: paygine-payment_method.php: 431288 #: paygine-payment_method.php:623 241 289 msgid "Payment completed successfully" 242 290 msgstr "Платеж успешно завершен" 243 291 244 #: paygine-payment_method.php: 461292 #: paygine-payment_method.php:655 245 293 msgid "The order has already been %s" 246 294 msgstr "Заказ уже %s" 247 295 248 #: paygine-payment_method.php: 474296 #: paygine-payment_method.php:667 249 297 msgid "Failed to complete request for operation %s from the processing center" 250 298 msgstr "Не удалось выполнить запрос операции %s от процессингового центра" 251 299 252 #: paygine-payment_method.php: 493300 #: paygine-payment_method.php:687 253 301 msgid "Request for operation %s from the processing center was completed successfully" 254 302 msgstr "Запрос операции %s от процессингового центра выполнен успешно" 255 303 256 #: paygine-payment_method.php: 535304 #: paygine-payment_method.php:729 257 305 msgid "Operation failed. Please refresh the page" 258 306 msgstr "Не удалось выполнить операцию. Обновите страницу" 259 307 260 #: paygine-payment_method.php: 552308 #: paygine-payment_method.php:747 261 309 msgid "Failed to get operation request path" 262 310 msgstr "Не удалось получить путь запроса операции" 263 311 264 #: paygine-payment_method.php: 556312 #: paygine-payment_method.php:751 265 313 msgid "For orders with AUTHORIZED status, only full refunds are available" 266 314 msgstr "Для заказов со статусом AUTHORIZED возможен только полный возврат средств" 267 315 268 #: paygine-payment_method.php: 577316 #: paygine-payment_method.php:775 269 317 msgid "Operation type and action type are not equal" 270 318 msgstr "Тип операции и тип действия не совпадают" 271 319 272 #: paygine-payment_method.php: 616320 #: paygine-payment_method.php:817 273 321 msgid "Complete payment" 274 322 msgstr "Списать средства" 275 323 276 #: paygine-payment_method.php: 674324 #: paygine-payment_method.php:873 277 325 msgid "Missing PC order ID" 278 326 msgstr "Отсутствует ID заказа Пц" 279 327 280 #: paygine-payment_method.php: 687328 #: paygine-payment_method.php:888 281 329 msgid "There are no operations in the order" 282 330 msgstr "Операции заказа не найдены" 283 331 284 #: paygine-payment_method.php: 719285 #: paygine-payment_method.php: 735332 #: paygine-payment_method.php:923 333 #: paygine-payment_method.php:942 286 334 msgid "Signature is missing" 287 335 msgstr "Отсутствует подпись" 288 336 289 #: paygine-payment_method.php: 723290 #: paygine-payment_method.php: 739337 #: paygine-payment_method.php:928 338 #: paygine-payment_method.php:947 291 339 msgid "Invalid signature" 292 340 msgstr "Неверная подпись" 293 341 294 #: paygine-payment_method.php: 725295 #: paygine-payment_method.php: 746342 #: paygine-payment_method.php:931 343 #: paygine-payment_method.php:955 296 344 msgid "Unknown operation type" 297 345 msgstr "Неизвестный тип операции" 298 346 299 #: paygine-payment_method.php: 727300 #: paygine-payment_method.php: 748347 #: paygine-payment_method.php:934 348 #: paygine-payment_method.php:958 301 349 msgid "Operation not approved" 302 350 msgstr "Операция не одобрена" 303 351 304 #: paygine-payment_method.php: 744352 #: paygine-payment_method.php:952 305 353 msgid "An error occurred during the operation" 306 354 msgstr "Во время операции произошла ошибка" 307 355 308 #: paygine-payment_method.php: 750356 #: paygine-payment_method.php:961 309 357 msgid "Unknown payment operation type" 310 358 msgstr "Неизвестный тип платежной операции" 311 359 312 #: paygine-payment_method.php: 774360 #: paygine-payment_method.php:985 313 361 msgid "Invalid operation amount" 314 362 msgstr "Неверная сумма операции" 315 363 316 #: paygine-payment_method.php: 806364 #: paygine-payment_method.php:1017 317 365 msgid "Funds for the order have been successfully debited" 318 366 msgstr "Средства за заказ успешно списаны" 319 367 320 #: paygine-payment_method.php: 807368 #: paygine-payment_method.php:1018 321 369 msgid "Failed to complete payment" 322 370 msgstr "Не удалось завершить платеж" 323 371 324 #: paygine-payment_method.php: 810372 #: paygine-payment_method.php:1021 325 373 msgid "Payment refunded successfully" 326 374 msgstr "Платеж успешно возвращен" 327 375 328 #: paygine-payment_method.php: 811376 #: paygine-payment_method.php:1022 329 377 msgid "Failed to refund payment" 330 378 msgstr "Не удалось вернуть платеж" 331 379 332 #: paygine-payment_method.php: 935380 #: paygine-payment_method.php:1138 333 381 msgid "Server response is empty" 334 382 msgstr "Ответ сервера пуст" 335 383 336 #: paygine-payment_method.php: 938384 #: paygine-payment_method.php:1142 337 385 msgid "Invalid XML from response" 338 386 msgstr "Неверный XML в ответе" 339 387 340 #: paygine-payment_method.php: 941388 #: paygine-payment_method.php:1146 341 389 msgid "Unable to decode xml" 342 390 msgstr "Невозможно декодировать XML" 343 391 344 #: paygine-payment_method.php: 991392 #: paygine-payment_method.php:1197 345 393 msgid "Settings" 346 394 msgstr "Настройки" -
paygine/trunk/languages/paygine-payment_method.pot
r3011342 r3036869 1 # Copyright (C) 202 3Paygine1 # Copyright (C) 2024 Paygine 2 2 # This file is distributed under the GPL3. 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Paygine payment m ethod (Visa/MasterCard/MIR) 2.1.5\n"6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/ paygine\n"5 "Project-Id-Version: Paygine payment module 2.2\n" 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/trunk\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 8 8 "Language-Team: LANGUAGE <[email protected]>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 202 3-11-20T20:39:42+03:00\n"12 "POT-Creation-Date: 2024-02-07T15:58:00+03:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 "X-Generator: WP-CLI 2. 8.1\n"14 "X-Generator: WP-CLI 2.9.0\n" 15 15 "X-Domain: paygine-payment_method\n" 16 16 17 17 #. Plugin Name of the plugin 18 msgid "Paygine payment m ethod (Visa/MasterCard/MIR)"18 msgid "Paygine payment module" 19 19 msgstr "" 20 20 21 21 #. Plugin URI of the plugin 22 msgid "http ://paygine.ru/"22 msgid "https://paygine.ru/" 23 23 msgstr "" 24 24 … … 28 28 29 29 #. Author of the plugin 30 #: paygine-payment_method.php:110 31 #: paygine-payment_method.php:111 32 #: paygine-payment_method.php:855 30 #: paygine-payment_method.php:117 31 #: paygine-payment_method.php:1063 33 32 msgid "Paygine" 34 33 msgstr "" 35 34 36 #: paygine-payment_method.php:112 37 #: paygine-payment_method.php:856 35 #: paygine-payment_method.php:119 36 msgid "To accept payments through the plugin, you need to apply to connect to Paygine on the website <a href=\"%1$s\" target=\"_blank\">%1$s</a> and enter into an agreement with the company.<br/>Support email: <a href=\"mailto:%2$s\">%2$s</a>" 37 msgstr "" 38 39 #: paygine-payment_method.php:137 40 #: paygine-payment_method.php:1064 38 41 msgid "Payments with bank cards via the <a href=\"%s\" target=\"_blank\">Paygine</a> payment system." 39 42 msgstr "" 40 43 41 #: paygine-payment_method.php:1 4544 #: paygine-payment_method.php:166 42 45 msgid "Pay for your order in installments" 43 46 msgstr "" 44 47 45 #: paygine-payment_method.php: 15246 msgid " Pay by QR"47 msgstr "" 48 49 #: paygine-payment_method.php: 17748 #: paygine-payment_method.php:221 49 msgid "Remove logo" 50 msgstr "" 51 52 #: paygine-payment_method.php:241 50 53 msgid "Enable/Disable" 51 54 msgstr "" 52 55 53 #: paygine-payment_method.php: 17956 #: paygine-payment_method.php:243 54 57 msgid "Enable Paygine checkout method" 55 58 msgstr "" 56 59 57 #: paygine-payment_method.php:184 60 #: paygine-payment_method.php:247 61 msgid "Title" 62 msgstr "" 63 64 #: paygine-payment_method.php:249 65 msgid "Custom title for payment type" 66 msgstr "" 67 68 #: paygine-payment_method.php:255 69 msgid "Description" 70 msgstr "" 71 72 #: paygine-payment_method.php:257 73 msgid "Custom description for payment type" 74 msgstr "" 75 76 #: paygine-payment_method.php:263 77 msgid "Logo" 78 msgstr "" 79 80 #: paygine-payment_method.php:265 81 msgid "Custom logo for payment type" 82 msgstr "" 83 84 #: paygine-payment_method.php:270 58 85 msgid "Sector ID" 59 86 msgstr "" 60 87 61 #: paygine-payment_method.php: 18688 #: paygine-payment_method.php:272 62 89 msgid "Your shop identifier at Paygine" 63 90 msgstr "" 64 91 65 #: paygine-payment_method.php: 19292 #: paygine-payment_method.php:277 66 93 msgid "Password" 67 94 msgstr "" 68 95 69 #: paygine-payment_method.php: 19496 #: paygine-payment_method.php:279 70 97 msgid "Password to use for digital signature" 71 98 msgstr "" 72 99 73 #: paygine-payment_method.php:2 00100 #: paygine-payment_method.php:284 74 101 msgid "Test Mode" 75 102 msgstr "" 76 103 77 #: paygine-payment_method.php:2 03104 #: paygine-payment_method.php:287 78 105 msgid "Test mode - real payments will not be processed" 79 106 msgstr "" 80 107 81 #: paygine-payment_method.php:2 04108 #: paygine-payment_method.php:288 82 109 msgid "Production mode - payments will be processed" 83 110 msgstr "" 84 111 85 #: paygine-payment_method.php:2 06112 #: paygine-payment_method.php:290 86 113 msgid "Select test or live mode" 87 114 msgstr "" 88 115 89 #: paygine-payment_method.php:2 11116 #: paygine-payment_method.php:294 90 117 msgid "Payment method" 91 118 msgstr "" 92 119 93 #: paygine-payment_method.php:2 14120 #: paygine-payment_method.php:297 94 121 msgid "Standard acquiring (one-stage payment)" 95 122 msgstr "" 96 123 97 #: paygine-payment_method.php:2 15124 #: paygine-payment_method.php:298 98 125 msgid "Standard acquiring (two-stage payment)" 99 126 msgstr "" 100 127 101 #: paygine-payment_method.php:2 16102 msgid " Halva Chastyami(one-stage payment)"103 msgstr "" 104 105 #: paygine-payment_method.php: 217106 msgid " Halva Chastyami(two-stage payment)"107 msgstr "" 108 109 #: paygine-payment_method.php: 218128 #: paygine-payment_method.php:299 129 msgid "Plait (one-stage payment)" 130 msgstr "" 131 132 #: paygine-payment_method.php:300 133 msgid "Plait (two-stage payment)" 134 msgstr "" 135 136 #: paygine-payment_method.php:301 110 137 msgid "Fast Payment System" 111 138 msgstr "" 112 139 113 #: paygine-payment_method.php: 219140 #: paygine-payment_method.php:302 114 141 msgid "Loan" 115 142 msgstr "" 116 143 117 #: paygine-payment_method.php: 221144 #: paygine-payment_method.php:304 118 145 msgid "Payment occurs after confirmation by the manager in the personal account" 119 146 msgstr "" 120 147 121 #: paygine-payment_method.php: 226148 #: paygine-payment_method.php:308 122 149 msgid "TAX" 123 150 msgstr "" 124 151 125 #: paygine-payment_method.php: 229152 #: paygine-payment_method.php:311 126 153 msgid "VAT rate 20%" 127 154 msgstr "" 128 155 129 #: paygine-payment_method.php: 230156 #: paygine-payment_method.php:312 130 157 msgid "VAT rate 10%" 131 158 msgstr "" 132 159 133 #: paygine-payment_method.php: 231160 #: paygine-payment_method.php:313 134 161 msgid "VAT rate calc. 20/120" 135 162 msgstr "" 136 163 137 #: paygine-payment_method.php: 232164 #: paygine-payment_method.php:314 138 165 msgid "VAT rate calc. 10/110" 139 166 msgstr "" 140 167 141 #: paygine-payment_method.php: 233168 #: paygine-payment_method.php:315 142 169 msgid "VAT rate 0%" 143 170 msgstr "" 144 171 145 #: paygine-payment_method.php: 234172 #: paygine-payment_method.php:316 146 173 msgid "Not subject to VAT" 147 174 msgstr "" 148 175 149 #: paygine-payment_method.php: 240176 #: paygine-payment_method.php:321 150 177 msgid "Notify URL" 151 178 msgstr "" 152 179 153 #: paygine-payment_method.php: 242180 #: paygine-payment_method.php:323 154 181 msgid "Report this URL to Paygine technical support to receive payment notifications" 155 182 msgstr "" 156 183 157 #: paygine-payment_method.php: 251184 #: paygine-payment_method.php:331 158 185 msgid "Data encryption algorithm" 159 186 msgstr "" 160 187 161 #: paygine-payment_method.php: 257188 #: paygine-payment_method.php:337 162 189 msgid "Must match your sector encryption settings in your personal account" 163 190 msgstr "" 164 191 165 #: paygine-payment_method.php: 263192 #: paygine-payment_method.php:342 166 193 msgid "Custom statuses for orders" 167 194 msgstr "" 168 195 169 #: paygine-payment_method.php: 269196 #: paygine-payment_method.php:346 170 197 msgid "Order registered" 171 198 msgstr "" 172 199 173 #: paygine-payment_method.php: 274200 #: paygine-payment_method.php:351 174 201 msgid "Order authorized" 175 202 msgstr "" 176 203 177 #: paygine-payment_method.php: 279204 #: paygine-payment_method.php:356 178 205 msgid "Loan agreement approved but not signed" 179 206 msgstr "" 180 207 181 #: paygine-payment_method.php: 284208 #: paygine-payment_method.php:361 182 209 msgid "Order successfully paid" 183 210 msgstr "" 184 211 185 #: paygine-payment_method.php: 289212 #: paygine-payment_method.php:366 186 213 msgid "Order canceled" 187 214 msgstr "" 188 215 189 #: paygine-payment_method.php:317 216 #: paygine-payment_method.php:371 217 msgid "Issuing an invoice for payment" 218 msgstr "" 219 220 #: paygine-payment_method.php:373 221 msgid "Enable issuing an invoice for payment by email of the payer" 222 msgstr "" 223 224 #: paygine-payment_method.php:377 225 msgid "Order agreement" 226 msgstr "" 227 228 #: paygine-payment_method.php:383 229 msgid "Payment expected" 230 msgstr "" 231 232 #: paygine-payment_method.php:409 190 233 msgid "Order #%s" 191 234 msgstr "" 192 235 193 #: paygine-payment_method.php: 333236 #: paygine-payment_method.php:431 194 237 msgid "Failed to register order" 195 238 msgstr "" 196 239 197 #: paygine-payment_method.php: 345240 #: paygine-payment_method.php:444 198 241 msgid "Order registered successfully" 199 242 msgstr "" 200 243 201 #: paygine-payment_method.php:378 202 #: paygine-payment_method.php:545 203 msgid "Failed to get Best2pay order ID" 204 msgstr "" 205 206 #: paygine-payment_method.php:381 207 msgid "Failed to get Best2pay operation ID" 208 msgstr "" 209 210 #: paygine-payment_method.php:384 211 #: paygine-payment_method.php:452 212 #: paygine-payment_method.php:539 244 #: paygine-payment_method.php:520 245 msgid "Order successfully create" 246 msgstr "" 247 248 #: paygine-payment_method.php:559 249 #: paygine-payment_method.php:741 250 msgid "Failed to get Paygine order ID" 251 msgstr "" 252 253 #: paygine-payment_method.php:563 254 msgid "Failed to get Paygine operation ID" 255 msgstr "" 256 257 #: paygine-payment_method.php:567 258 #: paygine-payment_method.php:647 259 #: paygine-payment_method.php:733 213 260 msgid "Undefined order ID" 214 261 msgstr "" 215 262 216 #: paygine-payment_method.php: 387217 #: paygine-payment_method.php: 455218 #: paygine-payment_method.php: 542263 #: paygine-payment_method.php:571 264 #: paygine-payment_method.php:651 265 #: paygine-payment_method.php:737 219 266 msgid "Failed to get order information" 220 267 msgstr "" 221 268 222 #: paygine-payment_method.php:400 269 #: paygine-payment_method.php:575 270 msgid "Request data is not valid" 271 msgstr "" 272 273 #: paygine-payment_method.php:588 223 274 msgid "Could not find operation" 224 275 msgstr "" 225 276 226 #: paygine-payment_method.php: 409277 #: paygine-payment_method.php:599 227 278 msgid "Failed to pay for the order" 228 279 msgstr "" 229 280 230 #: paygine-payment_method.php: 431281 #: paygine-payment_method.php:623 231 282 msgid "Payment completed successfully" 232 283 msgstr "" 233 284 234 #: paygine-payment_method.php: 461285 #: paygine-payment_method.php:655 235 286 msgid "The order has already been %s" 236 287 msgstr "" 237 288 238 #: paygine-payment_method.php: 474289 #: paygine-payment_method.php:667 239 290 msgid "Failed to complete request for operation %s from the processing center" 240 291 msgstr "" 241 292 242 #: paygine-payment_method.php: 493293 #: paygine-payment_method.php:687 243 294 msgid "Request for operation %s from the processing center was completed successfully" 244 295 msgstr "" 245 296 246 #: paygine-payment_method.php: 535297 #: paygine-payment_method.php:729 247 298 msgid "Operation failed. Please refresh the page" 248 299 msgstr "" 249 300 250 #: paygine-payment_method.php: 552301 #: paygine-payment_method.php:747 251 302 msgid "Failed to get operation request path" 252 303 msgstr "" 253 304 254 #: paygine-payment_method.php: 556305 #: paygine-payment_method.php:751 255 306 msgid "For orders with AUTHORIZED status, only full refunds are available" 256 307 msgstr "" 257 308 258 #: paygine-payment_method.php: 577309 #: paygine-payment_method.php:775 259 310 msgid "Operation type and action type are not equal" 260 311 msgstr "" 261 312 262 #: paygine-payment_method.php: 616313 #: paygine-payment_method.php:817 263 314 msgid "Complete payment" 264 315 msgstr "" 265 316 266 #: paygine-payment_method.php: 674317 #: paygine-payment_method.php:873 267 318 msgid "Missing PC order ID" 268 319 msgstr "" 269 320 270 #: paygine-payment_method.php: 687321 #: paygine-payment_method.php:888 271 322 msgid "There are no operations in the order" 272 323 msgstr "" 273 324 274 #: paygine-payment_method.php: 719275 #: paygine-payment_method.php: 735325 #: paygine-payment_method.php:923 326 #: paygine-payment_method.php:942 276 327 msgid "Signature is missing" 277 328 msgstr "" 278 329 279 #: paygine-payment_method.php: 723280 #: paygine-payment_method.php: 739330 #: paygine-payment_method.php:928 331 #: paygine-payment_method.php:947 281 332 msgid "Invalid signature" 282 333 msgstr "" 283 334 284 #: paygine-payment_method.php: 725285 #: paygine-payment_method.php: 746335 #: paygine-payment_method.php:931 336 #: paygine-payment_method.php:955 286 337 msgid "Unknown operation type" 287 338 msgstr "" 288 339 289 #: paygine-payment_method.php: 727290 #: paygine-payment_method.php: 748340 #: paygine-payment_method.php:934 341 #: paygine-payment_method.php:958 291 342 msgid "Operation not approved" 292 343 msgstr "" 293 344 294 #: paygine-payment_method.php: 744345 #: paygine-payment_method.php:952 295 346 msgid "An error occurred during the operation" 296 347 msgstr "" 297 348 298 #: paygine-payment_method.php: 750349 #: paygine-payment_method.php:961 299 350 msgid "Unknown payment operation type" 300 351 msgstr "" 301 352 302 #: paygine-payment_method.php: 774353 #: paygine-payment_method.php:985 303 354 msgid "Invalid operation amount" 304 355 msgstr "" 305 356 306 #: paygine-payment_method.php: 806357 #: paygine-payment_method.php:1017 307 358 msgid "Funds for the order have been successfully debited" 308 359 msgstr "" 309 360 310 #: paygine-payment_method.php: 807361 #: paygine-payment_method.php:1018 311 362 msgid "Failed to complete payment" 312 363 msgstr "" 313 364 314 #: paygine-payment_method.php: 810365 #: paygine-payment_method.php:1021 315 366 msgid "Payment refunded successfully" 316 367 msgstr "" 317 368 318 #: paygine-payment_method.php: 811369 #: paygine-payment_method.php:1022 319 370 msgid "Failed to refund payment" 320 371 msgstr "" 321 372 322 #: paygine-payment_method.php: 935373 #: paygine-payment_method.php:1138 323 374 msgid "Server response is empty" 324 375 msgstr "" 325 376 326 #: paygine-payment_method.php: 938377 #: paygine-payment_method.php:1142 327 378 msgid "Invalid XML from response" 328 379 msgstr "" 329 380 330 #: paygine-payment_method.php: 941381 #: paygine-payment_method.php:1146 331 382 msgid "Unable to decode xml" 332 383 msgstr "" 333 384 334 #: paygine-payment_method.php: 991385 #: paygine-payment_method.php:1197 335 386 msgid "Settings" 336 387 msgstr "" -
paygine/trunk/paygine-payment_method.php
r3011342 r3036869 1 1 <?php 2 2 declare(strict_types=1); 3 4 3 5 4 /* … … 17 16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 17 */ 18 19 19 /** 20 * Plugin Name: Paygine payment m ethod (Visa/MasterCard/MIR)20 * Plugin Name: Paygine payment module 21 21 * Plugin URI: https://paygine.ru/ 22 22 * Description: Receive payments via Visa/Mastercard/MIR easily with Paygine bank cards processing 23 * Version: 2. 1.523 * Version: 2.2.0 24 24 * Author: Paygine 25 * Tested up to: 6. 3.225 * Tested up to: 6.4.3 26 26 * License: GPL3 27 27 * … … 35 35 add_action('plugins_loaded', 'init_woocommerce_paygine', 0); 36 36 37 function init_woocommerce_paygine() 38 { 39 if(!class_exists('WC_Payment_Gateway')){ 37 function init_woocommerce_paygine() { 38 if(!class_exists('WC_Payment_Gateway')) { 40 39 return; 41 40 } 42 41 43 42 load_plugin_textdomain('paygine-payment_method', false, dirname(plugin_basename(__FILE__)) . '/languages'); 44 45 class woocommerce_paygine extends WC_Payment_Gateway 46 { 43 44 class woocommerce_paygine extends WC_Payment_Gateway { 47 45 const PLUGIN_SITE = 'https://paygine.ru'; 48 46 const SHOP_CART_MAX_LENGTH = 1000; … … 55 53 'loan' => '/webapi/custom/unicheckout/PurchaseWithLoanManager' 56 54 ]; 57 55 58 56 const OLD_TO_NEW_PAYMENT_METHODS = [ 59 57 'Purchase' => 'acquiring', … … 63 61 'PurchaseSBP' => 'sbp' 64 62 ]; 63 65 64 private const OPERATION_TYPES = [ 66 65 'PURCHASE', … … 70 69 'COMPLETE' 71 70 ]; 71 72 72 private const PAID_OPERATION_TYPES = [ 73 73 'PURCHASE', 74 74 'PURCHASE_BY_QR', 75 'AUTHORIZE' ,75 'AUTHORIZE' 76 76 ]; 77 77 78 private const OPERATION_APPROVED = 'APPROVED'; 78 79 private const OPERATION_COMPLETE = 'COMPLETE'; … … 90 91 protected string $testmode; 91 92 protected string $hash_algo; 93 protected string $notify_customer_enabled; 92 94 protected string $registered_status; 93 95 protected string $authorized_status; 94 96 protected string $loan_status; 95 97 protected string $completed_status; 98 protected string $agreement_status; 99 protected string $payment_expected_status; 96 100 protected string $canceled_status; 97 101 protected string $payment_method; … … 101 105 protected string $fiscal_positions; 102 106 protected array $shop_cart; 107 protected string $logo_field; 108 protected string $remove_logo_field; 103 109 /** 104 110 * Init fields, set settings, register hooks 105 111 */ 106 public function __construct() 107 { 112 public function __construct() { 108 113 require_once ABSPATH . 'wp-admin/includes/file.php'; 114 109 115 // plugin settings 110 116 $this->id = 'paygine'; … … 115 121 '[email protected]' 116 122 ); 117 $this->title = __('Paygine', 'paygine-payment_method');118 $this->description = sprintf(119 __('Payments with bank cards via the <a href="%s" target="_blank">Paygine</a> payment system.', 'paygine-payment_method'),120 self::PLUGIN_SITE121 );122 123 $this->icon = plugins_url('assets/img/paygine.png', __FILE__); 123 124 $this->has_fields = true; 124 125 $this->notify_url = add_query_arg('wc-api', 'paygine_notify', home_url('/')); 125 126 $this->callback_url = add_query_arg('wc-api', 'paygine', home_url('/')); 126 127 127 128 // means that the gateway accept refunds 128 129 $this->supports = array('refunds', 'products'); 129 130 130 131 $this->init_form_fields(); 131 132 $this->init_settings(); 132 133 133 134 // variables 135 $this->title = !empty($this->settings['title']) ? $this->settings['title'] : $this->method_title; 136 $this->description = !empty($this->settings['description']) ? $this->settings['description'] : sprintf( 137 __('Payments with bank cards via the <a href="%s" target="_blank">Paygine</a> payment system.', 'paygine-payment_method'), 138 self::PLUGIN_SITE 139 ); 140 $this->logo = $this->settings['logo'] ?? ''; 134 141 $this->sector = $this->settings['sector']; 135 142 $this->password = $this->settings['password']; … … 137 144 $this->payment_method = $this->settings['payment_method'] ?? ''; 138 145 $this->tax = $this->settings['tax'] ?? '6'; 139 $this->hash_algo = $this->settings['hash_algo'] ?? 'md5'; 140 146 $this->hash_algo = !empty($this->settings['hash_algo']) ? $this->settings['hash_algo'] : 'md5'; 147 $this->notify_customer_enabled = $this->settings['notify_customer_enabled'] ?? ''; 148 141 149 //statuses 142 150 $this->registered_status = $this->settings['registered_status'] ?? ''; … … 145 153 $this->completed_status = $this->settings['completed_status'] ?? ''; 146 154 $this->canceled_status = $this->settings['canceled_status'] ?? ''; 147 155 $this->agreement_status = $this->settings['agreement_status'] ?? ''; 156 $this->payment_expected_status = $this->settings['payment_expected_status'] ?? ''; 157 148 158 $this->currency = $this->get_currency(get_woocommerce_currency()); 149 159 $this->url = $this->paygine_get_url(); 150 160 $this->logo_field = $this->plugin_id . $this->id . '_logo'; 161 $this->remove_logo_field = $this->plugin_id . $this->id . '_remove_logo'; 162 151 163 switch($this->payment_method) { 152 164 case 'halva': 153 165 case 'halva_two_steps': 154 $this->title = __('Pay for your order in installments', 'paygine-payment_method'); //'Оплатить заказ Частями';155 $this->icon = plugins_url('assets/img/ halva.svg', __FILE__);166 $this->title = __('Pay for your order in installments', 'paygine-payment_method'); 167 $this->icon = plugins_url('assets/img/svkb.svg', __FILE__); 156 168 $this->description = '<iframe style="width:100%;height:180px;border:none;min-width: 440px;margin-left: -50px;" 157 src="' . plugins_url(' halva_widget.php', __FILE__) . '?amount='169 src="' . plugins_url('svkb_widget.php', __FILE__) . '?amount=' 158 170 . print_r((isset(WC()->cart->cart_contents_total)) ? WC()->cart->cart_contents_total : '', true) . '"></iframe>'; 159 171 break; 160 case 'sbp':161 $this->title = __('Pay by QR', 'paygine-payment_method'); //'Оплатить по QR';162 $this->icon = null;172 default: 173 if($this->logo) 174 $this->icon = wp_get_attachment_url($this->logo); 163 175 break; 164 176 } 177 165 178 // actions 166 179 add_action('init', array($this, 'successful_request')); … … 170 183 add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options')); 171 184 add_action('woocommerce_order_item_add_action_buttons', array($this, 'wc_order_item_add_complete_button'), 10, 1); 172 } 173 185 add_filter('woocommerce_generate_image_html', 'woocommerce_generate_image_html'); 186 add_action("woocommerce_order_status_changed", array($this, 'wc_paygine_order_payment_change'), 10, 4); 187 } 188 189 public function generate_image_html($key, $data) { 190 $field_key = $this->get_field_key($key); 191 $defaults = array( 192 'title' => '', 193 'disabled' => false, 194 'class' => '', 195 'css' => '', 196 'placeholder' => '', 197 'type' => 'file', 198 'desc_tip' => false, 199 'description' => '', 200 'custom_attributes' => array(), 201 ); 202 203 $data = wp_parse_args($data, $defaults); 204 205 ob_start();?> 206 <tr valign="top"> 207 <th scope="row" class="titledesc"> 208 <label for="<?php echo esc_attr($field_key);?>"><?php echo wp_kses_post($data['title']); ?> <?php echo $this->get_tooltip_html($data);?></label> 209 </th> 210 <td class="forminp"> 211 <fieldset> 212 <legend class="screen-reader-text"><span><?php echo wp_kses_post($data['title']);?></span></legend> 213 <input class="input-text regular-input" type="file" name="<?php echo esc_attr($field_key);?>" id="<?php echo esc_attr($field_key);?>" accept="image/*"> 214 </fieldset> 215 <?php if(!empty($this->logo)) { 216 $logo_meta = wp_get_attachment_metadata($this->logo);?> 217 <img src="<?php echo wp_get_attachment_url($this->logo) ?>" alt="" width="100" style="margin: 10px"> 218 <div>(<?php echo $logo_meta['width'] . 'x' . $logo_meta['height'];?>)</div> 219 <br> 220 <label for="<?php echo esc_attr($this->remove_logo_field);?>"> 221 <input class="" type="checkbox" name="<?php echo esc_attr($this->remove_logo_field);?>" id="<?php echo esc_attr($this->remove_logo_field);?>" style="" value="1"> <?php echo wp_kses_post(__('Remove logo', 'paygine-payment_method'));?></label> 222 <?php 223 } else {?> 224 <img src="<?php echo plugins_url('assets/img/paygine.png', plugin_basename(__FILE__)); ?>" alt="" width="100" style="margin: 10px"> 225 <?php } ?> 226 </td> 227 </tr> 228 <?php return ob_get_clean(); 229 } 230 174 231 /** 175 232 * Initialise Gateway Settings Form Fields … … 177 234 * @return void 178 235 */ 179 public function init_form_fields() 180 { 236 public function init_form_fields() { 181 237 $wc_statuses = wc_get_order_statuses(); 182 183 // array to generate admin form 238 184 239 $this->form_fields = array( 185 240 'enabled' => array( … … 189 244 'default' => 'yes' 190 245 ), 191 246 'title' => array( 247 'title' => __('Title', 'paygine-payment_method'), 248 'type' => 'text', 249 'description' => __('Custom title for payment type', 'paygine-payment_method'), 250 'desc_tip' => true, 251 'default' => '', 252 'placeholder' => $this->method_title 253 ), 254 'description' => array( 255 'title' => __('Description', 'paygine-payment_method'), 256 'type' => 'textarea', 257 'description' => __('Custom description for payment type', 'paygine-payment_method'), 258 'desc_tip' => true, 259 'default' => '', 260 'css' => 'width: 400px;' 261 ), 262 'logo' => array( 263 'title' => __('Logo', 'paygine-payment_method'), 264 'type' => 'image', 265 'description' => __('Custom logo for payment type', 'paygine-payment_method'), 266 'desc_tip' => true, 267 'default' => '' 268 ), 192 269 'sector' => array( 193 270 'title' => __('Sector ID', 'paygine-payment_method'), … … 197 274 'default' => '' 198 275 ), 199 200 276 'password' => array( 201 277 'title' => __('Password', 'paygine-payment_method'), … … 205 281 'default' => '' 206 282 ), 207 208 283 'testmode' => array( 209 284 'title' => __('Test Mode', 'paygine-payment_method'), … … 214 289 ), 215 290 'description' => __('Select test or live mode', 'paygine-payment_method'), 216 'desc_tip' => true, 217 ), 218 291 'desc_tip' => true 292 ), 219 293 'payment_method' => array( 220 294 'title' => __('Payment method', 'paygine-payment_method'), … … 223 297 'acquiring' => __('Standard acquiring (one-stage payment)', 'paygine-payment_method'), 224 298 'acquiring_two_steps' => __('Standard acquiring (two-stage payment)', 'paygine-payment_method') . ' *', 225 'halva' => __(' Halva Chastyami(one-stage payment)', 'paygine-payment_method'),226 'halva_two_steps' => __(' Halva Chastyami(two-stage payment)', 'paygine-payment_method') . ' *',299 'halva' => __('Plait (one-stage payment)', 'paygine-payment_method'), 300 'halva_two_steps' => __('Plait (two-stage payment)', 'paygine-payment_method') . ' *', 227 301 'sbp' => __('Fast Payment System', 'paygine-payment_method'), 228 302 'loan' => __('Loan', 'paygine-payment_method') 229 303 ), 230 304 'description' => '* ' . __('Payment occurs after confirmation by the manager in the personal account', 'paygine-payment_method'), 231 'desc_tip' => true, 232 ), 233 305 'desc_tip' => true 306 ), 234 307 'tax' => array( 235 308 'title' => __('TAX', 'paygine-payment_method'), … … 243 316 6 => __('Not subject to VAT', 'paygine-payment_method'), 244 317 ), 245 'default' => '6', 246 ), 247 318 'default' => '6' 319 ), 248 320 'notify_url' => array( 249 321 'title' => __('Notify URL', 'paygine-payment_method'), … … 254 326 'custom_attributes' => array( 255 327 'readonly' => 'readonly', 256 ), 257 ), 258 328 ) 329 ), 259 330 'hash_algo' => array( 260 331 'title' => __('Data encryption algorithm', 'paygine-payment_method'), … … 266 337 'description' => __('Must match your sector encryption settings in your personal account', 'paygine-payment_method'), 267 338 'desc_tip' => true, 268 'default' => 'md5', 269 ), 270 339 'default' => 'md5' 340 ), 271 341 'custom_statuses_header' => array( 272 342 'title' => __('Custom statuses for orders', 'paygine-payment_method'), 273 'type' => 'title', 274 ), 275 276 // custom order statuses 343 'type' => 'title' 344 ), 277 345 'registered_status' => array( 278 346 'title' => __('Order registered', 'paygine-payment_method'), 279 347 'type' => 'select', 280 'options' => $wc_statuses ,348 'options' => $wc_statuses 281 349 ), 282 350 'authorized_status' => array( 283 351 'title' => __('Order authorized', 'paygine-payment_method'), 284 352 'type' => 'select', 285 'options' => $wc_statuses ,353 'options' => $wc_statuses 286 354 ), 287 355 'loan_status' => array( 288 356 'title' => __('Loan agreement approved but not signed', 'paygine-payment_method'), 289 357 'type' => 'select', 290 'options' => $wc_statuses ,358 'options' => $wc_statuses 291 359 ), 292 360 'completed_status' => array( 293 361 'title' => __('Order successfully paid', 'paygine-payment_method'), 294 362 'type' => 'select', 295 'options' => $wc_statuses ,363 'options' => $wc_statuses 296 364 ), 297 365 'canceled_status' => array( 298 366 'title' => __('Order canceled', 'paygine-payment_method'), 299 367 'type' => 'select', 368 'options' => $wc_statuses 369 ), 370 'notify_customer_enabled' => array( 371 'title' => __('Issuing an invoice for payment', 'paygine-payment_method'), 372 'type' => 'checkbox', 373 'label' => __('Enable issuing an invoice for payment by email of the payer', 'paygine-payment_method'), 374 'default' => 'no' 375 ), 376 'agreement_status' => array( 377 'title' => __('Order agreement', 'paygine-payment_method'), 378 'type' => 'select', 300 379 'options' => $wc_statuses, 301 ), 302 380 'default' => 'wc-on-hold' 381 ), 382 'payment_expected_status' => array( 383 'title' => __('Payment expected', 'paygine-payment_method'), 384 'type' => 'select', 385 'options' => $wc_statuses, 386 'default' => 'wc-pending' 387 ) 303 388 ); 304 305 } 306 307 /** 308 * Overwritten WC function. 309 * Register order @ Paygine and redirect user to payment form 310 * 311 * @param $order_id 312 * @return string[] 313 **/ 314 public function process_payment($order_id) 315 { 316 $order = wc_get_order($order_id); 389 390 wp_enqueue_script('admin-paygine-script', plugins_url('assets/js/admin.js', __FILE__)); 391 } 392 393 public function wc_paygine_order_payment_change ($order_id, $status_from, $status_to, $order) { 394 if($order->payment_method === 'paygine' && ($status_from === 'on-hold' && $status_to === 'pending')) { 395 $this->process_payment_registration($order); 396 } 397 } 398 399 public function process_payment_registration($order) { 317 400 $order_amount = $this->centify($order->get_total()); 318 401 319 402 $this->calc_fiscal_position_shop_cart($order, $order_amount); 320 403 321 404 $args = array( 322 405 'sector' => $this->sector, … … 332 415 'signature' => $this->generate_sign([$this->sector, $order_amount, $this->currency], true) 333 416 ); 334 417 418 if($this->notify_customer_enabled === 'yes') { 419 $args = array_merge($args, ['notify_customer' => 1]); 420 } 421 335 422 try { 336 423 $response = $this->send_request($this->url . '/webapi/Register', ['body' => $args]); 337 424 if (is_wp_error($response)) 338 425 throw new Exception($response->get_error_message()); 426 339 427 $response = $response['body'] ?? $response; 428 340 429 $paygine_order_id = (int) $response; 341 430 if ($paygine_order_id == 0) … … 344 433 $this->log($e->getMessage(), ['args' => $args, 'response' => $response]); 345 434 wc_add_notice($e->getMessage(), 'error' ); 435 346 436 return [ 347 437 'result' => 'failure', … … 349 439 ]; 350 440 } 351 441 352 442 update_post_meta($order->get_id(), 'paygine_order_id', $paygine_order_id); 353 443 update_post_meta($order->get_id(), 'paygine_order_state', self::ORDER_REGISTERED); 354 444 $order->add_order_note(__('Order registered successfully', 'paygine-payment_method') . " (ID: $paygine_order_id)"); 355 445 446 return $paygine_order_id; 447 } 448 449 public function process_payment_payform($pay_order_id) : string { 356 450 $data = [ 357 451 'sector' => $this->sector, 358 'id' => $pay gine_order_id452 'id' => $pay_order_id 359 453 ]; 454 360 455 if(($this->payment_method === 'halva' || $this->payment_method === 'halva_two_steps') && $this->shop_cart) { 361 456 $shop_cart_encoded = base64_encode(json_encode($this->shop_cart, JSON_UNESCAPED_UNICODE)); 457 362 458 if(strlen($shop_cart_encoded) > self::SHOP_CART_MAX_LENGTH) 363 459 $shop_cart_encoded = ''; 460 364 461 $data['shop_cart'] = $shop_cart_encoded; 365 462 } 463 366 464 $this->sign_data($data, true); 367 465 $payment_path = self::PAYMENT_PATHS_BY_METHOD[$this->payment_method]; 368 $payment_url = $this->url . $payment_path . '?' . http_build_query($data); 466 467 return $this->url . $payment_path . '?' . http_build_query($data); 468 } 469 470 public function process_admin_options() { 471 if(!empty($_POST[$this->remove_logo_field]) && !empty($this->logo)) { 472 if(wp_delete_attachment($this->logo)) 473 $this->update_option('logo'); 474 } else if (!empty($_FILES[$this->logo_field]['name'])) { 475 require_once( ABSPATH . 'wp-admin/includes/image.php' ); 476 require_once( ABSPATH . 'wp-admin/includes/file.php' ); 477 require_once( ABSPATH . 'wp-admin/includes/media.php' ); 478 if(!file_is_valid_image($_FILES[$this->logo_field]['tmp_name'])) 479 return false; 480 481 $attachment_id = media_handle_upload($this->logo_field, 0 ); 482 if (is_wp_error($attachment_id)) 483 return $attachment_id->get_error_message(); 484 485 // remove old attachment 486 if(!empty($this->logo)) 487 wp_delete_attachment($this->logo); 488 489 $this->update_option('logo', $attachment_id); 490 } 491 492 $this->init_settings(); 493 494 $post_data = $this->get_post_data(); 495 496 foreach ( $this->get_form_fields() as $key => $field ) { 497 if(in_array($this->get_field_type( $field ), ['title', 'image'])) continue; 498 499 try { 500 $this->settings[ $key ] = $this->get_field_value( $key, $field, $post_data ); 501 } catch ( Exception $e ) { 502 $this->add_error( $e->getMessage() ); 503 } 504 } 505 506 return update_option( $this->get_option_key(), apply_filters( 'woocommerce_settings_api_sanitized_fields_' . $this->id, $this->settings ) ); 507 } 508 509 /** 510 * Overwritten WC function. 511 * Register order @ Paygine and redirect user to payment form 512 * 513 * @param $order_id 514 * @return string[] 515 **/ 516 public function process_payment($order_id) { 517 $order = wc_get_order($order_id); 518 519 if($this->notify_customer_enabled === 'yes' && $order->get_status() !== $this->agreement_status && !get_post_meta($order_id, 'paygine_order_moderated', true)) { 520 $order->add_order_note(__('Order successfully create', 'paygine-payment_method')); 521 $order->update_status($this->agreement_status); 522 523 update_post_meta($order->get_id(), 'paygine_order_moderated', 'yes'); 524 525 WC()->cart->empty_cart(); 526 527 return array( 528 'result' => 'success', 529 'redirect' => $this->get_return_url($order), 530 ); 531 } 532 533 $register_order_id = get_post_meta($order_id, 'paygine_order_id', true); 534 535 if($register_order_id) { 536 $payment_url = $this->process_payment_payform(intval($register_order_id)); 537 } else { 538 $pay_order_id = intval($this->process_payment_registration($order)); 539 $payment_url = $this->process_payment_payform($pay_order_id); 540 } 541 369 542 return array( 370 543 'result' => 'success', … … 372 545 ); 373 546 } 374 547 375 548 /** 376 549 * Callback from payment gateway was received 377 550 **/ 378 public function callback_from_gateway() 379 { 551 public function callback_from_gateway() { 380 552 $response = ''; 381 553 $order = []; 382 554 $checkout_url = apply_filters('woocommerce_get_checkout_url', wc_get_checkout_url()); 383 try{ 384 // processing center order ID555 556 try { 385 557 $pc_order_id = intval($_REQUEST['id']); 386 558 if(!$pc_order_id) 387 559 throw new Exception(__('Failed to get Paygine order ID', 'paygine-payment_method')); 560 388 561 $pc_operation_id = intval($_REQUEST['operation']); 389 562 if(!$pc_operation_id) 390 563 throw new Exception(__('Failed to get Paygine operation ID', 'paygine-payment_method')); 564 391 565 $order_id = intval($_REQUEST['reference']); 392 566 if(!$order_id) 393 567 throw new Exception(__('Undefined order ID', 'paygine-payment_method')); 568 394 569 $order = wc_get_order($order_id); 395 570 if(!$order) 396 571 throw new Exception(__('Failed to get order information', 'paygine-payment_method')); 397 572 398 // if order already paid 573 $db_pc_order_id = (int) get_post_meta($order_id, 'paygine_order_id', true); 574 if($db_pc_order_id !== $pc_order_id) 575 throw new Exception(__('Request data is not valid', 'paygine-payment_method')); 576 399 577 $pc_order_state = get_post_meta($order_id, 'paygine_order_state', true); 400 578 if($pc_order_state == self::ORDER_COMPLETED || $pc_order_state == self::ORDER_AUTHORIZED) { 401 579 wp_redirect($this->get_return_url($order)); 580 402 581 exit(); 403 582 } 404 583 405 584 $pc_order = $this->get_pc_order($pc_order_id); 406 585 $this->pc_order_validation($pc_order); … … 408 587 if(!$operation) 409 588 throw new Exception(__('Could not find operation', 'paygine-payment_method') . " ( $pc_operation_id )"); 589 410 590 $this->pc_order_operation_validation($operation, true); 411 591 412 592 $pc_order_params = $this->get_pc_order_params($pc_order); 413 593 $is_loan = (!empty($pc_order_params['vda_application_id']) || !empty($pc_order_params['fb_application_id'])); 594 414 595 // There is no valid operation amount in case of LOAN (VsegdaDa\FinBox) 415 596 if(!$is_loan) … … 418 599 $message = __('Failed to pay for the order', 'paygine-payment_method') . ":\n" . $e->getMessage(); 419 600 $this->log($message, ['data' => $data ?? '', 'response' => $response]); 601 420 602 if($order) 421 603 $order->add_order_note(nl2br($message)); 604 422 605 wc_add_notice(nl2br($message), 'error'); 423 606 wp_redirect($checkout_url); 607 424 608 exit(); 425 609 } 610 426 611 if($pc_order_state !== $pc_order['state']) { 427 // updating order status428 612 $order_status = $this->get_custom_order_status($operation['type'], $is_loan); 429 613 $order->update_status($order_status); 430 // updating order metadata431 614 update_post_meta($order_id, 'paygine_order_state', $pc_order['state']); 432 433 // updating order real payment method434 615 $payment_method = get_post_meta($order_id, 'paygine_payment_method', true); 435 if(!$payment_method){ 616 617 if(!$payment_method) { 436 618 $is_halva = !empty($pc_order_params['buyIdSumAmount']); 437 619 $payment_method = $this->get_pc_payment_method($operation['type'], $is_halva, $is_loan); 438 620 update_post_meta($order_id, 'paygine_payment_method', $payment_method); 439 621 } 622 440 623 $order->add_order_note(__('Payment completed successfully', 'paygine-payment_method')); 441 624 } 625 442 626 wp_redirect($this->get_return_url($order)); 627 443 628 exit(); 444 629 } 445 630 446 631 /** 447 632 * Payment notify from gateway was received 448 633 **/ 449 public function notify_from_gateway() 450 { 634 public function notify_from_gateway() { 451 635 global $wp_filesystem; 452 636 $order = []; 453 637 $pc_operation = []; 638 454 639 if (empty($wp_filesystem)) 455 640 WP_Filesystem(); 641 456 642 try { 457 643 $response = $wp_filesystem->get_contents('php://input'); … … 460 646 if(!$order_id) 461 647 throw new Exception(__('Undefined order ID', 'paygine-payment_method')); 648 462 649 $order = wc_get_order($order_id); 463 650 if(!$order) 464 651 throw new Exception(__('Failed to get order information', 'paygine-payment_method')); 465 466 // if order already completed\refunded 652 467 653 $pc_order_state = get_post_meta($order_id, 'paygine_order_state', true); 468 469 654 if ($pc_order_state === self::ORDER_CANCELED || $pc_order_state === self::ORDER_BLOCKED || $pc_order_state === self::ORDER_EXPIRED) 470 655 throw new Exception(sprintf(__('The order has already been %s', 'paygine-payment_method'), $pc_order_state)); 656 471 657 $this->pc_operation_validation($pc_operation); 472 473 658 $pc_order = $this->get_pc_order((int) $pc_operation['order_id']); 474 659 $this->pc_order_validation($pc_order); 475 476 660 $pc_order_params = $this->get_pc_order_params($pc_order); 477 661 $is_loan = (!empty($pc_order_params['vda_application_id']) || !empty($pc_order_params['fb_application_id'])); 662 478 663 // There is no valid operation amount in case of LOAN (VsegdaDa\FinBox) 479 664 if(!$is_loan) 480 665 $this->operation_amount_validation($pc_operation, $this->centify($order->get_total())); 481 482 666 } catch(Exception $e) { 483 667 $message = sprintf(__('Failed to complete request for operation %s from the processing center', 'paygine-payment_method'), $pc_operation['type']) . PHP_EOL . $e->getMessage(); 484 668 $this->log($message, $pc_operation); 669 485 670 if($order) 486 671 $order->add_order_note($message); 672 487 673 exit($message); 488 674 } 489 // updating order real payment method 675 490 676 $payment_method = get_post_meta($order_id, 'paygine_payment_method', true); 491 if(!$payment_method){ 677 678 if(!$payment_method) { 492 679 $is_halva = !empty($pc_order_params['buyIdSumAmount']); 493 680 $payment_method = $this->get_pc_payment_method($pc_operation['type'], $is_halva, $is_loan); 494 681 update_post_meta($order_id, 'paygine_payment_method', $payment_method); 495 682 } 496 497 // updating order status 683 498 684 $order_status = $this->get_custom_order_status($pc_operation['type']); 499 685 $order->update_status($order_status); 500 // updating order metadata501 686 update_post_meta($order_id, 'paygine_order_state', $pc_operation['order_state']); 502 687 $message = sprintf(__('Request for operation %s from the processing center was completed successfully', 'paygine-payment_method'), $pc_operation['type']); 503 688 $order->add_order_note($message); 689 504 690 exit('ok'); 505 691 } 506 507 public function complete_payment() {692 693 public function complete_payment() { 508 694 echo $this->payment_action(self::OPERATION_COMPLETE); 695 509 696 exit(); 510 697 } 511 698 512 699 /** 513 700 * Inherited method Process refund. … … 521 708 * @return boolean True or false based on success, or a WP_Error object. 522 709 */ 523 public function process_refund($order_id, $amount = null, $reason = '') 524 { 710 public function process_refund($order_id, $amount = null, $reason = '') { 525 711 return $this->payment_action(self::OPERATION_REFUND, $order_id, $amount, $reason); 526 712 } 527 713 528 714 /** 529 715 * Check operation state for hold order and set complete state … … 531 717 * @return string void 532 718 */ 533 public function payment_action($type, $order_id = 0, $amount = null, $reason = '') 534 { 535 try{ 719 public function payment_action($type, $order_id = 0, $amount = null, $reason = '') { 720 try { 536 721 $order = []; 537 722 $operation = []; 538 723 539 724 // get variables from request and checking token for custom 'complete' action 540 725 if($type === self::OPERATION_COMPLETE){ … … 544 729 throw new Exception(__('Operation failed. Please refresh the page', 'paygine-payment_method')); 545 730 } 546 731 547 732 if(!$order_id) 548 733 throw new Exception(__('Undefined order ID', 'paygine-payment_method')); 734 549 735 $order = wc_get_order($order_id); 550 736 if(!$order) 551 737 throw new Exception(__('Failed to get order information', 'paygine-payment_method')); 738 552 739 $pc_order_id = get_post_meta($order_id, 'paygine_order_id', true); 553 740 if(!$pc_order_id) 554 741 throw new Exception(__('Failed to get Paygine order ID', 'paygine-payment_method')); 555 742 556 743 $payment_method = get_post_meta($order_id, 'paygine_payment_method', true); 557 // converting old method to new558 744 $payment_method = self::OLD_TO_NEW_PAYMENT_METHODS[$payment_method] ?? $payment_method; 559 745 $request_path = self::get_action_path($type, $payment_method); 560 746 if(!$request_path) 561 747 throw new Exception(__('Failed to get operation request path', 'paygine-payment_method')); 562 // full refund for AUTHORIZED orders only 748 563 749 $pc_order_state = get_post_meta($order_id, 'paygine_order_state', true); 564 750 if($amount && $amount !== $order->get_total() && $type === self::OPERATION_REFUND && $pc_order_state === self::ORDER_AUTHORIZED){ 565 751 throw new Exception(__('For orders with AUTHORIZED status, only full refunds are available', 'paygine-payment_method')); 566 752 } 753 567 754 // hardcode loan amount = 0! we use loans only without prepayment! otherwise we need to save and use the prepayment amount!! 568 if($payment_method === 'loan') 755 if($payment_method === 'loan') { 569 756 $amount = 0; 570 elseif($amount)757 } elseif($amount) { 571 758 $amount = $this->centify($amount); 572 else759 } else { 573 760 $amount = $this->centify($order->get_total()); 574 761 } 762 575 763 $data = [ 576 764 'sector' => $this->sector, … … 579 767 'currency' => $this->currency 580 768 ]; 769 581 770 $this->sign_data($data, true); 582 771 $response = $this->send_request($this->url . $request_path, ['body' => $data]); … … 585 774 if($operation['type'] !== $type) 586 775 throw new Exception(__('Operation type and action type are not equal', 'paygine-payment_method')); 587 // for COMPLETED orders the operation amount may not be equal to the order amount(partial refund/complete)588 776 } catch(Exception $e) { 589 777 $comment = $this->get_action_comment($type)['fail'] . PHP_EOL . $e->getMessage(); … … 591 779 if($order) 592 780 $order->add_order_note($comment); 781 593 782 return json_encode([ 594 783 'success' => false, … … 596 785 ]); 597 786 } 598 787 599 788 $order_status = $this->get_custom_order_status($operation['type']); 600 789 if($order_status) 601 790 $order->update_status($order_status); 791 602 792 update_post_meta($order_id, 'paygine_order_state', $operation['order_state']); 793 603 794 $comment = $this->get_action_comment($type)['success']; 604 if($reason) {795 if($reason) { 605 796 $comment .= PHP_EOL . esc_html($reason); 606 797 } 607 798 608 799 $order->add_order_note($comment); 800 609 801 return json_encode([ 610 802 'success' => true, … … 612 804 ]); 613 805 } 614 806 615 807 /** 616 808 * Draw Complete button for authorized orders … … 618 810 * @return void 619 811 */ 620 function wc_order_item_add_complete_button($order) 621 { 622 if($order->get_payment_method() == $this->id){ 812 function wc_order_item_add_complete_button($order) { 813 if($order->get_payment_method() == $this->id) { 623 814 $pc_order_state = get_post_meta($order->get_id(), 'paygine_order_state', true); 624 if($pc_order_state === self::ORDER_AUTHORIZED){ 815 816 if($pc_order_state === self::ORDER_AUTHORIZED) { 625 817 $label = __('Complete payment', 'paygine-payment_method'); 626 $nonce_complete = wp_create_nonce('paygine_complete' . $order->get_id()); 627 ?> 628 <script src="<?php echo plugins_url('assets/js/scripts.js', plugin_basename(__FILE__)); ?>"></script> 629 <input type="hidden" id="nonce_paygine_complete" value="<?php echo $nonce_complete; ?>"> 630 <button type="button" id="button_paygine_complete" 631 class="button custom-items"><?php echo $label; ?></button> 632 <?php 633 } 634 } 635 } 636 637 private function calc_fiscal_position_shop_cart($order, $order_amount) 638 { 818 $nonce_complete = wp_create_nonce('paygine_complete' . $order->get_id());?> 819 820 <script src="<?php echo plugins_url('assets/js/scripts.js', plugin_basename(__FILE__));?>"></script> 821 <input type="hidden" id="nonce_paygine_complete" value="<?php echo $nonce_complete;?>"> 822 <button type="button" id="button_paygine_complete" class="button custom-items"><?php echo $label;?></button> 823 <?php } 824 } 825 } 826 827 private function calc_fiscal_position_shop_cart($order, $order_amount) { 639 828 $fiscal_positions = ''; 640 829 $fiscal_amount = 0; … … 642 831 $shop_cart_key = 0; 643 832 $order_items = $order->get_items(); 644 833 645 834 foreach($order_items as $item) { 646 835 $item_data = $item->get_data(); … … 653 842 $fiscal_positions .= str_replace([';', '|'], '', $item_data['name']) . '|'; 654 843 $fiscal_amount += $item_data['quantity'] * $element_price; 655 656 844 $shop_cart[$shop_cart_key]['quantityGoods'] = (int)$item['quantity']; 657 845 $shop_cart[$shop_cart_key]['goodCost'] = $item_price - $item_discount; … … 659 847 $shop_cart_key++; 660 848 } 661 849 662 850 $shipping_amount = $order->get_shipping_total(); 663 if ($shipping_amount){ 851 852 if ($shipping_amount) { 664 853 $fiscal_positions .= '1;' . $this->centify($shipping_amount) . ';6;Доставка|'; 665 854 $fiscal_amount += $this->centify($shipping_amount); 666 667 855 $shop_cart[$shop_cart_key]['quantityGoods'] = 1; 668 856 $shop_cart[$shop_cart_key]['goodCost'] = $shipping_amount; 669 857 $shop_cart[$shop_cart_key]['name'] = 'Доставка'; 670 858 } 859 671 860 $fiscalDiff = abs($fiscal_amount - $order_amount); 672 if ($fiscalDiff){ 861 862 if ($fiscalDiff) { 673 863 $fiscal_positions .= '1;' . $fiscalDiff . ';6;Скидка;14|'; 674 864 $shop_cart = []; 675 865 } 866 676 867 $this->fiscal_positions = substr($fiscal_positions, 0, -1); 677 868 $this->shop_cart = $shop_cart; 678 869 } 679 680 private function get_pc_order($pc_order_id) 681 { 870 871 private function get_pc_order($pc_order_id) { 682 872 if(!$pc_order_id) 683 873 throw new Exception(__('Missing PC order ID', 'paygine-payment_method')); 874 684 875 $data = [ 685 876 'sector' => $this->sector, 686 877 'id' => $pc_order_id, 687 878 ]; 879 688 880 $this->sign_data($data, true); 689 881 $response = $this->send_request($this->url . '/webapi/Order', ['body' => $data]); 882 690 883 return $this->parse_xml($response['body']); 691 884 } 692 693 private function get_pc_order_operation($pc_order, $pc_operation_id) 694 { 885 886 private function get_pc_order_operation($pc_order, $pc_operation_id) { 695 887 if(empty($pc_order['operations']['operation'])) 696 888 throw new Exception(__('There are no operations in the order', 'paygine-payment_method')); 697 // "operation" may contain one or few operations (array) 889 698 890 $operations = isset($pc_order['operations']['operation'][0]) ? $pc_order['operations']['operation'] : [$pc_order['operations']['operation']]; 891 699 892 foreach($operations as $operation) { 700 893 if(empty($operation['id'])) continue; … … 702 895 return $operation; 703 896 } 897 704 898 return []; 705 899 } 706 707 private function get_pc_order_params($pc_order) 708 { 900 901 private function get_pc_order_params($pc_order) { 709 902 $params = []; 903 710 904 if(empty($pc_order['parameters']['parameter'])) return $params; 711 905 foreach($pc_order['parameters']['parameter'] as $param) { … … 718 912 $params[$key] = $param['value'] ?? 'null'; 719 913 } 914 720 915 return $params; 721 916 } 722 723 public function pc_operation_validation($response): void 724 { 917 918 public function pc_operation_validation($response): void { 725 919 if(empty($response['reason_code']) && !empty($response['code']) && !empty($response['description'])) 726 920 throw new Exception("$response[description] (error code $response[code])"); 921 727 922 if(empty($response['signature'])) 728 923 throw new Exception(__('Signature is missing', 'paygine-payment_method')); 924 729 925 $xml_string = self::xml_values_to_string($response); 730 926 $signature = $this->generate_sign($xml_string, true); 731 927 if ($signature !== $response['signature']) 732 928 throw new Exception(__('Invalid signature', 'paygine-payment_method')); 929 733 930 if(!in_array($response['type'], self::OPERATION_TYPES)) 734 931 throw new Exception(__('Unknown operation type', 'paygine-payment_method') . ' : ' . $response['type']); 932 735 933 if($response['state'] !== self::OPERATION_APPROVED) 736 934 throw new Exception(__('Operation not approved', 'paygine-payment_method')); 737 935 } 738 739 public function pc_order_validation($order): void 740 { 936 937 public function pc_order_validation($order): void { 741 938 if(empty($order['reason_code']) && !empty($order['code']) && !empty($order['description'])) 742 939 throw new Exception("$order[description] (error code $order[code])"); 940 743 941 if(empty($order['signature'])) 744 942 throw new Exception(__('Signature is missing', 'paygine-payment_method')); 943 745 944 $xml_string = self::xml_values_to_string($order); 746 945 $signature = $this->generate_sign($xml_string, true); … … 748 947 throw new Exception(__('Invalid signature', 'paygine-payment_method')); 749 948 } 750 public function pc_order_operation_validation($operation, $is_payment = false): void 751 {949 950 public function pc_order_operation_validation($operation, $is_payment = false): void { 752 951 if(empty($operation['reason_code']) && !empty($operation['code']) && !empty($operation['description'])) 753 952 throw new Exception(__('An error occurred during the operation', 'paygine-payment_method') . "($operation[code] : $operation[description])"); 953 754 954 if(!in_array($operation['type'], self::OPERATION_TYPES)) 755 955 throw new Exception(__('Unknown operation type', 'paygine-payment_method') . ' : ' . $operation['type']); 956 756 957 if($operation['state'] !== self::OPERATION_APPROVED) 757 958 throw new Exception(__('Operation not approved', 'paygine-payment_method')); 959 758 960 if($is_payment && !in_array($operation['type'], self::PAID_OPERATION_TYPES)) { 759 961 throw new Exception(__('Unknown payment operation type', 'paygine-payment_method') . ' : ' . $operation['type']); 760 962 } 761 963 } 762 763 public static function xml_values_to_string($xml_array): string 764 { 964 965 public static function xml_values_to_string($xml_array): string { 765 966 if(!is_array($xml_array)) return ''; 967 766 968 $res = ''; 767 969 foreach($xml_array as $key => $value) { … … 769 971 $res .= is_string($value) ? $value : self::xml_values_to_string($value); 770 972 } 973 771 974 return $res; 772 975 } 773 774 public function get_operation_amount($operation): int 775 { 976 977 public function get_operation_amount($operation): int { 776 978 return !empty($operation['buyIdSumAmount']) ? (int) $operation['buyIdSumAmount'] : (int) $operation['amount']; 777 979 } 778 779 private function operation_amount_validation($operation, $order_amount): void 780 { 980 981 private function operation_amount_validation($operation, $order_amount): void { 781 982 $operation_amount = self::get_operation_amount($operation); 983 782 984 if (!$operation_amount || $operation_amount !== $order_amount) 783 985 throw new \Exception(__('Invalid operation amount', 'paygine-payment_method')); 784 986 } 785 786 public function get_custom_order_status($operation_type, $is_loan = false) 787 { 987 988 public function get_custom_order_status($operation_type, $is_loan = false) { 788 989 switch($operation_type){ 789 990 case 'PURCHASE': … … 796 997 return $this->canceled_status ?? false; 797 998 } 999 798 1000 return false; 799 1001 } 800 801 private function get_action_path($action_type, $payment_type) 802 { 1002 1003 private function get_action_path($action_type, $payment_type) { 803 1004 $prefix = ($payment_type == 'halva' || $payment_type == 'halva_two_steps') ? '/webapi/custom/svkb/' : '/webapi/'; 1005 804 1006 switch($action_type) { 805 1007 case self::OPERATION_COMPLETE: return $prefix . 'Complete'; 806 1008 case self::OPERATION_REFUND: return $prefix . 'Reverse'; 807 1009 } 1010 808 1011 return false; 809 1012 } 810 811 private function get_action_comment($action) 812 { 1013 1014 private function get_action_comment($action) { 813 1015 switch($action) { 814 1016 case self::OPERATION_COMPLETE: return [ … … 822 1024 } 823 1025 } 824 825 private function get_pc_payment_method($operation_type, $is_halva, $is_loan) 826 { 1026 1027 private function get_pc_payment_method($operation_type, $is_halva, $is_loan) { 827 1028 switch($operation_type) { 828 1029 case 'PURCHASE': … … 841 1042 return ''; 842 1043 } 843 844 private function send_request($url, $args, $method = 'post', int $repeat = 3) 845 { 1044 1045 private function send_request($url, $args, $method = 'post', int $repeat = 3) { 846 1046 $method = (strtolower($method) === 'get') ? 'get' : 'post'; 847 1047 $repeat = !$repeat ? 1 : $repeat; … … 853 1053 sleep(2); 854 1054 } 1055 855 1056 return $response; 856 1057 } 857 1058 858 1059 /** 859 1060 * Admin Panel Options 860 1061 **/ 861 public function admin_options() 862 { 863 ?> 864 <h3><?php _e('Paygine', 'paygine-payment_method'); ?></h3> 865 <p><?php echo sprintf(__('Payments with bank cards via the <a href="%s" target="_blank">Paygine</a> payment system.', 'paygine-payment_method'), self::PLUGIN_SITE); ?></p> 1062 public function admin_options() {?> 1063 <h3><?php _e('Paygine', 'paygine-payment_method');?></h3> 1064 <p><?php echo sprintf(__('Payments with bank cards via the <a href="%s" target="_blank">Paygine</a> payment system.', 'paygine-payment_method'), self::PLUGIN_SITE);?></p> 866 1065 <table class="form-table"> 867 <?php 868 // Generate the HTML For the settings form. 869 $this->generate_settings_html(); 870 ?> 871 </table><!--/.form-table--> 872 <?php 873 } 874 1066 <?php $this->generate_settings_html();?> 1067 </table> 1068 <?php } 1069 875 1070 /** 876 1071 * Get current currency code … … 878 1073 * @return string 879 1074 */ 880 public function get_currency($wc_currency): string 881 { 1075 public function get_currency($wc_currency): string { 882 1076 switch($wc_currency) { 883 1077 case 'EUR': return '978'; 884 1078 case 'USD': return '840'; 1079 885 1080 default: return '643'; 886 1081 } 887 1082 } 888 1083 889 1084 /** 890 1085 * @param array $data … … 892 1087 * @return void 893 1088 */ 894 public function sign_data(&$data, $password = false): void 895 { 1089 public function sign_data(&$data, $password = false): void { 896 1090 unset($data['signature']); 1091 897 1092 $sign = implode('', $data); 898 1093 if($password) 899 1094 $sign .= $this->password; 1095 900 1096 $data['signature'] = base64_encode($this->sign_hash($sign)); 901 1097 } 902 903 public function generate_sign($data, $password = false): string 904 { 1098 1099 public function generate_sign($data, $password = false): string { 905 1100 $string = is_array($data) ? implode('', $data) : (string) $data; 906 1101 if($password) 907 1102 $string .= $this->password; 1103 908 1104 return base64_encode($this->sign_hash($string)); 909 1105 } 910 911 private function sign_hash($data) 912 { 1106 1107 private function sign_hash($data) { 913 1108 return hash($this->hash_algo, $data); 914 1109 } 915 1110 916 1111 /** 917 1112 * Changes a currency unit to a derived equivalent currency unit … … 920 1115 * @return int 921 1116 */ 922 public function centify($value): int 923 { 1117 public function centify($value): int { 924 1118 return intval(strval($value * 100)); 925 1119 } 926 927 private function paygine_get_url(): string 928 { 1120 1121 private function paygine_get_url(): string { 929 1122 $paygine_url = "https://test.paygine.com"; 930 if ($this->testmode == "0"){ 1123 1124 if ($this->testmode == "0") { 931 1125 $paygine_url = "https://pay.paygine.com"; 932 1126 } 1127 933 1128 return $paygine_url; 934 1129 } 935 1130 936 1131 /** 937 1132 * Parse $xml from PC with removing element with values = '' or null … … 939 1134 * @return false|mixed 940 1135 */ 941 public function parse_xml(string $string) 942 { 1136 public function parse_xml(string $string) { 943 1137 if (!$string) 944 1138 throw new Exception(__('Server response is empty', 'paygine-payment_method')); 1139 945 1140 $xml = simplexml_load_string($string); 946 1141 if (!$xml) 947 1142 throw new Exception(__('Invalid XML from response', 'paygine-payment_method')); 1143 948 1144 $valid_xml = json_decode(json_encode($xml), true); 949 1145 if (!$valid_xml) 950 1146 throw new Exception(__('Unable to decode xml', 'paygine-payment_method')); 1147 951 1148 return $valid_xml; 952 1149 } 953 1150 954 1151 /** 955 1152 * Write log-messages in file when it accessible in FS on hosting … … 958 1155 * @param array $data 959 1156 */ 960 public function log(string $message, array $data = []) 961 { 1157 public function log(string $message, array $data = []) { 962 1158 $log = "\n[" . date("H:i:s d.m.Y") . '] ' . $message; 963 1159 if($data) 964 1160 $log .= "\n" . var_export($data, true); 1161 965 1162 file_put_contents(ABSPATH . $this->id . '.log', $log, FILE_APPEND); 966 1163 } 967 968 } // class 1164 } 1165 969 1166 /** 970 1167 * Add this gateway to the list of available payment gateways … … 973 1170 * @return mixed 974 1171 */ 975 function add_paygine_gateway($methods) 976 { 1172 function add_paygine_gateway($methods) { 977 1173 $methods[] = 'woocommerce_paygine'; 1174 978 1175 return $methods; 979 1176 } 980 1177 981 1178 add_filter('woocommerce_payment_gateways', 'add_paygine_gateway'); 982 1179 983 1180 add_filter( 984 1181 'plugin_action_links_' . plugin_basename( __FILE__ ), … … 992 1189 if (!class_exists('woocommerce')) 993 1190 return $links; 994 1191 995 1192 array_unshift( 996 1193 $links, … … 1001 1198 ) 1002 1199 ); 1003 1200 1004 1201 return $links; 1005 1202 } -
paygine/trunk/readme.txt
r3011342 r3036869 1 === paygine payment method===1 === Модуль оплаты Paygine === 2 2 Contributors: paygine 3 Tags: e-commerce, payments, paygine, платежные системы, sale 4 Tested up to: 6.3.2 3 Tags: woocommerce, payments, paygine, платежные системы, sale 5 4 Requires at least: 4.7 5 Tested up to: 6.4.3 6 6 Requires PHP: 7.4 7 Stable tag: 2.0.1 7 Stable tag: 2.2.0 8 WC requires at least: 6.0 9 WC tested up to: 8.5.1 8 10 License: GPLv3 9 11 License URI: https://www.gnu.org/licenses/gpl-3.0.html 10 12 11 == Плагин «Paygine» — платежное решение для сайтов на Wordpress == 12 • 3 встроенных способа приема платежей. 13 • Для юридических лиц и ИП. 14 • Быстрое поступление денег на счет компании. 15 • Полное соответствие 54-ФЗ. 16 • Бесплатное подключение. 17 == Настройка плагина == 18 Чтобы принимать платежи через плагин, подайте заявку на подключение к Paygine на сайте paygine.ru. С вами свяжется сотрудник компании и выдаст доступ на подключение. 19 == Поддержка передачи чека == 20 1. Настройте быструю передачу чеков в налоговую из Paygine согласно 54-ФЗ. 21 2. Передавайте чеки через партнеров (облачные кассы «АТОЛ Онлайн», Orange Data, «Бизнес.ру», Kit online). 22 == Тарифы == 23 • Комиссия за прием платежей — от 1%. Комиссия рассчитывается индивидуально для каждого бизнеса. Для корректной оценки тарифа необходимо предоставить информацию по виду деятельности компании, среднему чеку и оборотам в месяц. 24 == После подключения Paygine доступны == 13 == Description == 14 15 = Плагин «Paygine» — платежное решение для сайтов на Wordpress = 16 - 3 встроенных способа приема платежей 17 - Для юридических лиц и ИП 18 - Быстрое поступление денег на счет компании 19 - Полное соответствие 54-ФЗ 20 - Бесплатное подключение 21 22 = Поддержка передачи чека = 23 24 1. Настройте быструю передачу чеков в налоговую из Paygine согласно 54-ФЗ. 25 2. Передавайте чеки через партнеров (облачные кассы «АТОЛ Онлайн», Orange Data, «Бизнес.ру», Kit online). 26 27 = Тарифы = 28 29 Комиссия за прием платежей — от 1%. Комиссия рассчитывается индивидуально для каждого бизнеса. Для корректной оценки тарифа необходимо предоставить информацию по виду деятельности компании, среднему чеку и оборотам в месяц. 30 31 = После подключения Paygine доступны = 32 25 33 3 способа приема платежей: 26 •Банковские карты (MasterCard/Visa/MIR)27 •СБП28 • Халва Частями 34 - Банковские карты (MasterCard/Visa/MIR) 35 - СБП 36 - Плайт 29 37 30 • Личный кабинет, в котором вы сможете видеть все операции, возвращать платежи, выставлять и отправлять счета и обратиться в службу поддержки paygine (служба поддержки paygine работает 24/7). 38 Личный кабинет, в котором вы сможете видеть все операции, возвращать платежи, выставлять и отправлять счета и обратиться в службу поддержки paygine (служба поддержки paygine работает 24/7). 39 40 == Installation == 41 42 Чтобы принимать платежи через плагин, подайте заявку на подключение к Paygine на сайте https://paygine.ru. С вами свяжется сотрудник компании и выдаст доступ на подключение. 31 43 32 44 == Screenshots == 45 33 46 1. Страница настроек плагина
Note: See TracChangeset
for help on using the changeset viewer.