package com.ruoyi.bst.refund.service.impl;

import com.ruoyi.bst.pay.domain.PayVO;
import com.ruoyi.bst.pay.domain.dto.PayRefundDTO;
import com.ruoyi.bst.refund.domain.Refund;
import com.ruoyi.bst.refund.service.RefundConverter;
import org.springframework.stereotype.Service;

@Service
public class RefundConverterImpl implements RefundConverter{

    @Override
    public Refund toPo(PayRefundDTO dto, PayVO pay) {
        if (dto == null || pay == null) {
            return null;
        }

        Refund refund = new Refund();
        refund.setPayId(pay.getId());
        refund.setAmount(dto.getRefundAmount());
        refund.setStoreId(pay.getStoreId());
        refund.setReason(dto.getRefundReason());
        refund.setUserId(dto.getUserId());
        refund.setUserName(dto.getUserName());
        refund.setNumber(dto.getNumber());
        return refund;
    }
}
