package com.braintree.converters.populators.configuration;

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

public class BraintreeHostedFieldsConfigurationPopulator implements Populator<BraintreeHostedFieldsConfigurationModel, BraintreeHostedFieldsConfigurationData> {

    @Override
    public void populate(BraintreeHostedFieldsConfigurationModel source, BraintreeHostedFieldsConfigurationData target) throws ConversionException {
        target.setEnabled(source.isEnabled());
        target.setReverify(source.isReverify());
        target.setVerifyCard(source.isVerifyCard());
        target.setExpireBetween(source.getExpireBetween());
        target.setExpireOnAdding(source.isExpireOnAdding());
        target.setSavedCardAccountLimit(BraintreePaymentMethodLimitData.valueOf(source.getSavedCardAccountLimit().getCode()));
    }
}
