You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
153 lines
5.7 KiB
C#
153 lines
5.7 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Amazon.SellingPartnerApiSDK.AmazonSpApiSDK.Models.Exceptions;
|
|
using Amazon.SellingPartnerApiSDK.AmazonSpApiSDK.Runtime;
|
|
|
|
namespace Amazon.SellingPartnerApiSDK.Misc
|
|
{
|
|
/// <summary>
|
|
/// Amazon市场信息
|
|
/// https://developer-docs.amazon.com/sp-api/docs/marketplace-ids
|
|
/// </summary>
|
|
public class MarketPlace
|
|
{
|
|
private MarketPlace(string id, Region region, Country country, BaseXML.BaseCurrencyCode currencyCode)
|
|
{
|
|
Id = id;
|
|
Region = region;
|
|
Country = country;
|
|
CurrencyCode = currencyCode;
|
|
}
|
|
|
|
public string Id { get; set; }
|
|
public Region Region { get; set; }
|
|
public Country Country { get; set; }
|
|
public BaseXML.BaseCurrencyCode CurrencyCode { get; set; }
|
|
|
|
|
|
//NorthAmerica
|
|
public static MarketPlace US =>
|
|
new MarketPlace("ATVPDKIKX0DER", Region.NorthAmerica, Country.US, BaseXML.BaseCurrencyCode.USD);
|
|
|
|
public static MarketPlace Canada => new MarketPlace("A2EUQ1WTGCTBG2", Region.NorthAmerica, Country.CA,
|
|
BaseXML.BaseCurrencyCode.CAD);
|
|
|
|
public static MarketPlace Mexico => new MarketPlace("A1AM78C64UM0Y8", Region.NorthAmerica, Country.MX,
|
|
BaseXML.BaseCurrencyCode.MXN);
|
|
|
|
public static MarketPlace Brazil => new MarketPlace("A2Q3Y263D00KWC", Region.NorthAmerica, Country.BR,
|
|
BaseXML.BaseCurrencyCode.BRL);
|
|
|
|
//Europe
|
|
public static MarketPlace Spain =>
|
|
new MarketPlace("A1RKKUPIHCS9HS", Region.Europe, Country.ES, BaseXML.BaseCurrencyCode.EUR);
|
|
|
|
public static MarketPlace UnitedKingdom =>
|
|
new MarketPlace("A1F83G8C2ARO7P", Region.Europe, Country.UK, BaseXML.BaseCurrencyCode.GBP);
|
|
|
|
public static MarketPlace France =>
|
|
new MarketPlace("A13V1IB3VIYZZH", Region.Europe, Country.FR, BaseXML.BaseCurrencyCode.EUR);
|
|
|
|
public static MarketPlace Belgium =>
|
|
new MarketPlace("AMEN7PMS3EDWL", Region.Europe, Country.BE, BaseXML.BaseCurrencyCode.EUR);
|
|
|
|
public static MarketPlace Netherlands =>
|
|
new MarketPlace("A1805IZSGTT6HS", Region.Europe, Country.NL, BaseXML.BaseCurrencyCode.EUR);
|
|
|
|
public static MarketPlace Germany =>
|
|
new MarketPlace("A1PA6795UKMFR9", Region.Europe, Country.DE, BaseXML.BaseCurrencyCode.EUR);
|
|
|
|
public static MarketPlace Italy =>
|
|
new MarketPlace("APJ6JRA9NG5V4", Region.Europe, Country.IT, BaseXML.BaseCurrencyCode.EUR);
|
|
|
|
public static MarketPlace Sweden =>
|
|
new MarketPlace("A2NODRKZP88ZB9", Region.Europe, Country.SE, BaseXML.BaseCurrencyCode.SEK);
|
|
|
|
//ZA
|
|
|
|
public static MarketPlace Poland =>
|
|
new MarketPlace("A1C3SOZRARQ6R3", Region.Europe, Country.PL, BaseXML.BaseCurrencyCode.PLN);
|
|
|
|
public static MarketPlace Egypt =>
|
|
new MarketPlace("ARBP9OOSHTCHU", Region.Europe, Country.EG, BaseXML.BaseCurrencyCode.EGP);
|
|
|
|
|
|
public static MarketPlace Turkey =>
|
|
new MarketPlace("A33AVAJ2PDY3EV", Region.Europe, Country.TR, BaseXML.BaseCurrencyCode.TRY);
|
|
|
|
public static MarketPlace SaudiArabia =>
|
|
new MarketPlace("A17E79C6D8DWNP", Region.Europe, Country.SA, BaseXML.BaseCurrencyCode.SAR);
|
|
|
|
public static MarketPlace UnitedArabEmirates => new MarketPlace("A2VIGQ35RCS4UG", Region.Europe, Country.AE,
|
|
BaseXML.BaseCurrencyCode.AED);
|
|
|
|
public static MarketPlace India =>
|
|
new MarketPlace("A21TJRUUN4KGV", Region.Europe, Country.IN, BaseXML.BaseCurrencyCode.INR);
|
|
|
|
|
|
//FarEast
|
|
public static MarketPlace Singapore =>
|
|
new MarketPlace("A19VAU5U5O7RUS", Region.FarEast, Country.SG, BaseXML.BaseCurrencyCode.SGD);
|
|
|
|
public static MarketPlace Australia =>
|
|
new MarketPlace("A39IBJ37TRP1C6", Region.FarEast, Country.AU, BaseXML.BaseCurrencyCode.AUD);
|
|
|
|
public static MarketPlace Japan =>
|
|
new MarketPlace("A1VC38T7YXB528", Region.FarEast, Country.JP, BaseXML.BaseCurrencyCode.JPY);
|
|
|
|
public static ICollection<MarketPlace> GetMarketPlaceList()
|
|
{
|
|
var list = new List<MarketPlace>
|
|
{
|
|
//NorthAmerica
|
|
US,
|
|
Canada,
|
|
Mexico,
|
|
Brazil,
|
|
//Europe
|
|
Spain,
|
|
UnitedKingdom,
|
|
France,
|
|
Belgium,
|
|
Netherlands,
|
|
Germany,
|
|
Italy,
|
|
Sweden,
|
|
Egypt,
|
|
Poland,
|
|
Turkey,
|
|
UnitedArabEmirates,
|
|
India,
|
|
SaudiArabia,
|
|
//FarEast
|
|
Singapore,
|
|
Australia,
|
|
Japan
|
|
};
|
|
|
|
return list;
|
|
}
|
|
|
|
public static MarketPlace GetMarketPlaceById(string marketPlaceId)
|
|
{
|
|
var list = GetMarketPlaceList();
|
|
var marketPlace = list.FirstOrDefault(a => a.Id == marketPlaceId);
|
|
if (marketPlace == null)
|
|
throw new AmazonInvalidInputException(
|
|
"InvalidInput, Unable to found the MarketPlace by the given MarketPlaceId!");
|
|
|
|
return marketPlace;
|
|
}
|
|
|
|
public static MarketPlace GetMarketplaceByCountryCode(string countryCode)
|
|
{
|
|
var list = GetMarketPlaceList();
|
|
var marketPlace = list.FirstOrDefault(a => a.Country.Code == countryCode);
|
|
if (marketPlace == null)
|
|
throw new AmazonInvalidInputException(
|
|
"InvalidInput, Unable to found the MarketPlace by the given countryCode!");
|
|
|
|
return marketPlace;
|
|
}
|
|
}
|
|
} |