content: package com.food.order.system.payment.data.access.payment.mapper;
  
  
  import com.food.order.system.payment.data.access.payment.entity.PaymentEntity;
  import com.food.order.system.payment.service.domain.entity.Payment;
  import com.food.order.system.payment.service.domain.valueobject.PaymentId;
  import com.food.order.system.valueobject.CustomerId;
  import com.food.order.system.valueobject.Money;
  import com.food.order.system.valueobject.OrderId;
  import org.springframework.stereotype.Component;
  
  @Component
  public class PaymentDataAccessMapper {
  
      public PaymentEntity paymentToPaymentEntity(Payment payment) {
          return PaymentEntity.builder()
                  .id(payment.getId().getValue())
                  .customerId(payment.getCustomerId().getValue())
                  .orderId(payment.getOrderId().getValue())
                  .price(payment.getPrice().getAmount())
                  .status(payment.getStatus())
                  .createdAt(payment.getCreatedAt())
                  .build();
      }
  
      public Payment paymentEntityToPayment(PaymentEntity paymentEntity) {
          return Payment.builder()
                  .id(new PaymentId(paymentEntity.getId()))
                  .customerId(new CustomerId(paymentEntity.getCustomerId()))
                  .orderId(new OrderId(paymentEntity.getOrderId()))
                  .price(new Money(paymentEntity.getPrice()))
                  .createdAt(paymentEntity.getCreatedAt())
                  .build();
      }
  
  }
  