public string SetConfig(string clientId, string shipmateUsername, string shipmatePassword, string shipmateToken, string shipmateServiceKey, string shipmateBaseUrl, string carrierTrackAndTraceUrl, string DeliveryToName, string DeliveryToLine1, string DeliveryToLine2, string DeliveryToLine3, string DeliveryToCompanyName, string DeliveryToTelephone, string DeliveryToEmail, string DeliveryToCity, string DeliveryToPostcode, string DeliveryToCountry) { ShipmateConfig config = new ShipmateConfig() { ShipmateUsername = shipmateUsername, ShipmatePassword = Encrypt(shipmatePassword), ShipmateToken = Encrypt(shipmateToken), ShipmateServiceKey = shipmateServiceKey, ShipmateBaseUrl = shipmateBaseUrl, CarrierTrackAndTraceUrl = carrierTrackAndTraceUrl, DeliveryToName = DeliveryToName, DeliveryToLine1 = DeliveryToLine1, DeliveryToLine2 = DeliveryToLine2, DeliveryToLine3 = DeliveryToLine3, DeliveryToCompanyName = DeliveryToCompanyName, DeliveryToTelephone = DeliveryToTelephone, DeliveryToEmail = DeliveryToEmail, DeliveryToCity = DeliveryToCity, DeliveryToPostcode = DeliveryToPostcode, DeliveryToCountry = DeliveryToCountry }; ShipmateConfigBLL shipmateConfigBLL = new ShipmateConfigBLL(); return(shipmateConfigBLL.ShipmateConfig(clientId: clientId, config: (new JavaScriptSerializer()).Serialize(config))); }
public string GetCarrierTrackAndTraceUrl(string trackingReference) { ShipmateConfigBLL shipmateConfigBLL = new ShipmateConfigBLL(); string result = shipmateConfigBLL.ShipmateConfig(trackingReference: trackingReference); ShipmateConfig shipmateConfig = (new JavaScriptSerializer()).Deserialize <ShipmateConfig>(result); return(shipmateConfig.CarrierTrackAndTraceUrl); }
public Shipmate(string clientId) { string message; _clientId = clientId; _shipmateConfig = GetConfig(clientId, out message); if (message != "Success") { throw new Exception(message); } }
public ShipmateConfig GetConfig(string clientId, out string message) { ShipmateConfig shipmateConfig = null; ShipmateConfigBLL shipmateConfigBLL = new ShipmateConfigBLL(); string result = shipmateConfigBLL.ShipmateConfig(clientId: clientId); if (result == "ClientId does not exist!") { message = "ClientId does not exist!"; } else if (string.IsNullOrEmpty(result)) { message = "Config is empty"; } else { message = "Success"; shipmateConfig = (new JavaScriptSerializer()).Deserialize <ShipmateConfig>(result); shipmateConfig.ShipmatePassword = Decrypt(shipmateConfig.ShipmatePassword); shipmateConfig.ShipmateToken = Decrypt(shipmateConfig.ShipmateToken); } return(shipmateConfig); }