Changeset 2201328
- Timestamp:
- 11/26/2019 01:31:14 PM (6 years ago)
- Location:
- platon-pay
- Files:
-
- 10 edited
-
tags/1.7/inc/order-processing.php (modified) (1 diff)
-
trunk/css/style.css (modified) (5 diffs)
-
trunk/inc/form.php (modified) (1 diff)
-
trunk/inc/list-orders.php (modified) (1 diff)
-
trunk/inc/order-processing.php (modified) (4 diffs)
-
trunk/inc/settings.php (modified) (3 diffs)
-
trunk/index.php (modified) (5 diffs)
-
trunk/js/frontend.js (modified) (1 diff)
-
trunk/js/script.js (modified) (7 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
platon-pay/tags/1.7/inc/order-processing.php
r2171611 r2201328 46 46 $resultInfo['id_shortcode'] = $result->id_shortcode; 47 47 } 48 $newPriceFormat = number_format($resultInfo["price"], 2 );48 $newPriceFormat = number_format($resultInfo["price"], 2, '.', ''); 49 49 50 50 -
platon-pay/trunk/css/style.css
r2171607 r2201328 114 114 border-bottom: 1px solid #dddddd; 115 115 } 116 .tab-block li{116 .tab-block .tab-default { 117 117 background: #ddd; 118 118 color: #1c2345; … … 124 124 border-radius: 15px 15px 0 0; 125 125 margin: 0 10px 0 0; 126 } 127 .tab-block .additional-tab-block { 128 float: left; 126 129 } 127 130 .tab-block .active-tab { … … 229 232 border: 1px solid #ddd; 230 233 box-shadow: inset 0 1px 2px rgba(0,0,0,.07); 234 } 235 .full-width-block { 236 width: 100% !important; 237 display: inline-block; 238 } 239 #test-mode-info{ 240 display: none; 241 font-weight: 500; 242 } 243 #test-mode-info p { 244 margin-top: 0; 245 } 246 .test-info-card { 247 font-weight: 700; 231 248 } 232 249 .desc-field { … … 574 591 } 575 592 593 /*Форма отправки запроса на подключение модуля*************************************************************************/ 594 .left-test-mode-info { 595 width: 19%; 596 float: left; 597 } 598 .right-test-mode-info { 599 width: 81%; 600 float: right; 601 } 602 .wrapper-psp-hook-up { 603 position: absolute; 604 top: 50%; 605 left: 50%; 606 transform: translate(-50%,-50%); 607 background: #fff; 608 z-index: 9; 609 margin-left: -20px; 610 width: 100%; 611 max-width: 300px; 612 padding: 20px; 613 display: none; 614 } 615 .title-modal-hook-up { 616 display: block; 617 text-align: center; 618 font-size: 20px; 619 color: #000; 620 margin-bottom: 20px; 621 } 622 .button-default-platon { 623 background: #ee8527; 624 color: #fff; 625 cursor: pointer; 626 font-size: 16px; 627 border-radius: 5px; 628 padding: 9px 25px; 629 display: inline-block; 630 border: none; 631 } 632 #platon-psp-hook-up { 633 margin-bottom: 20px; 634 } 635 .button-default-platon:focus, 636 .button-default-platon:active { 637 outline: none; 638 } 639 .close-modal-hook-up { 640 position: absolute; 641 top: 10px; 642 right: 10px; 643 line-height: 0.7; 644 width: 15px; 645 height: 15px; 646 font-size: 16px; 647 cursor: pointer; 648 display: inline-block; 649 text-align: center; 650 } 651 .line-field-hook-up { 652 margin-bottom: 15px; 653 } 654 .line-field-hook-up input { 655 width: 100%; 656 outline: none; 657 height: 35px; 658 border: 1px solid #848484; 659 } 660 .line-field-hook-up input:focus, 661 .line-field-hook-up input:active { 662 outline: none; 663 border-color: #848484 !important; 664 box-shadow: none !important; 665 } 666 .message-result { 667 text-align: center; 668 font-weight: 500; 669 margin-bottom: 10px; 670 font-size: 14px; 671 display: none; 672 } 673 .status-success { 674 color: #1bcf1c; 675 } 676 .status-error { 677 color: #cc0000; 678 } 679 .overlay-psp-hook-up { 680 position: absolute; 681 top: 0; 682 right: 0; 683 bottom: 0; 684 left: 0; 685 z-index: 8; 686 background: rgba(0, 0, 0, 0.7); 687 margin-left: -20px; 688 display: none; 689 } 690 576 691 577 692 /*Нижняя панель(footer) плагина****************************************************************************************/ … … 603 718 } 604 719 } 720 @media(max-width: 1450px){ 721 .copy-shortcode { 722 padding: 11px 5px; 723 font-size: 12px; 724 } 725 } -
platon-pay/trunk/inc/form.php
r2171607 r2201328 52 52 $html .= '<input name="phone" class="phone-field-form" type="tel" placeholder="'.$phonePlaceholder.'" '. $phoneRequire .'>'; 53 53 } 54 $html .= '<input type="hidden" name="shortcode_id" value="'.$info['id_shortcode'].'">'; 55 $html .= '<input type="hidden" name="link_to_handler" value="'.$linkToHandler.'">'; 56 $html .= wp_nonce_field( 'platon_pay_nonce_action','platon_pay_nonce_field',true, false ); 57 $html .= '<button type="submit" data-active="0" class="button-order-processing" style="background-color: #'.$colorButtonForm.'">'.$nameButtonForm.'</button>'; 54 $html .= '<div class="do-not-transmit-field">'; 55 $html .= '<input type="hidden" name="shortcode_id" value="'.$info['id_shortcode'].'">'; 56 $html .= '<input type="hidden" name="link_to_handler" value="'.$linkToHandler.'">'; 57 $html .= wp_nonce_field( 'platon_pay_nonce_action','platon_pay_nonce_field',true, false ); 58 $html .= '</div>'; 59 $html .= '<button type="submit" data-active="0" class="button-order-processing" style="background-color: #'.$colorButtonForm.'">'.$nameButtonForm.'</button>'; 58 60 $html .= '</form>'; 59 61 $html .= '</div>'; -
platon-pay/trunk/inc/list-orders.php
r2171607 r2201328 106 106 <td class="id-invoice"><?php echo $info['id_invoice'] ? $info['id_invoice'] : ' '; ?></td> 107 107 <td class="order-platon"><?php echo $info['order_platon'] ? $info['order_platon'] : ' '; ?></td> 108 <td class="fio"><?php echo (($info['first_name'] ? $info['first_name'] : '') . ' ' . ($info['last_name'] ? $info['last_name'] : ' ')); ?></td>108 <td class="fio"><?php echo (($info['first_name'] ? $info['first_name'] : '') . ' ' . ($info['last_name'] ? $info['last_name'] : ' ')); ?></td> 109 109 <td class="email"><?php echo $info['email'] ? $info['email'] : ' '; ?></td> 110 110 <td class="phone"><?php echo $info['phone'] ? $info['phone'] : ' '; ?></td> -
platon-pay/trunk/inc/order-processing.php
r2174685 r2201328 36 36 /*Настройки для подключения к Platon***************************************************************************/ 37 37 $infoUrl = ( get_option('platon_url_field') ) ? get_option('platon_url_field') : ''; 38 $infoSecret = ( get_option('platon_secret_key') ) ? get_option('platon_secret_key') : ''; 39 $infoPassword = ( get_option('platon_password_key') ) ? get_option('platon_password_key') : ''; 38 if(get_option('platon_test_mode') !== '0'){ 39 $infoSecret = 'F5QQ6NQS64'; 40 $infoPassword = 'TaHycyY5z7PeZsX4fpuQcXusX5JHjmLy'; 41 }else{ 42 $infoSecret = ( get_option('platon_secret_key') ) ? get_option('platon_secret_key') : ''; 43 $infoPassword = ( get_option('platon_password_key') ) ? get_option('platon_password_key') : ''; 44 } 40 45 41 46 /*Сбор данных для совершения оплаты****************************************************************************/ … … 100 105 /*Изменение статуса заказа и запись внутренего id заказа от Platon*****************************************************/ 101 106 if(!isset($_GET["order"]) && isset($_POST['sign'])){ 102 103 107 $order_id = sanitize_text_field($_POST['id']); 104 108 $sign = sanitize_text_field($_POST['sign']); 105 109 $status = sanitize_text_field($_POST['status']); 106 110 111 $invoice_table = $wpdb->prefix . 'platon_invoice'; 112 $internal_order_id = sanitize_text_field($_POST['order']); 113 107 114 if ($order_id && $sign && $status === 'SALE') { 108 $internal_order_id = sanitize_text_field($_POST['order']);109 110 $invoice_table = $wpdb->prefix . 'platon_invoice';111 115 $wpdb->update( $invoice_table, 112 116 array( 'status' => 'Оплачен', 'order_platon' => $order_id), 113 117 array( 'id' => $internal_order_id )); 114 118 } 115 116 119 } 120 121 122 /*Изменение статуса заказа в тестовом режиме***************************************************************************/ 123 if(isset($_GET['platon-result']) && isset($_GET['order']) && get_option('platon_test_mode')){ 124 $invoice_table = $wpdb->prefix . 'platon_invoice'; 125 $internal_order_id = sanitize_text_field($_GET['order']); 126 $wpdb->update( $invoice_table, array( 'status' => 'Тестовый платеж'), array( 'id' => $internal_order_id )); 127 } 128 117 129 118 130 /*Показ оповещения после успешного совершения заказа*******************************************************************/ … … 137 149 } 138 150 139 151 140 152 /*Удаление заказа******************************************************************************************************/ 141 153 function platon_pay_remove_order(){ … … 163 175 } 164 176 add_action('wp_ajax_remove_order', 'platon_pay_remove_order'); 177 178 179 /*Функция для логирования полученых данных*******************************************************************************/ 180 function platon_pay_log_info($info = array()){ 181 $fp = fopen(plugin_dir_path( __FILE__ ).'platon-logs.txt','w+'); 182 fwrite($fp, $info); 183 fclose($fp); 184 } -
platon-pay/trunk/inc/settings.php
r2171607 r2201328 11 11 12 12 $callbackUrl = '/?platon-result=Result_Payment'; 13 13 14 $testMode = ( get_option('platon_test_mode') ) ? get_option('platon_test_mode') : ''; 14 15 15 16 $path = plugins_url( 'platon/index.php'); … … 64 65 65 66 <ul class="tab-block"> 66 <li data-tab="system-settings" class="active-tab ">Системные настройки Platon</li>67 <li data-tab="form-settings" >Настройки формы</li>68 <li data-tab="content-shortcode" >Формирование шорткода</li>69 <li data-tab="design-form" >Оповещения</li>67 <li data-tab="system-settings" class="active-tab tab-default">Системные настройки Platon</li> 68 <li data-tab="form-settings" class="tab-default">Настройки формы</li> 69 <li data-tab="content-shortcode" class="tab-default">Формирование шорткода</li> 70 <li data-tab="design-form" class="tab-default">Оповещения</li> 70 71 </ul> 71 72 72 73 <div class="all-content-tab"> 73 74 <div class="content-tab simple-fields active-content" id="system-settings"> 75 <div class="full-width-block"> 76 <div class="left-test-mode-info"> 77 <div class="field-block full-width-block"> 78 <input type="checkbox" class="checkbox" id="platon-test-mode" name="platon_test_mode" <?php echo ($testMode) ? 'checked' : ''; ?>> 79 <label for="platon-test-mode">Рабочий режим</label><!--Тестовый режим--> 80 </div> 81 <span class="button-default-platon" id="platon-psp-hook-up">Подключить PSP Platon</span> 82 </div> 83 <div class="right-test-mode-info"> 84 <div class="field-block full-width-block" id="test-mode-info"> 85 <p>Вы можете протестировать процесс работы модуля без проведения оплат.</p> 86 <p>Для включения реальных платежей – вам необходимы выключить «Режим тестирования» - и связаться с нашими специалистами для получения необходимых данных.</p> 87 <div class="test-info-card"> 88 <p>Для тестирования успешной оплаты картой, введите следующие реквизиты:</p> 89 <p>№ карты: 4111 1111 1111 1111</p> 90 <p>Срок: 01/20, CVV: 123</p> 91 </div> 92 </div> 93 </div> 94 </div> 95 74 96 <div class="field-block"> 75 97 <label for="url-field">Url</label> … … 291 313 </div> 292 314 315 <div class="wrapper-psp-hook-up" id="psp-hook-up"> 316 <span class="close-modal-hook-up">x</span> 317 <span class="title-modal-hook-up">Заявка на подключение</span> 318 <p class="message-result">Заявка была успешно отправлена</p> 319 <form class="form-hook-up"> 320 <div class="line-field-hook-up"> 321 <input type="text" name="your-name" placeholder="Ваше имя"> 322 </div> 323 <div class="line-field-hook-up"> 324 <input type="email" name="your-email" placeholder="E-mail"> 325 </div> 326 <div class="line-field-hook-up"> 327 <input type="tel" name="your-tel" class="phone-field-platon" placeholder="Телефон"> 328 </div> 329 <input type="hidden" name="your-site" value="<?php echo home_url(); ?>"> 330 <input type="hidden" name="your-callback-url" value="<?php echo home_url() . $callbackUrl; ?>"> 331 <input type="hidden" name="your-topic" value="WP"> 332 <?php echo wp_nonce_field( 'platon_pay_nonce_hook_up','platon_pay_nonce_hook_up',true, false ); ?> 333 <button id="send-info-hook-up" class="button-default-platon">Отправить заявку</button> 334 </form> 335 </div> 336 <div class="overlay-psp-hook-up"></div> 337 293 338 <script type="text/javascript"> 294 339 $(document).ready(function(){ -
platon-pay/trunk/index.php
r2171611 r2201328 4 4 * Description: “Platon Pay” is perfect for both single-page landing page and small sites where there is no large catalog of goods and store functions. 5 5 * Author: udjin 6 * Version: 1. 76 * Version: 1.8 7 7 * Requires at least: 4.7 8 8 * Requires PHP: 5.2 … … 21 21 $table_invoice = $wpdb->prefix . 'platon_invoice'; 22 22 $table_order = $wpdb->prefix . 'platon_orders'; 23 24 /*Включение тестового режима*/ 25 update_option( 'platon_test_mode', 1, true); 23 26 24 27 $sql = "CREATE TABLE $table_name ( … … 159 162 160 163 if($allOptions){ 164 $platonTestMode = sanitize_text_field($allOptions['platon_test_mode']); 161 165 $platonUrlField = esc_url($allOptions['platon_url_field']); 162 166 $platonSecretKey = sanitize_text_field($allOptions['platon_secret_key']); … … 185 189 $messageSuccessOrder = sanitize_text_field(str_replace(array($pOpen,$pClose), ' ', $allOptions['message_success_order'])); 186 190 191 update_option( 'platon_test_mode', $platonTestMode, true); 187 192 update_option( 'platon_url_field', $platonUrlField, true); 188 193 update_option( 'platon_secret_key', $platonSecretKey, true); … … 225 230 } 226 231 232 /**********************************************************************************************************************/ 233 /*Отправка информации на подключения оплаты****************************************************************************/ 234 /**********************************************************************************************************************/ 235 add_action('wp_ajax_send_info_hook_up', 'platon_pay_send_info_hook_up'); 236 function platon_pay_send_info_hook_up() { 237 $json = array(); 238 239 $nonceCode = check_ajax_referer( 'platon_pay_nonce_hook_up', 'security' ); 240 $sanitizeInfo = sanitize_text_field(json_encode($_POST['info'])); 241 $infoArray = json_decode($sanitizeInfo, true); 242 if($nonceCode){ 243 $hookUpArray = array( 244 'your-name' => sanitize_text_field($infoArray['your-name']), 245 'your-email' => sanitize_text_field($infoArray['your-email']), 246 'your-tel' => sanitize_text_field($infoArray['your-tel']), 247 'your-site' => sanitize_text_field($infoArray['your-site']), 248 'your-callback-url' => sanitize_text_field($infoArray['your-callback-url']), 249 'your-topic' => sanitize_text_field($infoArray['your-topic']) 250 ); 251 252 $headers = array(); 253 $headers[] = "Content/Type: application/json"; 254 $headers[] = "Accept: application/json"; 255 256 $curl = curl_init(); 257 curl_setopt($curl, CURLOPT_URL, 'https://platon.ua/wp-content/themes/platon/ajax_platon_bitrix_lead.php'); 258 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 259 curl_setopt($curl, CURLOPT_POST, 1); 260 curl_setopt($curl, CURLOPT_POSTFIELDS, $hookUpArray); 261 curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); 262 $res = json_decode(curl_exec($curl), true); 263 if($res['status'] == 'success') { 264 $json['message'] = 'Спасибо! Ваша заявка получена. В скором времени с Вами свяжется наш менеджер.'; 265 $json['status'] = 'success'; 266 }else{ 267 $errorResult = curl_error($curl); 268 $json['message'] = 'Ошибка'; 269 $json['status'] = 'error'; 270 } 271 curl_close($curl); 272 273 $json['info_result_status'] = $res; 274 } 275 276 echo json_encode($json); 277 wp_die(); 278 } 279 280 227 281 228 282 require_once(plugin_dir_path( __FILE__ ).'/inc/form.php'); -
platon-pay/trunk/js/frontend.js
r2171607 r2201328 71 71 parentForm.attr('action', result.url_to_send).append(result.args_inputs); 72 72 self.attr('data-active', '1'); 73 parentForm.find('.do-not-transmit-field').remove(); 73 74 parentForm.submit(); 74 75 } -
platon-pay/trunk/js/script.js
r2171607 r2201328 11 11 }else if(this.type === 'textarea'){ 12 12 let idTextarea = $(this).attr('id'); 13 dataOptions[this.name] = tinyMCE.get(idTextarea).getContent(); 13 let visibleTextarea = $('#'+idTextarea).is(":visible"); 14 if(visibleTextarea){ 15 dataOptions[this.name] = '<p>'+$(this).val()+'</p>'; 16 }else{ 17 dataOptions[this.name] = tinyMCE.get(idTextarea).getContent(); 18 } 14 19 }else{ 15 20 let nameField = this.name.split('['); … … 53 58 } 54 59 60 55 61 /*Запуск функции сохранения настроек------------------------*/ 56 62 $('#save-settings, #save-settings-bottom').on('click', function(){ 57 63 save_settings(); 58 64 }); 65 59 66 60 67 /*Удаления строки шорткода----------------------------------*/ … … 85 92 ); 86 93 } 87 94 95 88 96 /*Удаление заказа с админки****************************************************************************************/ 89 97 $(document).on('click', '.remove-order', function(){ … … 126 134 127 135 /*Переключение табов***********************************************************************************************/ 128 $('.tab-block').on('click', ' li', function(){136 $('.tab-block').on('click', '.tab-default', function(){ 129 137 let sel = $(this); 130 138 if(!sel.hasClass('active-tab')){ … … 188 196 $("#color-button-form").wheelColorPicker(); 189 197 198 190 199 /*Изменение цвета input в зависимости от выбраного цвета в ColorPicker*********************************************/ 191 200 $('.left-settings-form').on('blur','INPUT', function(){ … … 193 202 $(this).css({'background-color': colorInput}); 194 203 }); 195 196 204 205 197 206 /*Всплывающие подсказки********************************************************************************************/ 198 207 $('.help-icon').mouseover(function() { … … 228 237 }); 229 238 } 230 239 240 241 /*Блокирование полей при включеном тестовом режиме*****************************************************************/ 242 let testModeElement = $('#platon-test-mode'); 243 testModeElement.on('change', function(el) { 244 if(testModeElement.attr("checked") == 'checked'){ 245 $('#url-field, #secret-key, #password-key, #return-url').attr('disabled', true); 246 $('#test-mode-info').slideDown(); 247 testModeElement.next('label').text('Тестовый режим'); 248 }else{ 249 $('#url-field, #secret-key, #password-key, #return-url').removeAttr('disabled'); 250 $('#test-mode-info').slideUp(); 251 testModeElement.next('label').text('Рабочий режим'); 252 } 253 }); 254 if(testModeElement.attr("checked") == 'checked'){ 255 $('#url-field, #secret-key, #password-key, #return-url').attr('disabled', true); 256 $('#test-mode-info').slideDown(); 257 testModeElement.next('label').text('Тестовый режим'); 258 } 259 260 261 /*Всплывающее окно отправки запроса на подключение модуля**********************************************************/ 262 $('#platon-psp-hook-up').on('click',function(event){ 263 $('.form-hook-up').show(); 264 $('.message-result').text('').hide(); 265 $('.overlay-psp-hook-up').fadeIn(400, 266 function(){ 267 $('#psp-hook-up').css('display', 'block').animate({opacity: 1, top: '50%'}, 200); 268 }); 269 }); 270 $('.close-modal-hook-up, .overlay-psp-hook-up').on('click', function(){ 271 $('#psp-hook-up') 272 .animate({opacity: 0, top: '45%'}, 200, 273 function(){ 274 $('.overlay-psp-hook-up').fadeOut(400); 275 } 276 ); 277 }); 278 279 280 /*К полю телефона добавление плюса(+)******************************************************************************/ 281 $('.phone-field-platon').focus(function(){ 282 let sel = $(this); 283 if(sel.val() === ''){ 284 sel.val('+'); 285 } 286 }).blur(function(){ 287 let sel = $(this); 288 if(sel.val() === '+'){ 289 sel.val(''); 290 } 291 }); 292 293 294 /*Отправка информации с формы на подключение модуля***************************************************************/ 295 $('#send-info-hook-up').click(function(event){ 296 event.preventDefault(); 297 298 let infoHookUpArray = new Object(); 299 let requireFields = new Array(); 300 $('.form-hook-up').find('input').each(function() { 301 infoHookUpArray[this.name] = $(this).val(); 302 if($(this).val() === ''){ 303 requireFields.push(this.name); 304 } 305 }); 306 307 if(requireFields.length === 0) { 308 let dataInfo = { 309 action: 'send_info_hook_up', 310 dataType: 'json', 311 info: infoHookUpArray, 312 security: $('#platon_pay_nonce_hook_up').val() 313 }; 314 jQuery.ajax({ 315 url: ajaxurl, 316 data: dataInfo, 317 type: 'POST', 318 success: function (response) { 319 let result = JSON.parse(response); 320 // console.log(result); 321 $('.form-hook-up').slideUp(); 322 $('.message-result').show().attr('class','message-result status-' + result.status).text(result.message); 323 } 324 }); 325 }else{ 326 $('.message-result').show().addClass('status-error').text('Все поля обязательны для заполнения!'); 327 } 328 }); 231 329 232 330 }); -
platon-pay/trunk/readme.txt
r2171611 r2201328 76 76 * This version fixes a security related bug. 77 77 * Added ability to pay via Privat24. 78 = 1.8 = 79 * Added test mode 78 80 79 81 == Upgrade Notice == … … 83 85 = 1.7 = 84 86 * In this version has been fixed a bug with security and added ability to pay via Privat24. 87 = 1.8 = 88 * Added test mode
Note: See TracChangeset
for help on using the changeset viewer.