public async Task <string> InsertList(List <MLFSSale> sales)
        {
            foreach (MLFSSale sale in sales)
            {
                if (string.IsNullOrEmpty(sale.ProviderName))
                {
                    try
                    {
                        List <MLFSPlan> plansFromIO = await _clientData.GetClientPlans(sale.ClientId);

                        MLFSPlan selectedPlanFromIO = plansFromIO.Where(x => x.PrimaryID == sale.IOReference).FirstOrDefault();
                        if (selectedPlanFromIO != null && selectedPlanFromIO.PlanType.ToLower() != "wrap")
                        {
                            List <MLFSFee> feesFromIO = await _clientData.GetClientFees(sale.ClientId);

                            MLFSFee selectedFeeFromIO = feesFromIO.Where(x => x.Plan.PrimaryID == selectedPlanFromIO.PrimaryID && x.IsRecurring).FirstOrDefault();
                            sale.AddPlanData(selectedPlanFromIO, selectedFeeFromIO);
                        }
                    }
                    catch
                    {
                        //No IO data found
                    }
                }
                _db.MLFSSales.Add(sale);
            }
            await _db.SaveChangesAsync();

            return("Success");
        }
示例#2
0
        public void FeeTest()
        {
            //arrange
            string  f   = "{\"id\":6796456,\"href\":\"https://api.intelliflo.com/v2/clients/30944834/fees/6796456\",\"sequentialRef\":\"IOF06796456\",\"sellingAdviser\":{\"id\":91653,\"href\":\"https://crm.intelliflo.com/v2/advisers/91653\"},\"adviceCategory\":\"IndependentAdvice\",\"feeType\":{\"name\":\"PFP Premium Fee\",\"category\":\"OngoingFee\"},\"paymentType\":{\"name\":\"By Provider\",\"paidBy\":\"Provider\"},\"feeChargingType\":{\"name\":\"PercentOfFumAum\"},\"feePercentage\":0.50,\"net\":{\"currency\":\"GBP\",\"amount\":\"5000.0000\"},\"vat\":{\"currency\":\"GBP\",\"amount\":\"1000.0000\"},\"vatRate\":{\"rate\":0.0,\"isExempt\":true},\"status\":\"Draft\",\"statusDate\":\"2020-06-24T15:00:27Z\",\"recurring\":{\"frequency\":\"Monthly\",\"startsOn\":\"2020-07-31\",\"endsOn\":\"2030-06-30\"},\"isConsultancyFee\":false,\"banding\":{\"id\":106604,\"href\":\"https://api.intelliflo.com/v2/advisers/91653/bandingtemplates/106604\",\"percentage\":60.0},\"forwardIncomeTo\":{\"id\":91653,\"href\":\"https://crm.intelliflo.com/v2/advisers/91653\",\"useBanding\":false},\"clients\":[{\"id\":30944834,\"href\":\"https://crm.intelliflo.com/v2/clients/30944834\"}],\"plan_href\":\"https://portfolio.intelliflo.com/v2/clients/30944834/plans?filter=id in (55475456)\"}";
            JObject obj = JObject.Parse(f);

            //act
            MLFSFee fee = new MLFSFee(obj);

            //assert
            Assert.AreEqual(5000, fee.NetAmount);
        }
示例#3
0
        public void CreateListTest()
        {
            //arrange
            string f      = "[{\"id\":6796456,\"href\":\"https://api.intelliflo.com/v2/clients/30944834/fees/6796456\",\"sequentialRef\":\"IOF06796456\",\"sellingAdviser\":{\"id\":91653,\"href\":\"https://crm.intelliflo.com/v2/advisers/91653\"},\"adviceCategory\":\"IndependentAdvice\",\"feeType\":{\"name\":\"PFP Premium Fee\",\"category\":\"OngoingFee\"},\"paymentType\":{\"name\":\"By Provider\",\"paidBy\":\"Provider\"},\"feeChargingType\":{\"name\":\"PercentOfFumAum\"},\"feePercentage\":0.50,\"net\":{\"currency\":\"GBP\",\"amount\":\"5000.0000\"},\"vat\":{\"currency\":\"GBP\",\"amount\":\"1000.0000\"},\"vatRate\":{\"rate\":0.0,\"isExempt\":true},\"status\":\"Draft\",\"statusDate\":\"2020-06-24T15:00:27Z\",\"recurring\":{\"frequency\":\"Monthly\",\"startsOn\":\"2020-07-31\",\"endsOn\":\"2030-06-30\"},\"isConsultancyFee\":false,\"banding\":{\"id\":106604,\"href\":\"https://api.intelliflo.com/v2/advisers/91653/bandingtemplates/106604\",\"percentage\":60.0},\"forwardIncomeTo\":{\"id\":91653,\"href\":\"https://crm.intelliflo.com/v2/advisers/91653\",\"useBanding\":false},\"clients\":[{\"id\":30944834,\"href\":\"https://crm.intelliflo.com/v2/clients/30944834\"}],\"plan_href\":\"https://portfolio.intelliflo.com/v2/clients/30944834/plans?filter=id in (55475456)\"},{\"id\":6796456,\"href\":\"https://api.intelliflo.com/v2/clients/30944834/fees/6796456\",\"sequentialRef\":\"IOF06796456\",\"sellingAdviser\":{\"id\":91653,\"href\":\"https://crm.intelliflo.com/v2/advisers/91653\"},\"adviceCategory\":\"IndependentAdvice\",\"feeType\":{\"name\":\"PFP Premium Fee\",\"category\":\"OngoingFee\"},\"paymentType\":{\"name\":\"By Provider\",\"paidBy\":\"Provider\"},\"feeChargingType\":{\"name\":\"PercentOfFumAum\"},\"feePercentage\":0.60,\"net\":{\"currency\":\"GBP\",\"amount\":\"6000.0000\"},\"vat\":{\"currency\":\"GBP\",\"amount\":\"1200.0000\"},\"vatRate\":{\"rate\":0.0,\"isExempt\":true},\"status\":\"Draft\",\"statusDate\":\"2020-06-24T15:00:27Z\",\"recurring\":{\"frequency\":\"Monthly\",\"startsOn\":\"2020-07-31\",\"endsOn\":\"2030-06-30\"},\"isConsultancyFee\":false,\"banding\":{\"id\":106604,\"href\":\"https://api.intelliflo.com/v2/advisers/91653/bandingtemplates/106604\",\"percentage\":60.0},\"forwardIncomeTo\":{\"id\":91653,\"href\":\"https://crm.intelliflo.com/v2/advisers/91653\",\"useBanding\":false},\"clients\":[{\"id\":30944834,\"href\":\"https://crm.intelliflo.com/v2/clients/30944834\"}],\"plan_href\":\"https://portfolio.intelliflo.com/v2/clients/30944834/plans?filter=id in (55475456)\"}]";
            JArray jArray = JArray.Parse(f);

            //act
            List <MLFSFee> fees = MLFSFee.CreateList(jArray);

            //assert
            Assert.AreEqual(2, fees.Count, "Not all fees added");
            Assert.AreEqual(11000, fees.Sum(x => x.NetAmount), "Details dont match");
        }
        public async Task <List <MLFSFee> > GetClientFees(string clientId, string url = "")
        {
            if (String.IsNullOrEmpty(url))
            {
                url = String.Format("clients/{0}/fees", clientId);
            }
            IRestResponse response = await IOConnection.GetResponse(url);

            if (response.Content.Length != 0 && response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                JArray         jarray = Tools.ExtractItemsArrayFromJsonString(response.Content);
                List <MLFSFee> fees   = MLFSFee.CreateList(jarray);
                return(fees);
            }
            else
            {
                return(null);
            }
        }