public SupplementaryDataModel GetModelFromEntity(SupplementaryData entity) { return(new SupplementaryDataModel { DeliverableCode = entity.DeliverableCode, ConRefNumber = entity.ConRefNumber, ULN = entity.ULN, CostType = entity.CostType, CalendarYear = entity.CalendarYear, CalendarMonth = entity.CalendarMonth, ReferenceType = entity.ReferenceType, Reference = entity.Reference, ProviderSpecifiedReference = entity.ProviderSpecifiedReference, LearnAimRef = entity.LearnAimRef, SupplementaryDataPanelDate = entity.SupplementaryDataPanelDate, Value = entity.SupplementaryDataUnitCost?.Value ?? entity.Value }); }
public AuthorizationBuilder WithSupplementaryData(string type, params string[] values) { // create the dictionary if (SupplementaryData == null) { SupplementaryData = new Dictionary <string, List <string[]> >(); } // add the key if (!SupplementaryData.ContainsKey(type)) { SupplementaryData.Add(type, new List <string[]>()); } // add the values to it SupplementaryData[type].Add(values); return(this); }
public SupplementaryDataModel GetModelFromEntity(SupplementaryData entity) { return(new SupplementaryDataModel { DeliverableCode = entity.DeliverableCode, ConRefNumber = entity.ConRefNumber, ULN = entity.ULN, CostType = entity.CostType, CalendarYear = entity.CalendarYear, CalendarMonth = entity.CalendarMonth, ReferenceType = entity.ReferenceType, Reference = entity.Reference, ProviderSpecifiedReference = entity.ProviderSpecifiedReference, StaffName = entity.StaffName, OrgHours = entity.OrgHours, ProjectHours = entity.ProjectHours, HourlyRate = entity.HourlyRate, TotalHoursWorked = entity.TotalHoursWorked, Value = entity.Value }); }
public void BuildModelFromEntity() { var model = new SupplementaryDataModel { ConRefNumber = "ConRefNumber", DeliverableCode = "DeliverableCode", CalendarYear = 2019, CalendarMonth = 1, CostType = "CostType", ReferenceType = "ReferenceType", Reference = "Reference", ULN = 1, ProviderSpecifiedReference = "ProviderSpecifiedReference", Value = 1, LearnAimRef = "LearnAimRef", SupplementaryDataPanelDate = new DateTime(2019, 8, 1), }; var expectedModel = new SupplementaryData { ConRefNumber = "ConRefNumber", DeliverableCode = "DeliverableCode", CalendarYear = 2019, CalendarMonth = 1, CostType = "CostType", ReferenceType = "ReferenceType", Reference = "Reference", ULN = 1, ProviderSpecifiedReference = "ProviderSpecifiedReference", Value = 1, LearnAimRef = "LearnAimRef", SupplementaryDataPanelDate = new DateTime(2019, 8, 1), SourceFileId = 1 }; NewService().BuildModelFromEntity(model, 1).Should().BeEquivalentTo(expectedModel); }
/// <summary> /// Decodes all the string Member properties from Base64 strings /// </summary> public void Decode() { if (!IsEncoded) { return; } if (!string.IsNullOrEmpty(MerchantID)) { MerchantID = EncodingUtils.Base64Decode(MerchantID); } if (!string.IsNullOrEmpty(Account)) { Account = EncodingUtils.Base64Decode(Account); } if (!string.IsNullOrEmpty(Channel)) { Channel = EncodingUtils.Base64Decode(Channel); } if (!string.IsNullOrEmpty(OrderID)) { OrderID = EncodingUtils.Base64Decode(OrderID); } if (!string.IsNullOrEmpty(Amount)) { Amount = EncodingUtils.Base64Decode(Amount); } if (!string.IsNullOrEmpty(Currency)) { Currency = EncodingUtils.Base64Decode(Currency); } if (!string.IsNullOrEmpty(Timestamp)) { Timestamp = EncodingUtils.Base64Decode(Timestamp); } if (!string.IsNullOrEmpty(Hash)) { Hash = EncodingUtils.Base64Decode(Hash); } if (!string.IsNullOrEmpty(AutoSettleFlag)) { AutoSettleFlag = EncodingUtils.Base64Decode(AutoSettleFlag); } if (!string.IsNullOrEmpty(Comment1)) { Comment1 = EncodingUtils.Base64Decode(Comment1); } if (!string.IsNullOrEmpty(Comment2)) { Comment2 = EncodingUtils.Base64Decode(Comment2); } if (!string.IsNullOrEmpty(ReturnTSS)) { ReturnTSS = EncodingUtils.Base64Decode(ReturnTSS); } if (!string.IsNullOrEmpty(ShippingCode)) { ShippingCode = EncodingUtils.Base64Decode(ShippingCode); } if (!string.IsNullOrEmpty(ShippingCountry)) { ShippingCountry = EncodingUtils.Base64Decode(ShippingCountry); } if (!string.IsNullOrEmpty(BillingCode)) { BillingCode = EncodingUtils.Base64Decode(BillingCode); } if (!string.IsNullOrEmpty(BillingCountry)) { BillingCountry = EncodingUtils.Base64Decode(BillingCountry); } if (!string.IsNullOrEmpty(CardPaymentButtonText)) { CardPaymentButtonText = EncodingUtils.Base64Decode(CardPaymentButtonText); } if (!string.IsNullOrEmpty(CustomerNumber)) { CustomerNumber = EncodingUtils.Base64Decode(CustomerNumber); } if (!string.IsNullOrEmpty(VariableReference)) { VariableReference = EncodingUtils.Base64Decode(VariableReference); } if (!string.IsNullOrEmpty(ProductID)) { ProductID = EncodingUtils.Base64Decode(ProductID); } if (!string.IsNullOrEmpty(Language)) { Language = EncodingUtils.Base64Decode(Language); } if (!string.IsNullOrEmpty(CardStorageEnable)) { CardStorageEnable = EncodingUtils.Base64Decode(CardStorageEnable); } if (!string.IsNullOrEmpty(OfferSaveCard)) { OfferSaveCard = EncodingUtils.Base64Decode(OfferSaveCard); } if (!string.IsNullOrEmpty(PayerReference)) { PayerReference = EncodingUtils.Base64Decode(PayerReference); } if (!string.IsNullOrEmpty(PaymentReference)) { PaymentReference = EncodingUtils.Base64Decode(PaymentReference); } if (!string.IsNullOrEmpty(PayerExists)) { PayerExists = EncodingUtils.Base64Decode(PayerExists); } if (!string.IsNullOrEmpty(DCCEnable)) { DCCEnable = EncodingUtils.Base64Decode(DCCEnable); } if (!string.IsNullOrEmpty(HPPFraudFilterMode)) { HPPFraudFilterMode = EncodingUtils.Base64Decode(HPPFraudFilterMode); } if (!string.IsNullOrEmpty(HPPVersion)) { HPPVersion = EncodingUtils.Base64Decode(HPPVersion); } if (!string.IsNullOrEmpty(HPPSelectStoredCard)) { HPPSelectStoredCard = EncodingUtils.Base64Decode(HPPSelectStoredCard); } if (SupplementaryData != null && SupplementaryData.Keys.Count > 0) { var decoded = SupplementaryData.Select(kpv => new KeyValuePair <string, string>(kpv.Key, EncodingUtils.Base64Decode(kpv.Value))).ToList <KeyValuePair <string, string> >(); SupplementaryData.Clear(); foreach (KeyValuePair <string, string> kpv in decoded) { SupplementaryData.Add(kpv.Key, kpv.Value); } } IsEncoded = false; }