public void AddInformation(PaymentInformationType type, string data) { if (!string.IsNullOrEmpty(data)) { SwarmDb.GetDatabaseForWriting().CreatePaymentInformation(this.Identity, type, data); } }
private static BasicPaymentInformation ReadPaymentInformationFromDataReader(IDataRecord reader) { string dataTypeString = reader.GetString(2); string data = reader.GetString(3); PaymentInformationType dataType = (PaymentInformationType)Enum.Parse(typeof(PaymentInformationType), dataTypeString, true); return(new BasicPaymentInformation(dataType, data)); }
private string GetSinglePaymentInformation(PaymentInformationType type) { PopulateInformation(); foreach (PaymentInformation infoPiece in informationList) { if (infoPiece.Type == type) { return(infoPiece.Data); } } return(null); }
public int CreatePaymentInformation(int paymentId, PaymentInformationType type, string data) { using (DbConnection connection = GetMySqlDbConnection()) { connection.Open(); DbCommand command = GetDbCommand("CreatePaymentInformation", connection); command.CommandType = CommandType.StoredProcedure; AddParameterWithName(command, "paymentId", paymentId); AddParameterWithName(command, "dataTypeString", type.ToString()); AddParameterWithName(command, "data", data); return(Convert.ToInt32(command.ExecuteScalar())); } }
public BasicPaymentInformation(PaymentInformationType type, string data) { Type = type; Data = data; }
private FreightRateRequest BuildUPSFreightRateRequestForShipment(IShipment shipment) { FreightRateRequest freightRateRequest = new FreightRateRequest(); RequestType request = new RequestType(); String[] requestOption = { "1" }; //Ground request.RequestOption = requestOption; freightRateRequest.Request = request; /** ****************ShipFrom******************************* */ ShipFromType shipFrom = new ShipFromType(); AddressType shipFromAddress = new AddressType(); String[] shipFromAddressLines = { shipment.SourceAddress.Street, shipment.SourceAddress.Street2 }; shipFromAddress.AddressLine = shipFromAddressLines; shipFromAddress.City = shipment.SourceAddress.City; shipFromAddress.StateProvinceCode = shipment.SourceAddress.RegionBvin; shipFromAddress.PostalCode = shipment.SourceAddress.PostalCode; shipFromAddress.CountryCode = shipment.SourceAddress.CountryData.IsoCode; shipFrom.Address = shipFromAddress; freightRateRequest.ShipFrom = shipFrom; /** ****************ShipFrom******************************* */ /** ****************ShipTo*************************************** */ ShipToType shipTo = new ShipToType(); AddressType shipToAddress = new AddressType(); String[] shipToAddressLines = { shipment.DestinationAddress.Street, shipment.DestinationAddress.Street2 }; shipToAddress.AddressLine = shipToAddressLines; shipToAddress.City = shipment.DestinationAddress.City; shipToAddress.StateProvinceCode = shipment.DestinationAddress.RegionBvin; shipToAddress.PostalCode = shipment.DestinationAddress.PostalCode; shipToAddress.CountryCode = shipment.DestinationAddress.CountryData.IsoCode; shipTo.Address = shipToAddress; freightRateRequest.ShipTo = shipTo; /** ****************ShipTo*************************************** */ /** ***************PaymentInformationType************************* */ PaymentInformationType paymentInfo = new PaymentInformationType(); PayerType payer = new PayerType(); payer.AttentionName = Settings.PayerName; //Required PayerName payer.Name = Settings.PayerName; AddressType payerAddress = new AddressType(); String[] payerAddressLines = { shipment.DestinationAddress.Street }; payerAddress.AddressLine = payerAddressLines; payerAddress.City = shipment.DestinationAddress.City; payerAddress.StateProvinceCode = shipment.DestinationAddress.RegionBvin; payerAddress.PostalCode = shipment.DestinationAddress.PostalCode; payerAddress.CountryCode = shipment.DestinationAddress.CountryData.IsoCode; payer.Address = payerAddress; paymentInfo.Payer = payer; RateCodeDescriptionType shipBillOption = new RateCodeDescriptionType(); shipBillOption.Code = ((int)GlobalSettings.BillingOption).ToString(); shipBillOption.Description = GlobalSettings.BillingOption.ToString(); paymentInfo.ShipmentBillingOption = shipBillOption; freightRateRequest.PaymentInformation = paymentInfo; /** ***************PaymentInformationType************************* */ /** ***************Service************************************** */ RateCodeDescriptionType service = new RateCodeDescriptionType(); service.Code = Settings.ServiceCodeFilter[0].Code; service.Description = Settings.ServiceCodeFilter[0].DisplayName; freightRateRequest.Service = service; /** ***************Service************************************** */ /** **************HandlingUnitOne************************************* */ HandlingUnitType handUnitType = new HandlingUnitType(); handUnitType.Quantity = shipment.Items.Count.ToString(); RateCodeDescriptionType rateCodeDescType = new RateCodeDescriptionType(); rateCodeDescType.Code = GlobalSettings.HandleOneUnitType.ToString(); rateCodeDescType.Description = GlobalSettings.HandleOneUnitType.ToString(); handUnitType.Type = rateCodeDescType; freightRateRequest.HandlingUnitOne = handUnitType; /** **************HandlingUnitOne************************************* */ /** **************Commodity************************************* */ // Optimize Packages for Weight var optimizedPackages = OptimizeSingleGroup(shipment); var ignoreDimensions = GlobalSettings.IgnoreDimensions; List <CommodityType> commodityArray = new List <CommodityType>(); foreach (var pak in optimizedPackages) { //Prepare Commodity Item CommodityType commodity = WriteSingleCommidityPackage(pak, ignoreDimensions); commodityArray.Add(commodity); } freightRateRequest.Commodity = commodityArray.ToArray(); /** **************Commodity************************************* */ return(freightRateRequest); }
public BasicPaymentInformation (PaymentInformationType type, string data) { this.Type = type; this.Data = data; }
private string GetSinglePaymentInformation (PaymentInformationType type) { PopulateInformation(); foreach (PaymentInformation infoPiece in informationList) { if (infoPiece.Type == type) { return infoPiece.Data; } } return null; }
public void AddInformation (PaymentInformationType type, string data) { if (!string.IsNullOrEmpty(data)) { SwarmDb.GetDatabaseForWriting().CreatePaymentInformation(this.Identity, type, data); } }
static void Main() { try { FreightRateService freightRateService = new FreightRateService(); FreightRateRequest freightRateRequest = new FreightRateRequest(); RequestType request = new RequestType(); String[] requestOption = { "RateChecking Option" }; request.RequestOption = requestOption; freightRateRequest.Request = request; /** ****************ShipFrom******************************* */ ShipFromType shipFrom = new ShipFromType(); AddressType shipFromAddress = new AddressType(); String[] shipFromAddressLines = { "ShipFrom address" }; shipFromAddress.AddressLine = shipFromAddressLines; shipFromAddress.City = "ShipFrom city"; shipFromAddress.StateProvinceCode = "ShipFrom state province code"; shipFromAddress.PostalCode = "ShipFrom postal code"; shipFromAddress.CountryCode = "ShipFrom country code"; shipFrom.Address = shipFromAddress; shipFrom.AttentionName = "ShipFrom attention name"; shipFrom.Name = "ShipFrom Name"; freightRateRequest.ShipFrom = shipFrom; /** ****************ShipFrom******************************* */ /** ****************ShipTo*************************************** */ ShipToType shipTo = new ShipToType(); AddressType shipToAddress = new AddressType(); String[] shipToAddressLines = { "ShipTo address line" }; shipToAddress.AddressLine = shipToAddressLines; shipToAddress.City = "ShipTo city"; shipToAddress.StateProvinceCode = "ShipTo state province code"; shipToAddress.PostalCode = "ShipTo postal code"; shipToAddress.CountryCode = "ShipTo country code"; shipTo.Address = shipToAddress; shipTo.AttentionName = "ShipTo attention name"; shipTo.Name = "ShipTo Name"; freightRateRequest.ShipTo = shipTo; /** ****************ShipTo*************************************** */ /** ***************PaymentInformationType************************* */ PaymentInformationType paymentInfo = new PaymentInformationType(); PayerType payer = new PayerType(); payer.AttentionName = "Payer attention name"; payer.Name = "Payer name"; payer.ShipperNumber = "Payer shipper number"; AddressType payerAddress = new AddressType(); String[] payerAddressLines = { "Payer address line" }; payerAddress.AddressLine = payerAddressLines; payerAddress.City = "Payer city"; payerAddress.StateProvinceCode = "Payer state province code"; payerAddress.PostalCode = "Payer postal code"; payerAddress.CountryCode = "Payer country code"; payer.Address = payerAddress; paymentInfo.Payer = payer; RateCodeDescriptionType shipBillOption = new RateCodeDescriptionType(); shipBillOption.Code = "Ship bill option"; shipBillOption.Description = "Ship bill description"; paymentInfo.ShipmentBillingOption = shipBillOption; freightRateRequest.PaymentInformation = paymentInfo; /** ***************PaymentInformationType************************* */ //Below code use dummy data for referenced. Please update as required /** ***************Service************************************** */ RateCodeDescriptionType service = new RateCodeDescriptionType(); service.Code = "309"; service.Description = "UPS Ground Freight"; freightRateRequest.Service = service; /** ***************Service************************************** */ /** **************Commodity************************************* */ CommodityType commodity = new CommodityType(); CommodityValueType commValue = new CommodityValueType(); commValue.CurrencyCode = "USD"; commValue.MonetaryValue = "5670"; commodity.CommodityValue = commValue; commodity.NumberOfPieces = "20"; RateCodeDescriptionType packagingType = new RateCodeDescriptionType(); packagingType.Code = "BAG"; packagingType.Description = "BAG"; commodity.PackagingType = packagingType; WeightType weight = new WeightType(); UnitOfMeasurementType unitOfMeasurement = new UnitOfMeasurementType(); unitOfMeasurement.Code = "LBS"; unitOfMeasurement.Description = "Pounds"; weight.UnitOfMeasurement = unitOfMeasurement; weight.Value = "200"; commodity.Weight = weight; commodity.Description = "LCD TVS"; CommodityValueType commodityValue = new CommodityValueType(); commodityValue.CurrencyCode = "USD"; commodityValue.MonetaryValue = "100"; commodity.CommodityValue = commodityValue; commodity.Description = "LCD TVS"; commodity.FreightClass = "60"; CommodityType[] commodityArray = { commodity }; freightRateRequest.Commodity = commodityArray; /** **************Commodity************************************* */ /** **************HandlingUnitOne************************************* */ HandlingUnitType handUnitType = new HandlingUnitType(); handUnitType.Quantity = "1"; RateCodeDescriptionType rateCodeDescType = new RateCodeDescriptionType(); rateCodeDescType.Code = "SKD"; rateCodeDescType.Description = "SKID"; handUnitType.Type = rateCodeDescType; freightRateRequest.HandlingUnitOne = handUnitType; /** **************HandlingUnitOne************************************* */ UPSSecurity upss = new UPSSecurity(); UPSSecurityServiceAccessToken upsSvcToken = new UPSSecurityServiceAccessToken(); upsSvcToken.AccessLicenseNumber = "Your License Number"; upss.ServiceAccessToken = upsSvcToken; UPSSecurityUsernameToken upsSecUsrnameToken = new UPSSecurityUsernameToken(); upsSecUsrnameToken.Username = "******"; upsSecUsrnameToken.Password = "******"; upss.UsernameToken = upsSecUsrnameToken; freightRateService.UPSSecurityValue = upss; System.Net.ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy(); Console.WriteLine(freightRateRequest); FreightRateResponse freightRateResponse = freightRateService.ProcessFreightRate(freightRateRequest); Console.WriteLine("Response code: " + freightRateResponse.Response.ResponseStatus.Code); Console.WriteLine("Response description: " + freightRateResponse.Response.ResponseStatus.Description); Console.ReadKey(); } catch (System.Web.Services.Protocols.SoapException ex) { Console.WriteLine(""); Console.WriteLine("---------Freight Rate Web Service returns error----------------"); Console.WriteLine("---------\"Hard\" is user error \"Transient\" is system error----------------"); Console.WriteLine("SoapException Message= " + ex.Message); Console.WriteLine(""); Console.WriteLine("SoapException Category:Code:Message= " + ex.Detail.LastChild.InnerText); Console.WriteLine(""); Console.WriteLine("SoapException XML String for all= " + ex.Detail.LastChild.OuterXml); Console.WriteLine(""); Console.WriteLine("SoapException StackTrace= " + ex.StackTrace); Console.WriteLine("-------------------------"); Console.WriteLine(""); } catch (System.ServiceModel.CommunicationException ex) { Console.WriteLine(""); Console.WriteLine("--------------------"); Console.WriteLine("CommunicationException= " + ex.Message); Console.WriteLine("CommunicationException-StackTrace= " + ex.StackTrace); Console.WriteLine("-------------------------"); Console.WriteLine(""); } catch (Exception ex) { Console.WriteLine(""); Console.WriteLine("-------------------------"); Console.WriteLine(" General Exception= " + ex.Message); Console.WriteLine(" General Exception-StackTrace= " + ex.StackTrace); Console.WriteLine("-------------------------"); } finally { Console.ReadKey(); } }
public int CreatePaymentInformation(int paymentId, PaymentInformationType type, string data) { using (DbConnection connection = GetMySqlDbConnection()) { connection.Open(); DbCommand command = GetDbCommand("CreatePaymentInformation", connection); command.CommandType = CommandType.StoredProcedure; AddParameterWithName(command, "paymentId", paymentId); AddParameterWithName(command, "dataTypeString", type.ToString()); AddParameterWithName(command, "data", data); return Convert.ToInt32(command.ExecuteScalar()); } }
static void Main() { try { FreightShipService freightShipService = new FreightShipService(); FreightShipRequest freightShipRequest = new FreightShipRequest(); RequestType request = new RequestType(); String[] requestOption = { "1" }; request.RequestOption = requestOption; freightShipRequest.Request = request; ShipmentType shipment = new ShipmentType(); /** ****************ShipFrom******************************* */ ShipFromType shipFrom = new ShipFromType(); FreightShipAddressType shipFromAddress = new FreightShipAddressType(); String[] shipFromAddressLines = { "ShipFrom address line" }; shipFromAddress.AddressLine = shipFromAddressLines; shipFromAddress.City = "Roswell"; shipFromAddress.StateProvinceCode = "GA"; shipFromAddress.PostalCode = "30076"; shipFromAddress.CountryCode = "US"; shipFrom.Address = shipFromAddress; shipFrom.AttentionName = "XYZ Associates"; shipFrom.Name = "XYZ Associates"; FreightShipPhoneType shipFromPhone = new FreightShipPhoneType(); shipFromPhone.Number = "123456789"; shipFromPhone.Extension = "34567"; shipFrom.Phone = shipFromPhone; shipFrom.EMailAddress = "*****@*****.**"; shipment.ShipFrom = shipFrom; /** ****************ShipFrom******************************* */ shipment.ShipperNumber = "Your shipper number"; /** ****************ShipTo*************************************** */ ShipToType shipTo = new ShipToType(); FreightShipAddressType shipToAddress = new FreightShipAddressType(); String[] shipToAddressLines = { "ShipTo address line" }; shipToAddress.AddressLine = shipToAddressLines; shipToAddress.City = "Roswell"; shipToAddress.StateProvinceCode = "GA"; shipToAddress.PostalCode = "30076"; shipToAddress.CountryCode = "US"; shipTo.Address = shipFromAddress; shipTo.AttentionName = "PQR Associates"; shipTo.Name = "PQR"; FreightShipPhoneType shipToPhone = new FreightShipPhoneType(); shipToPhone.Number = "123456789"; shipToPhone.Extension = "34567"; shipTo.Phone = shipToPhone; shipTo.EMailAddress = "*****@*****.**"; shipment.ShipTo = shipTo; /** ****************ShipTo*************************************** */ /** ***************PaymentInformationType************************* */ PaymentInformationType paymentInfo = new PaymentInformationType(); PayerType payer = new PayerType(); payer.AttentionName = "Mr. XYZ"; payer.Name = "XYZ Associates"; FreightShipPhoneType payerPhone = new FreightShipPhoneType(); payerPhone.Number = "123456789"; payerPhone.Extension = "3456"; payer.Phone = payerPhone; payer.ShipperNumber = "Your Shipper Number"; payer.EMailAddress = "*****@*****.**"; FreightShipAddressType payerAddress = new FreightShipAddressType(); String[] payerAddressLines = { "Payer address line" }; payerAddress.AddressLine = payerAddressLines; payerAddress.City = "Roswell"; payerAddress.StateProvinceCode = "GA"; payerAddress.PostalCode = "30075"; payerAddress.CountryCode = "US"; payer.Address = payerAddress; paymentInfo.Payer = payer; ShipCodeDescriptionType shipBillOption = new ShipCodeDescriptionType(); shipBillOption.Code = "10"; shipBillOption.Description = "PREPAID"; paymentInfo.ShipmentBillingOption = shipBillOption; shipment.PaymentInformation = paymentInfo; /** ***************PaymentInformationType************************* */ /** ***************Service************************************** */ ShipCodeDescriptionType service = new ShipCodeDescriptionType(); service.Code = "309"; service.Description = "UPS Ground Freight"; shipment.Service = service; /** ***************Service************************************** */ //Below sample contains dummy data for your reference //Please update dummy date as per your requirement /** **************Commodity************************************* */ CommodityType commodity = new CommodityType(); commodity.NumberOfPieces = "20"; NMFCCommodityType nmfcCommodity = new NMFCCommodityType(); nmfcCommodity.PrimeCode = "132680"; nmfcCommodity.SubCode = "02"; commodity.NMFCCommodity = nmfcCommodity; commodity.FreightClass = "77.5"; ShipCodeDescriptionType packagingType = new ShipCodeDescriptionType(); packagingType.Code = "BAG"; packagingType.Description = "BAG"; commodity.PackagingType = packagingType; WeightType weight = new WeightType(); weight.Value = "200"; FreightShipUnitOfMeasurementType unitOfMeasurement = new FreightShipUnitOfMeasurementType(); unitOfMeasurement.Code = "lbs"; unitOfMeasurement.Description = "pounds"; weight.UnitOfMeasurement = unitOfMeasurement; commodity.Weight = weight; CommodityValueType commodityValue = new CommodityValueType(); commodityValue.CurrencyCode = "USD"; commodityValue.MonetaryValue = "100"; commodity.CommodityValue = commodityValue; commodity.Description = "LCD TVS"; CommodityType[] commodityArray = { commodity }; shipment.Commodity = commodityArray; /** **************Commodity************************************* */ /** **************HandlingUnitOne************************** */ HandlingUnitType handlingUnit = new HandlingUnitType(); handlingUnit.Quantity = "1"; ShipCodeDescriptionType handlingUnitType = new ShipCodeDescriptionType(); handlingUnitType.Code = "SKD"; handlingUnitType.Description = "SKID"; handlingUnit.Type = handlingUnitType; shipment.HandlingUnitOne = handlingUnit; /** **************HandlingUnitOne************************** */ UPSSecurity upss = new UPSSecurity(); UPSSecurityServiceAccessToken upssSvcAccessToken = new UPSSecurityServiceAccessToken(); upssSvcAccessToken.AccessLicenseNumber = "Your License"; upss.ServiceAccessToken = upssSvcAccessToken; UPSSecurityUsernameToken upssUsrNameToken = new UPSSecurityUsernameToken(); upssUsrNameToken.Username = "******"; upssUsrNameToken.Password = "******"; upss.UsernameToken = upssUsrNameToken; freightShipService.UPSSecurityValue = upss; freightShipRequest.Shipment = shipment; System.Net.ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy(); Console.WriteLine(freightShipRequest); FreightShipResponse freightShipResponse = freightShipService.ProcessShipment(freightShipRequest); Console.WriteLine("The transaction was a " + freightShipResponse.Response.ResponseStatus.Description); Console.WriteLine("The BOLID of the shipment is: " + freightShipResponse.ShipmentResults.BOLID); Console.WriteLine("The Shipment number of the shipment is " + freightShipResponse.ShipmentResults.ShipmentNumber); Console.ReadKey(); } catch (System.Web.Services.Protocols.SoapException ex) { Console.WriteLine(""); Console.WriteLine("---------FreightShip Web Service returns error----------------"); Console.WriteLine("---------\"Hard\" is user error \"Transient\" is system error----------------"); Console.WriteLine("SoapException Message= " + ex.Message); Console.WriteLine(""); Console.WriteLine("SoapException Category:Code:Message= " + ex.Detail.LastChild.InnerText); Console.WriteLine(""); Console.WriteLine("SoapException XML String for all= " + ex.Detail.LastChild.OuterXml); Console.WriteLine(""); Console.WriteLine("SoapException StackTrace= " + ex.StackTrace); Console.WriteLine("-------------------------"); Console.WriteLine(""); } catch (System.ServiceModel.CommunicationException ex) { Console.WriteLine(""); Console.WriteLine("--------------------"); Console.WriteLine("CommunicationException= " + ex.Message); Console.WriteLine("CommunicationException-StackTrace= " + ex.StackTrace); Console.WriteLine("-------------------------"); Console.WriteLine(""); } catch (Exception ex) { Console.WriteLine(""); Console.WriteLine("-------------------------"); Console.WriteLine(" Generaal Exception= " + ex.Message); Console.WriteLine(" Generaal Exception-StackTrace= " + ex.StackTrace); Console.WriteLine("-------------------------"); } finally { Console.ReadKey(); } }
public InMemoryPaymentInformation(PaymentInformationType type, string data) { this.Type = type; this.Data = data; }