diff --git a/src/main/java/com/mfsys/uco/UCOURI.java b/src/main/java/com/mfsys/uco/UCOURI.java index d99c7d3..2d2e60c 100644 --- a/src/main/java/com/mfsys/uco/UCOURI.java +++ b/src/main/java/com/mfsys/uco/UCOURI.java @@ -4,6 +4,7 @@ public interface UCOURI { String VIEW_BALANCE = "/user/viewBalance"; String ONBOARD_CUSTOMER = "/auth/user/authenticate/onboardCutomer"; String ADD_UCO_CUSTOMER_ACCOUNT = "/createUcoAccount"; + String UPDATE_CUSTOMER_PROFILE = "/updateCustomerProfile"; String FETCH_DEPOSITACCOUNTS = "/depositAccounts"; String FETCH_ACCOUNT_STATEMENT = "/accountStatement"; String FETCH_ACCOUNT_INQUIRY = "/accountInquiry"; diff --git a/src/main/java/com/mfsys/uco/controller/TransactionController.java b/src/main/java/com/mfsys/uco/controller/TransactionController.java index d2bd398..85f82f0 100644 --- a/src/main/java/com/mfsys/uco/controller/TransactionController.java +++ b/src/main/java/com/mfsys/uco/controller/TransactionController.java @@ -19,7 +19,7 @@ public class TransactionController { @PostMapping(UCOURI.GET_DR_TRANSACTION_PIN) public TransactionPinResponseModel getDrTransactionOtp(@RequestBody TransactionOtpRequestModel transactionOtpRequestModel) { - return transactionService.sendOtpAndValidateTranPin(transactionOtpRequestModel,false); + return transactionService.sendOtpAndValidateTranPin(transactionOtpRequestModel,true); } @PostMapping(UCOURI.RESEND_GET_DR_TRANSACTION_PIN) diff --git a/src/main/java/com/mfsys/uco/controller/UserController.java b/src/main/java/com/mfsys/uco/controller/UserController.java index 85811b4..5ee7eb2 100644 --- a/src/main/java/com/mfsys/uco/controller/UserController.java +++ b/src/main/java/com/mfsys/uco/controller/UserController.java @@ -178,4 +178,10 @@ public class UserController { ucoAccountService.addUcoAccount(addAccountRequestModel); return ResponseEntity.ok(HttpStatus.OK); } + + @PostMapping(UCOURI.UPDATE_CUSTOMER_PROFILE) + public ResponseEntity updateCustomerProfile(@RequestBody UpdateProfileRequestPayload updateProfileRequestPayload) { + customerProfileService.updateCustomerProfile(updateProfileRequestPayload); + return ResponseEntity.ok(HttpStatus.OK); + } } diff --git a/src/main/java/com/mfsys/uco/dto/UpdateProfileRequestPayload.java b/src/main/java/com/mfsys/uco/dto/UpdateProfileRequestPayload.java new file mode 100644 index 0000000..78845a5 --- /dev/null +++ b/src/main/java/com/mfsys/uco/dto/UpdateProfileRequestPayload.java @@ -0,0 +1,16 @@ +package com.mfsys.uco.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class UpdateProfileRequestPayload { + private String porOrgacode; + private String cmpCustcode; + private String cmpCustImage; +} diff --git a/src/main/java/com/mfsys/uco/dto/webclientdto/AccountDetail.java b/src/main/java/com/mfsys/uco/dto/webclientdto/AccountDetail.java index 6ead6e3..2ab5be7 100644 --- a/src/main/java/com/mfsys/uco/dto/webclientdto/AccountDetail.java +++ b/src/main/java/com/mfsys/uco/dto/webclientdto/AccountDetail.java @@ -21,6 +21,7 @@ public class AccountDetail { protected String plcLocadesc; protected String pcrCurrcode; protected String pcrCurrshort; + protected String mbmBkmsopendate; protected String pcrCurrdesc; protected String cmpCustcode; protected boolean mbmBkmsclosed; @@ -47,6 +48,5 @@ public class AccountDetail { private String pcaGlaccode; private String accJointStatus; private String accAttortype; - private LocalDate mbmBkmsopendate; } diff --git a/src/main/java/com/mfsys/uco/model/CustomerProfile.java b/src/main/java/com/mfsys/uco/model/CustomerProfile.java index a5fb145..79b3ffb 100644 --- a/src/main/java/com/mfsys/uco/model/CustomerProfile.java +++ b/src/main/java/com/mfsys/uco/model/CustomerProfile.java @@ -54,4 +54,8 @@ public class CustomerProfile { @Column(name = "CMP_ADDRESS", nullable = true, columnDefinition = FieldNameLength.DESCRIPTION_LONG) private String cmpAddress; + @Column(name = "CMP_CUSTIMG", nullable = true, columnDefinition = "LONGTEXT") + @Lob + private String cmpCustImage; + } diff --git a/src/main/java/com/mfsys/uco/service/CustomerProfileService.java b/src/main/java/com/mfsys/uco/service/CustomerProfileService.java index 0698257..6fcbad4 100644 --- a/src/main/java/com/mfsys/uco/service/CustomerProfileService.java +++ b/src/main/java/com/mfsys/uco/service/CustomerProfileService.java @@ -1,10 +1,14 @@ package com.mfsys.uco.service; +import com.mfsys.uco.dto.UpdateProfileRequestPayload; import com.mfsys.uco.model.CustomerProfile; +import com.mfsys.uco.model.CustomerProfileId; import com.mfsys.uco.repository.CustomerProfileRepository; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import java.util.Optional; + @Service @RequiredArgsConstructor public class CustomerProfileService { @@ -13,4 +17,12 @@ public class CustomerProfileService { public CustomerProfile fetchCustcodeBasedOnEmail(String porOrgacode, String email) { return customerProfileRepository.findbyEmail(porOrgacode, email); } + + public void updateCustomerProfile(UpdateProfileRequestPayload updateProfileRequestPayload) { + customerProfileRepository.findById(new CustomerProfileId(updateProfileRequestPayload.getPorOrgacode(), updateProfileRequestPayload.getCmpCustcode())) + .ifPresent(customerProfile -> { + customerProfile.setCmpCustImage(updateProfileRequestPayload.getCmpCustImage()); + customerProfileRepository.save(customerProfile); + }); + } } diff --git a/src/main/java/com/mfsys/uco/service/TransactionService.java b/src/main/java/com/mfsys/uco/service/TransactionService.java index 01d8406..8ca265f 100644 --- a/src/main/java/com/mfsys/uco/service/TransactionService.java +++ b/src/main/java/com/mfsys/uco/service/TransactionService.java @@ -287,10 +287,10 @@ public class TransactionService { .crMbmBkmsnumber(glAccontTranasctionRequestModel.getCrMbmBkmsnumber()) .dmpProdcode(glAccontTranasctionRequestModel.getDmpProdCode()) .drmbmBkmstitle(glAccontTranasctionRequestModel.getDrPcaGlacdesc()) - .drpcrCurrdesc("GL Currency") - .drPcrCurrshort("GL Curr") + .drpcrCurrdesc(glAccontTranasctionRequestModel.getCrPcrCurrdesc()) + .drPcrCurrshort(glAccontTranasctionRequestModel.getCrPcrCurrshort()) .cmpCustcode(glAccontTranasctionRequestModel.getCmpCustcode()) - .drPcrCurrcode("GL Curr") + .drPcrCurrcode(glAccontTranasctionRequestModel.getCrPcrCurrcode()) .crMbmBkmstitle(glAccontTranasctionRequestModel.getCrMbmBkmstitle()) .drSgtGntramt(BigDecimal.valueOf(glAccontTranasctionRequestModel.getSgtGntramtfc())) .crSgtGntramt(null) diff --git a/src/main/java/com/mfsys/uco/service/UcoAccountService.java b/src/main/java/com/mfsys/uco/service/UcoAccountService.java index 970a80a..73488c0 100644 --- a/src/main/java/com/mfsys/uco/service/UcoAccountService.java +++ b/src/main/java/com/mfsys/uco/service/UcoAccountService.java @@ -123,12 +123,18 @@ public class UcoAccountService { } private void updateCustomerApplication(Map payload) { - webClient.post().uri(SecurityURI.UPDATE_CUSTOMER_APPLICATION).bodyValue(payload).retrieve() - .onStatus(status -> status.is4xxClientError() || status.is5xxServerError(), clientResponse - -> Mono.error(new RuntimeException("Response has error status."))).bodyToMono(String.class); + webClient.post() + .uri(SecurityURI.UPDATE_CUSTOMER_APPLICATION) + .bodyValue(payload) + .retrieve() + .onStatus( + status -> status.is4xxClientError() || status.is5xxServerError(), + clientResponse -> Mono.error(new RuntimeException("Response has error status.")) + ) + .bodyToMono(String.class) + .block(); } - public List fetchdepositAccountFromCiihive(String porOrgacode, String cmpCustcode) { String url = UCOURI.GET_CMP_UCOACCOUNTS + "?porOrgacode=" + porOrgacode + "&cmpCustcode=" + cmpCustcode; List map = (List) webClientDeposit.getCmpUcoAccounts(url, porOrgacode); @@ -165,7 +171,7 @@ public void saveCustomerAccountDetails(String porOrgacode, String cmpCustcode,St fetchdepositAccountFromCiihive(porOrgacode, cmpCustcode).stream().forEach(k -> { if(k.getMbmBkmsnumber().equals(accountNumber)){ UcoAccount ucoAccount = UcoAccount.builder() - .id(new AccountId(k.getPorOrgacode(), k.getMbmBkmsnumber())) // Set the AccountId, assuming a method exists to create or retrieve it + .id(new AccountId(k.getPorOrgacode(), k.getMbmBkmsnumber())) .dmpProdcode(k.getDmpProdcode()) .mbmBkmstitle(k.getMbmBkmstitle()) .pcrCurrdesc(k.getPcrCurrdesc())