Cleanup
This commit is contained in:
@@ -10,7 +10,6 @@ import de.rwu.easydrop.api.client.PurchaserFactory;
|
||||
import de.rwu.easydrop.api.client.SellerFactory;
|
||||
import de.rwu.easydrop.data.connector.OfferPersistenceInterface;
|
||||
import de.rwu.easydrop.model.Offer;
|
||||
import de.rwu.easydrop.model.Webshop;
|
||||
import de.rwu.easydrop.service.mapping.ProductMapper;
|
||||
import de.rwu.easydrop.service.writer.OfferWriter;
|
||||
import de.rwu.easydrop.util.FormattingUtil;
|
||||
@@ -51,15 +50,13 @@ public class OfferProvisioner {
|
||||
* @param offer
|
||||
*/
|
||||
private void toSeller(final Offer offer) throws IllegalArgumentException {
|
||||
if (offer.getTargetProduct().getDataOrigin() == Webshop.EBAY) {
|
||||
this.ebaySeller.sellProduct(ProductMapper.mapProductToDTO(offer.getTargetProduct()));
|
||||
|
||||
} else if (offer.getTargetProduct().getDataOrigin().equals(Webshop.AMAZON)) {
|
||||
this.amazonSeller.sellProduct(ProductMapper.mapProductToDTO(offer.getTargetProduct()));
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported target plattform");
|
||||
switch (offer.getTargetProduct().getDataOrigin()) {
|
||||
case EBAY -> this.ebaySeller.sellProduct(
|
||||
ProductMapper.mapProductToDTO(offer.getTargetProduct()));
|
||||
case AMAZON -> this.amazonSeller.sellProduct(
|
||||
ProductMapper.mapProductToDTO(offer.getTargetProduct()));
|
||||
default -> throw new IllegalArgumentException("Unsupported source plattform");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,17 +65,13 @@ public class OfferProvisioner {
|
||||
* @param offer
|
||||
*/
|
||||
private void toBuyer(final Offer offer) throws IllegalArgumentException {
|
||||
if (offer.getSourceProduct().getDataOrigin() == Webshop.EBAY) {
|
||||
this.ebayPurchaser.purchaseProduct(
|
||||
switch (offer.getSourceProduct().getDataOrigin()) {
|
||||
case EBAY -> ebayPurchaser.purchaseProduct(
|
||||
ProductMapper.mapProductToDTO(offer.getSourceProduct()));
|
||||
|
||||
} else if (offer.getTargetProduct().getDataOrigin().equals(Webshop.AMAZON)) {
|
||||
this.amazonPurchaser.purchaseProduct(
|
||||
case AMAZON -> amazonPurchaser.purchaseProduct(
|
||||
ProductMapper.mapProductToDTO(offer.getSourceProduct()));
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported target plattform");
|
||||
default -> throw new IllegalArgumentException("Unsupported target plattform");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user