This repository has been archived on 2020-08-02. You can view files and clone it, but cannot push or open issues or pull requests.
e-commerce/prototype/src/main/java/org/hso/ecommerce/action/booking/CreateBookingAction.java

31 lines
868 B
Java

package org.hso.ecommerce.action.booking;
import org.hso.ecommerce.entities.booking.Booking;
import org.hso.ecommerce.entities.booking.BookingAccountEntry;
import org.hso.ecommerce.entities.booking.BookingReason;
public class CreateBookingAction {
private Booking booking;
public CreateBookingAction(BookingAccountEntry source, BookingAccountEntry destination, BookingReason reason, int amountCent) {
booking = new Booking();
booking.reason = reason;
booking.amountCent = amountCent;
assert source != null || destination != null;
if (source != null) {
booking.source = source.copyAddAmount(-amountCent);
}
if (destination != null) {
booking.destination = destination.copyAddAmount(amountCent);
}
}
public Booking finish() {
return booking;
}
}