Update wallet implementation & resource API
This commit is contained in:
parent
892afd8efb
commit
9f20f92c02
8
sql/sequence_session_script.sql
Normal file
8
sql/sequence_session_script.sql
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
-- SEQUENCE: public."T_SESSION_session_id_seq"
|
||||||
|
|
||||||
|
-- DROP SEQUENCE public."T_SESSION_session_id_seq";
|
||||||
|
|
||||||
|
CREATE SEQUENCE public."t_session_id_seq";
|
||||||
|
|
||||||
|
ALTER SEQUENCE public."t_session_id_seq"
|
||||||
|
OWNER TO postgres;
|
19
sql/table_session_script.sql
Normal file
19
sql/table_session_script.sql
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
-- Table: public."T_SESSION"
|
||||||
|
|
||||||
|
-- DROP TABLE public."T_SESSION";
|
||||||
|
|
||||||
|
CREATE TABLE public."T_SESSION"
|
||||||
|
(
|
||||||
|
session_id integer NOT NULL DEFAULT nextval('"t_session_id_seq"'::regclass),
|
||||||
|
user_id bigint NOT NULL,
|
||||||
|
start_session bigint NOT NULL,
|
||||||
|
end_session bigint NOT NULL,
|
||||||
|
CONSTRAINT "T_SESSION_pkey" PRIMARY KEY (session_id)
|
||||||
|
)
|
||||||
|
WITH (
|
||||||
|
OIDS = FALSE
|
||||||
|
)
|
||||||
|
TABLESPACE pg_default;
|
||||||
|
|
||||||
|
ALTER TABLE public."T_SESSION"
|
||||||
|
OWNER to postgres;
|
|
@ -8,7 +8,7 @@ CREATE TABLE public."T_WALLET"
|
||||||
wallet_hash character varying(255) COLLATE pg_catalog."default" NOT NULL,
|
wallet_hash character varying(255) COLLATE pg_catalog."default" NOT NULL,
|
||||||
user_hash character varying(255) COLLATE pg_catalog."default" NOT NULL,
|
user_hash character varying(255) COLLATE pg_catalog."default" NOT NULL,
|
||||||
type character varying(255) COLLATE pg_catalog."default" NOT NULL,
|
type character varying(255) COLLATE pg_catalog."default" NOT NULL,
|
||||||
sold numeric(255,5) NOT NULL,
|
balance numeric(255,5) NOT NULL,
|
||||||
creation_date bigint NOT NULL,
|
creation_date bigint NOT NULL,
|
||||||
modification_date bigint NOT NULL,
|
modification_date bigint NOT NULL,
|
||||||
is_active boolean NOT NULL,
|
is_active boolean NOT NULL,
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class Wallet {
|
||||||
@DatabaseField(canBeNull = false)
|
@DatabaseField(canBeNull = false)
|
||||||
private String type;
|
private String type;
|
||||||
@DatabaseField(canBeNull = false)
|
@DatabaseField(canBeNull = false)
|
||||||
private Double sold;
|
private Double balance;
|
||||||
@DatabaseField(canBeNull = false)
|
@DatabaseField(canBeNull = false)
|
||||||
private long creation_date;
|
private long creation_date;
|
||||||
@DatabaseField(canBeNull = false)
|
@DatabaseField(canBeNull = false)
|
||||||
|
@ -40,11 +40,11 @@ public class Wallet {
|
||||||
this.is_active = isActive;
|
this.is_active = isActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Wallet(String wallet_hash, String user_hash, String type, Double sold, boolean isActive) {
|
public Wallet(String wallet_hash, String user_hash, String type, Double balance, boolean isActive) {
|
||||||
this.wallet_hash = wallet_hash;
|
this.wallet_hash = wallet_hash;
|
||||||
this.user_hash = user_hash;
|
this.user_hash = user_hash;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.sold = sold;
|
this.balance = balance;
|
||||||
this.is_active = isActive;
|
this.is_active = isActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,11 +77,11 @@ public class Wallet {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getSold() {
|
public Double getBalance() {
|
||||||
return sold;
|
return balance;
|
||||||
}
|
}
|
||||||
public void setSold(Double sold) {
|
public void setBalance(Double sold) {
|
||||||
this.sold = sold;
|
this.balance = balance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean is_active() {
|
public boolean is_active() {
|
||||||
|
@ -110,6 +110,6 @@ public class Wallet {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "{wallet_hash:"+wallet_hash+",user_hash:"+user_hash+",type:"+type+",sold:"+sold+"}";
|
return "{wallet_hash:"+wallet_hash+",user_hash:"+user_hash+",type:"+type+",balance:"+balance+"}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,14 @@ public class WalletDao {
|
||||||
return walletDao.queryForFirst(preparedQuery);
|
return walletDao.queryForFirst(preparedQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateWalletBalance(String walletHash, double newBalance) throws Exception {
|
||||||
|
walletDao = createWalletDaoConnection();
|
||||||
|
UpdateBuilder<Wallet, String> updateBuilder = walletDao.updateBuilder();
|
||||||
|
updateBuilder.updateColumnValue("balance",newBalance);
|
||||||
|
updateBuilder.where().eq("wallet_hash",walletHash);
|
||||||
|
updateBuilder.update();
|
||||||
|
}
|
||||||
|
|
||||||
public List<Wallet> getUserWallet(String userHash) throws Exception {
|
public List<Wallet> getUserWallet(String userHash) throws Exception {
|
||||||
walletDao = createWalletDaoConnection();
|
walletDao = createWalletDaoConnection();
|
||||||
QueryBuilder<Wallet, String> queryBuilder = walletDao.queryBuilder();
|
QueryBuilder<Wallet, String> queryBuilder = walletDao.queryBuilder();
|
||||||
|
@ -43,7 +51,7 @@ public class WalletDao {
|
||||||
return walletDao.query(preparedQuery);
|
return walletDao.query(preparedQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Wallet> getOldUserWallets(String userHash) throws Exception{
|
public List<Wallet> getUserOldWallets(String userHash) throws Exception{
|
||||||
walletDao = createWalletDaoConnection();
|
walletDao = createWalletDaoConnection();
|
||||||
QueryBuilder<Wallet, String> queryBuilder = walletDao.queryBuilder();
|
QueryBuilder<Wallet, String> queryBuilder = walletDao.queryBuilder();
|
||||||
queryBuilder.where().eq("user_hash",userHash).and().eq("is_active",false);
|
queryBuilder.where().eq("user_hash",userHash).and().eq("is_active",false);
|
||||||
|
|
|
@ -14,6 +14,7 @@ import java.util.List;
|
||||||
|
|
||||||
public class BlockchainQueryImplementation {
|
public class BlockchainQueryImplementation {
|
||||||
|
|
||||||
|
/*
|
||||||
public Double getWalletSold(String walletHash){
|
public Double getWalletSold(String walletHash){
|
||||||
QueryWrapper queryWrapper = new QueryWrapper();
|
QueryWrapper queryWrapper = new QueryWrapper();
|
||||||
Double sold = 0.0;
|
Double sold = 0.0;
|
||||||
|
@ -63,7 +64,7 @@ public class BlockchainQueryImplementation {
|
||||||
return wallets;
|
return wallets;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
public String sendTransaction(String sourceWallet, String destinationWallet, Double amount){
|
public String sendTransaction(String sourceWallet, String destinationWallet, Double amount){
|
||||||
TransactionWrapper transactionWrapper = new TransactionWrapper();
|
TransactionWrapper transactionWrapper = new TransactionWrapper();
|
||||||
BlockEvent.TransactionEvent transactionEvent = transactionWrapper.sendTransaction("transaction",new String[]{sourceWallet,destinationWallet,amount.toString()});
|
BlockEvent.TransactionEvent transactionEvent = transactionWrapper.sendTransaction("transaction",new String[]{sourceWallet,destinationWallet,amount.toString()});
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
||||||
|
|
||||||
public class DatabaseTransactionImplementation {
|
public class DatabaseTransactionImplementation {
|
||||||
|
|
||||||
|
/*
|
||||||
public void saveTransaction(Transaction transaction) throws Exception{
|
public void saveTransaction(Transaction transaction) throws Exception{
|
||||||
TransactionDao transactionDao = new TransactionDao();
|
TransactionDao transactionDao = new TransactionDao();
|
||||||
long now = Instant.now().toEpochMilli();
|
long now = Instant.now().toEpochMilli();
|
||||||
|
@ -44,5 +45,6 @@ public class DatabaseTransactionImplementation {
|
||||||
TransactionDao transactionDao = new TransactionDao();
|
TransactionDao transactionDao = new TransactionDao();
|
||||||
return transactionDao.getUserReceivedTransaction(userHash);
|
return transactionDao.getUserReceivedTransaction(userHash);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,10 +36,10 @@ public class DatabaseUserImplementation {
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
public User getUser(String email, String password) throws Exception{
|
public User getUser(String email, String password) throws Exception{
|
||||||
UserDao userDao = new UserDao();
|
UserDao userDao = new UserDao();
|
||||||
User user1 = userDao.getUser(email);
|
User user1 = userDao.getUser(email);
|
||||||
|
@ -54,9 +54,9 @@ public class DatabaseUserImplementation {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
public Map<String,String> userLogger(User user) throws Exception {
|
public Map<String,String> userLogger(User user) throws Exception {
|
||||||
UserDao userDao = new UserDao();
|
UserDao userDao = new UserDao();
|
||||||
Map<String,String> response = new HashMap<String, String>();
|
Map<String,String> response = new HashMap<String, String>();
|
||||||
|
@ -76,9 +76,9 @@ public class DatabaseUserImplementation {
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
private String hashPassword(String plainTextPassword){
|
private String hashPassword(String plainTextPassword){
|
||||||
return BCrypt.hashpw(plainTextPassword,BCrypt.gensalt());
|
return BCrypt.hashpw(plainTextPassword,BCrypt.gensalt());
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import javax.json.JsonReader;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class WalletImplementation {
|
public class WalletImplementation {
|
||||||
|
@ -32,7 +31,7 @@ public class WalletImplementation {
|
||||||
|
|
||||||
transactionWrapper.sendTransaction("initWallet",new String[]{wallet.getWallet_hash(),wallet.getType(),wallet.getUser_hash()}); //Create Wallet in Blockchain
|
transactionWrapper.sendTransaction("initWallet",new String[]{wallet.getWallet_hash(),wallet.getType(),wallet.getUser_hash()}); //Create Wallet in Blockchain
|
||||||
|
|
||||||
wallet.setSold(0.0);
|
wallet.setBalance(0.0);
|
||||||
wallet.setIs_active(true);
|
wallet.setIs_active(true);
|
||||||
long now = Instant.now().toEpochMilli();
|
long now = Instant.now().toEpochMilli();
|
||||||
wallet.setCreation_date(now);
|
wallet.setCreation_date(now);
|
||||||
|
@ -42,7 +41,7 @@ public class WalletImplementation {
|
||||||
|
|
||||||
response.put("walletHash",wallet.getWallet_hash());
|
response.put("walletHash",wallet.getWallet_hash());
|
||||||
response.put("walletType",wallet.getType());
|
response.put("walletType",wallet.getType());
|
||||||
response.put("walletSold",wallet.getSold().toString());
|
response.put("walletSold",wallet.getBalance().toString());
|
||||||
response.put("response","true");
|
response.put("response","true");
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
@ -73,18 +72,41 @@ public class WalletImplementation {
|
||||||
wallet.setWallet_hash(walletJson.getString("id"));
|
wallet.setWallet_hash(walletJson.getString("id"));
|
||||||
wallet.setUser_hash(walletJson.getString("owner"));
|
wallet.setUser_hash(walletJson.getString("owner"));
|
||||||
wallet.setType(walletJson.getString("walletType"));
|
wallet.setType(walletJson.getString("walletType"));
|
||||||
wallet.setSold(walletJson.getJsonNumber("sold").doubleValue());
|
wallet.setBalance(walletJson.getJsonNumber("sold").doubleValue());
|
||||||
}
|
}
|
||||||
return wallet;
|
return wallet;
|
||||||
}
|
}
|
||||||
|
|
||||||
//setSold
|
//setSold
|
||||||
|
public void setSoldToWallet(String walletHash, double balance) throws Exception {
|
||||||
|
TransactionWrapper transactionWrapper = new TransactionWrapper();
|
||||||
|
transactionWrapper.sendTransaction("setSoldOnWallet",new String[]{walletHash,String.valueOf(balance)});
|
||||||
|
|
||||||
|
WalletDao walletDao = new WalletDao();
|
||||||
|
walletDao.updateWalletBalance(walletHash,balance);
|
||||||
|
}
|
||||||
|
|
||||||
|
//addMoney
|
||||||
|
//TODO
|
||||||
|
|
||||||
//transfer
|
//transfer
|
||||||
|
public void transferWallet(String walletHash, String newUserHash) throws Exception {
|
||||||
|
TransactionWrapper transactionWrapper = new TransactionWrapper();
|
||||||
|
transactionWrapper.sendTransaction("transferWallet",new String[]{walletHash,newUserHash});
|
||||||
|
|
||||||
|
WalletDao walletDao = new WalletDao();
|
||||||
|
walletDao.transferWallet(walletHash,newUserHash);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//delete
|
//delete
|
||||||
|
public void deleteWallet(String walletHash) throws Exception {
|
||||||
|
TransactionWrapper transactionWrapper = new TransactionWrapper();
|
||||||
|
transactionWrapper.sendTransaction("deleteWallet",new String[]{walletHash});
|
||||||
|
|
||||||
|
WalletDao walletDao = new WalletDao();
|
||||||
|
walletDao.deleteWallet(walletHash);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private String generateWalletHash(String walletBuilderString){
|
private String generateWalletHash(String walletBuilderString){
|
||||||
|
|
|
@ -12,7 +12,7 @@ import javax.validation.Valid;
|
||||||
@RequestMapping(value = "/api/rest/query")
|
@RequestMapping(value = "/api/rest/query")
|
||||||
public class BlockchainQueryResource {
|
public class BlockchainQueryResource {
|
||||||
|
|
||||||
|
/*
|
||||||
@RequestMapping(value = "/balance", method = RequestMethod.GET ,params = {"walletHash"},produces = "application/json")
|
@RequestMapping(value = "/balance", method = RequestMethod.GET ,params = {"walletHash"},produces = "application/json")
|
||||||
@ResponseStatus(HttpStatus.OK)
|
@ResponseStatus(HttpStatus.OK)
|
||||||
public ResponseEntity<StringResponse> getUserBalance(@RequestParam(value = "walletHash") String walletHash){
|
public ResponseEntity<StringResponse> getUserBalance(@RequestParam(value = "walletHash") String walletHash){
|
||||||
|
@ -30,7 +30,7 @@ public class BlockchainQueryResource {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
@RequestMapping(value = "/registerUser", method = RequestMethod.POST, produces = "application/json")
|
@RequestMapping(value = "/registerUser", method = RequestMethod.POST, produces = "application/json")
|
||||||
@ResponseStatus(HttpStatus.OK)
|
@ResponseStatus(HttpStatus.OK)
|
||||||
public ResponseEntity<StringResponse> registerUser(@Valid @RequestBody User user){
|
public ResponseEntity<StringResponse> registerUser(@Valid @RequestBody User user){
|
||||||
|
|
|
@ -12,7 +12,7 @@ import java.util.List;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "/api/rest/transaction")
|
@RequestMapping(value = "/api/rest/transaction")
|
||||||
public class DatabaseTransactionResource {
|
public class DatabaseTransactionResource {
|
||||||
|
/*
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
@ResponseStatus(HttpStatus.CREATED)
|
@ResponseStatus(HttpStatus.CREATED)
|
||||||
public ResponseEntity<String> saveTransaction(@Valid @RequestBody Transaction transaction){
|
public ResponseEntity<String> saveTransaction(@Valid @RequestBody Transaction transaction){
|
||||||
|
@ -105,6 +105,7 @@ public class DatabaseTransactionResource {
|
||||||
return new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST);
|
return new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,9 +42,9 @@ public class DatabaseUserResource {
|
||||||
return ResponseEntity.status(HttpStatus.CONFLICT).body(responseS);
|
return ResponseEntity.status(HttpStatus.CONFLICT).body(responseS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
@RequestMapping(value = "/login", method = RequestMethod.POST,produces = "application/json")
|
@RequestMapping(value = "/login", method = RequestMethod.POST,produces = "application/json")
|
||||||
@ResponseStatus(HttpStatus.OK)
|
@ResponseStatus(HttpStatus.OK)
|
||||||
public ResponseEntity<StringResponse> login(@Valid @RequestBody User user){
|
public ResponseEntity<StringResponse> login(@Valid @RequestBody User user){
|
||||||
|
@ -78,9 +78,9 @@ public class DatabaseUserResource {
|
||||||
return ResponseEntity.status(HttpStatus.CONFLICT).body(responseS);
|
return ResponseEntity.status(HttpStatus.CONFLICT).body(responseS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
@PostMapping(value = "/get", produces = "application/json")
|
@PostMapping(value = "/get", produces = "application/json")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseEntity<User> getUser(@RequestBody User user){
|
public ResponseEntity<User> getUser(@RequestBody User user){
|
||||||
|
@ -99,9 +99,9 @@ public class DatabaseUserResource {
|
||||||
return new ResponseEntity(e.getMessage(), HttpStatus.CONFLICT);
|
return new ResponseEntity(e.getMessage(), HttpStatus.CONFLICT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
@PostMapping(value = "/update")
|
@PostMapping(value = "/update")
|
||||||
@ResponseStatus(HttpStatus.OK)
|
@ResponseStatus(HttpStatus.OK)
|
||||||
public ResponseEntity updateUser(@RequestBody User user){
|
public ResponseEntity updateUser(@RequestBody User user){
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package restService;
|
package restService;
|
||||||
|
|
||||||
import database.Wallet.Wallet;
|
import database.Wallet.Wallet;
|
||||||
import database.transaction.Transaction;
|
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -24,7 +23,7 @@ public class WalletResource {
|
||||||
|
|
||||||
Wallet returnWallet = new Wallet();
|
Wallet returnWallet = new Wallet();
|
||||||
returnWallet.setWallet_hash(walletResponse.get("walletHash"));
|
returnWallet.setWallet_hash(walletResponse.get("walletHash"));
|
||||||
returnWallet.setSold(Double.parseDouble(walletResponse.get("walletSold")));
|
returnWallet.setBalance(Double.parseDouble(walletResponse.get("walletSold")));
|
||||||
returnWallet.setType(walletResponse.get("walletType"));
|
returnWallet.setType(walletResponse.get("walletType"));
|
||||||
|
|
||||||
if(Boolean.parseBoolean(walletResponse.get("response"))){
|
if(Boolean.parseBoolean(walletResponse.get("response"))){
|
||||||
|
@ -72,4 +71,48 @@ public class WalletResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/setBalance", method = RequestMethod.POST,produces = "application/json")
|
||||||
|
@ResponseStatus(HttpStatus.OK)
|
||||||
|
public ResponseEntity setBalance(@RequestBody Wallet wallet){
|
||||||
|
WalletImplementation walletImplementation = new WalletImplementation();
|
||||||
|
try{
|
||||||
|
walletImplementation.setSoldToWallet(wallet.getWallet_hash(),wallet.getBalance());
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body("{\"response\":\"ok\"}");
|
||||||
|
} catch (Exception e){
|
||||||
|
StringResponse responseS = new StringResponse(e.getMessage());
|
||||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(responseS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/transfer", method = RequestMethod.POST, produces = "application/json")
|
||||||
|
@ResponseStatus(HttpStatus.OK)
|
||||||
|
public ResponseEntity transferWallet(@RequestBody Wallet wallet){
|
||||||
|
WalletImplementation walletImplementation = new WalletImplementation();
|
||||||
|
try {
|
||||||
|
walletImplementation.transferWallet(wallet.getWallet_hash(),wallet.getUser_hash());
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body("{\"response\":\"ok\"}");
|
||||||
|
} catch (Exception e){
|
||||||
|
StringResponse responseS = new StringResponse(e.getMessage());
|
||||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(responseS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/delete/{walletHash}", method = RequestMethod.DELETE)
|
||||||
|
public ResponseEntity deleteWallet(@PathVariable("walletHash") String walletHash){
|
||||||
|
WalletImplementation walletImplementation = new WalletImplementation();
|
||||||
|
try{
|
||||||
|
walletImplementation.deleteWallet(walletHash);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body("{\"response\":\"ok\"}");
|
||||||
|
}catch (Exception e){
|
||||||
|
StringResponse responseS = new StringResponse(e.getMessage());
|
||||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(responseS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue