pub fn replace_ship_county_dependent(
    rrc: &mut RootRenderingComponent,
    field_value: String,
    record: &Record,
) {
    let country_name = if field_value == "IT" {
        "Italia".to_string()
    } else {
        isocountriesmod::get_country_name(&field_value)
    };
    rrc.reqbody = rrc.reqbody.replace("ship-country-name", &country_name);

    let market_lang = if field_value == "IT" {
        "it".to_string()
    } else {
        "en".to_string()
    };
    rrc.reqbody = rrc.reqbody.replace("market-lang", &market_lang);

    let vendita_or_sale = if field_value == "IT" {
        "vendita".to_string()
    } else {
        "sale".to_string()
    };
    rrc.reqbody = rrc.reqbody.replace("vendita-or-sale", &vendita_or_sale);

    let trasportatore = if field_value == "IT" {
        "GLS".to_string()
    } else {
        //SPRING se la spedizione costa 11 euro. DHL se costa 16€
        let mut xx = "".to_string();
        for rf2 in record {
            if rf2.0 == "shipping-price" {
                //from string to decimal
                let f64_shipping_price: f64 = unwrap!(rf2.1.parse());
                //floats are difficult to be equal. It is better a comparison.
                if f64_shipping_price < 14.0 {
                    xx = "SPRING".to_string();
                } else {
                    xx = "DHL".to_string();
                }
            }
        }
        //return from block
        xx
    };
    rrc.reqbody = rrc.reqbody.replace("GLS-or-SPRING-or-DHL", &trasportatore);
    //cod-spedizione
    let cod_spedizione = if trasportatore == "GLS" {
        "SHIP AMA"
    } else if trasportatore == "SPRING" {
        "SHIP SPR"
    } else if trasportatore == "DHL" {
        "SHIP DHL"
    } else {
        ""
    };
    rrc.reqbody = rrc.reqbody.replace("cod-spedizione", cod_spedizione);
    //in the future, the name-spedizioni could be fetch from webservice, but now it is not a priority.
    //name-spedizione
    let name_spedizione = if trasportatore == "GLS" {
        "Spedizione Italia - AMAZON"
    } else if trasportatore == "SPRING" {
        "Spedizione Int. / Int. Shipping - SPRING"
    } else if trasportatore == "DHL" {
        "Spedizione Int. / Int. Shipping - DHL"
    } else {
        ""
    };
    rrc.reqbody = rrc.reqbody.replace("name-spedizione", name_spedizione);
}
///some data are dependent of the ship_country
some data are dependent of the ship_country
some data are dependent of the ship_country
pub fn replace_ship_county_dependent(
    rrc: &mut RootRenderingComponent,
    field_value: String,
    record: &Record,
) {
    let country_name = if field_value == "IT" {
        "Italia".to_string()
    } else {
        isocountriesmod::get_country_name(&field_value)
    };
    rrc.reqbody = rrc.reqbody.replace("ship-country-name", &country_name);
    let market_lang = if field_value == "IT" {
        "it".to_string()
    } else {
        "en".to_string()
    };
    rrc.reqbody = rrc.reqbody.replace("market-lang", &market_lang);
    let vendita_or_sale = if field_value == "IT" {
        "vendita".to_string()
    } else {
        "sale".to_string()
    };
    rrc.reqbody = rrc.reqbody.replace("vendita-or-sale", &vendita_or_sale);
    let trasportatore = if field_value == "IT" {
        "GLS".to_string()
    } else {
        //SPRING se la spedizione costa 11 euro. DHL se costa 16€
        let mut xx = "".to_string();
        for rf2 in record {
            if rf2.0 == "shipping-price" {
                //from string to decimal
                let f64_shipping_price: f64 = unwrap!(rf2.1.parse());
                //floats are difficult to be equal. It is better a comparison.
                if f64_shipping_price < 14.0 {
                    xx = "SPRING".to_string();
                } else {
                    xx = "DHL".to_string();
                }
            }
        }
        //return from block
        xx
    };
    rrc.reqbody = rrc.reqbody.replace("GLS-or-SPRING-or-DHL", &trasportatore);
    //cod-spedizione
    let cod_spedizione = if trasportatore == "GLS" {
        "SHIP AMA"
    } else if trasportatore == "SPRING" {
        "SHIP SPR"
    } else if trasportatore == "DHL" {
        "SHIP DHL"
    } else {
        ""
    };
    rrc.reqbody = rrc.reqbody.replace("cod-spedizione", cod_spedizione);
    //in the future, the name-spedizioni could be fetch from webservice, but now it is not a priority.
    //name-spedizione
    let name_spedizione = if trasportatore == "GLS" {
        "Spedizione Italia - AMAZON"
    } else if trasportatore == "SPRING" {
        "Spedizione Int. / Int. Shipping - SPRING"
    } else if trasportatore == "DHL" {
        "Spedizione Int. / Int. Shipping - DHL"
    } else {
        ""
    };
    rrc.reqbody = rrc.reqbody.replace("name-spedizione", name_spedizione);
}
pub fn replace_ship_county_dependent ( rrc : & mut RootRenderingComponent , field_value : String , record : & Record , ) { let country_name = if field_value == " " { " " . to_string ( ) } else { isocountriesmod :: get_country_name ( & field_value ) } ; rrc . reqbody = rrc . reqbody . replace ( " " , & country_name ) ; let market_lang = if field_value == " " { " " . to_string ( ) } else { " " . to_string ( ) } ; rrc . reqbody = rrc . reqbody . replace ( " " , & market_lang ) ; let vendita_or_sale = if field_value == " " { " " . to_string ( ) } else { " " . to_string ( ) } ; rrc . reqbody = rrc . reqbody . replace ( " " , & vendita_or_sale ) ; let trasportatore = if field_value == " " { " " . to_string ( ) } else { //SPRING se la spedizione costa 11 euro. DHL se costa 16€ let mut xx = " " . to_string ( ) ; for rf2 in record { if rf2 . 0 == " " { //from string to decimal let f64_shipping_price : f64 = unwrap ! ( rf2 1 parse ( ) ) ; //floats are difficult to be equal. It is better a comparison. if f64_shipping_price < 14.0 { xx = " " . to_string ( ) ; } else { xx = " " . to_string ( ) ; } } } //return from block xx } ; rrc . reqbody = rrc . reqbody . replace ( " " , & trasportatore ) ; //cod-spedizione let cod_spedizione = if trasportatore == " " { " " } else if trasportatore == " " { " " } else if trasportatore == " " { " " } else { " " } ; rrc . reqbody = rrc . reqbody . replace ( " " , cod_spedizione ) ; //in the future, the name-spedizioni could be fetch from webservice, but now it is not a priority. //name-spedizione let name_spedizione = if trasportatore == " " { " " } else if trasportatore == " " { " " } else if trasportatore == " " { " " } else { " " } ; rrc . reqbody = rrc . reqbody . replace ( " " , name_spedizione ) ; }
some data are dependent of the ship_country
some data are dependent of the ship_country
rrc
&mut RootRenderingComponent
field_value
String
record
&Record