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

@ -1,16 +1,13 @@
package com.mfsys.uco.controller;
import com.mfsys.comm.util.FunctionReturnDetail;
import com.mfsys.uco.UCOURI;
import com.mfsys.uco.dto.CashInTransactionRequest;
import com.mfsys.uco.dto.CashOutTransactionRequest;
import com.mfsys.uco.dto.Transaction.TransactionOtpRequestModel;
import com.mfsys.uco.dto.TransactionPinResponseModel;
import com.mfsys.uco.dto.webclientdto.AccountDetail;
import com.mfsys.uco.model.TransactionTrail;
import com.mfsys.uco.service.TransactionService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -28,12 +25,12 @@ public class TransactionController {
}
@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);
}
@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);
}

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

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

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

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

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

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

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

@ -37,25 +37,18 @@ public class CustomerProfile {
@Column(name = "KYC_RENEWAL_DATE", nullable = true, columnDefinition = FieldNameLength.DATE)
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)
private String cmpEmail;
@Column(name = "CMP_NAME", nullable = true, columnDefinition = FieldNameLength.CODE_50)
private String cmpName;
@Column(name = "CMP_USERNAME", nullable = true, columnDefinition = FieldNameLength.CODE_50)
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;
}

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

@ -18,62 +18,44 @@ import java.time.LocalDate;
@Table(name = "BN_MS_UA_UCOACCOUNTTRAIL")
public class TransactionTrail {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "POR_ORGACODE", nullable = false, updatable = false, columnDefinition = FieldNameLength.POR_ORGACODE)
protected String porOrgacode;
@Column(name = "DR_MBM_BKMSNUMBER", nullable = false, updatable = false, columnDefinition = FieldNameLength.ACCOUNT_NUMBER)
protected String drMbmBkmsnumber;
@Column(name = "CR_MBM_BKMSNUMBER", nullable = false, updatable = false, columnDefinition = FieldNameLength.ACCOUNT_NUMBER)
protected String crMbmBkmsnumber;
@Column(name = "DMP_PRODCODE", nullable = false, updatable = false, columnDefinition = FieldNameLength.DMP_PRODCODE)
protected String dmpProdcode;
@Column(name = "DR_MBM_BKMSTITLE", nullable = false, updatable = true, columnDefinition = FieldNameLength.ACCOUNT_TITLE)
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)
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)
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)
protected String sgtSentGntrnumber;
@Column(name = "DR_SGT_GNTRDATE", nullable = false, updatable = false, columnDefinition = FieldNameLength.DATE)
protected LocalDate drSgtGntrdate;
@Column(name = "CR_SGT_GNTRDATE", nullable = true, updatable = false, columnDefinition = FieldNameLength.DATE)
protected LocalDate crSgtGntrdate;
@Column(name = "SGT_GNTRAMT", nullable = false, updatable = false, columnDefinition = FieldNameLength.AMOUNT_REAL)
protected BigDecimal sgtGntramt = BigDecimal.ZERO;
@Column(name = "BAT_ACNTTRANSENT", nullable = false, columnDefinition = FieldNameLength.BOOLEAN_BIT)
protected boolean batAcnttranSend;
@Column(name = "BAT_ACNTTRANRECEIVED", nullable = true, columnDefinition = FieldNameLength.BOOLEAN_BIT)
protected boolean batAcnttranReceived;
@Column(name = "SGT_RECEIVEGNTRNUMBER", nullable = true, updatable = true, columnDefinition = FieldNameLength.CODE_500)
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;
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.Builder;
import lombok.Data;
@ -16,31 +19,23 @@ import java.time.LocalDate;
@AllArgsConstructor
@NoArgsConstructor
public class UcoAccount {
@EmbeddedId
private AccountId id;
@Column(name = "DMP_PRODCODE", nullable = false, updatable = false, columnDefinition = FieldNameLength.DMP_PRODCODE)
protected String dmpProdcode;
@Column(name = "MBM_BKMSTITLE", nullable = false, updatable = true, columnDefinition = FieldNameLength.ACCOUNT_TITLE)
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)
protected String cmpCustcode;
@Column(name = "PCR_CURRCODE", columnDefinition=FieldNameLength.PCR_CURRCODE)
private String pcrCurrcode;
@Column(name = "MBM_BKMSCLOSED", nullable = false, columnDefinition = FieldNameLength.BOOLEAN_BIT)
protected boolean mbmBkmsclosed;
@Column(name = "SGT_LASTTRANDATE", nullable = true, updatable = true, columnDefinition = FieldNameLength.DATE)
protected LocalDate sgtLasttrandate;
@Column(name = "MBM_BKMSOPENDATE", nullable = false, columnDefinition = FieldNameLength.DATE)
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
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)")
List<CustomerAccountActivity> findAllByCmpUserIdAndDateBetween(String porOrgacode, String cmpCustcode, String fdate, String 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);
}

@ -9,7 +9,8 @@ import org.springframework.stereotype.Repository;
@Repository
public interface CustomerProfileRepository extends JpaRepository<CustomerProfile, CustomerProfileId> {
@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")
CustomerProfile findbyEmail(String porOrgacode, String email);
}

@ -10,9 +10,9 @@ import java.util.Optional;
@Repository
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")
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")
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;
@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")
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 * " +
"FROM bn_ms_ua_ucoaccounttrail " +
"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);
}

@ -1,8 +1,6 @@
package com.mfsys.uco.repository;
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 org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
@ -12,5 +10,5 @@ import org.springframework.stereotype.Repository;
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")
UcoAccount findUcoAccountByCmpCustcode(String porOrgacode,String cmpCustcode);
UcoAccount findUcoAccountByCmpCustcode(String porOrgacode, String cmpCustcode);
}

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

@ -1,18 +1,16 @@
package com.mfsys.uco.service;
import com.mfsys.uco.dto.webclientdto.AccountDetail;
import com.mfsys.uco.model.CustomerProfile;
import com.mfsys.uco.repository.CustomerProfileRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@RequiredArgsConstructor
public class CustomerProfileService {
private final CustomerProfileRepository customerProfileRepository;
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()
.onStatus(status -> status.is4xxClientError() || status.is5xxServerError(), clientResponse
-> 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) {
Optional<Pin> pin = pinRepository.findLatestActiveOtpByUserName(email,pinType);
public void verifyOtp(String porOrgacode, String email, String obpPincode, String pinType) {
Optional<Pin> pin = pinRepository.findLatestActiveOtpByUserName(email, pinType);
if (pin.isPresent() && pin.get().getPincode().equals(obpPincode) && pin.get().getPorOrgacode().equals(porOrgacode)) {
pin.get().setPinstatus("VERIFIED");
pinRepository.save(pin.get());
@ -59,8 +59,9 @@ public class NotificationService {
}
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));
pin.setPinstatus("VERIFIED");
pinRepository.save(pin);

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

@ -1,6 +1,5 @@
package com.mfsys.uco.service;
import com.mfsys.comm.util.FunctionReturnDetail;
import com.mfsys.uco.UCOURI;
import com.mfsys.uco.dto.*;
import com.mfsys.uco.dto.Transaction.TransactionOtpRequestModel;
@ -29,16 +28,16 @@ public class TransactionService {
private final TransactionTrailRepository transactionTrailRepository;
private final WebClientDepositService webClientDepositService;
public TransactionPinResponseModel sendOtpAndValidateTranPin(TransactionOtpRequestModel transactionOtpRequestModel){
CustomerProfile customerProfile = verifyOldPinAndGetCmpProfile(transactionOtpRequestModel.getPorOrgacode(),
transactionOtpRequestModel.getTransPincode(),transactionOtpRequestModel.getCmpCustcode());
return TransactionPinResponseModel.builder().notificationId(transactionPinService.sendOtp(customerProfile, transactionOtpRequestModel.getChannelCode(),
transactionOtpRequestModel.getPinType(), "Transaction Verification OTP", transactionOtpRequestModel.isOtpRequired())).build();
public TransactionPinResponseModel sendOtpAndValidateTranPin(TransactionOtpRequestModel transactionOtpRequestModel) {
CustomerProfile customerProfile = verifyOldPinAndGetCmpProfile(transactionOtpRequestModel.getPorOrgacode(),
transactionOtpRequestModel.getTransPincode(), transactionOtpRequestModel.getCmpCustcode());
return TransactionPinResponseModel.builder().notificationId(transactionPinService.sendOtp(customerProfile, transactionOtpRequestModel.getChannelCode(),
transactionOtpRequestModel.getPinType(), "Transaction Verification OTP", transactionOtpRequestModel.isOtpRequired())).build();
}
public Map<String,Object> cashInTransaction(CashInTransactionRequest transactionRequest) {
public Map<String, Object> cashInTransaction(CashInTransactionRequest transactionRequest) {
validation(transactionRequest);
TransactionTrail transactionTrail = TransactionTrail.builder()
TransactionTrail transactionTrail = TransactionTrail.builder()
.porOrgacode(transactionRequest.getPorOrgacode())
.drMbmBkmsnumber(transactionRequest.getDrMbmBkmsnumber())
.crMbmBkmsnumber(transactionRequest.getCrMbmBkmsnumber())
@ -65,19 +64,19 @@ public class TransactionService {
.otdTrancomment(transactionRequest.getOtdTrancomment())
.porOrgacode(transactionRequest.getPorOrgacode())
.build();
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");
transactionTrail.setSgtSentGntrnumber(extractTranNumber(List.of(transactionId.get("arguments"))));
transactionTrail.setBatAcnttranSend(true);
transactionTrailRepository.save(transactionTrail);
return response;
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");
transactionTrail.setSgtSentGntrnumber(extractTranNumber(List.of(transactionId.get("arguments"))));
transactionTrail.setBatAcnttranSend(true);
transactionTrailRepository.save(transactionTrail);
return response;
}
private void validation(CashInTransactionRequest transactionRequest) {
if(transactionRequest.getCrMbmBkmsnumber().equals(transactionRequest.getDrMbmBkmsnumber())){
if (transactionRequest.getCrMbmBkmsnumber().equals(transactionRequest.getDrMbmBkmsnumber())) {
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) {
@ -86,16 +85,16 @@ public class TransactionService {
}
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);
}
public Map<String,Object> cashOutTransaction(CashOutTransactionRequest cashOutTransactionRequest) {
public Map<String, Object> cashOutTransaction(CashOutTransactionRequest cashOutTransactionRequest) {
verifyOldPinAndGetCmpProfile(cashOutTransactionRequest.getPorOrgacode(),
cashOutTransactionRequest.getCmpTranpin(),cashOutTransactionRequest.getCmpCustcode());
Map<String,Object> response = new HashMap<>();
cashOutTransactionRequest.getCmpTranpin(), cashOutTransactionRequest.getCmpCustcode());
Map<String, Object> response = new HashMap<>();
Optional<TransactionTrail> transactionTrail = transactionTrailRepository.findById(Math.toIntExact(cashOutTransactionRequest.getId()));
if(transactionTrail.isPresent()) {
if (transactionTrail.isPresent()) {
CoreCashOutTransaction cashOutTransaction = CoreCashOutTransaction.builder()
.crPcrCurrcode("123")
.crMbmBkmsnumber(transactionTrail.get().getCrMbmBkmsnumber())
@ -104,19 +103,19 @@ public class TransactionService {
.sgtGntramtfc(transactionTrail.get().getSgtGntramt())
.build();
response = (Map<String,Object>) webClientDepositService.postTransaction(cashOutTransaction, UCOURI.BANKING_CASH_OUT, transactionTrail.get().getPorOrgacode());
Map<String,Object> transactionId = (Map<String,Object>) response.get("FuncReturnDetail");
transactionTrail.get().setSgtReceiveGntrnumber(extractTranNumber(List.of(transactionId.get("arguments"))));
transactionTrail.get().setBatAcnttranReceived(true);
transactionTrailRepository.save(transactionTrail.get());
response = (Map<String, Object>) webClientDepositService.postTransaction(cashOutTransaction, UCOURI.BANKING_CASH_OUT, transactionTrail.get().getPorOrgacode());
Map<String, Object> transactionId = (Map<String, Object>) response.get("FuncReturnDetail");
transactionTrail.get().setSgtReceiveGntrnumber(extractTranNumber(List.of(transactionId.get("arguments"))));
transactionTrail.get().setBatAcnttranReceived(true);
transactionTrailRepository.save(transactionTrail.get());
}
return response;
}
private CustomerProfile verifyOldPinAndGetCmpProfile(String porOrgacode, String transPincode,String cmpCustcode) {
CustomerProfile customerProfile = transactionPinService.fetchCustomer(porOrgacode,
cmpCustcode);
transactionPinService.validateOldPin(customerProfile,transPincode);
private CustomerProfile verifyOldPinAndGetCmpProfile(String porOrgacode, String transPincode, String cmpCustcode) {
CustomerProfile customerProfile = transactionPinService.fetchCustomer(porOrgacode,
cmpCustcode);
transactionPinService.validateOldPin(customerProfile, transPincode);
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) {
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.UCOAccountRepository;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
@ -37,13 +38,13 @@ public class UcoAccountService {
this.webClientCrmService = webClientCrmService;
}
public AccountInquiryResponse fetchAccountTitile(String porOrgacode, String acntTypeCode, String acntTypeValue){
if(acntTypeCode.equals("01")){
CustomerProfile customerProfile = customerProfileRepository.findProfilesByMobilePhone(porOrgacode,acntTypeValue);
if(Objects.isNull(customerProfile)){
public AccountInquiryResponse fetchAccountTitile(String porOrgacode, String acntTypeCode, String acntTypeValue) {
if (acntTypeCode.equals("01")) {
CustomerProfile customerProfile = customerProfileRepository.findProfilesByMobilePhone(porOrgacode, acntTypeValue);
if (Objects.isNull(customerProfile)) {
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 null;
@ -51,26 +52,27 @@ public class UcoAccountService {
public Double fetchAccountBalance(String porOrgacode, String mbmBkmsNumber) {
return (Double) getIndvAccountDetails(porOrgacode,mbmBkmsNumber);
return (Double) getIndvAccountDetails(porOrgacode, mbmBkmsNumber);
}
public Object getIndvAccountDetails(String porOrgacode, String mbmBkmsnumber) {
String url= UCOURI.GET_UCOACC_BALANCE+"?porOrgacode="+porOrgacode+"&mbmBkmsnumber="+mbmBkmsnumber;
return webClientDeposit.getUcoAccountBalance(url,porOrgacode);
String url = UCOURI.GET_UCOACC_BALANCE + "?porOrgacode=" + porOrgacode + "&mbmBkmsnumber=" + mbmBkmsnumber;
return webClientDeposit.getUcoAccountBalance(url, porOrgacode);
}
public void onBoardCustomer(SignupStep3RequestModel signupStep3RequestModel) {
if(Objects.nonNull(customerProfileService.fetchCustcodeBasedOnEmail(signupStep3RequestModel.getPorOrgacode(),signupStep3RequestModel.getEmail()))){
public void onBoardCustomer(SignupStep3RequestModel signupStep3RequestModel) {
if (Objects.nonNull(customerProfileService.fetchCustcodeBasedOnEmail(signupStep3RequestModel.getPorOrgacode(), signupStep3RequestModel.getEmail()))) {
throw new UserAlreadyRegisteredException(null);
}
String porOrgacode = signupStep3RequestModel.getPorOrgacode();
Map cmpCustcodeReturn = (Map) webClientCrmService.onboardCustomer(Map.of("CMP_FULLNAME",signupStep3RequestModel.getName()
,"PIT_IDENCODE",signupStep3RequestModel.getIdentificationType(),"CIT_IDENVALUE",signupStep3RequestModel.getIdentificationNumber()
,"PAD_ADRSMOBPHONE",signupStep3RequestModel.getPhone(),"POR_ORGACODE",signupStep3RequestModel.getPorOrgacode(),"SUS_USERCODE","01",
"PLC_LOCACODE","2003"), UCOURI.CUSTOMER_ONBOARDING,signupStep3RequestModel.getPorOrgacode());
String cmpCustcode = String.valueOf(cmpCustcodeReturn.get("cmpCustcode"));
AccountDetail accountDetail = fetchdepositAccountFromCiihive(porOrgacode,cmpCustcode);
Map cmpCustcodeReturn = (Map) webClientCrmService.onboardCustomer(Map.of("CMP_FULLNAME", signupStep3RequestModel.getName()
, "PIT_IDENCODE", signupStep3RequestModel.getIdentificationType(), "CIT_IDENVALUE", signupStep3RequestModel.getIdentificationNumber()
, "PAD_ADRSMOBPHONE", signupStep3RequestModel.getPhone(), "POR_ORGACODE", signupStep3RequestModel.getPorOrgacode(), "SUS_USERCODE", "01",
"PLC_LOCACODE", "2003"), UCOURI.CUSTOMER_ONBOARDING, signupStep3RequestModel.getPorOrgacode());
String cmpCustcode = String.valueOf(cmpCustcodeReturn.get("cmpCustcode"));
AccountDetail accountDetail = fetchdepositAccountFromCiihive(porOrgacode, cmpCustcode);
CustomerProfile customerProfile = CustomerProfile.builder().cmpCustcode(accountDetail.getCmpCustcode()).cmpEmail(signupStep3RequestModel.getEmail())
.cmpName(signupStep3RequestModel.getName()).cmpIsKycVerified(signupStep3RequestModel.isKycAdded())
.pitIdencode(signupStep3RequestModel.getIdentificationType()).pitIdenvalue(signupStep3RequestModel.getIdentificationNumber())
@ -80,32 +82,32 @@ public class UcoAccountService {
.build();
customerProfileRepository.save(customerProfile);
UcoAccount ucoAccount = UcoAccount.builder()
.id(new AccountId(accountDetail.getPorOrgacode(),accountDetail.getMbmBkmsnumber())) // Set the AccountId, assuming a method exists to create or retrieve it
.dmpProdcode(accountDetail.getDmpProdcode())
.mbmBkmstitle(accountDetail.getMbmBkmstitle())
.pcrCurrdesc(accountDetail.getPcrCurrdesc())
.cmpCustcode(accountDetail.getCmpCustcode())
.pcrCurrcode(accountDetail.getPcrCurrcode())
.mbmBkmsclosed(accountDetail.isMbmBkmsclosed())
.mbmBkmsopendate(LocalDate.now())
.sgtLasttrandate(LocalDate.now())
.build();
.id(new AccountId(accountDetail.getPorOrgacode(), accountDetail.getMbmBkmsnumber())) // Set the AccountId, assuming a method exists to create or retrieve it
.dmpProdcode(accountDetail.getDmpProdcode())
.mbmBkmstitle(accountDetail.getMbmBkmstitle())
.pcrCurrdesc(accountDetail.getPcrCurrdesc())
.cmpCustcode(accountDetail.getCmpCustcode())
.pcrCurrcode(accountDetail.getPcrCurrcode())
.mbmBkmsclosed(accountDetail.isMbmBkmsclosed())
.mbmBkmsopendate(LocalDate.now())
.sgtLasttrandate(LocalDate.now())
.build();
ucoAccountRepository.save(ucoAccount);
}
}
public AccountDetail fetchdepositAccountFromCiihive(String porOrgacode,String cmpCustcode){
String url= UCOURI.GET_CMP_UCOACCOUNTS+"?porOrgacode="+porOrgacode+"&cmpCustcode="+cmpCustcode;
List<Object> map = (List<Object>) webClientDeposit.getCmpUcoAccounts(url,porOrgacode);
ObjectMapper objectMapper = new ObjectMapper();
public AccountDetail fetchdepositAccountFromCiihive(String porOrgacode, String cmpCustcode) {
String url = UCOURI.GET_CMP_UCOACCOUNTS + "?porOrgacode=" + porOrgacode + "&cmpCustcode=" + cmpCustcode;
List<Object> map = (List<Object>) webClientDeposit.getCmpUcoAccounts(url, porOrgacode);
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){
String url= UCOURI.FETCH_EXCHANGE_RATE+"?porOrgacode="+porOrgacode;
return webClientDeposit.fetchExchangeRate(url,porOrgacode);
}
public Object fetchExchangeRate(String porOrgacode) {
String url = UCOURI.FETCH_EXCHANGE_RATE + "?porOrgacode=" + porOrgacode;
return webClientDeposit.fetchExchangeRate(url, porOrgacode);
}
}

@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mfsys.comm.exception.ApplicationException;
import com.mfsys.comm.exception.ApplicationExceptionMapper;
import org.apache.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
@ -25,12 +24,14 @@ public class WebClientCrmService {
public WebClientCrmService(WebClient 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)
.header("SUS_USERCODE", porOrgacode)
.header("POR_ORGACODE", porOrgacode).retrieve().toEntity(Object.class),
null);
}
public Object onboardCustomer(Map onBoardingData, String url, String porOrgaCode) {
return handleResponse(webClientCrm.post().uri(url).bodyValue(onBoardingData).accept(MediaType.APPLICATION_JSON)
.header("SUS_USERCODE", porOrgaCode)
@ -45,7 +46,7 @@ public class WebClientCrmService {
return response.getBody();
} catch (WebClientResponseException 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.mfsys.comm.exception.ApplicationException;
import com.mfsys.comm.exception.ApplicationExceptionMapper;
import com.mfsys.comm.util.FunctionReturnDetail;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
@ -15,7 +14,6 @@ import reactor.core.publisher.Mono;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@Service
public class WebClientDepositService {
@ -25,19 +23,21 @@ public class WebClientDepositService {
public WebClientDepositService(WebClient 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)
.header("SUS_USERCODE", porOrgacode)
.header("POR_ORGACODE", porOrgacode).retrieve().toEntity(Object.class),
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)
.header("SUS_USERCODE", porOrgacode)
.header("POR_ORGACODE", porOrgacode).retrieve().toEntity(Object.class),
null);
}
public Object postTransaction(Object tranData, String url, String porOrgaCode) {
return handleResponse(webClientDeposit.post().uri(url).bodyValue(tranData).accept(MediaType.APPLICATION_JSON)
.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)
.header("SUS_USERCODE", porOrgacode)
.header("POR_ORGACODE", porOrgacode).retrieve().toEntity(Object.class),
@ -61,7 +60,7 @@ public class WebClientDepositService {
return response.getBody();
} catch (WebClientResponseException 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