Skip to content

Instantly share code, notes, and snippets.

@mitanjos
Created April 17, 2018 18:01
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