class PersistableTransactionPopulator extends AbstractDataPopulator<PersistableTransaction, Transaction> {

	private OrderService orderService;
	private PricingService pricingService;
	
	@Override
	public Transaction populate(PersistableTransaction source, Transaction target, MerchantStore store,
			Language language) throws ConversionException {<FILL_FUNCTION_BODY>}

	@Override
	protected Transaction createTarget() {
		// TODO Auto-generated method stub
		return null;
	}
	
	public OrderService getOrderService() {
		return orderService;
	}

	public void setOrderService(OrderService orderService) {
		this.orderService = orderService;
	}

	public PricingService getPricingService() {
		return pricingService;
	}

	public void setPricingService(PricingService pricingService) {
		this.pricingService = pricingService;
	}

}

		
		Validate.notNull(source,"PersistableTransaction must not be null");
		Validate.notNull(orderService,"OrderService must not be null");
		Validate.notNull(pricingService,"OrderService must not be null");
		
		if(target == null) {
			target = new Transaction();
		}
		
		
		try {
			

			target.setAmount(pricingService.getAmount(source.getAmount()));
			target.setDetails(source.getDetails());
			target.setPaymentType(PaymentType.valueOf(source.getPaymentType()));
			target.setTransactionType(TransactionType.valueOf(source.getTransactionType()));
			target.setTransactionDate(DateUtil.getDate(source.getTransactionDate()));
			
			if(source.getOrderId()!=null && source.getOrderId().longValue() > 0) {
				Order order = orderService.getById(source.getOrderId());
/*				if(source.getCustomerId() == null) {
					throw new ConversionException("Cannot add a transaction for an Order without specyfing the customer");
				}*/
				
				if(order == null) {
					throw new ConversionException("Order with id " + source.getOrderId() + "does not exist");
				}
				target.setOrder(order);
			}
			
			return target;
			
			
		
		} catch(Exception e) {
			throw new ConversionException(e);
		}

	
<methods>public non-sealed void <init>() ,public java.util.Locale getLocale() ,public com.salesmanager.core.model.payments.Transaction populate(com.salesmanager.shop.model.order.transaction.PersistableTransaction, com.salesmanager.core.model.merchant.MerchantStore, com.salesmanager.core.model.reference.language.Language) throws com.salesmanager.core.business.exception.ConversionException,public void setLocale(java.util.Locale) <variables>private java.util.Locale locale