Changeset 3227831
- Timestamp:
- 01/24/2025 05:07:59 AM (14 months ago)
- Location:
- ksher-payment
- Files:
-
- 6 edited
-
.DS_Store (modified) (previous)
-
tags/.DS_Store (modified) (previous)
-
trunk/assets/js/upload.js (modified) (1 diff)
-
trunk/ksher.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/setting/setting.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ksher-payment/trunk/assets/js/upload.js
r3225972 r3227831 52 52 }); 53 53 54 if ($("#ksher-private-key-file").prop("files").length) { 55 if ( 56 $("#ksher-private-key-file").prop("files")[0].type == 57 "application/x-x509-ca-cert" 58 ) { 59 ksherPrivateKey = $("#ksher-private-key-file").prop("files")[0]; 60 ksherPrivateKeyUrl = ""; 61 form_data = new FormData(); 62 63 form_data.append("file", ksherPrivateKey); 64 form_data.append("action", "file_upload"); 65 form_data.append("security", ul.nonce); 66 67 $.ajax({ 68 url: ul.ajaxurl, 69 type: "POST", 70 contentType: false, 71 processData: false, 72 data: form_data, 73 beforeSend: function () { 74 $("#ksher-message").html( 75 '<div class="ksher-preload"><div class="lds-facebook"><div></div><div></div><div></div></div></div>' 76 ); 77 }, 78 success: function (response) { 79 ksherPrivateKeyUrl = response ? response : "0"; 80 if (ksherPrivateKeyUrl !== "0") { 81 setTimeout(function () { 82 var filename = ksherPrivateKeyUrl.substring( 83 ksherPrivateKeyUrl.lastIndexOf("/") + 1 54 function uploadPrivateKey() { 55 return new Promise((resolve, reject) => { 56 if ($("#ksher-private-key-file").prop("files").length) { 57 if ( 58 $("#ksher-private-key-file").prop("files")[0].type == 59 "application/x-x509-ca-cert" 60 ) { 61 let ksherPrivateKey = $("#ksher-private-key-file").prop( 62 "files" 63 )[0]; 64 let form_data = new FormData(); 65 66 form_data.append("file", ksherPrivateKey); 67 form_data.append("action", "file_upload"); 68 form_data.append("security", ul.nonce); 69 70 $.ajax({ 71 url: ul.ajaxurl, 72 type: "POST", 73 contentType: false, 74 processData: false, 75 data: form_data, 76 beforeSend: function () { 77 $("#ksher-message").html( 78 '<div class="ksher-preload"><div class="lds-facebook"><div></div><div></div><div></div></div></div>' 84 79 ); 85 $("#ksher-private-key-filename").html( 86 "Your filename is " + filename 87 ); 88 $("#ksher-private-key-filename").removeClass("ksher-warning"); 89 $("#ksher-private-key-filename").addClass("ksher-success"); 90 }, 2000); 91 hasErrorPrivatekey = "0"; 80 }, 81 success: function (response) { 82 const ksherPrivateKeyUrl = response ? response : "0"; 83 if (ksherPrivateKeyUrl !== "0") { 84 setTimeout(function () { 85 var filename = ksherPrivateKeyUrl.substring( 86 ksherPrivateKeyUrl.lastIndexOf("/") + 1 87 ); 88 $("#ksher-private-key-filename").html( 89 "Your filename is " + filename 90 ); 91 $("#ksher-private-key-filename").removeClass( 92 "ksher-warning" 93 ); 94 $("#ksher-private-key-filename").addClass( 95 "ksher-success" 96 ); 97 }, 2000); 98 resolve("success"); 99 } else { 100 setTimeout(function () { 101 $("#ksher-private-key-filename").html( 102 "No file Upload(.pem only)" 103 ); 104 $("#ksher-private-key-filename").removeClass( 105 "ksher-success" 106 ); 107 $("#ksher-private-key-filename").addClass( 108 "ksher-warning" 109 ); 110 }, 2000); 111 reject("File upload failed"); 112 } 113 }, 114 error: function (response) { 115 alert("Upload file Error occurred", response); 116 reject("File upload error"); 117 }, 118 }); 119 } else { 120 reject("Invalid file type"); 121 } 122 } else { 123 resolve("No file selected"); 124 } 125 }); 126 } 127 128 function checkConnection() { 129 $.ajax({ 130 url: ul.ajaxurl, 131 type: "POST", 132 dataType: "json", 133 data: { 134 action: "ksher_check_connection", 135 ksher_app_id: ksherAppID, 136 security: ul.nonce, 137 }, 138 success: function (response) { 139 setTimeout(function () { 140 if (response.result === "true") { 141 $("#ksher-check-result").html( 142 '<p class="ksher-success">Your Website is Connected</p>' 143 ); 92 144 } else { 93 setTimeout(function () { 94 $("#ksher-private-key-filename").html( 95 "No file Upload(.pem only)" 96 ); 97 $("#ksher-private-key-filename").removeClass("ksher-success"); 98 $("#ksher-private-key-filename").addClass("ksher-warning"); 99 }, 2000); 100 hasErrorPrivatekey = "1"; 145 $("#ksher-check-result").html( 146 '<p class="ksher-fail">Not Connected</p>' 147 ); 101 148 } 102 }, 103 error: function (response) { 104 alert("Upload file Error occured", response); 105 }, 106 }); 149 }, 1000); 150 }, 151 error: function (response) { 152 alert("Error occurred", response); 153 $("#ksher-check-result").html('<p class="ksher-fail">Error</p>'); 154 }, 155 }); 156 } 157 158 async function executeTasks() { 159 try { 160 await uploadPrivateKey(); 161 checkConnection(); 162 } catch (error) { 163 console.error("Error in executing tasks:", error); 107 164 } 108 165 } 109 166 110 $.ajax({ 111 url: ul.ajaxurl, 112 type: "POST", 113 dataType: "json", 114 data: { 115 action: "ksher_check_connection", 116 ksher_app_id: ksherAppID, 117 security: ul.nonce, 118 }, 119 success: function (response) { 120 setTimeout(function () { 121 if (response.result === "true") { 122 $("#ksher-check-result").html( 123 '<p class="ksher-success">You Website is Connected</p>' 124 ); 125 } else { 126 $("#ksher-check-result").html( 127 '<p class="ksher-fail">Not Connect</p>' 128 ); 129 } 130 }, 1000); 131 }, 132 error: function (response) { 133 alert("Error occured", response); 134 $("#ksher-check-result").html('<p class="ksher-fail">error</p>'); 135 }, 136 }); 167 executeTasks(); 137 168 138 169 setTimeout(function () { -
ksher-payment/trunk/ksher.php
r3227827 r3227831 4 4 * Plugin URI: https://www.ksher.com 5 5 * Description: Ksher Gateway Plugin is a WordPress plugin designed specifically for WooCommerce. The plugin adds support for Ksher Payment Gateway payment method to WooCommerce and Checkout Block. 6 * Version: 1.1. 56 * Version: 1.1.6 7 7 * Author: Ksher 8 8 * Text Domain: ksher -
ksher-payment/trunk/readme.txt
r3227827 r3227831 6 6 Requires PHP: 7.0 7 7 WooCommerce up to: 9.0.0 8 Stable tag: 1.1. 58 Stable tag: 1.1.6 9 9 License: GPLv2 or later 10 10 … … 34 34 1.1.4 35 35 Update Support Block 36 37 1.1.6 38 Fixed Check Connection -
ksher-payment/trunk/setting/setting.php
r3225972 r3227831 267 267 268 268 $privatekey_content = file_get_contents( $ksher_private_key_url ); 269 269 270 $encoded_sign = ksher_sign_process( $privatekey_content, $data); 270 271 $data['sign'] = $encoded_sign; … … 282 283 'data' =>$body['data']['mch_appid'] , 283 284 'result' => 'true', 285 'privatekey_content' => $privatekey_content, 284 286 ) 285 287 );
Note: See TracChangeset
for help on using the changeset viewer.