package com.bonus.canteen.core.auth.mobile.api;

import com.bonus.canteen.core.auth.mobile.alipay.dto.AliPayUserAgreementQueryDTO;
import com.bonus.canteen.core.auth.mobile.alipay.service.AliPayService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class AliPayApi {
   private static final Logger log = LoggerFactory.getLogger(AliPayApi.class);
   @Resource
   private AliPayService aliPayService;

   public String paymentCodeDecod(String authCode) {
      try {
         return this.aliPayService.paymentCodeDecod(authCode);
      } catch (Exception var3) {
         log.error("支付宝付款码解码异常", var3);
         return null;
      }
   }

//   public String decodeBarCodeForEnterprise(String authCode) {
//      try {
//         return this.aliPayService.decodeBarCode(authCode);
//      } catch (Exception var3) {
//         log.error("支付宝付款码解码异常", var3);
//         return null;
//      }
//   }

   public String userAgreementQuerySelect(String openId) {
      AliPayUserAgreementQueryDTO aliPayUserAgreementQueryDTO = (new AliPayUserAgreementQueryDTO()).setAlipayUserId(openId);

      try {
         return this.aliPayService.userAgreementQueryselect(aliPayUserAgreementQueryDTO);
      } catch (Exception var4) {
         log.error("支付宝查询签约号异常", var4);
         return null;
      }
   }
}
