package com.jeequan.jeepay.pay.ctrl.openapi;

import com.jeequan.jeepay.core.model.openapi.AccessReq;
import com.jeequan.jeepay.pay.anno.OpenLabel;
import com.jeequan.jeepay.pay.ctrl.OpenApiController;
import com.jeequan.jeepay.pay.service.openapi.impl.TransferApiService;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO
 *
 * @author deng
 * @since 2024/5/14
 */
@Slf4j
@RestController
@RequestMapping("/api/open")
public class TransferController extends OpenApiController {

    @Autowired
    private TransferApiService transferApiService;

    @OpenLabel
    @PostMapping("/transfer")
    public Object transfer() {
        AccessReq rq = getRQ();
        transferApiService.preCheck(rq);
        return transferApiService.transfer(rq);
    }

    @OpenLabel
    @PostMapping("/transferResult")
    public Object transferResult() {
        AccessReq rq = getRQ();
        transferApiService.preCheck(rq);
        return transferApiService.transferResult(rq);
    }

    @OpenLabel
    @PostMapping("/transferWallet")
    public Object transferWalletInfo() {
        AccessReq rq = getRQ();
        transferApiService.preCheck(rq);
        return transferApiService.transferWalletInfo(rq);
    }
}
