package com.braintree.converters.populators;

import static de.hybris.platform.servicelayer.util.ServicesUtil.validateParameterNotNull;

import de.hybris.platform.converters.Populator;
import de.hybris.platform.servicelayer.dto.converter.ConversionException;

import com.braintree.hybris.data.BrainTreeSubscriptionInfoData;
import com.braintree.payment.dto.BraintreeInfo;


public class BrainTreeInfoPopulator implements Populator<BrainTreeSubscriptionInfoData, BraintreeInfo> {

    @Override
    public void populate(final BrainTreeSubscriptionInfoData source, final BraintreeInfo target)
            throws ConversionException {
        validateParameterNotNull(source, "Subscription data cannot be null");

        target.setPaymentMethodToken(source.getPaymentMethodToken());
        target.setPaymentMethodGraphQLToken(source.getPaymentMethodGraphQLToken());
        target.setNonce(source.getNonce());
        target.setDeviceData(source.getDeviceData());
        target.setImageSource(source.getImageSource());
        target.setExpirationMonth(source.getExpirationMonth());
        target.setExpirationYear(source.getExpirationYear());
        target.setLiabilityShifted(source.getLiabilityShifted());

        target.setPaymentProvider(source.getPaymentProvider());
        target.setSavePaymentInfo(source.isSavePaymentInfo());
        target.setShouldBeSaved(source.isShouldBeSaved());
        target.setCardNumber(source.getCardNumber());
        target.setCardType(source.getCardType());
        target.setEmail(source.getEmail());
        target.setCardholderName(source.getCardholder());
        target.setIntent(source.getIntent());
        target.setAmount(source.getAmount());
        target.setPaypalFundingSource(source.getPaypalFundingSource());
    }
}
