/// <summary> /// Serialize to a JSON object /// </summary> public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } ((Fhir.R4.Models.BackboneElement) this).SerializeJson(writer, options, false); if (AmountQuantity != null) { writer.WritePropertyName("amountQuantity"); AmountQuantity.SerializeJson(writer, options); } if (AmountRange != null) { writer.WritePropertyName("amountRange"); AmountRange.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(AmountString)) { writer.WriteString("amountString", (string)AmountString !); } if (_AmountString != null) { writer.WritePropertyName("_amountString"); _AmountString.SerializeJson(writer, options); } if (AmountType != null) { writer.WritePropertyName("amountType"); AmountType.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(AmountText)) { writer.WriteString("amountText", (string)AmountText !); } if (_AmountText != null) { writer.WritePropertyName("_amountText"); _AmountText.SerializeJson(writer, options); } if (ReferenceRange != null) { writer.WritePropertyName("referenceRange"); ReferenceRange.SerializeJson(writer, options); } if (includeStartObject) { writer.WriteEndObject(); } }
private TaxRange(decimal fromAmount, decimal?toAmount, ulong fixAmount, decimal taxCentPerDollar, ulong taxCentApplyAfterDollar) { Range = new AmountRange(fromAmount, toAmount); FixTaxAmount = fixAmount; VariableTaxDetail = new VariableTax(taxCentPerDollar, taxCentApplyAfterDollar); }
public void AmountRangeRepository_UpdateValue() { var repo = new AmountRangeRepository(); var key = "TwoIds"; var amountRange = new AmountRange { Code = "TwoIds", Display = "Updated Two IDs" }; repo.UpdateValue(key, amountRange); var containsKey = repo.ContainsKey(key); var value = repo.GetValue <AmountRange>(key); Assert.IsNotNull(value); Assert.IsTrue(containsKey); Assert.AreEqual("Updated Two IDs", value.Display); }
public void AmountRangeRepository_AddValue() { var repo = new AmountRangeRepository(); var key = "Fake"; var amountRange = new AmountRange { Code = "Fake", Display = "Fake" }; repo.AddValue(key, amountRange); var value = repo.GetValue <AmountRange>(key); var containsKey = repo.ContainsKey(key); Assert.IsNotNull(value); Assert.IsTrue(containsKey); Assert.AreEqual("Fake", value.Code); }
private static decimal GenerateAmount(AmountRange amtRange) { switch (amtRange) { case AmountRange.UnderOneHundred: return(DataGenerator.Amount(25.00m, 99.99m)); case AmountRange.NoIdsNoThirdParty: return(DataGenerator.Amount(25.00m, 500.00m)); case AmountRange.SingleId: return(DataGenerator.Amount(501.00m, 999.00m)); case AmountRange.TwoIds: return(DataGenerator.Amount(1001.00m, 1499.00m)); case AmountRange.ThirdParty: return(DataGenerator.Amount(1501.00m, 2999.00m)); default: return(DataGenerator.Amount(25.00m, 150.00m)); } }
/// <summary> /// Serialize to a JSON object /// </summary> public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } ((fhirCsR4.Models.BackboneElement) this).SerializeJson(writer, options, false); if (Target != null) { writer.WritePropertyName("target"); Target.SerializeJson(writer, options); } if (Type != null) { writer.WritePropertyName("type"); Type.SerializeJson(writer, options); } if (Interaction != null) { writer.WritePropertyName("interaction"); Interaction.SerializeJson(writer, options); } if (Organism != null) { writer.WritePropertyName("organism"); Organism.SerializeJson(writer, options); } if (OrganismType != null) { writer.WritePropertyName("organismType"); OrganismType.SerializeJson(writer, options); } if (AmountQuantity != null) { writer.WritePropertyName("amountQuantity"); AmountQuantity.SerializeJson(writer, options); } if (AmountRange != null) { writer.WritePropertyName("amountRange"); AmountRange.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(AmountString)) { writer.WriteString("amountString", (string)AmountString !); } if (_AmountString != null) { writer.WritePropertyName("_amountString"); _AmountString.SerializeJson(writer, options); } if (AmountType != null) { writer.WritePropertyName("amountType"); AmountType.SerializeJson(writer, options); } if ((Source != null) && (Source.Count != 0)) { writer.WritePropertyName("source"); writer.WriteStartArray(); foreach (Reference valSource in Source) { valSource.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (includeStartObject) { writer.WriteEndObject(); } }
public FeeLookupData FeeLookupForBpEp(string fromLocation, string toCountry, string toState, string sendCurr, AmountRange amtRange, ItemChoiceType1 itemChoiceType, string receiveCode, string receiveAgentId, string agentId, string agentPos) { var feeLookupData = new FeeLookupData(); var feeLookupReq = FeeLookupRequestFactory.FeeLookupForBpEp(toCountry, toState, sendCurr, amtRange, itemChoiceType, receiveCode, receiveAgentId, agentId, agentPos); feeLookupData.Set(feeLookupReq); feeLookupData.Set(_acIntegration.FeeLookup(feeLookupData.FeeLookupReq)); return(feeLookupData); }
public static FeeLookupRequest FeeLookupForEp(string receiveCode, string receiveAgentId, AmountRange amountRange, double amount) { return(new FeeLookupRequest { MgiSessionType = SessionType.BP, ProductVariant = ProductVariantType.EP, Item = amountRange == AmountRange.CustomAmount ? (decimal)amount : GenerateAmount(amountRange), ItemElementName = ItemChoiceType1.amountIncludingFee, DefaultMaxFee = false, AllOptions = true, DestinationCountry = Country.Usa, ReceiveCode = receiveCode, ReceiveAgentID = receiveAgentId }); }
private static FeeLookupRequest GenerateBaseFeeLookupRequest(string toCountry, string toState, string sendCurr, AmountRange amtRange, double amount, ItemChoiceType1 itemChoiceType) { return(new FeeLookupRequest { DefaultMaxFee = false, AllOptions = true, DestinationCountry = toCountry, DestinationCountrySubdivisionCode = toState, SendCurrency = sendCurr, Item = amtRange == AmountRange.CustomAmount ? (decimal)amount : GenerateAmount(amtRange), ItemElementName = itemChoiceType, }); }
public static FeeLookupRequest FeeLookupForBpEp(string toCountry, string toState, string sendCurr, AmountRange amtRange, ItemChoiceType1 itemChoiceType, string receiveCode, string receiveAgentId, string agentId, string agentPos) { var feeLookupRequest = GenerateBaseFeeLookupRequest(toCountry, toState, sendCurr, amtRange, 0.0 /*custom amount currently unsupported for Bill Pay*/, itemChoiceType); feeLookupRequest.MgiSessionType = SessionType.BP; feeLookupRequest.ProductVariant = ProductVariantType.EP; feeLookupRequest.ReceiveCode = receiveCode; feeLookupRequest.ReceiveAgentID = receiveAgentId; feeLookupRequest.AgentID = agentId; feeLookupRequest.AgentSequence = agentPos; return(feeLookupRequest); }