package com.bonus.canteen.core.pay.common.vo;


import com.bonus.canteen.core.account.v3.web.vo.AccOrdBasicsVO;
import com.bonus.canteen.core.pay.channel.account.vo.AccPayResultVO;
import com.bonus.canteen.core.pay.common.constants.PayStateEnum;
import com.bonus.canteen.core.pay.common.dto.PayRefundDTO;

import java.math.BigDecimal;

public class PayRefundVO {
   private Integer code;
   private String msg;
   private Long tradeId;
   private String outTradeNo;
   private BigDecimal amount;
   private BigDecimal refundAmount;
   private AccPayResultVO accPayResultVO;

   public static PayRefundVO of(PayRefundDTO payRefundDTO) {
      PayRefundVO payRefundVO = new PayRefundVO();
      payRefundVO.setCode(PayStateEnum.PAY_FAIL.getKey());
      payRefundVO.setMsg(PayStateEnum.PAY_FAIL.getDesc());
      payRefundVO.setTradeId(payRefundDTO.getTradeId());
      payRefundVO.setAmount(payRefundDTO.getAmount());
      payRefundVO.setRefundAmount(BigDecimal.ZERO);
      return payRefundVO;
   }

   public void fillAccOrdBasicsVo(AccOrdBasicsVO accOrdBasicsVO) {
      if (accOrdBasicsVO != null) {
         this.accPayResultVO = AccPayResultVO.of(accOrdBasicsVO);
      }

   }

   public Integer getCode() {
      return this.code;
   }

   public String getMsg() {
      return this.msg;
   }

   public Long getTradeId() {
      return this.tradeId;
   }

   public String getOutTradeNo() {
      return this.outTradeNo;
   }

   public BigDecimal getAmount() {
      return this.amount;
   }

   public BigDecimal getRefundAmount() {
      return this.refundAmount;
   }

   public AccPayResultVO getAccPayResultVO() {
      return this.accPayResultVO;
   }

   public void setCode(final Integer code) {
      this.code = code;
   }

   public void setMsg(final String msg) {
      this.msg = msg;
   }

   public void setTradeId(final Long tradeId) {
      this.tradeId = tradeId;
   }

   public void setOutTradeNo(final String outTradeNo) {
      this.outTradeNo = outTradeNo;
   }

   public void setAmount(final BigDecimal amount) {
      this.amount = amount;
   }

   public void setRefundAmount(final BigDecimal refundAmount) {
      this.refundAmount = refundAmount;
   }

   public void setAccPayResultVO(final AccPayResultVO accPayResultVO) {
      this.accPayResultVO = accPayResultVO;
   }
}
