package com.braintree.customersupportbackoffice.widgets.order;

import com.hybris.cockpitng.util.DefaultWidgetController;
import org.zkoss.util.Locales;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.NumberFormat;

public class AbstractOrderActionController extends DefaultWidgetController {

    private static final String DECIMAL_FORMAT_PATTERN = "#0.00";

    protected String formatAmount(final BigDecimal amount) {
        final DecimalFormat decimalFormat = (DecimalFormat) NumberFormat.getNumberInstance(Locales.getCurrent());
        decimalFormat.applyPattern(DECIMAL_FORMAT_PATTERN);
        return decimalFormat.format(amount);
    }

}
