Basket model

public class Basket implements PaymentType {

    private String id;
    private BigDecimal amountTotalGross;
    private BigDecimal amountTotalVat;
    private BigDecimal amountTotalDiscount;
    private Currency currencyCode;
    private String orderId;
    private String note;
    private List<BasketItem> basketItems = new ArrayList<BasketItem>();
}

public class BasketItem {

    private String basketItemReferenceId;
    private Integer quantity;
    private Integer vat;
    private BigDecimal amountDiscount;
    private BigDecimal amountGross;
    private BigDecimal amountVat;
    private BigDecimal amountPerUnit;
    private BigDecimal amountNet;
    private String unit;
    private String title;
    private String subTitle;
    private URL imageUrl;
}

Create and initialize basket request

Create and initialize basket item 1

private BasketItem getMaxTestBasketItem1() {
        BasketItem basketItem = new BasketItem();
        basketItem.setBasketItemReferenceId("Artikelnummer4711");
        basketItem.setAmountDiscount(BigDecimal.ONE);
        basketItem.setAmountGross(new BigDecimal(500.5));
        basketItem.setAmountNet(new BigDecimal(420.1));
        basketItem.setAmountPerUnit(new BigDecimal(100.1));
        basketItem.setAmountVat(new BigDecimal(80.4));
        basketItem.setQuantity(5);
        basketItem.setTitle("Apple iPhone");
        basketItem.setUnit("Pc.");
        basketItem.setVat(19);
        basketItem.setSubTitle("XS in Red");
        basketItem.setType("goods");
        try {
            basketItem.setImageUrl(new URL("https://www.apple.com/v/iphone-xs/d/images/overview/hero_top_device_large_2x.jpg"));
        } catch (MalformedURLException e) {
        }
        return basketItem;
    }

Create and initialize basket item 2

private BasketItem getMaxTestBasketItem2() {
        BasketItem basketItem = new BasketItem();
        basketItem.setBasketItemReferenceId("Artikelnummer4712");
        basketItem.setAmountDiscount(BigDecimal.ONE);
        basketItem.setAmountGross(new BigDecimal(365.99));
        basketItem.setAmountNet(new BigDecimal(307.55));
        basketItem.setAmountPerUnit(new BigDecimal(223.66));
        basketItem.setAmountVat(new BigDecimal(58.44));
        basketItem.setQuantity(3);
        basketItem.setTitle("Apple iPad Air");
        basketItem.setUnit("Pc.");
        basketItem.setVat(20);
        basketItem.setSubTitle("Nicht nur Pros brauchen Power.");
        basketItem.setType("goods");
        try {
            basketItem.setImageUrl(new URL("https://www.apple.com/de/ipad-air/images/overview/hero__gmn7i7gbziqa_large_2x.jpg"));
        } catch (MalformedURLException e) {
        }
        return basketItem;
    }

Create and initialize basket

protected Basket getMaxTestBasket() {
        Basket basket = new Basket();
        basket.setAmountTotalGross(new BigDecimal(866.49));
        basket.setAmountTotalVat(new BigDecimal(866.49*0.2).setScale(2, RoundingMode.HALF_UP));
        basket.setAmountTotalDiscount(BigDecimal.TEN);
        basket.setAmountTotalVat(new BigDecimal(144.42));
        basket.setCurrencyCode(Currency.getInstance("EUR"));
        basket.setNote("Mistery shopping");
        basket.setOrderId(getRandomId());
        basket.addBasketItem(getMaxTestBasketItem1());
        basket.addBasketItem(getMaxTestBasketItem2());
        return basket;
    }

Create basket

Basket maxBasket = getMaxTestBasket();
Heidelpay heidelpay = new Heidelpay("s-priv-xxxxxxxxxx");
Basket basket = heidelpay.createBasket(maxBasket);