package com.bonus.core.pay.api;
import com.bonus.core.pay.api.dto.UnifyPayDTO;
import com.bonus.core.pay.api.dto.UnifyPaySelectDTO;
import com.bonus.core.pay.api.dto.UnifyRefundDTO;
import com.bonus.core.pay.api.vo.UnifyPaySelectVO;
import com.bonus.core.pay.api.vo.UnifyPayVO;
import com.bonus.core.pay.api.vo.UnifyRefundVO;
import com.bonus.core.pay.common.business.ChannelBusiness;
import com.bonus.core.pay.common.business.PayBusiness;
import com.bonus.core.pay.common.business.RefundBusiness;
import com.bonus.core.pay.common.constants.PayChannelSelectEnum;
import com.bonus.core.pay.common.service.PayService;
import com.bonus.core.pay.common.vo.PayChannelSelectDTO;
import com.bonus.core.pay.common.vo.PayChannelSelectResultVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class PayApi {
   private static final Logger log = LoggerFactory.getLogger(PayApi.class);
   @Lazy
   @Resource
   protected ChannelBusiness channelBusiness;
   @Lazy
   @Resource
   protected PayBusiness payBusiness;
   @Lazy
   @Autowired
   protected RefundBusiness refundBusiness;

   public PayChannelSelectResultVO payChannelSelect(PayChannelSelectEnum selectType, PayChannelSelectDTO payChannelSelectDTO) {
      return this.channelBusiness.payChannelSelect(selectType, payChannelSelectDTO);
   }

   public UnifyPayVO pay(UnifyPayDTO payDTO) {
      return this.payBusiness.unifyPay(payDTO);
   }

   public UnifyPaySelectVO paySelect(UnifyPaySelectDTO paySelectDTO) {
      return this.payBusiness.unifyPaySelect(paySelectDTO);
   }

   public UnifyRefundVO refund(UnifyRefundDTO refundDTO) {
      return this.refundBusiness.unifyRefund(refundDTO);
   }

}
