Plugin Directory

Changeset 1309998


Ignore:
Timestamp:
12/16/2015 01:56:49 PM (10 years ago)
Author:
ctala
Message:

Agregando version 2.5.12.2

Location:
woocommerce-chilean-peso-currency
Files:
13 added
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • woocommerce-chilean-peso-currency/trunk/readme.txt

    r1175236 r1309998  
    99Requires at least: 3, 3.3+ and WooCommerce 1.4+, Chilean Peso, Pesos Chilenos, currency
    1010
    11 Tested up to: 3.6
     11Tested up to: 4.4
    1212
    13 Stable tag: 2.5.5
     13Stable tag: 2.5.12.2
    1414
    1515== Description ==
     
    2222Lo que hace este plugin es facilitar la integración de los pesos Chilenos a Woocommerce, además de agregar las distintas regiones del país ( Chile obviamente ) y aceptar pagos con paypal a través de dolares.
    2323
     24Si se requiere usar el valor actualizado del dolar es necesario crear un api en https://openexchangerates.org/ y agregarla a la configuracion del plugin.
     25
     26La Configuracion del plugin se puede encontrar en el menu de settings bajo el nombre de Chilean Peso
     27
    2428Deshabilita el código postal por ahora, debido a que en Chile aún no acostumbramos a utilizarlo.
    2529
    2630== TODO ==
    2731
    28 Agregar panel de administración para las variables.
     32== Changelog ==
    2933
    30 == Changelog ==
     34= 2.5.12.2 =
     35
     36* Se agrega validacion de que el codigo del api de OpenXChange exista antes de crear el objeto.
     37* Se valida que las variables existan antes de preguntar por ellas.
     38
     39= 2.5.12.1 =
     40Actualizado el 14 de Diciembre del 2015
     41
     42* Se agrega nuevo repositorio oficial en github
     43* Se arregla problema en el cobro de impuestos cuando estos no están incluidos con Paypal. ( Gracias a Juan Pablo Oyarzun)
     44* Se agrega WIKI
     45* Se agrega Menú para configuración
     46* Se agrega código para usar el API de OpenExchange
     47* Se agrega la opción de usar el valor fijo para el dolar.
    3148
    3249= 2.5.5 =
  • woocommerce-chilean-peso-currency/trunk/woocommerce-chilean-peso.php

    r1175236 r1309998  
    33/*
    44  Plugin Name: WooCommerce Chilean Peso + Chilean States
    5   Plugin URI: http://plugins.svn.wordpress.org/woocommerce-chilean-peso-currency/
     5  Plugin URI: https://github.com/NAITUSEIRL/Woocommerce-Chilean-Peso
     6  Wiki URI: http://wiki.cristiantala.cl
    67  Description: This plugin enables the payment with paypal for Chile and the Chilean states to WooCommerce.
    7   Version: 2.5.5
    8   Author: Cristian Tala Sánchez <cristian.tala@gmail.com>
     8  Version: 2.5.12.2
     9  Author: Cristian Tala Sánchez <yomismo@cristiantala.cl>
    910  Author URI: http://www.cristiantala.cl
    1011  License: GPLv3
    1112  Requires at least: 3.0 +
    12   Tested up to: 4.2
     13  Tested up to: 4.4
    1314 */
    1415/*
    15  *      Copyright 2012 Cristian Tala Sánchez <cristian.tala@gmail.com>
     16 *      Copyright 2012 Cristian Tala Sánchez <yomismo@cristiantala.cl>
    1617 *
    1718 *      This program is free software; you can redistribute it and/or modify
     
    3031 *      MA 02110-1301, USA.
    3132 */
     33include_once 'classes/MyChileanPesoSettingsPage.php';
     34include_once 'classes/OpenExchangeRate.php';
     35include_once 'helpers/rowMeta.php';
     36
     37//$test = MyChileanPesoSettingsPage();
     38
    3239register_activation_hook(__FILE__, 'ctala_install_cleancache');
    3340
     
    3542 * Esta funcion limpia el cache luego de instalar la nueva versión del plugin.
    3643 */
     44
    3745function ctala_install_cleancache() {
    3846
     
    9098    //Grupo para el cache
    9199    $ctala_group = "ctala";
    92 //Segundos en una semana a cachear el valor.
    93     $ctala_expire = 604800;
     100    //Segundos en un día.
     101    $ctala_expire = 86400;
    94102
     103    $options = get_option('ctala_options_pesos');
    95104    if ($paypal_args['currency_code'] == 'CLP') {
    96105
    97         $valorDolar = wp_cache_get('clp_usd_ctala', $ctala_group);
    98         if (false === $valorDolar) {
    99             if (function_exists('curl_version')) {
    100                 $file = 'latest.json';
    101                 $appId = '3d2f0769c4fc42278faffd3933a23dd6';
    102                 $url = "http://openexchangerates.org/api/$file?app_id=$appId";
    103 // Open CURL session:
    104                 $ch = curl_init($url);
    105                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     106        // Si está activada la opción de usar el dolar fijo, se usa el valro del dolar del sistema
     107        if (isset($options["id_check_usarfijodolar"]) && $options["id_check_usarfijodolar"] == "on") {
     108            $valorDolar = $options["id_fijo_dolar"];
     109            error_log(print_r("Se usa el valor por defecto del dolar : $valorDolar", true));
     110        } else {
    106111
    107 // Get the data:
    108                 $json = curl_exec($ch);
    109                 curl_close($ch);
     112            $valorDolar = wp_cache_get('clp_usd_ctala', $ctala_group);
    110113
    111 // Decode JSON response:
    112                 $exchangeRates = json_decode($json);
    113                 $valorDolar = $exchangeRates->rates->CLP;
    114             } else {
    115                 $valorDolar = 630; // Este es el valor por defecto.
     114            if (false === $valorDolar) {
     115                if (function_exists('curl_version') && isset($options["id_openkey"])) {
     116                    error_log(print_r("ENTRANDO AL A FUNCION", true));
     117                    $appId = $options["id_openkey"];
     118                    $openXChange = new OpenExchangeRateCT($appId);
     119                    $valorDolar = $openXChange->valorDolar();
     120                } else {
     121                    $valorDolar = 690; // Este es el valor por defecto.
     122                }
     123                wp_cache_set('clp_usd_ctala', $valorDolar, $ctala_group, $ctala_expire);
    116124            }
    117             wp_cache_set('clp_usd_ctala', $valorDolar, $ctala_group, $ctala_expire);
    118125        }
    119 
    120126        $convert_rate = $valorDolar; //set the converting rate
    121127        $paypal_args['currency_code'] = 'USD'; //change CLP to USD
     
    125131            $paypal_args['amount_' . $i] = round($paypal_args['amount_' . $i] / $convert_rate, 2);
    126132            ++$i;
     133        }
     134        if (isset($paypal_args['discount_amount_cart']) && $paypal_args['discount_amount_cart'] > 0) {
     135            $paypal_args['discount_amount_cart'] = round($paypal_args['discount_amount_cart'] / $convert_rate, 2);
     136        }
     137
     138        if (isset($paypal_args['tax_cart']) && $paypal_args['tax_cart'] > 0) {
     139            $paypal_args['tax_cart'] = round($paypal_args['tax_cart'] / $convert_rate, 2);
    127140        }
    128141    }
Note: See TracChangeset for help on using the changeset viewer.