package io.reactivesw.order.order.application.model.mapper;

import io.reactivesw.catalog.product.application.model.Price;
import io.reactivesw.order.order.domain.entity.value.PriceValue;

/**
 * Created by Davis on 17/2/7.
 */
public final class PriceMapper {
  /**
   * Instantiates a new Price mapper.
   */
  private PriceMapper() {
  }

  /**
   * Model to entity price value.
   *
   * @param model the model
   * @return the price value
   */
  public static PriceValue modelToEntity(Price model) {
    // TODO: 17/2/7  
    return null;
  }
}

@@ -116,16 +116,70 @@
 .Price;%0A
+import io.reactivesw.common.model.mapper.MoneyMapper;%0A
 import i
@@ -235,16 +235,16 @@
 eValue;%0A
-
 %0A/**%0A * 
@@ -561,41 +561,572 @@
     
-// TODO: 17/2/7  %0A    return null
+PriceValue entity = new PriceValue();%0A%0A    entity.setValue(MoneyMapper.modelToEntity(model.getValue()));%0A    entity.setCountry(model.getCountry());%0A    if (model.getCustomerGroup() != null) %7B%0A      entity.setCustomerGroup(model.getCustomerGroup().getId());%0A    %7D%0A    if (model.getChannel() != null) %7B%0A      entity.setChannel(model.getChannel().getId());%0A    %7D%0A    entity.setValidFrom(model.getValidFrom());%0A    entity.setValidUntil(model.getValidUntil());%0A    entity.setDiscounted(model.getDiscounted());%0A    entity.setCustom(model.getCustom());%0A%0A    return entity
 ;%0A  

edit PriceMapper