Created
April 17, 2018 18:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.clouddemo.kjoshi.restep.controller; | |
import com.braintreegateway.Result; | |
import com.clouddemo.kjoshi.restep.service.BrainTreeService; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.RequestParam; | |
import org.springframework.web.bind.annotation.RestController; | |
@RestController | |
@RequestMapping("/v1/api/braintree") | |
public class BrainTreeController { | |
private static final Logger logger = LoggerFactory.getLogger(BrainTreeController.class); | |
@Autowired | |
BrainTreeService svc; | |
@RequestMapping("/token") | |
public void getBrainTreeToken(){ | |
svc.getClientTocken(); | |
} | |
@RequestMapping("/transaction") | |
public Result bookTransaction(@RequestParam("amt")Double amt,@RequestParam("nonce")String nonce){ | |
logger.info("Booking transaction for amount:{} and nounce:{}",amt,nonce); | |
return svc.performTransaction(amt,nonce); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment