package com.rf.psychological.douyin.service;

import com.alibaba.fastjson.JSONObject;
import com.rf.psychological.douyin.model.DouYinOrderEntity;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

import java.util.Map;

/**
 * @Description:抖音接口
 * @Author: mimang
 * @Date: 2023/8/15
 */
@ConditionalOnProperty(prefix="douyin",name = "isDouYin", havingValue = "true")
public interface DouYinService {



    /**
     * 获取到用户openid
     * @param code
     * @return
     * @throws Exception
     */
    String jscode2session(String code) throws Exception;

    /**
     * 静默登录注册
     * @param openid 用户openid
     * @param resultJson 待返回结果数据
     * @return
     */
    JSONObject douyinLogin(String openid, JSONObject resultJson);

    /**
     * 获取到token
     * @return
     */
    String getAccessToken() throws Exception;

    String getRQCode(String appname, String path) throws Exception;

    /**
     * 预下单
     * @param totalAmount 金额
      * @param subject 主题
     * @param body 介绍
     * @param resultId 结果Id
     * @return
     */
    Map<String, Object> createOrder(int totalAmount, String subject, String body, String resultId, String path) throws Exception;


    /**
     * 查询订单支付情况
     * @param orderNo 订单编号
     * @return
     */
    Map<String, Object> queryOrder(String orderNo) throws Exception;

    void checkOrderStatus();

    /**
     * 处理回调结果
     * @param msgJson 信息
     * @param resultCode 返回code
     * @return
     */
    JSONObject notifyOrder(JSONObject jsonObject, JSONObject msgJson, String resultCode);

    DouYinOrderEntity queryOrderByResultId(String resultId);

    JSONObject pushOrder(String orderNo,String resultId,String title,String openId,int totalAmount, String path,int orderStatus,String imgPath) throws Exception;
}
