Full object response

This commit is contained in:
MathewFrancis 2025-08-28 15:16:13 +05:30
parent fcec677942
commit b5146eebc6
4 changed files with 23 additions and 10 deletions

View File

@ -1,4 +1,6 @@
package com.example.cezenBTC.DTO.user;
public record UserDataDTO(String userIdNumber, String userName, String btId) {
import com.example.cezenBTC.DTO.CenteralServerConect.ApiResponse;
public record UserDataDTO(String userIdNumber, String userName, String btId, ApiResponse fullResponse) {
}

View File

@ -87,7 +87,7 @@ public class CezenABSAuthenticationProvider implements AuthenticationProvider/*
}
System.out.println("Auth DONE");
return new UsernamePasswordAuthenticationToken(userStringId+","+btId+","+user.log().cUsrNm(), pwd, authorities);
return new UsernamePasswordAuthenticationToken(userStringId+","+btId+","+user.log().cUsrNm()+","+pwd, pwd, authorities);
} else {
throw new BadCredentialsException("Invalid password!");
}

View File

@ -1,9 +1,12 @@
package com.example.cezenBTC.controller;
import com.example.cezenBTC.DTO.CenteralServerConect.ApiResponse;
import com.example.cezenBTC.DTO.ReturnStatus;
import com.example.cezenBTC.DTO.user.AdminSetPasswordDTO;
import com.example.cezenBTC.DTO.user.UserDataDTO;
import com.example.cezenBTC.absbridge.model.LoginRequest;
import com.example.cezenBTC.entity.user.UserEntity;
import com.example.cezenBTC.service.ABS.ABSServiceForLogIn;
import com.example.cezenBTC.service.BtcUserService;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
@ -18,6 +21,10 @@ public class SignUpController {
@Autowired
private BtcUserService btcUserService;
@Autowired
private ABSServiceForLogIn absServiceForLogIn;
//sign up route
@PostMapping("/signup")
public ReturnStatus signUp(@RequestBody @Valid AdminSetPasswordDTO adminSetPasswordDTO){
@ -42,7 +49,7 @@ public class SignUpController {
UserEntity userEntity = this.btcUserService.getUserByUserId(garuHamu[0]);
return new UserDataDTO(userEntity.getUserIdNumber(), userEntity.getUserName(), garuHamu[1]);
return new UserDataDTO(userEntity.getUserIdNumber(), userEntity.getUserName(), garuHamu[1], null);
}
@ -57,10 +64,19 @@ public class SignUpController {
// this is to venerate karthik garu and hamu
String[] garuHamu = authentication.getName().split(",");
String op = "User Id is -" + garuHamu[0] + "- the betting terminal id is -" + garuHamu[1] + "- The name is -"+ garuHamu[2]+"-";
String op = "User Id is -" + garuHamu[0] + "- the betting terminal id is -" + garuHamu[1] + "- The name is -"+ garuHamu[2]+"- password -"+garuHamu[3];
ApiResponse user = this.absServiceForLogIn.loginInServiceListener(
new LoginRequest(garuHamu[0], garuHamu[1], "", garuHamu[3], "", ""));
System.out.println(op);
return new UserDataDTO(garuHamu[0], garuHamu[2], garuHamu[1]);
// if the second auth fails then betting terminal is down
if(user.log() == null){
return new UserDataDTO("Error", "Login Error", "Check credentials", null);
}
return new UserDataDTO(garuHamu[0], garuHamu[2], garuHamu[1], user);
}
}

View File

@ -260,8 +260,6 @@ public class ABSServiceForLogIn {
json.put("success", rcvHeader.nRetCd() == AbsProtocol.SUCCESS);
json.put("encryption", encMeta);
System.out.println("-".repeat(10) + json.get("ok"));
Object rcvHeaderRaw = json.get("rcvHeaderRaw");
RcvHeader rcvHeaderMix = (RcvHeader) json.get("rcvHeaderRaw");
@ -284,7 +282,6 @@ public class ABSServiceForLogIn {
Log logDump = null;
System.out.println("-".repeat(10) + encryption);
// ---- body offset logic (like Node) ----
int bodyOffset = rcvHeader.size();
if (reply.length >= bodyOffset + 4) {
@ -367,8 +364,6 @@ public class ABSServiceForLogIn {
logDump
);
System.out.println(apiResponse);
//json.put("log", log);
} catch (Exception ex) {
json.put("parseLogError", ex.toString());