package com.gree.mall.manager.logic.user;
import com.gree.mall.manager.exception.RemoteServiceException;
import com.gree.mall.manager.logic.common.WechatLogic;
import com.gree.mall.manager.plus.service.UserService;

import lombok.extern.slf4j.Slf4j;
import org.jdom.JDOMException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.text.ParseException;
import java.util.*;

@Slf4j
@Service
public class PayLogic {

    @Autowired
    WechatLogic wechatLogic;
    @Autowired
    UserService userService;

    public void payCall(String body) throws JDOMException, IOException, RemoteServiceException, ParseException {
        log.info("==========支付回调开始：{}",body);
        Map<String, String> params = wechatLogic.doXMLParse(body);
//            if (!weChatLogic.isTenpaySign(params)) {
//                // 支付失败
//                //throw new CommonException(C.ERROR_CODE_REQUEST_FAIL,C.ERROR_MSG_REQUEST_FAIL);
//            }
        String id = params.get("out_trade_no");//订单号


        log.info("===============支付回调成功:{}==============",id);

    }

}
