diff --git a/pom.xml b/pom.xml
index f31c941..b2b6ea4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,6 +86,18 @@
org.springframework.boot
spring-boot-starter-webflux
+
+ com.itextpdf
+ kernel
+ 7.2.5
+
+
+
+ com.itextpdf
+ layout
+ 7.2.5
+
+
diff --git a/src/main/java/com/mfsys/uco/compositeKeys/CustomerProfileId.java b/src/main/java/com/mfsys/uco/compositeKeys/CustomerProfileId.java
new file mode 100644
index 0000000..62a08be
--- /dev/null
+++ b/src/main/java/com/mfsys/uco/compositeKeys/CustomerProfileId.java
@@ -0,0 +1,66 @@
+package com.mfsys.uco.compositeKeys;
+
+import java.io.Serializable;
+
+public class CustomerProfileId implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String porOrgacode;
+ private String cmpCustcode;
+
+ public CustomerProfileId() {
+ }
+
+ public CustomerProfileId(String porOrgacode, String cmpCustcode) {
+ this.porOrgacode = porOrgacode;
+ this.cmpCustcode = cmpCustcode;
+ }
+
+ public String getPorOrgacode() {
+ return porOrgacode;
+ }
+
+ 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 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;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/mfsys/uco/constants/UCOURI.java b/src/main/java/com/mfsys/uco/constants/UCOURI.java
index cb68ca8..a67811f 100644
--- a/src/main/java/com/mfsys/uco/constants/UCOURI.java
+++ b/src/main/java/com/mfsys/uco/constants/UCOURI.java
@@ -3,4 +3,21 @@ package com.mfsys.uco.constants;
public interface UCOURI {
String ONBOARD_CUSTOMER = "/auth/user/authenticate/onboardCutomer";
+ String VIEW_BALANCE = "/user/viewBalance";
+ String FETCH_LOGIIN_DATA = "/fetchlogindata";
+ String FETCH_DEPOSITACCOUNTS = "/depositAccounts";
+ String FETCH_ACCOUNT_STATEMENT = "/accountStatement";
+ String FETCH_ACCOUNT_INQUIRY = "/accountInquiry";
+ String GENERATE_TRANSACTIONS_REPORT = "/generateReport";
+ String CREATE_TRAN_PIN = "/createTransactionPin";
+ String VERIFY_TRAN_PIN = "/verifyTransactionPin";
+ String CHANGE_TRAN_PIN = "/changeTransactionPin";
+ String FETCH_EXCHANGE_RATE = "/fetchExchangeRate";
+ String ACCOUNT_ACTIVITY = "/account/activity/organization/{porOrgacode}/customer/{cmpCustcode}/fromdate/{fdate}/todate/{tdate}";
+ String RESEND_OTP = "/resend-otp";
+ String ADD_UCO_CUSTOMER_ACCOUNT = "/createUcoAccount";
+ String UPDATE_CUSTOMER_PROFILE = "/updateCustomerProfile";
+ String ADD_BENEFICIARY = "/addBeneficary";
+ String GET_BENEFICIARY = "/getBeneficary";
+ String DELETE_BENEFICIARY = "/deleteBeneficary";
}
diff --git a/src/main/java/com/mfsys/uco/controller/UserController.java b/src/main/java/com/mfsys/uco/controller/UserController.java
index 946a06c..e208003 100644
--- a/src/main/java/com/mfsys/uco/controller/UserController.java
+++ b/src/main/java/com/mfsys/uco/controller/UserController.java
@@ -1,23 +1,46 @@
package com.mfsys.uco.controller;
+import com.itextpdf.kernel.pdf.PdfDocument;
+import com.itextpdf.kernel.pdf.PdfWriter;
+import com.itextpdf.layout.element.Paragraph;
+import com.itextpdf.layout.Document;
import com.mfsys.uco.constants.UCOURI;
-import com.mfsys.uco.request.SignupStep3Request;
-import com.mfsys.uco.service.UcoAccountService;
+import com.mfsys.uco.model.AccountDetail;
+import com.mfsys.uco.model.CustomerProfile;
+import com.mfsys.uco.request.*;
+import com.mfsys.uco.response.*;
+import com.mfsys.uco.service.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+
+
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.Base64;
+import java.util.List;
@RestController
@RequestMapping
public class UserController {
private final UcoAccountService ucoAccountService;
+ private final CustomerProfileService customerProfileService;
+ private final TransactionPinService transactionPinService;
+ private final CustomerAccountActivityService customerAccountActivityService;
+ private final NotificationService notificationService;
- public UserController(UcoAccountService ucoAccountService) {
+ public UserController(
+ UcoAccountService ucoAccountService,
+ CustomerProfileService customerProfileService,
+ TransactionPinService transactionPinService,
+ CustomerAccountActivityService customerAccountActivityService,
+ NotificationService notificationService) {
this.ucoAccountService = ucoAccountService;
+ this.customerProfileService = customerProfileService;
+ this.transactionPinService = transactionPinService;
+ this.customerAccountActivityService = customerAccountActivityService;
+ this.notificationService = notificationService;
}
@PostMapping(UCOURI.ONBOARD_CUSTOMER)
@@ -26,5 +49,142 @@ public class UserController {
return ResponseEntity.ok(HttpStatus.OK);
}
+ @PostMapping(UCOURI.VIEW_BALANCE)
+ public ViewBalanceResponse viewBalance(@RequestBody ViewBalanceRequest viewBalanceRequest) {
+ ViewBalanceResponse viewBalanceResponse = new ViewBalanceResponse();
+ viewBalanceResponse.setMbmBkmsbalance(ucoAccountService.fetchAccountBalance(viewBalanceRequest.getPorOrgacode(), viewBalanceRequest.getMbmBkmsNumber()));
+ return viewBalanceResponse;
+ }
+
+ @GetMapping(UCOURI.FETCH_LOGIIN_DATA)
+ public CustomerProfile fetchlogindata(@RequestParam String porOrgacode, @RequestParam String email) {
+ return customerProfileService.fetchCustcodeBasedOnEmail(porOrgacode, email);
+ }
+
+ @GetMapping(UCOURI.FETCH_DEPOSITACCOUNTS)
+ public List getDepositAccounts(
+ @RequestParam String porOrgacode,
+ @RequestParam String cmpCustcode,
+ @RequestParam String pctCstycode) {
+ return ucoAccountService.fetchdepositAccountFromCiihive(porOrgacode, cmpCustcode);
+ }
+
+ @GetMapping(UCOURI.FETCH_ACCOUNT_STATEMENT)
+ public List getAccountStatement(
+ @RequestParam String porOrgacode,
+ @RequestParam String mbmBkmsnumber,
+ @RequestParam String sgtGntrvaluedatefrom,
+ @RequestParam String sgtGntrvaluedateto
+ ) {
+
+ List transactions = new ArrayList<>();
+ DepositAccountTransactionResponse transaction = new DepositAccountTransactionResponse();
+ transaction.setTranID("12345");
+ transaction.setSgtGntrCreatedAt("2024-03-17");
+ transaction.setSgtGntrNarration("Sample Transaction");
+ transaction.setSgtGntrvaluedate("2024-03-17");
+ transaction.setDeposit("100.00");
+ transaction.setWithdrawal("0.00");
+ transaction.setStatus("approved");
+ transaction.setSgtGntramt("1000.00");
+ transactions.add(transaction);
+ return transactions;
+ }
+
+ @GetMapping(UCOURI.FETCH_ACCOUNT_INQUIRY)
+ public List getAccountInquiry(
+ @RequestParam String acntTypeCode,
+ @RequestParam String acntTypeValue,
+ @RequestParam String porOrgacode,
+ @RequestParam String channelCode) {
+ return ucoAccountService.fetchAccountTitile(porOrgacode, acntTypeCode, acntTypeValue);
+ }
+
+ @PostMapping(UCOURI.GENERATE_TRANSACTIONS_REPORT)
+ public String generateReport(@RequestBody TransactionHistoryRequest request) {
+ try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
+ PdfWriter writer = new PdfWriter(baos);
+ PdfDocument pdf = new PdfDocument(writer);
+ Document document = new Document(pdf);
+ document.add(new Paragraph("Account Transaction History Report"));
+ document.add(new Paragraph("Organization Code: " + request.getPorOrgacode()));
+ document.add(new Paragraph("Account Number: " + request.getMbmBkmsnumber()));
+ document.add(new Paragraph("From: " + request.getSgtGntrvaluedatefrom() + " To: " + request.getSgtGntrvaluedateto()));
+ document.close();
+ return Base64.getEncoder().encodeToString(baos.toByteArray());
+ } catch (Exception e) {
+ return "Error generating report";
+ }
+ }
+
+ @PostMapping(UCOURI.CREATE_TRAN_PIN)
+ public ResponseEntity createTransactionPin(@RequestBody CreateTransactionPinRequest request) {
+ transactionPinService.createTransactionPin(request);
+ return ResponseEntity.ok(HttpStatus.OK);
+ }
+
+ @PostMapping(UCOURI.VERIFY_TRAN_PIN)
+ public ResponseEntity> verifyPin(@RequestBody VerifyPinRequest request) {
+ transactionPinService.verifyOTPAndSavePin(request);
+ return ResponseEntity.ok(HttpStatus.OK);
+ }
+
+ @PutMapping(UCOURI.CHANGE_TRAN_PIN)
+ public ResponseEntity updateTransactionPin(@RequestBody ChangeTransactionPinRequest request) {
+ transactionPinService.updateTransactionPin(request);
+ return ResponseEntity.ok("OTP sent");
+ }
+
+ @GetMapping(UCOURI.FETCH_EXCHANGE_RATE)
+ public Object fetchExchangeRate(@RequestParam String porOrgacode) {
+ return ucoAccountService.fetchExchangeRate(porOrgacode);
+ }
+
+ @GetMapping(UCOURI.ACCOUNT_ACTIVITY)
+ public ResponseEntity> getCustomerAccountActivity(
+ @PathVariable String porOrgacode,
+ @PathVariable String cmpCustcode,
+ @PathVariable String fdate,
+ @PathVariable String tdate) {
+ return new ResponseEntity<>(customerAccountActivityService.getCustomerAccountActivity(porOrgacode, cmpCustcode, fdate, tdate), HttpStatus.OK);
+ }
+
+ @PostMapping(UCOURI.RESEND_OTP)
+ @ResponseStatus(HttpStatus.OK)
+ public ResponseEntity sendSignUpOtp(@RequestBody OTPRequest otpRequest) {
+ notificationService.sendOtp(otpRequest);
+ return ResponseEntity.ok("OTP sent");
+ }
+
+ @PostMapping(UCOURI.ADD_UCO_CUSTOMER_ACCOUNT)
+ public ResponseEntity addUcoCustomerAccount(@RequestBody AddAccountRequest addAccountRequest) {
+ ucoAccountService.addUcoAccount(addAccountRequest);
+ return ResponseEntity.ok(HttpStatus.OK);
+ }
+
+ @PostMapping(UCOURI.UPDATE_CUSTOMER_PROFILE)
+ public ResponseEntity updateCustomerProfile(@RequestBody UpdateProfileRequest updateProfileRequest) {
+ customerProfileService.updateCustomerProfile(updateProfileRequest);
+ return ResponseEntity.ok(HttpStatus.OK);
+ }
+
+ @PostMapping(UCOURI.ADD_BENEFICIARY)
+ public ResponseEntity updateCustomerProfile(@RequestBody BeneficiaryRequest beneficiaryRequest) {
+ customerProfileService.addBeneficiary(beneficiaryRequest);
+ return ResponseEntity.ok(HttpStatus.OK);
+ }
+ @GetMapping(UCOURI.GET_BENEFICIARY)
+ public List updateCustomerProfile(@RequestParam String porOrgacode, @RequestParam String email) {
+ return customerProfileService.fetchBeneficiaryBasedOnEmail(porOrgacode,email);
+ }
+
+ @DeleteMapping(UCOURI.DELETE_BENEFICIARY)
+ public ResponseEntity deleteBeneficiary(
+ @RequestParam String mbmBkmsnumberRef,
+ @RequestParam String porOrgacode,
+ @RequestParam String email) {
+ customerProfileService.deleteBeneficiary(porOrgacode,email,mbmBkmsnumberRef);
+ return ResponseEntity.noContent().build();
+ }
}
diff --git a/src/main/java/com/mfsys/uco/model/AccountDetail.java b/src/main/java/com/mfsys/uco/model/AccountDetail.java
new file mode 100644
index 0000000..6a82c1f
--- /dev/null
+++ b/src/main/java/com/mfsys/uco/model/AccountDetail.java
@@ -0,0 +1,86 @@
+package com.mfsys.uco.model;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.RequiredArgsConstructor;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.Map;
+
+@Data
+@RequiredArgsConstructor
+@AllArgsConstructor
+@Builder
+public class AccountDetail {
+
+ protected String porOrgacode;
+
+ protected String mbmBkmsnumber;
+
+ protected String mbmBkmstitle;
+
+ protected String dmpProddesc;
+
+ protected String plcLocadesc;
+
+ protected String pcrCurrcode;
+
+ protected String pcrCurrshort;
+
+ protected String mbmBkmsopendate;
+
+ protected String pcrCurrdesc;
+
+ protected String cmpCustcode;
+
+ protected boolean mbmBkmsclosed;
+
+ protected String pctCstycode;
+
+ protected BigDecimal mbmBkmsbalance;
+
+ protected Map charges = Map.of();
+
+ protected String dmpProdcode;
+
+ protected boolean cmpBlacklisted;
+
+ protected String plcLocacode;
+
+ protected boolean mbmNotificationService;
+
+ protected String dmpCredittype;
+
+ protected BigDecimal perEratrateact;
+
+ protected LocalDate kycRenewalDate;
+
+ protected String padAdrsmobphone;
+
+ protected boolean btaRolloverSpecialRate;
+
+ private String pasAcstcode;
+
+ private BigDecimal btaBookingamount;
+
+ private BigDecimal bdaDpacblockamt;
+
+ private boolean bdaDpacblocked;
+
+ private String pbdBankname;
+
+ private String pbbBranchname;
+
+ private String pbbBranchcountry;
+
+ private String pbbBranchcity;
+
+ private String pcaGlaccode;
+
+ private String accJointStatus;
+
+ private String accAttortype;
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/mfsys/uco/model/CustomerProfile.java b/src/main/java/com/mfsys/uco/model/CustomerProfile.java
index b58ea59..d0056c2 100644
--- a/src/main/java/com/mfsys/uco/model/CustomerProfile.java
+++ b/src/main/java/com/mfsys/uco/model/CustomerProfile.java
@@ -1,5 +1,6 @@
package com.mfsys.uco.model;
+import com.mfsys.uco.compositeKeys.CustomerProfileId;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -11,6 +12,7 @@ import java.time.LocalDate;
@Entity
@Table(name = "BN_CS_MP_CUSTOMERPROFILE")
@Data
+@IdClass(CustomerProfileId.class)
@Builder
@AllArgsConstructor
@NoArgsConstructor
@@ -20,6 +22,7 @@ public class CustomerProfile {
@Column(name = "POR_ORGACODE")
protected String porOrgacode;
+ @Id
@Column(name = "CMP_CUSTCODE")
protected String cmpCustcode;
diff --git a/src/main/java/com/mfsys/uco/repository/CustomerProfileRepository.java b/src/main/java/com/mfsys/uco/repository/CustomerProfileRepository.java
index 8a16123..0d20de7 100644
--- a/src/main/java/com/mfsys/uco/repository/CustomerProfileRepository.java
+++ b/src/main/java/com/mfsys/uco/repository/CustomerProfileRepository.java
@@ -1,12 +1,13 @@
package com.mfsys.uco.repository;
+import com.mfsys.uco.compositeKeys.CustomerProfileId;
import com.mfsys.uco.model.CustomerProfile;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
@Repository
-public interface CustomerProfileRepository extends JpaRepository {
+public interface CustomerProfileRepository extends JpaRepository {
@Query("SELECT c FROM CustomerProfile c WHERE c.porOrgacode =:porOrgacode and c.cmpEmail = :email")
CustomerProfile findbyEmail(String porOrgacode, String email);
diff --git a/src/main/java/com/mfsys/uco/service/CustomerAccountActivityService.java b/src/main/java/com/mfsys/uco/service/CustomerAccountActivityService.java
new file mode 100644
index 0000000..7d045de
--- /dev/null
+++ b/src/main/java/com/mfsys/uco/service/CustomerAccountActivityService.java
@@ -0,0 +1,14 @@
+package com.mfsys.uco.service;
+
+import com.mfsys.uco.response.CustomerAccountActivityResponse;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class CustomerAccountActivityService {
+
+ public List getCustomerAccountActivity(String porOrgacode, String cmpCustcode, String fdate, String tdate) {
+ return null;
+ }
+}
diff --git a/src/main/java/com/mfsys/uco/service/CustomerProfileService.java b/src/main/java/com/mfsys/uco/service/CustomerProfileService.java
index 453887f..2e0d25a 100644
--- a/src/main/java/com/mfsys/uco/service/CustomerProfileService.java
+++ b/src/main/java/com/mfsys/uco/service/CustomerProfileService.java
@@ -2,7 +2,14 @@ package com.mfsys.uco.service;
import com.mfsys.uco.model.CustomerProfile;
import com.mfsys.uco.repository.CustomerProfileRepository;
+import com.mfsys.uco.request.BeneficiaryRequest;
+import com.mfsys.uco.request.UpdateProfileRequest;
+import com.mfsys.uco.response.BeneficiaryResponse;
+import org.springframework.stereotype.Service;
+import java.util.List;
+
+@Service
public class CustomerProfileService {
private final CustomerProfileRepository customerProfileRepository;
@@ -14,4 +21,17 @@ public class CustomerProfileService {
public CustomerProfile fetchCustcodeBasedOnEmail(String porOrgacode, String email) {
return customerProfileRepository.findbyEmail(porOrgacode, email);
}
+
+ public void updateCustomerProfile(UpdateProfileRequest updateProfileRequest) {
+ }
+
+ public void addBeneficiary(BeneficiaryRequest beneficiaryRequest) {
+ }
+
+ public List fetchBeneficiaryBasedOnEmail(String porOrgacode, String email) {
+ return null;
+ }
+
+ public void deleteBeneficiary(String porOrgacode, String email, String mbmBkmsnumberRef) {
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/mfsys/uco/service/NotificationService.java b/src/main/java/com/mfsys/uco/service/NotificationService.java
new file mode 100644
index 0000000..83c1a1f
--- /dev/null
+++ b/src/main/java/com/mfsys/uco/service/NotificationService.java
@@ -0,0 +1,11 @@
+package com.mfsys.uco.service;
+
+import com.mfsys.uco.request.OTPRequest;
+import org.springframework.stereotype.Service;
+
+@Service
+public class NotificationService {
+
+ public void sendOtp(OTPRequest otpRequest) {
+ }
+}
diff --git a/src/main/java/com/mfsys/uco/service/TransactionPinService.java b/src/main/java/com/mfsys/uco/service/TransactionPinService.java
new file mode 100644
index 0000000..6db7e35
--- /dev/null
+++ b/src/main/java/com/mfsys/uco/service/TransactionPinService.java
@@ -0,0 +1,20 @@
+package com.mfsys.uco.service;
+
+import com.mfsys.uco.request.ChangeTransactionPinRequest;
+import com.mfsys.uco.request.CreateTransactionPinRequest;
+import com.mfsys.uco.request.VerifyPinRequest;
+import org.springframework.stereotype.Service;
+
+@Service
+public class TransactionPinService {
+
+ public void createTransactionPin(CreateTransactionPinRequest request) {
+ }
+
+ public void verifyOTPAndSavePin(VerifyPinRequest request) {
+ }
+
+ public void updateTransactionPin(ChangeTransactionPinRequest request) {
+
+ }
+}
diff --git a/src/main/java/com/mfsys/uco/service/UcoAccountService.java b/src/main/java/com/mfsys/uco/service/UcoAccountService.java
index f5a08c5..bca6bfe 100644
--- a/src/main/java/com/mfsys/uco/service/UcoAccountService.java
+++ b/src/main/java/com/mfsys/uco/service/UcoAccountService.java
@@ -1,8 +1,13 @@
package com.mfsys.uco.service;
+import com.mfsys.uco.model.AccountDetail;
+import com.mfsys.uco.request.AddAccountRequest;
import com.mfsys.uco.request.SignupStep3Request;
+import com.mfsys.uco.response.AccountInquiryResponse;
import org.springframework.stereotype.Service;
+import java.util.List;
+
@Service
public class UcoAccountService {
public void onBoardCustomer(SignupStep3Request signupStep3Request) {
@@ -14,4 +19,24 @@ public class UcoAccountService {
//call updateCustomerApplication using arguments of map email and porOrgacode
}
+
+ public Double fetchAccountBalance(String porOrgacode, String mbmBkmsNumber) {
+ return null;
+ }
+
+ public List fetchdepositAccountFromCiihive(String porOrgacode, String cmpCustcode) {
+ return null;
+ }
+
+ public List fetchAccountTitile(String porOrgacode, String acntTypeCode, String acntTypeValue) {
+ return null;
+ }
+
+ public Object fetchExchangeRate(String porOrgacode) {
+ return null;
+ }
+
+ public void addUcoAccount(AddAccountRequest addAccountRequest) {
+
+ }
}