public static function getByLangShopSiteAndUsername($id_lang, $id_shop, $ebay_country, $ebay_user_identifier, $template_content)
    {
        $ebay_country_spec = EbayCountrySpec::getInstanceByKey($ebay_country);
        $ebay_site_id = $ebay_country_spec->getSiteID();
        $sql = 'SELECT `id_ebay_profile` 
			FROM `' . _DB_PREFIX_ . 'ebay_profile` ep
			WHERE ep.`id_lang` = ' . (int) $id_lang . '
			AND ep.`id_shop` = ' . (int) $id_shop . '
			AND ep.`ebay_site_id` = ' . (int) $ebay_site_id . '
			AND ep.`ebay_user_identifier` = \'' . pSQL($ebay_user_identifier) . '\'';
        if ($id_profile = Db::getInstance()->getValue($sql)) {
            return new EbayProfile($id_profile);
        }
        // otherwise create the eBay profile
        $ebay_profile = new EbayProfile();
        $ebay_profile->id_lang = $id_lang;
        $ebay_profile->id_shop = $id_shop;
        $ebay_profile->ebay_site_id = $ebay_site_id;
        $ebay_profile->ebay_user_identifier = $ebay_user_identifier;
        $returns_policy_configuration = new EbayReturnsPolicyConfiguration();
        $returns_policy_configuration->save();
        $ebay_profile->id_ebay_returns_policy_configuration = $returns_policy_configuration->id;
        $ebay_profile->save();
        $ebay_profile->setConfiguration('EBAY_COUNTRY_DEFAULT', $ebay_country);
        $ebay_profile->setPicturesSettings();
        $ebay_profile->setDefaultConfig($template_content);
        return $ebay_profile;
    }
 public static function createPreviousDefaultConfiguration()
 {
     $returns_policy_configuration = new EbayReturnsPolicyConfiguration();
     $returns_policy_configuration->ebay_returns_within = Configuration::get('EBAY_RETURNS_WITHIN');
     $returns_policy_configuration->ebay_returns_who_pays = Configuration::get('EBAY_RETURNS_WHO_PAYS');
     $returns_policy_configuration->ebay_returns_description = Configuration::get('EBAY_RETURNS_DESCRIPTION');
     $returns_policy_configuration->ebay_returns_accepted_option = Configuration::get('EBAY_RETURNS_ACCEPTED_OPTION');
     $returns_policy_configuration->save();
     return $returns_policy_configuration->id;
 }