package com.braintree.converters.populators.configuration;

import com.braintree.enums.BraintreePaymentMethodLimitData;
import com.braintree.hybris.data.BraintreeSRCConfigurationData;
import de.hybris.platform.converters.Populator;
import de.hybris.platform.core.model.BraintreeSRCConfigurationModel;
import de.hybris.platform.servicelayer.dto.converter.ConversionException;

public class BraintreeSRCConfigurationPopulator implements Populator<BraintreeSRCConfigurationModel, BraintreeSRCConfigurationData> {

    @Override
    public void populate(BraintreeSRCConfigurationModel source, BraintreeSRCConfigurationData target) throws ConversionException {
        target.setEnabled(source.isEnabled());
        target.setSavedSRCAccountLimit(BraintreePaymentMethodLimitData.valueOf(source.getSavedSRCAccountLimit().getCode()));
    }
}
