Nabeel-DG-BS
Raja Nabeel 2 years ago
parent eb48ddf4ad
commit ab7e7e3058

@ -12,6 +12,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter; import org.springframework.web.filter.OncePerRequestFilter;
import java.io.IOException; import java.io.IOException;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -61,7 +62,7 @@ public class LoggingActivityFilter extends OncePerRequestFilter {
String deviceName = request.getHeader("deviceName"); String deviceName = request.getHeader("deviceName");
String userActivity = request.getHeader("userActivity"); String userActivity = request.getHeader("userActivity");
CustomerProfile customer = customerProfileRepository.findbyEmail(porOrgacode,email); CustomerProfile customer = customerProfileRepository.findbyEmail(porOrgacode, email);
if (customer != null && userActivity != null) { if (customer != null && userActivity != null) {
CustomerAccountActivity activity = new CustomerAccountActivity( CustomerAccountActivity activity = new CustomerAccountActivity(
null, null,

@ -1,16 +1,13 @@
package com.mfsys.uco.controller; package com.mfsys.uco.controller;
import com.mfsys.comm.util.FunctionReturnDetail;
import com.mfsys.uco.UCOURI; import com.mfsys.uco.UCOURI;
import com.mfsys.uco.dto.CashInTransactionRequest; import com.mfsys.uco.dto.CashInTransactionRequest;
import com.mfsys.uco.dto.CashOutTransactionRequest; import com.mfsys.uco.dto.CashOutTransactionRequest;
import com.mfsys.uco.dto.Transaction.TransactionOtpRequestModel; import com.mfsys.uco.dto.Transaction.TransactionOtpRequestModel;
import com.mfsys.uco.dto.TransactionPinResponseModel; import com.mfsys.uco.dto.TransactionPinResponseModel;
import com.mfsys.uco.dto.webclientdto.AccountDetail;
import com.mfsys.uco.model.TransactionTrail; import com.mfsys.uco.model.TransactionTrail;
import com.mfsys.uco.service.TransactionService; import com.mfsys.uco.service.TransactionService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
@ -28,12 +25,12 @@ public class TransactionController {
} }
@PostMapping(UCOURI.SUBMIT_DR_TRANSACTION) @PostMapping(UCOURI.SUBMIT_DR_TRANSACTION)
public Map<String,Object> cashInTransaction(@RequestBody CashInTransactionRequest transactionRequest) { public Map<String, Object> cashInTransaction(@RequestBody CashInTransactionRequest transactionRequest) {
return transactionService.cashInTransaction(transactionRequest); return transactionService.cashInTransaction(transactionRequest);
} }
@PostMapping(UCOURI.SUBMIT_CR_TRANSACTION) @PostMapping(UCOURI.SUBMIT_CR_TRANSACTION)
public Map<String,Object> cashOutTransaction(@RequestBody CashOutTransactionRequest transactionRequest) { public Map<String, Object> cashOutTransaction(@RequestBody CashOutTransactionRequest transactionRequest) {
return transactionService.cashOutTransaction(transactionRequest); return transactionService.cashOutTransaction(transactionRequest);
} }

@ -9,8 +9,6 @@ import com.mfsys.uco.dto.*;
import com.mfsys.uco.dto.webclientdto.AccountDetail; import com.mfsys.uco.dto.webclientdto.AccountDetail;
import com.mfsys.uco.model.CustomerAccountActivity; import com.mfsys.uco.model.CustomerAccountActivity;
import com.mfsys.uco.model.CustomerProfile; import com.mfsys.uco.model.CustomerProfile;
import com.mfsys.uco.model.UcoAccount;
import com.mfsys.uco.repository.UCOAccountRepository;
import com.mfsys.uco.service.*; import com.mfsys.uco.service.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
@ -18,11 +16,9 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Base64; import java.util.Base64;
import java.util.List; import java.util.List;
import java.util.Map;
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@ -36,7 +32,7 @@ public class UserController {
private final CustomerAccountActivityService customerAccountActivityService; private final CustomerAccountActivityService customerAccountActivityService;
@PostMapping(UCOURI.ONBOARD_CUSTOMER) @PostMapping(UCOURI.ONBOARD_CUSTOMER)
public ResponseEntity<HttpStatus> customerOnBoarding(@RequestBody SignupStep3RequestModel signupStep3RequestModel) { public ResponseEntity<HttpStatus> customerOnBoarding(@RequestBody SignupStep3RequestModel signupStep3RequestModel) {
ucoAccountService.onBoardCustomer(signupStep3RequestModel); ucoAccountService.onBoardCustomer(signupStep3RequestModel);
return ResponseEntity.ok(HttpStatus.OK); return ResponseEntity.ok(HttpStatus.OK);
} }
@ -44,7 +40,7 @@ public class UserController {
@PostMapping(UCOURI.VIEW_BALANCE) @PostMapping(UCOURI.VIEW_BALANCE)
public ViewBalanceResponseModel viewBalance(@RequestBody ViewBalanceRequestModel viewBalanceRequestModel) { public ViewBalanceResponseModel viewBalance(@RequestBody ViewBalanceRequestModel viewBalanceRequestModel) {
ViewBalanceResponseModel viewBalanceResponseModel = new ViewBalanceResponseModel(); ViewBalanceResponseModel viewBalanceResponseModel = new ViewBalanceResponseModel();
viewBalanceResponseModel.setMbmBkmsbalance(ucoAccountService.fetchAccountBalance(viewBalanceRequestModel.getPorOrgacode(),viewBalanceRequestModel.getMbmBkmsNumber())); viewBalanceResponseModel.setMbmBkmsbalance(ucoAccountService.fetchAccountBalance(viewBalanceRequestModel.getPorOrgacode(), viewBalanceRequestModel.getMbmBkmsNumber()));
return viewBalanceResponseModel; return viewBalanceResponseModel;
} }
@ -52,7 +48,7 @@ public class UserController {
public CustomerProfile fetchlogindata( public CustomerProfile fetchlogindata(
@RequestParam String porOrgacode, @RequestParam String porOrgacode,
@RequestParam String email) { @RequestParam String email) {
return customerProfileService.fetchCustcodeBasedOnEmail(porOrgacode,email); return customerProfileService.fetchCustcodeBasedOnEmail(porOrgacode, email);
} }
@GetMapping(UCOURI.FETCH_DEPOSITACCOUNTS) @GetMapping(UCOURI.FETCH_DEPOSITACCOUNTS)
@ -60,7 +56,7 @@ public class UserController {
@RequestParam String porOrgacode, @RequestParam String porOrgacode,
@RequestParam String cmpCustcode, @RequestParam String cmpCustcode,
@RequestParam String pctCstycode) { @RequestParam String pctCstycode) {
return List.of(ucoAccountService.fetchdepositAccountFromCiihive(porOrgacode,cmpCustcode)); return List.of(ucoAccountService.fetchdepositAccountFromCiihive(porOrgacode, cmpCustcode));
} }
@GetMapping(UCOURI.FETCH_ACCOUNT_STATEMENT) @GetMapping(UCOURI.FETCH_ACCOUNT_STATEMENT)
@ -91,7 +87,7 @@ public class UserController {
@RequestParam String acntTypeValue, @RequestParam String acntTypeValue,
@RequestParam String porOrgacode, @RequestParam String porOrgacode,
@RequestParam String channelCode) { @RequestParam String channelCode) {
return ucoAccountService.fetchAccountTitile(porOrgacode,acntTypeCode,acntTypeValue); return ucoAccountService.fetchAccountTitile(porOrgacode, acntTypeCode, acntTypeValue);
} }
// mine // mine
@ -119,13 +115,14 @@ public class UserController {
return "Error generating report"; return "Error generating report";
} }
} }
@PostMapping(UCOURI.CREATE_TRAN_PIN) @PostMapping(UCOURI.CREATE_TRAN_PIN)
public ResponseEntity<HttpStatus> createTransactionPin(@RequestBody CreateTransactionPinRequest request) { public ResponseEntity<HttpStatus> createTransactionPin(@RequestBody CreateTransactionPinRequest request) {
try { try {
transactionPinService.createTransactionPin(request); transactionPinService.createTransactionPin(request);
return ResponseEntity.ok(HttpStatus.OK); return ResponseEntity.ok(HttpStatus.OK);
} catch (Exception e) { } catch (Exception e) {
return ResponseEntity.ok(HttpStatus.INTERNAL_SERVER_ERROR); return ResponseEntity.ok(HttpStatus.INTERNAL_SERVER_ERROR);
} }
} }
@ -163,7 +160,7 @@ public class UserController {
@GetMapping(UCOURI.ACCOUNT_ACTIVITY) @GetMapping(UCOURI.ACCOUNT_ACTIVITY)
public ResponseEntity<List<CustomerAccountActivity>> getCustomerAccountActivity( public ResponseEntity<List<CustomerAccountActivity>> getCustomerAccountActivity(
@PathVariable String porOrgacode, @PathVariable String cmpCustcode,@PathVariable String fdate,@PathVariable String tdate) { @PathVariable String porOrgacode, @PathVariable String cmpCustcode, @PathVariable String fdate, @PathVariable String tdate) {
return new ResponseEntity<List<CustomerAccountActivity>>( return new ResponseEntity<List<CustomerAccountActivity>>(
customerAccountActivityService.getCustomerAccountActivity(porOrgacode, cmpCustcode, fdate, tdate), customerAccountActivityService.getCustomerAccountActivity(porOrgacode, cmpCustcode, fdate, tdate),
HttpStatus.OK); HttpStatus.OK);

@ -29,6 +29,6 @@ public class CashInTransactionRequest {
private String transMode; private String transMode;
private double sgtGntramtfc; private double sgtGntramtfc;
private String otdTrancomment; private String otdTrancomment;
private String obpPincode ; private String obpPincode;
private String pinType ; private String pinType;
} }

@ -1,4 +1,5 @@
package com.mfsys.uco.dto.Transaction; package com.mfsys.uco.dto.Transaction;
import lombok.Data; import lombok.Data;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;

@ -10,13 +10,13 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class VerifyPinRequest { public class VerifyPinRequest {
String channelCode; String channelCode;
String pctCstycode; String pctCstycode;
String porOrgacode; String porOrgacode;
String cmpCustcode; String cmpCustcode;
String email; String email;
String obpPincode; String obpPincode;
String pinType; String pinType;
} }

@ -8,6 +8,7 @@ import lombok.RequiredArgsConstructor;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.Map; import java.util.Map;
@Data @Data
@RequiredArgsConstructor @RequiredArgsConstructor
@AllArgsConstructor @AllArgsConstructor

@ -4,8 +4,6 @@ package com.mfsys.uco.exception;
import com.mfsys.comm.exception.ApplicationException; import com.mfsys.comm.exception.ApplicationException;
import com.mfsys.comm.exception.ERRCode; import com.mfsys.comm.exception.ERRCode;
import javax.swing.*;
public class OldPinIncorrectException extends ApplicationException { public class OldPinIncorrectException extends ApplicationException {
public OldPinIncorrectException() { public OldPinIncorrectException() {
super(null, ERRCode.OLD_PIN_INCORRECT, null); super(null, ERRCode.OLD_PIN_INCORRECT, null);

@ -13,32 +13,32 @@ import java.time.LocalDateTime;
@AllArgsConstructor @AllArgsConstructor
public class CustomerAccountActivity { public class CustomerAccountActivity {
@Id @Id
@GeneratedValue(strategy= GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
private Long id; private Long id;
@Column(name = "POR_ORGACODE", nullable = false, updatable = false, columnDefinition = FieldNameLength.POR_ORGACODE) @Column(name = "POR_ORGACODE", nullable = false, updatable = false, columnDefinition = FieldNameLength.POR_ORGACODE)
private String porOrgacode; private String porOrgacode;
@Column(name = "CMP_CUSTCODE", nullable = false, updatable = false, columnDefinition = FieldNameLength.CUSTOMER_CODE) @Column(name = "CMP_CUSTCODE", nullable = false, updatable = false, columnDefinition = FieldNameLength.CUSTOMER_CODE)
private String cmpCustcode; private String cmpCustcode;
private LocalDateTime date; private LocalDateTime date;
private String channal; private String channal;
private String deviceName; private String deviceName;
private String activity; private String activity;
@JsonIgnore @JsonIgnore
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumns({ @JoinColumns({
@JoinColumn(name = "POR_ORGACODE", referencedColumnName = "POR_ORGACODE", insertable = false, updatable = false), @JoinColumn(name = "POR_ORGACODE", referencedColumnName = "POR_ORGACODE", insertable = false, updatable = false),
@JoinColumn(name = "CMP_CUSTCODE", referencedColumnName = "CMP_CUSTCODE", insertable = false, updatable = false)}) @JoinColumn(name = "CMP_CUSTCODE", referencedColumnName = "CMP_CUSTCODE", insertable = false, updatable = false)})
private CustomerProfile customer; private CustomerProfile customer;
public CustomerAccountActivity() { public CustomerAccountActivity() {
} }
} }

@ -37,25 +37,18 @@ public class CustomerProfile {
@Column(name = "KYC_RENEWAL_DATE", nullable = true, columnDefinition = FieldNameLength.DATE) @Column(name = "KYC_RENEWAL_DATE", nullable = true, columnDefinition = FieldNameLength.DATE)
protected LocalDate kycRenewalDate; protected LocalDate kycRenewalDate;
@Column(name = "CMP_ISKYC_VERIFIED", nullable = false, columnDefinition = FieldNameLength.BOOLEAN_BIT)
protected boolean cmpIsKycVerified = false;
@Column(name = "CMP_TRAN_PIN", nullable = true, columnDefinition = FieldNameLength.PIN_VALUE)
protected String cmpTranpin;
@Column(name = "CMP_UNVERIFIED_TRAN_PIN", nullable = true, columnDefinition = FieldNameLength.PIN_VALUE)
protected String cmpUnverifiedTranpin;
@Column(name = "CMP_TRAN_PIN_VERIFIED", nullable = false, columnDefinition = FieldNameLength.BOOLEAN_BIT)
protected boolean cmpTranpinVerfied = false;
@Column(name = "CMP_EMAIL", nullable = true, columnDefinition = FieldNameLength.CODE_50) @Column(name = "CMP_EMAIL", nullable = true, columnDefinition = FieldNameLength.CODE_50)
private String cmpEmail; private String cmpEmail;
@Column(name = "CMP_NAME", nullable = true, columnDefinition = FieldNameLength.CODE_50) @Column(name = "CMP_NAME", nullable = true, columnDefinition = FieldNameLength.CODE_50)
private String cmpName; private String cmpName;
@Column(name = "CMP_USERNAME", nullable = true, columnDefinition = FieldNameLength.CODE_50) @Column(name = "CMP_USERNAME", nullable = true, columnDefinition = FieldNameLength.CODE_50)
private String cmpUserName; private String cmpUserName;
@Column(name = "CMP_ISKYC_VERIFIED", nullable=false, columnDefinition=FieldNameLength.BOOLEAN_BIT)
protected boolean cmpIsKycVerified = false;
@Column(name = "CMP_TRAN_PIN", nullable=true, columnDefinition=FieldNameLength.PIN_VALUE)
protected String cmpTranpin;
@Column(name = "CMP_UNVERIFIED_TRAN_PIN", nullable=true, columnDefinition=FieldNameLength.PIN_VALUE)
protected String cmpUnverifiedTranpin;
@Column(name = "CMP_TRAN_PIN_VERIFIED", nullable=false, columnDefinition=FieldNameLength.BOOLEAN_BIT)
protected boolean cmpTranpinVerfied = false;
} }

@ -4,63 +4,63 @@ import java.io.Serializable;
public class CustomerProfileId implements Serializable { public class CustomerProfileId implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String porOrgacode; private String porOrgacode;
private String cmpCustcode; private String cmpCustcode;
public String getPorOrgacode() { public CustomerProfileId() {
return porOrgacode; }
}
public void setPorOrgacode(String porOrgacode) { public CustomerProfileId(String porOrgacode, String cmpCustcode) {
this.porOrgacode = porOrgacode; this.porOrgacode = porOrgacode;
} this.cmpCustcode = cmpCustcode;
}
public String getCmpCustcode() { public String getPorOrgacode() {
return cmpCustcode; return porOrgacode;
} }
public void setCmpCustcode(String cmpCustcode) { public void setPorOrgacode(String porOrgacode) {
this.cmpCustcode = cmpCustcode; this.porOrgacode = porOrgacode;
} }
public CustomerProfileId() { public String getCmpCustcode() {
return cmpCustcode;
} }
public CustomerProfileId(String porOrgacode, String cmpCustcode) { public void setCmpCustcode(String cmpCustcode) {
this.porOrgacode = porOrgacode;
this.cmpCustcode = cmpCustcode; this.cmpCustcode = cmpCustcode;
} }
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + ((cmpCustcode == null) ? 0 : cmpCustcode.hashCode()); result = prime * result + ((cmpCustcode == null) ? 0 : cmpCustcode.hashCode());
result = prime * result + ((porOrgacode == null) ? 0 : porOrgacode.hashCode()); result = prime * result + ((porOrgacode == null) ? 0 : porOrgacode.hashCode());
return result; return result;
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj)
return true; return true;
if (obj == null) if (obj == null)
return false; return false;
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
CustomerProfileId other = (CustomerProfileId) obj; CustomerProfileId other = (CustomerProfileId) obj;
if (cmpCustcode == null) { if (cmpCustcode == null) {
if (other.cmpCustcode != null) if (other.cmpCustcode != null)
return false; return false;
} else if (!cmpCustcode.equals(other.cmpCustcode)) } else if (!cmpCustcode.equals(other.cmpCustcode))
return false; return false;
if (porOrgacode == null) { if (porOrgacode == null) {
if (other.porOrgacode != null) if (other.porOrgacode != null)
return false; return false;
} else if (!porOrgacode.equals(other.porOrgacode)) } else if (!porOrgacode.equals(other.porOrgacode))
return false; return false;
return true; return true;
} }
} }

@ -18,62 +18,44 @@ import java.time.LocalDate;
@Table(name = "BN_MS_UA_UCOACCOUNTTRAIL") @Table(name = "BN_MS_UA_UCOACCOUNTTRAIL")
public class TransactionTrail { public class TransactionTrail {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "POR_ORGACODE", nullable = false, updatable = false, columnDefinition = FieldNameLength.POR_ORGACODE) @Column(name = "POR_ORGACODE", nullable = false, updatable = false, columnDefinition = FieldNameLength.POR_ORGACODE)
protected String porOrgacode; protected String porOrgacode;
@Column(name = "DR_MBM_BKMSNUMBER", nullable = false, updatable = false, columnDefinition = FieldNameLength.ACCOUNT_NUMBER) @Column(name = "DR_MBM_BKMSNUMBER", nullable = false, updatable = false, columnDefinition = FieldNameLength.ACCOUNT_NUMBER)
protected String drMbmBkmsnumber; protected String drMbmBkmsnumber;
@Column(name = "CR_MBM_BKMSNUMBER", nullable = false, updatable = false, columnDefinition = FieldNameLength.ACCOUNT_NUMBER) @Column(name = "CR_MBM_BKMSNUMBER", nullable = false, updatable = false, columnDefinition = FieldNameLength.ACCOUNT_NUMBER)
protected String crMbmBkmsnumber; protected String crMbmBkmsnumber;
@Column(name = "DMP_PRODCODE", nullable = false, updatable = false, columnDefinition = FieldNameLength.DMP_PRODCODE) @Column(name = "DMP_PRODCODE", nullable = false, updatable = false, columnDefinition = FieldNameLength.DMP_PRODCODE)
protected String dmpProdcode; protected String dmpProdcode;
@Column(name = "DR_MBM_BKMSTITLE", nullable = false, updatable = true, columnDefinition = FieldNameLength.ACCOUNT_TITLE) @Column(name = "DR_MBM_BKMSTITLE", nullable = false, updatable = true, columnDefinition = FieldNameLength.ACCOUNT_TITLE)
protected String drmbmBkmstitle; protected String drmbmBkmstitle;
@Column(name = "DR_PCR_CURRDESC", nullable=false, columnDefinition=FieldNameLength.DESCRIPTION_LONG)
private String drpcrCurrdesc;
@Column(name = "CMP_CUSTCODE", nullable = false, updatable = false, columnDefinition = FieldNameLength.CUSTOMER_CODE) @Column(name = "CMP_CUSTCODE", nullable = false, updatable = false, columnDefinition = FieldNameLength.CUSTOMER_CODE)
protected String cmpCustcode; protected String cmpCustcode;
@Column(name = "DR_PCR_CURRCODE", columnDefinition=FieldNameLength.PCR_CURRCODE)
private String drPcrCurrcode;
@Column(name = "CR_MBM_BKMSTITLE", nullable = false, updatable = true, columnDefinition = FieldNameLength.ACCOUNT_TITLE) @Column(name = "CR_MBM_BKMSTITLE", nullable = false, updatable = true, columnDefinition = FieldNameLength.ACCOUNT_TITLE)
protected String crMbmBkmstitle; protected String crMbmBkmstitle;
@Column(name = "CR_PCR_CURRDESC", nullable=false, columnDefinition=FieldNameLength.DESCRIPTION_LONG)
private String crPcrCurrdesc;
@Column(name = "CR_PCR_CURRCODE", columnDefinition=FieldNameLength.PCR_CURRCODE)
private String crPcrCurrcode;
@Column(name = "SGT_SENTGNTRNUMBER", nullable = false, updatable = false, columnDefinition = FieldNameLength.CODE_500) @Column(name = "SGT_SENTGNTRNUMBER", nullable = false, updatable = false, columnDefinition = FieldNameLength.CODE_500)
protected String sgtSentGntrnumber; protected String sgtSentGntrnumber;
@Column(name = "DR_SGT_GNTRDATE", nullable = false, updatable = false, columnDefinition = FieldNameLength.DATE) @Column(name = "DR_SGT_GNTRDATE", nullable = false, updatable = false, columnDefinition = FieldNameLength.DATE)
protected LocalDate drSgtGntrdate; protected LocalDate drSgtGntrdate;
@Column(name = "CR_SGT_GNTRDATE", nullable = true, updatable = false, columnDefinition = FieldNameLength.DATE) @Column(name = "CR_SGT_GNTRDATE", nullable = true, updatable = false, columnDefinition = FieldNameLength.DATE)
protected LocalDate crSgtGntrdate; protected LocalDate crSgtGntrdate;
@Column(name = "SGT_GNTRAMT", nullable = false, updatable = false, columnDefinition = FieldNameLength.AMOUNT_REAL) @Column(name = "SGT_GNTRAMT", nullable = false, updatable = false, columnDefinition = FieldNameLength.AMOUNT_REAL)
protected BigDecimal sgtGntramt = BigDecimal.ZERO; protected BigDecimal sgtGntramt = BigDecimal.ZERO;
@Column(name = "BAT_ACNTTRANSENT", nullable = false, columnDefinition = FieldNameLength.BOOLEAN_BIT) @Column(name = "BAT_ACNTTRANSENT", nullable = false, columnDefinition = FieldNameLength.BOOLEAN_BIT)
protected boolean batAcnttranSend; protected boolean batAcnttranSend;
@Column(name = "BAT_ACNTTRANRECEIVED", nullable = true, columnDefinition = FieldNameLength.BOOLEAN_BIT) @Column(name = "BAT_ACNTTRANRECEIVED", nullable = true, columnDefinition = FieldNameLength.BOOLEAN_BIT)
protected boolean batAcnttranReceived; protected boolean batAcnttranReceived;
@Column(name = "SGT_RECEIVEGNTRNUMBER", nullable = true, updatable = true, columnDefinition = FieldNameLength.CODE_500) @Column(name = "SGT_RECEIVEGNTRNUMBER", nullable = true, updatable = true, columnDefinition = FieldNameLength.CODE_500)
protected String sgtReceiveGntrnumber; protected String sgtReceiveGntrnumber;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "DR_PCR_CURRDESC", nullable = false, columnDefinition = FieldNameLength.DESCRIPTION_LONG)
private String drpcrCurrdesc;
@Column(name = "DR_PCR_CURRCODE", columnDefinition = FieldNameLength.PCR_CURRCODE)
private String drPcrCurrcode;
@Column(name = "CR_PCR_CURRDESC", nullable = false, columnDefinition = FieldNameLength.DESCRIPTION_LONG)
private String crPcrCurrdesc;
@Column(name = "CR_PCR_CURRCODE", columnDefinition = FieldNameLength.PCR_CURRCODE)
private String crPcrCurrcode;
} }

@ -1,7 +1,10 @@
package com.mfsys.uco.model; package com.mfsys.uco.model;
import com.mfsys.comm.util.FieldNameLength; import com.mfsys.comm.util.FieldNameLength;
import jakarta.persistence.*; import jakarta.persistence.Column;
import jakarta.persistence.EmbeddedId;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -16,31 +19,23 @@ import java.time.LocalDate;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class UcoAccount { public class UcoAccount {
@EmbeddedId
private AccountId id;
@Column(name = "DMP_PRODCODE", nullable = false, updatable = false, columnDefinition = FieldNameLength.DMP_PRODCODE) @Column(name = "DMP_PRODCODE", nullable = false, updatable = false, columnDefinition = FieldNameLength.DMP_PRODCODE)
protected String dmpProdcode; protected String dmpProdcode;
@Column(name = "MBM_BKMSTITLE", nullable = false, updatable = true, columnDefinition = FieldNameLength.ACCOUNT_TITLE) @Column(name = "MBM_BKMSTITLE", nullable = false, updatable = true, columnDefinition = FieldNameLength.ACCOUNT_TITLE)
protected String mbmBkmstitle; protected String mbmBkmstitle;
@Column(name = "PCR_CURRDESC", nullable=false, columnDefinition=FieldNameLength.DESCRIPTION_LONG)
private String pcrCurrdesc;
@Column(name = "CMP_CUSTCODE", nullable = false, updatable = false, columnDefinition = FieldNameLength.CUSTOMER_CODE) @Column(name = "CMP_CUSTCODE", nullable = false, updatable = false, columnDefinition = FieldNameLength.CUSTOMER_CODE)
protected String cmpCustcode; protected String cmpCustcode;
@Column(name = "PCR_CURRCODE", columnDefinition=FieldNameLength.PCR_CURRCODE)
private String pcrCurrcode;
@Column(name = "MBM_BKMSCLOSED", nullable = false, columnDefinition = FieldNameLength.BOOLEAN_BIT) @Column(name = "MBM_BKMSCLOSED", nullable = false, columnDefinition = FieldNameLength.BOOLEAN_BIT)
protected boolean mbmBkmsclosed; protected boolean mbmBkmsclosed;
@Column(name = "SGT_LASTTRANDATE", nullable = true, updatable = true, columnDefinition = FieldNameLength.DATE) @Column(name = "SGT_LASTTRANDATE", nullable = true, updatable = true, columnDefinition = FieldNameLength.DATE)
protected LocalDate sgtLasttrandate; protected LocalDate sgtLasttrandate;
@Column(name = "MBM_BKMSOPENDATE", nullable = false, columnDefinition = FieldNameLength.DATE) @Column(name = "MBM_BKMSOPENDATE", nullable = false, columnDefinition = FieldNameLength.DATE)
protected LocalDate mbmBkmsopendate; protected LocalDate mbmBkmsopendate;
@EmbeddedId
private AccountId id;
@Column(name = "PCR_CURRDESC", nullable = false, columnDefinition = FieldNameLength.DESCRIPTION_LONG)
private String pcrCurrdesc;
@Column(name = "PCR_CURRCODE", columnDefinition = FieldNameLength.PCR_CURRCODE)
private String pcrCurrcode;
} }

@ -10,8 +10,8 @@ import java.util.List;
@Repository @Repository
public interface CustomerAccountActivityRepository extends JpaRepository<CustomerAccountActivity, Integer> { public interface CustomerAccountActivityRepository extends JpaRepository<CustomerAccountActivity, Integer> {
@Query("SELECT cust FROM CustomerAccountActivity cust WHERE cust.porOrgacode = :porOrgacode and cust.cmpCustcode = :cmpCustcode AND DATE(cust.date) BETWEEN DATE(:fdate) AND DATE(:tdate)") @Query("SELECT cust FROM CustomerAccountActivity cust WHERE cust.porOrgacode = :porOrgacode and cust.cmpCustcode = :cmpCustcode AND DATE(cust.date) BETWEEN DATE(:fdate) AND DATE(:tdate)")
List<CustomerAccountActivity> findAllByCmpUserIdAndDateBetween(String porOrgacode, String cmpCustcode, String fdate, String tdate); List<CustomerAccountActivity> findAllByCmpUserIdAndDateBetween(String porOrgacode, String cmpCustcode, String fdate, String tdate);
} }

@ -9,7 +9,8 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public interface CustomerProfileRepository extends JpaRepository<CustomerProfile, CustomerProfileId> { public interface CustomerProfileRepository extends JpaRepository<CustomerProfile, CustomerProfileId> {
@Query("SELECT c FROM BN_CS_MP_CUSTOMERPROFILE c WHERE c.porOrgacode =:porOrgacode and c.padAdrsmobphone = :phone") @Query("SELECT c FROM BN_CS_MP_CUSTOMERPROFILE c WHERE c.porOrgacode =:porOrgacode and c.padAdrsmobphone = :phone")
CustomerProfile findProfilesByMobilePhone(String porOrgacode,String phone); CustomerProfile findProfilesByMobilePhone(String porOrgacode, String phone);
@Query("SELECT c FROM BN_CS_MP_CUSTOMERPROFILE c WHERE c.porOrgacode =:porOrgacode and c.cmpEmail = :email") @Query("SELECT c FROM BN_CS_MP_CUSTOMERPROFILE c WHERE c.porOrgacode =:porOrgacode and c.cmpEmail = :email")
CustomerProfile findbyEmail(String porOrgacode, String email); CustomerProfile findbyEmail(String porOrgacode, String email);
} }

@ -10,9 +10,9 @@ import java.util.Optional;
@Repository @Repository
public interface PinRepository extends JpaRepository<Pin, Long> { public interface PinRepository extends JpaRepository<Pin, Long> {
@Query("SELECT p FROM DG_PN_PIN p WHERE p.userName = :username AND p.pinstatus = 'Unverified' AND p.pinExpirydate > CURRENT_TIMESTAMP AND p.pintype=:pinType ORDER BY p.pinserial DESC LIMIT 1") @Query("SELECT p FROM DG_PN_PIN p WHERE p.userName = :username AND p.pinstatus = 'Unverified' AND p.pinExpirydate > CURRENT_TIMESTAMP AND p.pintype=:pinType ORDER BY p.pinserial DESC LIMIT 1")
Optional<Pin> findLatestActiveOtpByUserName(String username,String pinType); Optional<Pin> findLatestActiveOtpByUserName(String username, String pinType);
@Query("SELECT p FROM DG_PN_PIN p WHERE p.pinserial = :id And p.pincode =:obpPincode AND p.pinstatus = 'Unverified' AND p.pinExpirydate > CURRENT_TIMESTAMP AND p.pintype=:pinType ORDER BY p.pinserial DESC LIMIT 1") @Query("SELECT p FROM DG_PN_PIN p WHERE p.pinserial = :id And p.pincode =:obpPincode AND p.pinstatus = 'Unverified' AND p.pinExpirydate > CURRENT_TIMESTAMP AND p.pintype=:pinType ORDER BY p.pinserial DESC LIMIT 1")
Optional<Pin> findsss(String id,String pinType,String obpPincode); Optional<Pin> findsss(String id, String pinType, String obpPincode);
} }

@ -9,17 +9,17 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
@Repository @Repository
public interface TransactionTrailRepository extends JpaRepository<TransactionTrail,Integer> { public interface TransactionTrailRepository extends JpaRepository<TransactionTrail, Integer> {
@Query("SELECT t FROM BN_MS_UA_UCOACCOUNTTRAIL t WHERE t.porOrgacode =:porOrgacode and t.crMbmBkmsnumber = :crMbmBkmsnumber and t.batAcnttranReceived = false") @Query("SELECT t FROM BN_MS_UA_UCOACCOUNTTRAIL t WHERE t.porOrgacode =:porOrgacode and t.crMbmBkmsnumber = :crMbmBkmsnumber and t.batAcnttranReceived = false")
Optional<List<TransactionTrail>> findByPorOrgacodeAndCrMbmBkmsnumberAndBatAcnttranReceivedFalse(String porOrgacode, String crMbmBkmsnumber); Optional<List<TransactionTrail>> findByPorOrgacodeAndCrMbmBkmsnumberAndBatAcnttranReceivedFalse(String porOrgacode, String crMbmBkmsnumber);
// @Query("SELECT t FROM BN_MS_UA_UCOACCOUNTTRAIL t WHERE t.porOrgacode =:porOrgacode and t.drMbmBkmsnumber = :mbmBkmsnumber or(t.crMbmBkmsnumber = :mbmBkmsnumber and t.batAcnttranReceived = false)") // @Query("SELECT t FROM BN_MS_UA_UCOACCOUNTTRAIL t WHERE t.porOrgacode =:porOrgacode and t.drMbmBkmsnumber = :mbmBkmsnumber or(t.crMbmBkmsnumber = :mbmBkmsnumber and t.batAcnttranReceived = false)")
@Query(value = "SELECT * " + @Query(value = "SELECT * " +
"FROM bn_ms_ua_ucoaccounttrail " + "FROM bn_ms_ua_ucoaccounttrail " +
"WHERE (dr_mbm_bkmsnumber = :mbmBkmsnumber AND (bat_acnttransent = TRUE OR bat_acnttranreceived = TRUE)) " + "WHERE (dr_mbm_bkmsnumber = :mbmBkmsnumber AND (bat_acnttransent = TRUE OR bat_acnttranreceived = TRUE)) " +
" OR (cr_mbm_bkmsnumber = :mbmBkmsnumber AND (bat_acnttransent = TRUE AND bat_acnttranreceived = TRUE))",nativeQuery = true) " OR (cr_mbm_bkmsnumber = :mbmBkmsnumber AND (bat_acnttransent = TRUE AND bat_acnttranreceived = TRUE))", nativeQuery = true)
Optional<List<TransactionTrail>> fetchDepositAccountStatement(String mbmBkmsnumber); Optional<List<TransactionTrail>> fetchDepositAccountStatement(String mbmBkmsnumber);
} }

@ -1,8 +1,6 @@
package com.mfsys.uco.repository; package com.mfsys.uco.repository;
import com.mfsys.uco.model.AccountId; import com.mfsys.uco.model.AccountId;
import com.mfsys.uco.model.CustomerProfile;
import com.mfsys.uco.model.CustomerProfileId;
import com.mfsys.uco.model.UcoAccount; import com.mfsys.uco.model.UcoAccount;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
@ -12,5 +10,5 @@ import org.springframework.stereotype.Repository;
public interface UCOAccountRepository extends JpaRepository<UcoAccount, AccountId> { public interface UCOAccountRepository extends JpaRepository<UcoAccount, AccountId> {
@Query("SELECT c FROM BN_MS_UC_UCOACCOUNT c WHERE c.id.porOrgacode =:porOrgacode and c.cmpCustcode = :cmpCustcode") @Query("SELECT c FROM BN_MS_UC_UCOACCOUNT c WHERE c.id.porOrgacode =:porOrgacode and c.cmpCustcode = :cmpCustcode")
UcoAccount findUcoAccountByCmpCustcode(String porOrgacode,String cmpCustcode); UcoAccount findUcoAccountByCmpCustcode(String porOrgacode, String cmpCustcode);
} }

@ -10,19 +10,19 @@ import java.util.List;
@Service @Service
public class CustomerAccountActivityService { public class CustomerAccountActivityService {
private CustomerAccountActivityRepository customerAccountActivityRepository; private CustomerAccountActivityRepository customerAccountActivityRepository;
@Autowired @Autowired
public CustomerAccountActivityService(CustomerAccountActivityRepository customerAccountActivityRepository) { public CustomerAccountActivityService(CustomerAccountActivityRepository customerAccountActivityRepository) {
this.customerAccountActivityRepository = customerAccountActivityRepository; this.customerAccountActivityRepository = customerAccountActivityRepository;
} }
public List<CustomerAccountActivity> getCustomerAccountActivity(String porOrgacode, String cmpCustcode, String fdate, String tdate) { public List<CustomerAccountActivity> getCustomerAccountActivity(String porOrgacode, String cmpCustcode, String fdate, String tdate) {
return customerAccountActivityRepository.findAllByCmpUserIdAndDateBetween(porOrgacode,cmpCustcode, fdate, tdate); return customerAccountActivityRepository.findAllByCmpUserIdAndDateBetween(porOrgacode, cmpCustcode, fdate, tdate);
} }
public void postCustomerAccountActivity(CustomerAccountActivity customerAccountActivity) { public void postCustomerAccountActivity(CustomerAccountActivity customerAccountActivity) {
customerAccountActivityRepository.save(customerAccountActivity); customerAccountActivityRepository.save(customerAccountActivity);
} }
} }

@ -1,18 +1,16 @@
package com.mfsys.uco.service; package com.mfsys.uco.service;
import com.mfsys.uco.dto.webclientdto.AccountDetail;
import com.mfsys.uco.model.CustomerProfile; import com.mfsys.uco.model.CustomerProfile;
import com.mfsys.uco.repository.CustomerProfileRepository; import com.mfsys.uco.repository.CustomerProfileRepository;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class CustomerProfileService { public class CustomerProfileService {
private final CustomerProfileRepository customerProfileRepository; private final CustomerProfileRepository customerProfileRepository;
public CustomerProfile fetchCustcodeBasedOnEmail(String porOrgacode, String email) { public CustomerProfile fetchCustcodeBasedOnEmail(String porOrgacode, String email) {
return customerProfileRepository.findbyEmail(porOrgacode,email); return customerProfileRepository.findbyEmail(porOrgacode, email);
} }
} }

@ -47,11 +47,11 @@ public class NotificationService {
webClient.post().uri("/notification/otp/email").bodyValue(Map.of("email", otpRequest.getEmail(), "subject", otpRequest.getSubject(), "otp", otp, "userName", otpRequest.getUsername())).retrieve() webClient.post().uri("/notification/otp/email").bodyValue(Map.of("email", otpRequest.getEmail(), "subject", otpRequest.getSubject(), "otp", otp, "userName", otpRequest.getUsername())).retrieve()
.onStatus(status -> status.is4xxClientError() || status.is5xxServerError(), clientResponse .onStatus(status -> status.is4xxClientError() || status.is5xxServerError(), clientResponse
-> Mono.error(new RuntimeException("Response has error status."))).bodyToMono(String.class).block(); -> Mono.error(new RuntimeException("Response has error status."))).bodyToMono(String.class).block();
return pin.getPinserial(); return pin.getPinserial();
} }
public void verifyOtp(String porOrgacode, String email, String obpPincode,String pinType) { public void verifyOtp(String porOrgacode, String email, String obpPincode, String pinType) {
Optional<Pin> pin = pinRepository.findLatestActiveOtpByUserName(email,pinType); Optional<Pin> pin = pinRepository.findLatestActiveOtpByUserName(email, pinType);
if (pin.isPresent() && pin.get().getPincode().equals(obpPincode) && pin.get().getPorOrgacode().equals(porOrgacode)) { if (pin.isPresent() && pin.get().getPincode().equals(obpPincode) && pin.get().getPorOrgacode().equals(porOrgacode)) {
pin.get().setPinstatus("VERIFIED"); pin.get().setPinstatus("VERIFIED");
pinRepository.save(pin.get()); pinRepository.save(pin.get());
@ -59,8 +59,9 @@ public class NotificationService {
} }
throw new InvalidOTPException(porOrgacode); throw new InvalidOTPException(porOrgacode);
} }
public void verifyOtpViaOtpId(String id, String pinType,String obpPincode){
Pin pin = pinRepository.findsss(id,pinType,obpPincode) public void verifyOtpViaOtpId(String id, String pinType, String obpPincode) {
Pin pin = pinRepository.findsss(id, pinType, obpPincode)
.orElseThrow(() -> new IllegalArgumentException("Notification not found for ID: " + id)); .orElseThrow(() -> new IllegalArgumentException("Notification not found for ID: " + id));
pin.setPinstatus("VERIFIED"); pin.setPinstatus("VERIFIED");
pinRepository.save(pin); pinRepository.save(pin);

@ -33,7 +33,7 @@ public class TransactionPinService {
public boolean verifyOTPAndSavePin(VerifyPinRequest request) { public boolean verifyOTPAndSavePin(VerifyPinRequest request) {
notificationService.verifyOtp(request.getPorOrgacode(), request.getEmail(), request.getObpPincode(), request.getPinType()); notificationService.verifyOtp(request.getPorOrgacode(), request.getEmail(), request.getObpPincode(), request.getPinType());
CustomerProfile profile = fetchCustomer(request.getPorOrgacode(), request.getCmpCustcode()); CustomerProfile profile = fetchCustomer(request.getPorOrgacode(), request.getCmpCustcode());
if(Objects.nonNull(profile.getCmpUnverifiedTranpin())) { if (Objects.nonNull(profile.getCmpUnverifiedTranpin())) {
profile.setCmpTranpin(profile.getCmpUnverifiedTranpin()); profile.setCmpTranpin(profile.getCmpUnverifiedTranpin());
profile.setCmpUnverifiedTranpin(null); profile.setCmpUnverifiedTranpin(null);
} }
@ -42,9 +42,9 @@ public class TransactionPinService {
return true; return true;
} }
public CustomerProfile fetchCustomer(String porOrgacode, String cmpCustcode){ public CustomerProfile fetchCustomer(String porOrgacode, String cmpCustcode) {
CustomerProfileId profileId = new CustomerProfileId(porOrgacode,cmpCustcode); CustomerProfileId profileId = new CustomerProfileId(porOrgacode, cmpCustcode);
return customerProfileRepository.findById(profileId) return customerProfileRepository.findById(profileId)
.orElseThrow(() -> new IllegalArgumentException("Customer profile not found for ID: " + profileId)); .orElseThrow(() -> new IllegalArgumentException("Customer profile not found for ID: " + profileId));
} }

@ -1,6 +1,5 @@
package com.mfsys.uco.service; package com.mfsys.uco.service;
import com.mfsys.comm.util.FunctionReturnDetail;
import com.mfsys.uco.UCOURI; import com.mfsys.uco.UCOURI;
import com.mfsys.uco.dto.*; import com.mfsys.uco.dto.*;
import com.mfsys.uco.dto.Transaction.TransactionOtpRequestModel; import com.mfsys.uco.dto.Transaction.TransactionOtpRequestModel;
@ -29,16 +28,16 @@ public class TransactionService {
private final TransactionTrailRepository transactionTrailRepository; private final TransactionTrailRepository transactionTrailRepository;
private final WebClientDepositService webClientDepositService; private final WebClientDepositService webClientDepositService;
public TransactionPinResponseModel sendOtpAndValidateTranPin(TransactionOtpRequestModel transactionOtpRequestModel){ public TransactionPinResponseModel sendOtpAndValidateTranPin(TransactionOtpRequestModel transactionOtpRequestModel) {
CustomerProfile customerProfile = verifyOldPinAndGetCmpProfile(transactionOtpRequestModel.getPorOrgacode(), CustomerProfile customerProfile = verifyOldPinAndGetCmpProfile(transactionOtpRequestModel.getPorOrgacode(),
transactionOtpRequestModel.getTransPincode(),transactionOtpRequestModel.getCmpCustcode()); transactionOtpRequestModel.getTransPincode(), transactionOtpRequestModel.getCmpCustcode());
return TransactionPinResponseModel.builder().notificationId(transactionPinService.sendOtp(customerProfile, transactionOtpRequestModel.getChannelCode(), return TransactionPinResponseModel.builder().notificationId(transactionPinService.sendOtp(customerProfile, transactionOtpRequestModel.getChannelCode(),
transactionOtpRequestModel.getPinType(), "Transaction Verification OTP", transactionOtpRequestModel.isOtpRequired())).build(); transactionOtpRequestModel.getPinType(), "Transaction Verification OTP", transactionOtpRequestModel.isOtpRequired())).build();
} }
public Map<String,Object> cashInTransaction(CashInTransactionRequest transactionRequest) { public Map<String, Object> cashInTransaction(CashInTransactionRequest transactionRequest) {
validation(transactionRequest); validation(transactionRequest);
TransactionTrail transactionTrail = TransactionTrail.builder() TransactionTrail transactionTrail = TransactionTrail.builder()
.porOrgacode(transactionRequest.getPorOrgacode()) .porOrgacode(transactionRequest.getPorOrgacode())
.drMbmBkmsnumber(transactionRequest.getDrMbmBkmsnumber()) .drMbmBkmsnumber(transactionRequest.getDrMbmBkmsnumber())
.crMbmBkmsnumber(transactionRequest.getCrMbmBkmsnumber()) .crMbmBkmsnumber(transactionRequest.getCrMbmBkmsnumber())
@ -65,19 +64,19 @@ public class TransactionService {
.otdTrancomment(transactionRequest.getOtdTrancomment()) .otdTrancomment(transactionRequest.getOtdTrancomment())
.porOrgacode(transactionRequest.getPorOrgacode()) .porOrgacode(transactionRequest.getPorOrgacode())
.build(); .build();
Map<String,Object> response = (Map<String,Object>)webClientDepositService.postTransaction(coreCashInTransaction, UCOURI.BANKING_CASH_IN,transactionRequest.getPorOrgacode()); Map<String, Object> response = (Map<String, Object>) webClientDepositService.postTransaction(coreCashInTransaction, UCOURI.BANKING_CASH_IN, transactionRequest.getPorOrgacode());
Map<String,Object> transactionId = (Map<String,Object>) response.get("FuncReturnDetail"); Map<String, Object> transactionId = (Map<String, Object>) response.get("FuncReturnDetail");
transactionTrail.setSgtSentGntrnumber(extractTranNumber(List.of(transactionId.get("arguments")))); transactionTrail.setSgtSentGntrnumber(extractTranNumber(List.of(transactionId.get("arguments"))));
transactionTrail.setBatAcnttranSend(true); transactionTrail.setBatAcnttranSend(true);
transactionTrailRepository.save(transactionTrail); transactionTrailRepository.save(transactionTrail);
return response; return response;
} }
private void validation(CashInTransactionRequest transactionRequest) { private void validation(CashInTransactionRequest transactionRequest) {
if(transactionRequest.getCrMbmBkmsnumber().equals(transactionRequest.getDrMbmBkmsnumber())){ if (transactionRequest.getCrMbmBkmsnumber().equals(transactionRequest.getDrMbmBkmsnumber())) {
throw new SameCrDrAccountExistsException(); throw new SameCrDrAccountExistsException();
} }
notificationService.verifyOtpViaOtpId(transactionRequest.getNotificationId(),transactionRequest.getPinType(),transactionRequest.getObpPincode()); notificationService.verifyOtpViaOtpId(transactionRequest.getNotificationId(), transactionRequest.getPinType(), transactionRequest.getObpPincode());
} }
public List<TransactionTrail> fetchPendingCrTransactions(String porOrgacode, String mbmBkmsnumber) { public List<TransactionTrail> fetchPendingCrTransactions(String porOrgacode, String mbmBkmsnumber) {
@ -86,16 +85,16 @@ public class TransactionService {
} }
public List<TransactionTrail> fetchDepositAccountStatement(String porOrgacode, String mbmBkmsnumber) { public List<TransactionTrail> fetchDepositAccountStatement(String porOrgacode, String mbmBkmsnumber) {
Optional<List<TransactionTrail>> optionalTransactions = transactionTrailRepository.fetchDepositAccountStatement( mbmBkmsnumber); Optional<List<TransactionTrail>> optionalTransactions = transactionTrailRepository.fetchDepositAccountStatement(mbmBkmsnumber);
return optionalTransactions.orElseGet(Collections::emptyList); return optionalTransactions.orElseGet(Collections::emptyList);
} }
public Map<String,Object> cashOutTransaction(CashOutTransactionRequest cashOutTransactionRequest) { public Map<String, Object> cashOutTransaction(CashOutTransactionRequest cashOutTransactionRequest) {
verifyOldPinAndGetCmpProfile(cashOutTransactionRequest.getPorOrgacode(), verifyOldPinAndGetCmpProfile(cashOutTransactionRequest.getPorOrgacode(),
cashOutTransactionRequest.getCmpTranpin(),cashOutTransactionRequest.getCmpCustcode()); cashOutTransactionRequest.getCmpTranpin(), cashOutTransactionRequest.getCmpCustcode());
Map<String,Object> response = new HashMap<>(); Map<String, Object> response = new HashMap<>();
Optional<TransactionTrail> transactionTrail = transactionTrailRepository.findById(Math.toIntExact(cashOutTransactionRequest.getId())); Optional<TransactionTrail> transactionTrail = transactionTrailRepository.findById(Math.toIntExact(cashOutTransactionRequest.getId()));
if(transactionTrail.isPresent()) { if (transactionTrail.isPresent()) {
CoreCashOutTransaction cashOutTransaction = CoreCashOutTransaction.builder() CoreCashOutTransaction cashOutTransaction = CoreCashOutTransaction.builder()
.crPcrCurrcode("123") .crPcrCurrcode("123")
.crMbmBkmsnumber(transactionTrail.get().getCrMbmBkmsnumber()) .crMbmBkmsnumber(transactionTrail.get().getCrMbmBkmsnumber())
@ -104,19 +103,19 @@ public class TransactionService {
.sgtGntramtfc(transactionTrail.get().getSgtGntramt()) .sgtGntramtfc(transactionTrail.get().getSgtGntramt())
.build(); .build();
response = (Map<String,Object>) webClientDepositService.postTransaction(cashOutTransaction, UCOURI.BANKING_CASH_OUT, transactionTrail.get().getPorOrgacode()); response = (Map<String, Object>) webClientDepositService.postTransaction(cashOutTransaction, UCOURI.BANKING_CASH_OUT, transactionTrail.get().getPorOrgacode());
Map<String,Object> transactionId = (Map<String,Object>) response.get("FuncReturnDetail"); Map<String, Object> transactionId = (Map<String, Object>) response.get("FuncReturnDetail");
transactionTrail.get().setSgtReceiveGntrnumber(extractTranNumber(List.of(transactionId.get("arguments")))); transactionTrail.get().setSgtReceiveGntrnumber(extractTranNumber(List.of(transactionId.get("arguments"))));
transactionTrail.get().setBatAcnttranReceived(true); transactionTrail.get().setBatAcnttranReceived(true);
transactionTrailRepository.save(transactionTrail.get()); transactionTrailRepository.save(transactionTrail.get());
} }
return response; return response;
} }
private CustomerProfile verifyOldPinAndGetCmpProfile(String porOrgacode, String transPincode,String cmpCustcode) { private CustomerProfile verifyOldPinAndGetCmpProfile(String porOrgacode, String transPincode, String cmpCustcode) {
CustomerProfile customerProfile = transactionPinService.fetchCustomer(porOrgacode, CustomerProfile customerProfile = transactionPinService.fetchCustomer(porOrgacode,
cmpCustcode); cmpCustcode);
transactionPinService.validateOldPin(customerProfile,transPincode); transactionPinService.validateOldPin(customerProfile, transPincode);
return customerProfile; return customerProfile;
} }
@ -126,7 +125,7 @@ public class TransactionService {
} }
private String extractTranNumber( List<Object> args ){ private String extractTranNumber(List<Object> args) {
if (args != null && args.size() > 0) { if (args != null && args.size() > 0) {
return String.valueOf(args.get(0)).replace("[", "").replace("]", ""); return String.valueOf(args.get(0)).replace("[", "").replace("]", "");
} }

@ -13,6 +13,7 @@ import com.mfsys.uco.model.UcoAccount;
import com.mfsys.uco.repository.CustomerProfileRepository; import com.mfsys.uco.repository.CustomerProfileRepository;
import com.mfsys.uco.repository.UCOAccountRepository; import com.mfsys.uco.repository.UCOAccountRepository;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -37,13 +38,13 @@ public class UcoAccountService {
this.webClientCrmService = webClientCrmService; this.webClientCrmService = webClientCrmService;
} }
public AccountInquiryResponse fetchAccountTitile(String porOrgacode, String acntTypeCode, String acntTypeValue){ public AccountInquiryResponse fetchAccountTitile(String porOrgacode, String acntTypeCode, String acntTypeValue) {
if(acntTypeCode.equals("01")){ if (acntTypeCode.equals("01")) {
CustomerProfile customerProfile = customerProfileRepository.findProfilesByMobilePhone(porOrgacode,acntTypeValue); CustomerProfile customerProfile = customerProfileRepository.findProfilesByMobilePhone(porOrgacode, acntTypeValue);
if(Objects.isNull(customerProfile)){ if (Objects.isNull(customerProfile)) {
throw new AccountDoesntExistsException(); throw new AccountDoesntExistsException();
} }
UcoAccount ucoAccount = ucoAccountRepository.findUcoAccountByCmpCustcode(porOrgacode,customerProfile.getCmpCustcode()); UcoAccount ucoAccount = ucoAccountRepository.findUcoAccountByCmpCustcode(porOrgacode, customerProfile.getCmpCustcode());
return AccountInquiryResponse.builder().mbmBkmsnumber(ucoAccount.getId().getMbmBkmsnumber()).mbmBkmstitle(ucoAccount.getMbmBkmstitle()).build(); return AccountInquiryResponse.builder().mbmBkmsnumber(ucoAccount.getId().getMbmBkmsnumber()).mbmBkmstitle(ucoAccount.getMbmBkmstitle()).build();
} }
return null; return null;
@ -51,26 +52,27 @@ public class UcoAccountService {
public Double fetchAccountBalance(String porOrgacode, String mbmBkmsNumber) { public Double fetchAccountBalance(String porOrgacode, String mbmBkmsNumber) {
return (Double) getIndvAccountDetails(porOrgacode,mbmBkmsNumber); return (Double) getIndvAccountDetails(porOrgacode, mbmBkmsNumber);
} }
public Object getIndvAccountDetails(String porOrgacode, String mbmBkmsnumber) { public Object getIndvAccountDetails(String porOrgacode, String mbmBkmsnumber) {
String url= UCOURI.GET_UCOACC_BALANCE+"?porOrgacode="+porOrgacode+"&mbmBkmsnumber="+mbmBkmsnumber; String url = UCOURI.GET_UCOACC_BALANCE + "?porOrgacode=" + porOrgacode + "&mbmBkmsnumber=" + mbmBkmsnumber;
return webClientDeposit.getUcoAccountBalance(url,porOrgacode); return webClientDeposit.getUcoAccountBalance(url, porOrgacode);
} }
public void onBoardCustomer(SignupStep3RequestModel signupStep3RequestModel) { public void onBoardCustomer(SignupStep3RequestModel signupStep3RequestModel) {
if(Objects.nonNull(customerProfileService.fetchCustcodeBasedOnEmail(signupStep3RequestModel.getPorOrgacode(),signupStep3RequestModel.getEmail()))){ if (Objects.nonNull(customerProfileService.fetchCustcodeBasedOnEmail(signupStep3RequestModel.getPorOrgacode(), signupStep3RequestModel.getEmail()))) {
throw new UserAlreadyRegisteredException(null); throw new UserAlreadyRegisteredException(null);
} }
String porOrgacode = signupStep3RequestModel.getPorOrgacode(); String porOrgacode = signupStep3RequestModel.getPorOrgacode();
Map cmpCustcodeReturn = (Map) webClientCrmService.onboardCustomer(Map.of("CMP_FULLNAME",signupStep3RequestModel.getName() Map cmpCustcodeReturn = (Map) webClientCrmService.onboardCustomer(Map.of("CMP_FULLNAME", signupStep3RequestModel.getName()
,"PIT_IDENCODE",signupStep3RequestModel.getIdentificationType(),"CIT_IDENVALUE",signupStep3RequestModel.getIdentificationNumber() , "PIT_IDENCODE", signupStep3RequestModel.getIdentificationType(), "CIT_IDENVALUE", signupStep3RequestModel.getIdentificationNumber()
,"PAD_ADRSMOBPHONE",signupStep3RequestModel.getPhone(),"POR_ORGACODE",signupStep3RequestModel.getPorOrgacode(),"SUS_USERCODE","01", , "PAD_ADRSMOBPHONE", signupStep3RequestModel.getPhone(), "POR_ORGACODE", signupStep3RequestModel.getPorOrgacode(), "SUS_USERCODE", "01",
"PLC_LOCACODE","2003"), UCOURI.CUSTOMER_ONBOARDING,signupStep3RequestModel.getPorOrgacode()); "PLC_LOCACODE", "2003"), UCOURI.CUSTOMER_ONBOARDING, signupStep3RequestModel.getPorOrgacode());
String cmpCustcode = String.valueOf(cmpCustcodeReturn.get("cmpCustcode")); String cmpCustcode = String.valueOf(cmpCustcodeReturn.get("cmpCustcode"));
AccountDetail accountDetail = fetchdepositAccountFromCiihive(porOrgacode,cmpCustcode); AccountDetail accountDetail = fetchdepositAccountFromCiihive(porOrgacode, cmpCustcode);
CustomerProfile customerProfile = CustomerProfile.builder().cmpCustcode(accountDetail.getCmpCustcode()).cmpEmail(signupStep3RequestModel.getEmail()) CustomerProfile customerProfile = CustomerProfile.builder().cmpCustcode(accountDetail.getCmpCustcode()).cmpEmail(signupStep3RequestModel.getEmail())
.cmpName(signupStep3RequestModel.getName()).cmpIsKycVerified(signupStep3RequestModel.isKycAdded()) .cmpName(signupStep3RequestModel.getName()).cmpIsKycVerified(signupStep3RequestModel.isKycAdded())
.pitIdencode(signupStep3RequestModel.getIdentificationType()).pitIdenvalue(signupStep3RequestModel.getIdentificationNumber()) .pitIdencode(signupStep3RequestModel.getIdentificationType()).pitIdenvalue(signupStep3RequestModel.getIdentificationNumber())
@ -80,32 +82,32 @@ public class UcoAccountService {
.build(); .build();
customerProfileRepository.save(customerProfile); customerProfileRepository.save(customerProfile);
UcoAccount ucoAccount = UcoAccount.builder() UcoAccount ucoAccount = UcoAccount.builder()
.id(new AccountId(accountDetail.getPorOrgacode(),accountDetail.getMbmBkmsnumber())) // Set the AccountId, assuming a method exists to create or retrieve it .id(new AccountId(accountDetail.getPorOrgacode(), accountDetail.getMbmBkmsnumber())) // Set the AccountId, assuming a method exists to create or retrieve it
.dmpProdcode(accountDetail.getDmpProdcode()) .dmpProdcode(accountDetail.getDmpProdcode())
.mbmBkmstitle(accountDetail.getMbmBkmstitle()) .mbmBkmstitle(accountDetail.getMbmBkmstitle())
.pcrCurrdesc(accountDetail.getPcrCurrdesc()) .pcrCurrdesc(accountDetail.getPcrCurrdesc())
.cmpCustcode(accountDetail.getCmpCustcode()) .cmpCustcode(accountDetail.getCmpCustcode())
.pcrCurrcode(accountDetail.getPcrCurrcode()) .pcrCurrcode(accountDetail.getPcrCurrcode())
.mbmBkmsclosed(accountDetail.isMbmBkmsclosed()) .mbmBkmsclosed(accountDetail.isMbmBkmsclosed())
.mbmBkmsopendate(LocalDate.now()) .mbmBkmsopendate(LocalDate.now())
.sgtLasttrandate(LocalDate.now()) .sgtLasttrandate(LocalDate.now())
.build(); .build();
ucoAccountRepository.save(ucoAccount); ucoAccountRepository.save(ucoAccount);
} }
public AccountDetail fetchdepositAccountFromCiihive(String porOrgacode,String cmpCustcode){ public AccountDetail fetchdepositAccountFromCiihive(String porOrgacode, String cmpCustcode) {
String url= UCOURI.GET_CMP_UCOACCOUNTS+"?porOrgacode="+porOrgacode+"&cmpCustcode="+cmpCustcode; String url = UCOURI.GET_CMP_UCOACCOUNTS + "?porOrgacode=" + porOrgacode + "&cmpCustcode=" + cmpCustcode;
List<Object> map = (List<Object>) webClientDeposit.getCmpUcoAccounts(url,porOrgacode); List<Object> map = (List<Object>) webClientDeposit.getCmpUcoAccounts(url, porOrgacode);
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.convertValue(map.get(0), AccountDetail.class); return objectMapper.convertValue(map.get(0), AccountDetail.class);
} }
public Object fetchExchangeRate(String porOrgacode){ public Object fetchExchangeRate(String porOrgacode) {
String url= UCOURI.FETCH_EXCHANGE_RATE+"?porOrgacode="+porOrgacode; String url = UCOURI.FETCH_EXCHANGE_RATE + "?porOrgacode=" + porOrgacode;
return webClientDeposit.fetchExchangeRate(url,porOrgacode); return webClientDeposit.fetchExchangeRate(url, porOrgacode);
}
} }
}

@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.mfsys.comm.exception.ApplicationException; import com.mfsys.comm.exception.ApplicationException;
import com.mfsys.comm.exception.ApplicationExceptionMapper; import com.mfsys.comm.exception.ApplicationExceptionMapper;
import org.apache.http.HttpHeaders;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -25,12 +24,14 @@ public class WebClientCrmService {
public WebClientCrmService(WebClient webClientCrm) { public WebClientCrmService(WebClient webClientCrm) {
this.webClientCrm = webClientCrm; this.webClientCrm = webClientCrm;
} }
public Object getUcoAccountBalance(String url,String porOrgacode) {
public Object getUcoAccountBalance(String url, String porOrgacode) {
return handleResponse(webClientCrm.get().uri(url).accept(MediaType.APPLICATION_JSON) return handleResponse(webClientCrm.get().uri(url).accept(MediaType.APPLICATION_JSON)
.header("SUS_USERCODE", porOrgacode) .header("SUS_USERCODE", porOrgacode)
.header("POR_ORGACODE", porOrgacode).retrieve().toEntity(Object.class), .header("POR_ORGACODE", porOrgacode).retrieve().toEntity(Object.class),
null); null);
} }
public Object onboardCustomer(Map onBoardingData, String url, String porOrgaCode) { public Object onboardCustomer(Map onBoardingData, String url, String porOrgaCode) {
return handleResponse(webClientCrm.post().uri(url).bodyValue(onBoardingData).accept(MediaType.APPLICATION_JSON) return handleResponse(webClientCrm.post().uri(url).bodyValue(onBoardingData).accept(MediaType.APPLICATION_JSON)
.header("SUS_USERCODE", porOrgaCode) .header("SUS_USERCODE", porOrgaCode)
@ -45,7 +46,7 @@ public class WebClientCrmService {
return response.getBody(); return response.getBody();
} catch (WebClientResponseException e) { } catch (WebClientResponseException e) {
ApplicationExceptionMapper.APIError errorDetails = parseErrorDetails(e); ApplicationExceptionMapper.APIError errorDetails = parseErrorDetails(e);
throw new ApplicationException(porgaCode,errorDetails.getErrorCode(),errorDetails.getArguments()); throw new ApplicationException(porgaCode, errorDetails.getErrorCode(), errorDetails.getArguments());
} }
} }

@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.mfsys.comm.exception.ApplicationException; import com.mfsys.comm.exception.ApplicationException;
import com.mfsys.comm.exception.ApplicationExceptionMapper; import com.mfsys.comm.exception.ApplicationExceptionMapper;
import com.mfsys.comm.util.FunctionReturnDetail;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -15,7 +14,6 @@ import reactor.core.publisher.Mono;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
@Service @Service
public class WebClientDepositService { public class WebClientDepositService {
@ -25,19 +23,21 @@ public class WebClientDepositService {
public WebClientDepositService(WebClient webClientDeposit) { public WebClientDepositService(WebClient webClientDeposit) {
this.webClientDeposit = webClientDeposit; this.webClientDeposit = webClientDeposit;
} }
public Object getUcoAccountBalance(String url,String porOrgacode) {
public Object getUcoAccountBalance(String url, String porOrgacode) {
return handleResponse(webClientDeposit.get().uri(url).accept(MediaType.APPLICATION_JSON) return handleResponse(webClientDeposit.get().uri(url).accept(MediaType.APPLICATION_JSON)
.header("SUS_USERCODE", porOrgacode) .header("SUS_USERCODE", porOrgacode)
.header("POR_ORGACODE", porOrgacode).retrieve().toEntity(Object.class), .header("POR_ORGACODE", porOrgacode).retrieve().toEntity(Object.class),
null); null);
} }
public Object getCmpUcoAccounts(String url,String porOrgacode) { public Object getCmpUcoAccounts(String url, String porOrgacode) {
return handleResponse(webClientDeposit.get().uri(url).accept(MediaType.APPLICATION_JSON) return handleResponse(webClientDeposit.get().uri(url).accept(MediaType.APPLICATION_JSON)
.header("SUS_USERCODE", porOrgacode) .header("SUS_USERCODE", porOrgacode)
.header("POR_ORGACODE", porOrgacode).retrieve().toEntity(Object.class), .header("POR_ORGACODE", porOrgacode).retrieve().toEntity(Object.class),
null); null);
} }
public Object postTransaction(Object tranData, String url, String porOrgaCode) { public Object postTransaction(Object tranData, String url, String porOrgaCode) {
return handleResponse(webClientDeposit.post().uri(url).bodyValue(tranData).accept(MediaType.APPLICATION_JSON) return handleResponse(webClientDeposit.post().uri(url).bodyValue(tranData).accept(MediaType.APPLICATION_JSON)
.header("SUS_USERCODE", porOrgaCode) .header("SUS_USERCODE", porOrgaCode)
@ -47,8 +47,7 @@ public class WebClientDepositService {
} }
public Object fetchExchangeRate(String url, String porOrgacode) {
public Object fetchExchangeRate(String url,String porOrgacode) {
return handleResponse(webClientDeposit.get().uri(url).accept(MediaType.APPLICATION_JSON) return handleResponse(webClientDeposit.get().uri(url).accept(MediaType.APPLICATION_JSON)
.header("SUS_USERCODE", porOrgacode) .header("SUS_USERCODE", porOrgacode)
.header("POR_ORGACODE", porOrgacode).retrieve().toEntity(Object.class), .header("POR_ORGACODE", porOrgacode).retrieve().toEntity(Object.class),
@ -61,7 +60,7 @@ public class WebClientDepositService {
return response.getBody(); return response.getBody();
} catch (WebClientResponseException e) { } catch (WebClientResponseException e) {
ApplicationExceptionMapper.APIError errorDetails = parseErrorDetails(e); ApplicationExceptionMapper.APIError errorDetails = parseErrorDetails(e);
throw new ApplicationException(porgaCode,errorDetails.getErrorCode(),errorDetails.getArguments()); throw new ApplicationException(porgaCode, errorDetails.getErrorCode(), errorDetails.getArguments());
} }
} }

Loading…
Cancel
Save