Changeset 2954327
- Timestamp:
- 08/16/2023 10:30:30 AM (12 months ago)
- Location:
- snapplify-payment-gateway
- Files:
-
- 26 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
snapplify-payment-gateway/trunk/changelog.txt
r2810644 r2954327 1 2 3 1 4 2022-11-03 - version 1.0.0 2 5 * Initial release -
snapplify-payment-gateway/trunk/includes/class-wc-gateway-snapplify.php
r2810644 r2954327 217 217 $amountInUSD = round( ( $originalAmount / $USDToZAR ), 2 ); 218 218 $amountInOrderCurrency = round( ( $amountInUSD * $USDToCurrency ), 2 ); 219 220 221 222 223 219 224 $body = array( 220 225 'referenceCode' => $order_id . '_' . gmdate( 'YmmddHis' ), … … 267 272 } 268 273 269 public function snapplify_success() { 270 $payment_response = SNAP_Helpers::make_submit_payment_response_object( $_REQUEST ); 274 private function snapplify_get_payment_country_currency($originalAmount, $billingCurrency) 275 { 276 $success = false; 277 $rates = null; 278 $apiArray = array(); 279 // $apiArray[] = "c6bc01da16fb403a9a7c09be270c269b"; 280 // $apiArray[] = "26bec72a4ed1403c98fe7b2e213d6174"; 281 // $apiArray[] = "6e40b0cdb2ab4f1396eba6ed764b0bfc"; 282 $apiArray[] = "c5859382ef1e487fb159251230d9f2ad"; 283 $apiArray[] = "23d274d3fd754224af55549416a9c6ac"; 284 $apiArray[] = "8f4c6268eb2c482b88c6201712f8e91d"; 285 $apiArray[] = "3c06a455b44e4ce1b731ff931cc1165d"; 286 $apiArray[] = "26bec72a4ed1403c98fe7b2e213d6174"; 287 $apiArray[] = "a326110605c44d7c801e65e7dbc8caca"; 288 $apiArray[] = "42adbe51bdfb4a22a297da4f4394636b"; 289 $apiArray[] = "9230dc426e86404788827905613120cd"; 290 $apiArray[] = "3008d67f86a94e149a59090512698156"; 291 // We got this url from the documentation for the remote API. 292 $url = 'https://openexchangerates.org/api/latest.json'; 293 294 while ($success == false && count($apiArray) > 0) { 295 296 $appId = array_pop($apiArray); 297 $query = $url . "?app_id=" . $appId . '&symbols=ZAR,KES'; 298 299 // Call the API. 300 $response = wp_remote_get($query); 301 302 if (is_wp_error($response)) { 303 $success = false; 304 } else { 305 // Check the response 306 $code = wp_remote_retrieve_response_code($response); 307 $body = wp_remote_retrieve_body($response); 308 309 if ($code == 200) { 310 try { 311 $decoded = json_decode($body, true); 312 313 $data = array(); 314 $data = $decoded["rates"]; 315 $USDToCurrency = $data[$billingCurrency]; 316 $storeCurrency = $data[$this->store_currency]; 317 $amountInUSD = round(($originalAmount / $storeCurrency), 2); 318 $rates = round(($amountInUSD * $USDToCurrency), 2); 319 } catch (\Error $e) { 320 $rates = null; 321 } catch (\Exception $e) { 322 $rates = null; 323 } 324 $success = true; 325 } 326 } 327 } // end while 328 329 return $rates; 330 } 331 332 public function snapplify_success() 333 { 334 $payment_response = SNAP_Helpers::make_submit_payment_response_object($_REQUEST); 271 335 272 336 $validation_response = $this->snap_attempt_payment_validation( $payment_response ); -
snapplify-payment-gateway/trunk/readme.txt
r2811630 r2954327 2 2 Contributors: snapplify 3 3 Tags: Snapplify, woocommerce, gateway, payments, e-commerce 4 Requires at least: 5.3.04 Requires at least: .0 5 5 Requires PHP: 7.2 6 Tested up to: 6. 0.27 Stable tag: 1.0. 06 Tested up to: 6. 7 Stable tag: 1.0. 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 49 49 50 50 == Changelog == 51 52 51 53 = 1.0.0 = 52 54 * Initial release -
snapplify-payment-gateway/trunk/snapplify-payment-gateway.php
r2810875 r2954327 17 17 * Plugin URI: https://www.snapplify.com/woo-plugin 18 18 * Description: Accept payments in WooCommerce using Snapplify Pay. 19 * Version: 1.0. 019 * Version: 1.0. 20 20 * Author: Snapplify 21 21 * Author URI: https://snapplify.com … … 52 52 53 53 define( 'SNAP_DIR', plugin_dir_url( __FILE__ ) ); 54 define( 'SNAP_VERSION', '1.0. 4');54 define( 'SNAP_VERSION', '1.0.'); 55 55 56 56 require_once plugin_basename( 'includes/class-helpers.php' ); … … 67 67 */ 68 68 function snap_register_gateway( $methods ) { 69 $methods[] = ' WC_Gateway_Snapplify';69 $methods[] = 'WC_Gateway_Snapplify'; 70 70 return $methods; 71 71 }
Note: See TracChangeset
for help on using the changeset viewer.