Baby steps (get it? : o) towards implementing loss provisioning api.
diff --git a/api/src/main/java/io/mifos/individuallending/api/v1/client/IndividualLending.java b/api/src/main/java/io/mifos/individuallending/api/v1/client/IndividualLending.java
index b483ec3..7f378d5 100644
--- a/api/src/main/java/io/mifos/individuallending/api/v1/client/IndividualLending.java
+++ b/api/src/main/java/io/mifos/individuallending/api/v1/client/IndividualLending.java
@@ -33,18 +33,9 @@
 @SuppressWarnings("unused")
 @FeignClient (value = "portfolio-v1", path = "/portfolio/v1", configuration = CustomFeignClientsConfiguration.class)
 public interface IndividualLending {
-  @RequestMapping(
-      value = "/individuallending/products/{productidentifier}/lossprovisionsteps/{dayslate}",
-      method = RequestMethod.DELETE,
-      produces = MediaType.ALL_VALUE,
-      consumes = MediaType.APPLICATION_JSON_VALUE
-  )
-  void deleteLossProvisionStep(
-      @PathVariable("productidentifier") final String productIdentifier,
-      @PathVariable("dayslate") final String daysLate);
 
   @RequestMapping(
-      value = "/individuallending/products/{productidentifier}/lossprovisionsteps/",
+      value = "/individuallending/products/{productidentifier}/lossprovisionsteps",
       method = RequestMethod.PUT,
       produces = MediaType.ALL_VALUE,
       consumes = MediaType.APPLICATION_JSON_VALUE
diff --git a/api/src/test/java/io/mifos/individuallending/api/v1/domain/product/LossProvisionStepTest.java b/api/src/test/java/io/mifos/individuallending/api/v1/domain/product/LossProvisionStepTest.java
index e7947b6..e401491 100644
--- a/api/src/test/java/io/mifos/individuallending/api/v1/domain/product/LossProvisionStepTest.java
+++ b/api/src/test/java/io/mifos/individuallending/api/v1/domain/product/LossProvisionStepTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2017 Kuelap, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package io.mifos.individuallending.api.v1.domain.product;
 
 import io.mifos.core.test.domain.ValidationTest;
diff --git a/service/src/main/java/io/mifos/individuallending/internal/command/ChangeLossProvisionSteps.java b/service/src/main/java/io/mifos/individuallending/internal/command/ChangeLossProvisionSteps.java
new file mode 100644
index 0000000..cc47711
--- /dev/null
+++ b/service/src/main/java/io/mifos/individuallending/internal/command/ChangeLossProvisionSteps.java
@@ -0,0 +1,18 @@
+package io.mifos.individuallending.internal.command;
+
+import io.mifos.individuallending.api.v1.domain.product.LossProvisionStep;
+
+import java.util.List;
+
+/**
+ * @author Myrle Krantz
+ */
+public class ChangeLossProvisionSteps {
+  private final String productIdentifier;
+  private final List<LossProvisionStep> lossProvisionSteps;
+
+  public ChangeLossProvisionSteps(String productIdentifier, List<LossProvisionStep> lossProvisionSteps) {
+    this.productIdentifier = productIdentifier;
+    this.lossProvisionSteps = lossProvisionSteps;
+  }
+}
diff --git a/service/src/main/java/io/mifos/individuallending/internal/mapper/LossProvisionStepMapper.java b/service/src/main/java/io/mifos/individuallending/internal/mapper/LossProvisionStepMapper.java
new file mode 100644
index 0000000..1b4bbbe
--- /dev/null
+++ b/service/src/main/java/io/mifos/individuallending/internal/mapper/LossProvisionStepMapper.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2017 Kuelap, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.mifos.individuallending.internal.mapper;
+
+import io.mifos.individuallending.api.v1.domain.product.LossProvisionStep;
+import io.mifos.individuallending.internal.repository.LossProvisionStepEntity;
+
+import java.math.BigDecimal;
+
+public interface LossProvisionStepMapper {
+  static LossProvisionStepEntity map(
+      final Long productId,
+      final LossProvisionStep instance) {
+    final LossProvisionStepEntity ret = new LossProvisionStepEntity();
+    ret.setProductId(productId);
+    ret.setDaysLate(instance.getDaysLate());
+    ret.setPercentProvision(instance.getPercentProvision().setScale(2, BigDecimal.ROUND_HALF_EVEN));
+    return ret;
+  }
+
+  static LossProvisionStep map(
+      final LossProvisionStepEntity entity) {
+    final LossProvisionStep ret = new LossProvisionStep();
+    ret.setDaysLate(entity.getDaysLate());
+    ret.setPercentProvision(entity.getPercentProvision());
+    return ret;
+  }
+}
diff --git a/service/src/main/java/io/mifos/portfolio/service/internal/repository/ProductArrearsConfigurationEntity.java b/service/src/main/java/io/mifos/individuallending/internal/repository/LossProvisionStepEntity.java
similarity index 90%
rename from service/src/main/java/io/mifos/portfolio/service/internal/repository/ProductArrearsConfigurationEntity.java
rename to service/src/main/java/io/mifos/individuallending/internal/repository/LossProvisionStepEntity.java
index f2ff9b9..a74a8ea 100644
--- a/service/src/main/java/io/mifos/portfolio/service/internal/repository/ProductArrearsConfigurationEntity.java
+++ b/service/src/main/java/io/mifos/individuallending/internal/repository/LossProvisionStepEntity.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.portfolio.service.internal.repository;
+package io.mifos.individuallending.internal.repository;
 
 import javax.persistence.*;
 import java.math.BigDecimal;
@@ -25,7 +25,7 @@
 @SuppressWarnings("unused")
 @Entity
 @Table(name = "bastet_p_arrears_config")
-public class ProductArrearsConfigurationEntity {
+public class LossProvisionStepEntity {
   @Id
   @GeneratedValue(strategy = GenerationType.IDENTITY)
   @Column(name = "id")
@@ -76,7 +76,7 @@
   public boolean equals(Object o) {
     if (this == o) return true;
     if (o == null || getClass() != o.getClass()) return false;
-    ProductArrearsConfigurationEntity that = (ProductArrearsConfigurationEntity) o;
+    LossProvisionStepEntity that = (LossProvisionStepEntity) o;
     return Objects.equals(productId, that.productId) &&
         Objects.equals(daysLate, that.daysLate);
   }
diff --git a/service/src/main/java/io/mifos/portfolio/service/internal/repository/ProductArrearsConfigurationRepository.java b/service/src/main/java/io/mifos/individuallending/internal/repository/LossProvisionStepRepository.java
similarity index 67%
rename from service/src/main/java/io/mifos/portfolio/service/internal/repository/ProductArrearsConfigurationRepository.java
rename to service/src/main/java/io/mifos/individuallending/internal/repository/LossProvisionStepRepository.java
index 01bdfb4..810412e 100644
--- a/service/src/main/java/io/mifos/portfolio/service/internal/repository/ProductArrearsConfigurationRepository.java
+++ b/service/src/main/java/io/mifos/individuallending/internal/repository/LossProvisionStepRepository.java
@@ -13,17 +13,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.portfolio.service.internal.repository;
+package io.mifos.individuallending.internal.repository;
 
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Repository;
 
-import java.util.List;
+import java.util.Optional;
+import java.util.stream.Stream;
 
 /**
  * @author Myrle Krantz
  */
 @Repository
-public interface ProductArrearsConfigurationRepository extends JpaRepository<ProductArrearsConfigurationEntity, Long> {
-  List<ProductArrearsConfigurationEntity> findByProductId(Long id);
+public interface LossProvisionStepRepository extends JpaRepository<LossProvisionStepEntity, Long> {
+  Stream<LossProvisionStepEntity> findByProductId(Long id);
+
+  Optional<LossProvisionStepEntity> findByProductIdAndDaysLate(Long id, int daysLate);
 }
diff --git a/service/src/main/java/io/mifos/individuallending/internal/service/DataContextOfAction.java b/service/src/main/java/io/mifos/individuallending/internal/service/DataContextOfAction.java
index 03c1fac..90c0328 100644
--- a/service/src/main/java/io/mifos/individuallending/internal/service/DataContextOfAction.java
+++ b/service/src/main/java/io/mifos/individuallending/internal/service/DataContextOfAction.java
@@ -21,7 +21,6 @@
 import io.mifos.individuallending.internal.repository.CaseParametersEntity;
 import io.mifos.portfolio.api.v1.domain.AccountAssignment;
 import io.mifos.portfolio.service.internal.repository.CaseEntity;
-import io.mifos.portfolio.service.internal.repository.ProductArrearsConfigurationEntity;
 import io.mifos.portfolio.service.internal.repository.ProductEntity;
 
 import javax.annotation.Nonnull;
@@ -37,20 +36,17 @@
   private final ProductEntity product;
   private final CaseEntity customerCase;
   private final CaseParametersEntity caseParameters;
-  private final List<ProductArrearsConfigurationEntity> productArrearsConfigurationEntities;
   private final List<AccountAssignment> oneTimeAccountAssignments;
 
   public DataContextOfAction(
       final @Nonnull ProductEntity product,
       final @Nonnull CaseEntity customerCase,
       final @Nonnull CaseParametersEntity caseParameters,
-      final List<ProductArrearsConfigurationEntity> productArrearsConfigurationEntities,
       final @Nullable List<AccountAssignment> oneTimeAccountAssignments)
   {
     this.product = product;
     this.customerCase = customerCase;
     this.caseParameters = caseParameters;
-    this.productArrearsConfigurationEntities = productArrearsConfigurationEntities;
     this.oneTimeAccountAssignments = oneTimeAccountAssignments == null ? Collections.emptyList() : oneTimeAccountAssignments;
   }
 
@@ -70,10 +66,6 @@
     return CaseParametersMapper.mapEntity(caseParameters, product.getMinorCurrencyUnitDigits());
   }
 
-  public @Nonnull List<ProductArrearsConfigurationEntity> getProductArrearsConfigurationEntities() {
-    return productArrearsConfigurationEntities;
-  }
-
   @Nonnull List<AccountAssignment> getOneTimeAccountAssignments() {
     return oneTimeAccountAssignments;
   }
diff --git a/service/src/main/java/io/mifos/individuallending/internal/service/DataContextService.java b/service/src/main/java/io/mifos/individuallending/internal/service/DataContextService.java
index eb04895..20f2e0d 100644
--- a/service/src/main/java/io/mifos/individuallending/internal/service/DataContextService.java
+++ b/service/src/main/java/io/mifos/individuallending/internal/service/DataContextService.java
@@ -19,7 +19,10 @@
 import io.mifos.individuallending.internal.repository.CaseParametersEntity;
 import io.mifos.individuallending.internal.repository.CaseParametersRepository;
 import io.mifos.portfolio.api.v1.domain.AccountAssignment;
-import io.mifos.portfolio.service.internal.repository.*;
+import io.mifos.portfolio.service.internal.repository.CaseEntity;
+import io.mifos.portfolio.service.internal.repository.CaseRepository;
+import io.mifos.portfolio.service.internal.repository.ProductEntity;
+import io.mifos.portfolio.service.internal.repository.ProductRepository;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -34,18 +37,15 @@
   private final ProductRepository productRepository;
   private final CaseRepository caseRepository;
   private final CaseParametersRepository caseParametersRepository;
-  private final ProductArrearsConfigurationRepository productArrearsConfigurationRepository;
 
   @Autowired
   public DataContextService(
       final ProductRepository productRepository,
       final CaseRepository caseRepository,
-      final CaseParametersRepository caseParametersRepository,
-      final ProductArrearsConfigurationRepository productArrearsConfigurationRepository) {
+      final CaseParametersRepository caseParametersRepository) {
     this.productRepository = productRepository;
     this.caseRepository = caseRepository;
     this.caseParametersRepository = caseParametersRepository;
-    this.productArrearsConfigurationRepository = productArrearsConfigurationRepository;
   }
 
   public DataContextOfAction checkedGetDataContext(
@@ -66,14 +66,10 @@
                 "Individual loan not found ''{0}.{1}''.",
                 productIdentifier, caseIdentifier));
 
-    final List<ProductArrearsConfigurationEntity> productArrearsConfigurationEntities
-        = productArrearsConfigurationRepository.findByProductId(product.getId());
-
     return new DataContextOfAction(
         product,
         customerCase,
         caseParameters,
-        productArrearsConfigurationEntities,
         oneTimeAccountAssignments);
   }
 }
\ No newline at end of file
diff --git a/service/src/main/java/io/mifos/individuallending/internal/service/LossProvisionStepService.java b/service/src/main/java/io/mifos/individuallending/internal/service/LossProvisionStepService.java
new file mode 100644
index 0000000..a079ecf
--- /dev/null
+++ b/service/src/main/java/io/mifos/individuallending/internal/service/LossProvisionStepService.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2017 Kuelap, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.mifos.individuallending.internal.service;
+
+import io.mifos.core.lang.ServiceException;
+import io.mifos.individuallending.api.v1.domain.product.LossProvisionStep;
+import io.mifos.individuallending.internal.mapper.LossProvisionStepMapper;
+import io.mifos.individuallending.internal.repository.LossProvisionStepRepository;
+import io.mifos.portfolio.service.internal.repository.ProductRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+/**
+ * @author Myrle Krantz
+ */
+@Service
+public class LossProvisionStepService {
+  private final ProductRepository productRepository;
+  private final LossProvisionStepRepository lossProvisionStepRepository;
+
+  @Autowired
+  public LossProvisionStepService(
+      final ProductRepository productRepository,
+      final LossProvisionStepRepository lossProvisionStepRepository) {
+    this.productRepository = productRepository;
+    this.lossProvisionStepRepository = lossProvisionStepRepository;
+  }
+
+  public Optional<LossProvisionStep> findByProductIdAndDaysLate(
+      final Long id,
+      final int daysLate) {
+    return lossProvisionStepRepository.findByProductIdAndDaysLate(id, daysLate).map(LossProvisionStepMapper::map);
+  }
+
+  public List<LossProvisionStep> findByProductIdentifier(
+      final String productIdentifier) {
+    final Long productId = productRepository.findByIdentifier(productIdentifier)
+        .orElseThrow(() -> ServiceException.notFound("Product ''{}'' doesn''t exist.", productIdentifier))
+        .getId();
+    return lossProvisionStepRepository.findByProductId(productId)
+        .map(LossProvisionStepMapper::map)
+        .collect(Collectors.toList());
+  }
+}
\ No newline at end of file
diff --git a/service/src/main/java/io/mifos/individuallending/internal/service/costcomponent/DisbursePaymentBuilderService.java b/service/src/main/java/io/mifos/individuallending/internal/service/costcomponent/DisbursePaymentBuilderService.java
index 57a80f4..c843ee0 100644
--- a/service/src/main/java/io/mifos/individuallending/internal/service/costcomponent/DisbursePaymentBuilderService.java
+++ b/service/src/main/java/io/mifos/individuallending/internal/service/costcomponent/DisbursePaymentBuilderService.java
@@ -38,14 +38,14 @@
 @Service
 public class DisbursePaymentBuilderService implements PaymentBuilderService {
   private final ScheduledChargesService scheduledChargesService;
-  private final LossProvisioningService lossProvisioningService;
+  private final LossProvisionChargesService lossProvisionChargesService;
 
   @Autowired
   public DisbursePaymentBuilderService(
       final ScheduledChargesService scheduledChargesService,
-      final LossProvisioningService lossProvisioningService) {
+      final LossProvisionChargesService lossProvisionChargesService) {
     this.scheduledChargesService = scheduledChargesService;
-    this.lossProvisioningService = lossProvisioningService;
+    this.lossProvisionChargesService = lossProvisionChargesService;
   }
 
   @Override
@@ -75,7 +75,7 @@
 
     final List<ScheduledCharge> scheduledCharges = scheduledChargesService.getScheduledCharges(
         productIdentifier, scheduledActions);
-    final Optional<ScheduledCharge> initialLossProvisionCharge = lossProvisioningService.getScheduledChargeForDisbursement(
+    final Optional<ScheduledCharge> initialLossProvisionCharge = lossProvisionChargesService.getScheduledChargeForDisbursement(
         dataContextOfAction, forDate);
     initialLossProvisionCharge.ifPresent(scheduledCharges::add);
 
diff --git a/service/src/main/java/io/mifos/individuallending/internal/service/schedule/LossProvisioningService.java b/service/src/main/java/io/mifos/individuallending/internal/service/schedule/LossProvisionChargesService.java
similarity index 75%
rename from service/src/main/java/io/mifos/individuallending/internal/service/schedule/LossProvisioningService.java
rename to service/src/main/java/io/mifos/individuallending/internal/service/schedule/LossProvisionChargesService.java
index bdfb7fe..7bb2eb7 100644
--- a/service/src/main/java/io/mifos/individuallending/internal/service/schedule/LossProvisioningService.java
+++ b/service/src/main/java/io/mifos/individuallending/internal/service/schedule/LossProvisionChargesService.java
@@ -15,20 +15,19 @@
  */
 package io.mifos.individuallending.internal.service.schedule;
 
-import io.mifos.core.lang.ServiceException;
 import io.mifos.individuallending.api.v1.domain.product.AccountDesignators;
 import io.mifos.individuallending.api.v1.domain.product.ChargeProportionalDesignator;
+import io.mifos.individuallending.api.v1.domain.product.LossProvisionStep;
 import io.mifos.individuallending.api.v1.domain.workflow.Action;
 import io.mifos.individuallending.internal.service.DataContextOfAction;
+import io.mifos.individuallending.internal.service.LossProvisionStepService;
 import io.mifos.portfolio.api.v1.domain.ChargeDefinition;
-import io.mifos.portfolio.service.internal.repository.ProductArrearsConfigurationEntity;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.time.LocalDate;
-import java.util.List;
 import java.util.Optional;
-import java.util.stream.Collectors;
 
 import static io.mifos.individuallending.api.v1.domain.product.ChargeIdentifiers.PROVISION_FOR_LOSSES_ID;
 import static io.mifos.individuallending.api.v1.domain.product.ChargeIdentifiers.PROVISION_FOR_LOSSES_NAME;
@@ -37,7 +36,15 @@
  * @author Myrle Krantz
  */
 @Service
-public class LossProvisioningService {
+public class LossProvisionChargesService {
+  private final LossProvisionStepService lossProvisionStepService;
+
+  @Autowired
+  public LossProvisionChargesService(
+      final LossProvisionStepService lossProvisionStepService) {
+    this.lossProvisionStepService = lossProvisionStepService;
+  }
+
   public Optional<ScheduledCharge> getScheduledChargeForMarkLate(
       final DataContextOfAction dataContextOfAction,
       final LocalDate forDate,
@@ -59,7 +66,7 @@
       final LocalDate forDate,
       final int daysLate, Action action) {
     final Optional<ChargeDefinition> optionalChargeDefinition = percentProvision(dataContextOfAction, daysLate)
-        .map(this::getLossProvisionCharge);
+        .map(percentProvision -> getLossProvisionCharge(percentProvision, action));
 
     return optionalChargeDefinition.map(chargeDefinition -> {
       final ScheduledAction scheduledAction = new ScheduledAction(action, forDate);
@@ -71,22 +78,15 @@
       final DataContextOfAction dataContextOfAction,
       final int daysLate)
   {
-    final List<ProductArrearsConfigurationEntity> arrearsConfigurationForGivenDaysLate =
-        dataContextOfAction.getProductArrearsConfigurationEntities().stream()
-            .filter(x -> x.getDaysLate() == daysLate)
-            .collect(Collectors.toList());
-
-    if (arrearsConfigurationForGivenDaysLate.size() > 1)
-      throw ServiceException.internalError("There should not be more than one arrears allocation for given # of days late.");
-    if (arrearsConfigurationForGivenDaysLate.size() == 0)
-      return Optional.empty(); //None
-
-    return Optional.of(arrearsConfigurationForGivenDaysLate.get(0).getPercentProvision());
+    return lossProvisionStepService.findByProductIdAndDaysLate(dataContextOfAction.getProductEntity().getId(), daysLate)
+        .map(LossProvisionStep::getPercentProvision);
   }
 
-  private ChargeDefinition getLossProvisionCharge(final BigDecimal percentProvision) {
+  private ChargeDefinition getLossProvisionCharge(
+      final BigDecimal percentProvision,
+      final Action action) {
     final ChargeDefinition ret = new ChargeDefinition();
-    ret.setChargeAction(Action.MARK_LATE.name());
+    ret.setChargeAction(action.name());
     ret.setIdentifier(PROVISION_FOR_LOSSES_ID);
     ret.setName(PROVISION_FOR_LOSSES_NAME);
     ret.setDescription(PROVISION_FOR_LOSSES_NAME);
diff --git a/service/src/main/java/io/mifos/individuallending/rest/LossProvisionStepRestController.java b/service/src/main/java/io/mifos/individuallending/rest/LossProvisionStepRestController.java
new file mode 100644
index 0000000..c2d0d0d
--- /dev/null
+++ b/service/src/main/java/io/mifos/individuallending/rest/LossProvisionStepRestController.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2017 Kuelap, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.mifos.individuallending.rest;
+
+import io.mifos.anubis.annotation.AcceptedTokenType;
+import io.mifos.anubis.annotation.Permittable;
+import io.mifos.core.command.gateway.CommandGateway;
+import io.mifos.core.lang.ServiceException;
+import io.mifos.individuallending.api.v1.domain.product.LossProvisionStep;
+import io.mifos.individuallending.internal.command.ChangeLossProvisionSteps;
+import io.mifos.individuallending.internal.service.LossProvisionStepService;
+import io.mifos.portfolio.api.v1.PermittableGroupIds;
+import io.mifos.portfolio.service.internal.service.ProductService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ * @author Myrle Krantz
+ */
+@RestController
+@RequestMapping("/individuallending/products/{productidentifier}/cases/lossprovisionsteps")
+public class LossProvisionStepRestController {
+  private final CommandGateway commandGateway;
+  private final ProductService productService;
+  private final LossProvisionStepService lossProvisionStepService;
+
+  @Autowired
+  public LossProvisionStepRestController(
+      final CommandGateway commandGateway,
+      final ProductService productService,
+      final LossProvisionStepService lossProvisionStepService) {
+    this.commandGateway = commandGateway;
+    this.productService = productService;
+    this.lossProvisionStepService = lossProvisionStepService;
+  }
+
+  @Permittable(value = AcceptedTokenType.TENANT, groupId = PermittableGroupIds.PRODUCT_LOSS_PROVISIONING_MANAGEMENT)
+  @RequestMapping(
+      method = RequestMethod.PUT,
+      consumes = MediaType.ALL_VALUE,
+      produces = MediaType.APPLICATION_JSON_VALUE)
+  public @ResponseBody
+  ResponseEntity<Void>
+  setLossProvisionSteps(
+      @PathVariable("productidentifier") final String productIdentifier,
+      @RequestBody @Valid List<LossProvisionStep> lossProvisionSteps) {
+    checkProductExists(productIdentifier);
+
+    commandGateway.process(new ChangeLossProvisionSteps(productIdentifier, lossProvisionSteps));
+
+    return new ResponseEntity<>(HttpStatus.ACCEPTED);
+  }
+
+  @Permittable(value = AcceptedTokenType.TENANT, groupId = PermittableGroupIds.PRODUCT_LOSS_PROVISIONING_MANAGEMENT)
+  @RequestMapping(
+      method = RequestMethod.GET,
+      consumes = MediaType.ALL_VALUE,
+      produces = MediaType.APPLICATION_JSON_VALUE
+  )
+  public @ResponseBody
+  List<LossProvisionStep>
+  getAllLossProvisionSteps(
+      @PathVariable("productidentifier") final String productIdentifier) {
+    checkProductExists(productIdentifier);
+
+    return lossProvisionStepService.findByProductIdentifier(productIdentifier);
+  }
+
+  private void checkProductExists(@PathVariable("productidentifier") String productIdentifier) {
+    productService.findByIdentifier(productIdentifier)
+        .orElseThrow(() -> ServiceException.notFound("Product not found ''{0}''.", productIdentifier));
+  }
+}
diff --git a/service/src/test/java/io/mifos/individuallending/internal/service/IndividualLoanServiceTest.java b/service/src/test/java/io/mifos/individuallending/internal/service/IndividualLoanServiceTest.java
index 4bc8051..91b18f5 100644
--- a/service/src/test/java/io/mifos/individuallending/internal/service/IndividualLoanServiceTest.java
+++ b/service/src/test/java/io/mifos/individuallending/internal/service/IndividualLoanServiceTest.java
@@ -161,7 +161,6 @@
           product,
           customerCase,
           CaseParametersMapper.map(1L, caseParameters),
-          Collections.emptyList(),
           Collections.emptyList());
     }
 
diff --git a/service/src/test/java/io/mifos/individuallending/internal/service/costcomponent/PaymentBuilderServiceTestHarness.java b/service/src/test/java/io/mifos/individuallending/internal/service/costcomponent/PaymentBuilderServiceTestHarness.java
index 84b3f38..99a5c17 100644
--- a/service/src/test/java/io/mifos/individuallending/internal/service/costcomponent/PaymentBuilderServiceTestHarness.java
+++ b/service/src/test/java/io/mifos/individuallending/internal/service/costcomponent/PaymentBuilderServiceTestHarness.java
@@ -55,7 +55,6 @@
         product,
         customerCase,
         caseParameters,
-        Collections.emptyList(),
         Collections.emptyList());
     return testSubject.getPaymentBuilder(
         dataContextOfAction,