Plugin Directory

Changeset 2954327

Timestamp:
08/16/2023 10:30:30 AM (12 months ago)
Author:
snapplify
Message:

Bug Fixing

Location:
snapplify-payment-gateway
Files:
26 added
4 edited

Legend:

Unmodified
Added
Removed
  • snapplify-payment-gateway/trunk/changelog.txt

    r2810644 r2954327  
     1
     2
     3
    142022-11-03 - version 1.0.0
    25* Initial release
  • snapplify-payment-gateway/trunk/includes/class-wc-gateway-snapplify.php

    r2810644 r2954327  
    217217        $amountInUSD = round( ( $originalAmount / $USDToZAR ), 2 );
    218218        $amountInOrderCurrency = round( ( $amountInUSD * $USDToCurrency ), 2 );
     219
     220
     221
     222
     223
    219224        $body = array(
    220225            'referenceCode' => $order_id . '_' . gmdate( 'YmmddHis' ),
     
    267272    }
    268273
    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);
    271335
    272336        $validation_response = $this->snap_attempt_payment_validation( $payment_response );
  • snapplify-payment-gateway/trunk/readme.txt

    r2811630 r2954327  
    22Contributors: snapplify
    33Tags: Snapplify, woocommerce, gateway, payments, e-commerce
    4 Requires at least: 5.3.0
     4Requires at least: .0
    55Requires PHP: 7.2
    6 Tested up to: 6.0.2
    7 Stable tag: 1.0.0
     6Tested up to: 6.
     7Stable tag: 1.0.
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4949
    5050== Changelog ==
     51
     52
    5153= 1.0.0 =
    5254* Initial release
  • snapplify-payment-gateway/trunk/snapplify-payment-gateway.php

    r2810875 r2954327  
    1717 * Plugin URI:        https://www.snapplify.com/woo-plugin
    1818 * Description:       Accept payments in WooCommerce using Snapplify Pay.
    19  * Version:           1.0.0
     19 * Version:           1.0.
    2020 * Author:            Snapplify
    2121 * Author URI:        https://snapplify.com
     
    5252
    5353    define( 'SNAP_DIR', plugin_dir_url( __FILE__ ) );
    54     define( 'SNAP_VERSION', '1.0.4');
     54    define( 'SNAP_VERSION', '1.0.');
    5555
    5656    require_once plugin_basename( 'includes/class-helpers.php' );
     
    6767 */
    6868function snap_register_gateway( $methods ) {
    69     $methods[] = 'WC_Gateway_Snapplify';
     69    $methods[] = 'WC_Gateway_Snapplify';
    7070    return $methods;
    7171}
Note: See TracChangeset for help on using the changeset viewer.