Skip to content

Commit

Permalink
live-contract-provider-scc-done
Browse files Browse the repository at this point in the history
  • Loading branch information
yacekmm committed Oct 19, 2024
1 parent e102d42 commit 90d8886
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class PromoterPercentageDiscountBase extends CdcFrameworkTestBase {

@BeforeEach
void setUp() {
//TODO contract expects system in specific state. Setup this state here
price = builders.aPrice().priceForItem(100_00, UUIDs.zeros()).inDb();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ public class PriceRestController {

private final PriceService priceService;

//TODO specify path
@PostMapping(path = V1 + "/item/{itemId}/price-factor/percentage")
@ResponseBody
@Transactional
public List<PriceWithFactorsDto> applyPercentageFactor(
@PathVariable("itemId") String itemId,
@RequestBody PercentageFactorRequestDto factorRequestDto) {

//TODO implement API to satisfy contract requested by consumer
return null;
return priceService.applyPercentageFactor(itemId, factorRequestDto.percentage())
.map(itemPrices -> itemPrices.stream().map(PriceWithFactorsDto::from).toList())
.getOrElseThrow(ErrorResult::toException);
}

}

0 comments on commit 90d8886

Please sign in to comment.