Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

package com.spice.profitmandi.web.v2.controller;

import com.spice.profitmandi.web.controller.OTPController;
import com.spice.profitmandi.web.v2.response.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/v2")
public class V2OTPController extends V2BaseController {

    @Autowired
    private OTPController otpController;

    @GetMapping("/otp/generateOTP")
    public ResponseEntity<ApiResponse<?>> generateOtp(@RequestParam("mobile") String mobile) throws Throwable {
        return wrapResponse(otpController.generateOtp(mobile));
    }

    @GetMapping("/otp/verifyOTP")
    public ResponseEntity<ApiResponse<?>> validateOtp(@RequestParam String mobile,
                                                       @RequestParam int referenceId,
                                                       @RequestParam String otpCode) throws Throwable {
        return wrapResponse(otpController.validateOtp(mobile, referenceId, otpCode));
    }

    @PostMapping("/otp/parseOTP")
    public ResponseEntity<ApiResponse<?>> parseOTP(@RequestParam(name = "message") String message) throws Throwable {
        return wrapResponse(otpController.parseOTP(message));
    }
}