package com.fs.his.controller;

import com.alibaba.fastjson.JSON;
import com.fs.huifuPay.domain.HuiFuOnlinePay;
import com.fs.huifuPay.domain.HuiFuOnlineRefund;
import com.fs.huifuPay.domain.HuiFuResult;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value="/huFu")
public class FsTestCommonController {

    @RequestMapping("/payNotifyUrl")
    public String asyncMessage(@RequestParam String resp_desc,@RequestParam String resp_code,@RequestParam String sign,@RequestParam String resp_data) {
        System.out.println(resp_data);
        System.out.println(resp_desc);
        System.out.println(resp_code);
        HuiFuResult huiFuResult = JSON.parseObject(resp_data, HuiFuResult.class);
        System.out.println(huiFuResult);
        return "ok";
    }


    @RequestMapping("/payOnlineNotifyUrl")
    public String asyncHuFuOnlinePay(@RequestParam String resp_desc,@RequestParam String resp_code,@RequestParam String sign,@RequestParam String resp_data) {
        System.out.println(resp_data);
        System.out.println(resp_desc);
        System.out.println(resp_code);
        HuiFuOnlinePay huFuResult = JSON.parseObject(resp_data, HuiFuOnlinePay.class);
        System.out.println(huFuResult);
        return "ok";
    }
    @RequestMapping("/onlineRefund")
    public String onlineRefund(@RequestParam String resp_desc,@RequestParam String resp_code,@RequestParam String sign,@RequestParam String resp_data) {
        System.out.println(resp_data);
        System.out.println(resp_desc);
        System.out.println(resp_code);
        HuiFuOnlineRefund huFuResult = JSON.parseObject(resp_data, HuiFuOnlineRefund.class);
        System.out.println(huFuResult);
        return "ok";
    }

    @RequestMapping("/refundNotifyUrl")
    public String refundMessage(@RequestParam String resp_desc,@RequestParam String resp_code,@RequestParam String sign,@RequestParam String resp_data) {
        System.out.println(resp_data);
        return "ok";
    }
}
