package com.ywt.alipaympapi.controller;

import com.ywt.model.ResponseVO;
import com.ywt.request.oauth.NoticeOauthRequest;
import com.ywt.request.oauth.PhoneOauthRequest;
import com.ywt.response.oauth.NoticeOauthResponseData;
import com.ywt.response.oauth.PhoneOauthResponseData;
import com.ywt.alipaympapi.service.IsvOauthService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Desc
 */
@RestController
@Slf4j
public class VerifyController {

    @Autowired
    private IsvOauthService isvOauthService;

    /**
     * 发送手机验证码
     *
     * @param request
     * @return
     */
    @PostMapping("isvRequest.other.phoneOauth")
    public ResponseVO<PhoneOauthResponseData> sendPhoneVerification(PhoneOauthRequest request) {

        return ResponseVO.success(isvOauthService.sendPhoneVerification(request));
    }

    /**
     * 消息通知授权
     *
     * @param request
     * @return
     */
    @PostMapping("isvRequest.other.noticeAuth")
    public ResponseVO<NoticeOauthResponseData> noticeAuth(NoticeOauthRequest request) {

        return ResponseVO.success(isvOauthService.getTemplateId(request));
    }
}
