Subversion Repositories SmartDukaan

Rev

Rev 29870 | Rev 29906 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 29870 Rev 29893
Line 23... Line 23...
23
 
23
 
24
import org.apache.commons.io.output.ByteArrayOutputStream;
24
import org.apache.commons.io.output.ByteArrayOutputStream;
25
import org.apache.commons.lang.StringUtils;
25
import org.apache.commons.lang.StringUtils;
26
import org.apache.logging.log4j.LogManager;
26
import org.apache.logging.log4j.LogManager;
27
import org.apache.logging.log4j.Logger;
27
import org.apache.logging.log4j.Logger;
28
import org.apache.solr.common.util.Hash;
-
 
29
import org.json.JSONArray;
28
import org.json.JSONArray;
30
import org.json.JSONObject;
29
import org.json.JSONObject;
31
import org.openqa.selenium.Dimension;
30
import org.openqa.selenium.Dimension;
32
import org.openqa.selenium.OutputType;
31
import org.openqa.selenium.OutputType;
33
import org.openqa.selenium.TakesScreenshot;
32
import org.openqa.selenium.TakesScreenshot;
Line 45... Line 44...
45
import com.smartdukaan.cron.scheduled.ScheduledTasks;
44
import com.smartdukaan.cron.scheduled.ScheduledTasks;
46
import com.spice.profitmandi.common.enumuration.ItemType;
45
import com.spice.profitmandi.common.enumuration.ItemType;
47
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
46
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
48
import com.spice.profitmandi.common.model.CustomRetailer;
47
import com.spice.profitmandi.common.model.CustomRetailer;
49
import com.spice.profitmandi.common.model.ProfitMandiConstants;
48
import com.spice.profitmandi.common.model.ProfitMandiConstants;
-
 
49
import com.spice.profitmandi.common.services.mandii.AccountStatusResponseOut;
-
 
50
import com.spice.profitmandi.common.services.mandii.EligibilityStatusEnum;
50
import com.spice.profitmandi.common.services.mandii.Gender;
51
import com.spice.profitmandi.common.services.mandii.Gender;
51
import com.spice.profitmandi.common.services.mandii.MandiiService;
52
import com.spice.profitmandi.common.services.mandii.MandiiService;
52
import com.spice.profitmandi.common.services.mandii.MandiiUser;
53
import com.spice.profitmandi.common.services.mandii.MandiiUser;
53
import com.spice.profitmandi.common.util.FileUtil;
54
import com.spice.profitmandi.common.util.FileUtil;
54
import com.spice.profitmandi.common.util.FormattingUtils;
55
import com.spice.profitmandi.common.util.FormattingUtils;
55
import com.spice.profitmandi.common.util.Utils;
56
import com.spice.profitmandi.common.util.Utils;
56
import com.spice.profitmandi.dao.entity.catalog.Item;
57
import com.spice.profitmandi.dao.entity.catalog.Item;
57
import com.spice.profitmandi.dao.entity.catalog.Offer;
58
import com.spice.profitmandi.dao.entity.catalog.Offer;
58
import com.spice.profitmandi.dao.entity.catalog.Scheme;
59
import com.spice.profitmandi.dao.entity.catalog.Scheme;
59
import com.spice.profitmandi.dao.entity.catalog.TagListing;
60
import com.spice.profitmandi.dao.entity.catalog.TagListing;
-
 
61
import com.spice.profitmandi.dao.entity.dtr.CreditAccount;
-
 
62
import com.spice.profitmandi.dao.entity.dtr.CreditStatus;
60
import com.spice.profitmandi.dao.entity.dtr.Document;
63
import com.spice.profitmandi.dao.entity.dtr.Document;
61
import com.spice.profitmandi.dao.entity.dtr.PaymentOptionTransaction;
64
import com.spice.profitmandi.dao.entity.dtr.PaymentOptionTransaction;
62
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
65
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
63
import com.spice.profitmandi.dao.entity.fofo.DebitNote;
66
import com.spice.profitmandi.dao.entity.fofo.DebitNote;
64
import com.spice.profitmandi.dao.entity.fofo.FofoKyc;
67
import com.spice.profitmandi.dao.entity.fofo.FofoKyc;
Line 94... Line 97...
94
import com.spice.profitmandi.dao.entity.warehouse.WarehouseInventoryItem;
97
import com.spice.profitmandi.dao.entity.warehouse.WarehouseInventoryItem;
95
import com.spice.profitmandi.dao.entity.warehouse.WarehouseScan;
98
import com.spice.profitmandi.dao.entity.warehouse.WarehouseScan;
96
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
99
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
97
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
100
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
98
import com.spice.profitmandi.dao.enumuration.dtr.PaymentOptionReferenceType;
101
import com.spice.profitmandi.dao.enumuration.dtr.PaymentOptionReferenceType;
-
 
102
import com.spice.profitmandi.dao.enumuration.fofo.Gateway;
99
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
103
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
100
import com.spice.profitmandi.dao.model.ContentPojo;
104
import com.spice.profitmandi.dao.model.ContentPojo;
101
import com.spice.profitmandi.dao.model.MediaPojo;
105
import com.spice.profitmandi.dao.model.MediaPojo;
102
import com.spice.profitmandi.dao.repository.GenericRepository;
106
import com.spice.profitmandi.dao.repository.GenericRepository;
103
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
107
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
104
import com.spice.profitmandi.dao.repository.catalog.ManualPaymentRequestRepository;
108
import com.spice.profitmandi.dao.repository.catalog.ManualPaymentRequestRepository;
105
import com.spice.profitmandi.dao.repository.catalog.OfferRepository;
109
import com.spice.profitmandi.dao.repository.catalog.OfferRepository;
106
import com.spice.profitmandi.dao.repository.catalog.SchemeRepository;
110
import com.spice.profitmandi.dao.repository.catalog.SchemeRepository;
107
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
111
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
108
import com.spice.profitmandi.dao.repository.cs.CsService;
112
import com.spice.profitmandi.dao.repository.cs.CsService;
-
 
113
import com.spice.profitmandi.dao.repository.dtr.CreditAccountRepository;
109
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
114
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
110
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
115
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
111
import com.spice.profitmandi.dao.repository.dtr.LeadRepository;
116
import com.spice.profitmandi.dao.repository.dtr.LeadRepository;
112
import com.spice.profitmandi.dao.repository.dtr.Mongo;
117
import com.spice.profitmandi.dao.repository.dtr.Mongo;
113
import com.spice.profitmandi.dao.repository.dtr.PartnerOnBoardingPanelRepository;
118
import com.spice.profitmandi.dao.repository.dtr.PartnerOnBoardingPanelRepository;
Line 156... Line 161...
156
import com.spice.profitmandi.service.scheme.SchemeService;
161
import com.spice.profitmandi.service.scheme.SchemeService;
157
import com.spice.profitmandi.service.transaction.TransactionService;
162
import com.spice.profitmandi.service.transaction.TransactionService;
158
import com.spice.profitmandi.service.user.RetailerService;
163
import com.spice.profitmandi.service.user.RetailerService;
159
import com.spice.profitmandi.service.wallet.WalletService;
164
import com.spice.profitmandi.service.wallet.WalletService;
160
import com.spice.profitmandi.service.warehouse.WarehouseInventoryService;
165
import com.spice.profitmandi.service.warehouse.WarehouseInventoryService;
-
 
166
 
161
import in.shop2020.model.v1.order.OrderStatus;
167
import in.shop2020.model.v1.order.OrderStatus;
162
import in.shop2020.model.v1.order.WalletReferenceType;
168
import in.shop2020.model.v1.order.WalletReferenceType;
163
import okhttp3.OkHttpClient;
169
import okhttp3.OkHttpClient;
164
import okhttp3.Request;
170
import okhttp3.Request;
165
import okhttp3.Response;
171
import okhttp3.Response;
Line 790... Line 796...
790
					body.toString(), emailSnapshotMap);
796
					body.toString(), emailSnapshotMap);
791
			LOGGER.info("Sent mail to {}", email);
797
			LOGGER.info("Sent mail to {}", email);
792
		}
798
		}
793
		driver.quit();
799
		driver.quit();
794
	}
800
	}
795
	
801
 
796
	// Rollout prebooking orders amount in case the order is grned.
802
	// Rollout prebooking orders amount in case the order is grned.
797
	public void pbfix() throws ProfitMandiBusinessException {
803
	public void pbfix() throws ProfitMandiBusinessException {
798
		List<PrebookingOrder> prebookingOrders = prebookingOrderRepository.selectAll();
804
		List<PrebookingOrder> prebookingOrders = prebookingOrderRepository.selectAll();
799
		Map<Integer, Boolean> prebookingCleared = new HashMap<>();
805
		Map<Integer, Boolean> prebookingCleared = new HashMap<>();
800
		prebookingOrders = prebookingOrders.stream().collect(Collectors.toList());
806
		prebookingOrders = prebookingOrders.stream().collect(Collectors.toList());
801
		Map<Integer, List<PrebookingOrder>> catalogPrebookingMap = new HashMap<>();
807
		Map<Integer, List<PrebookingOrder>> catalogPrebookingMap = new HashMap<>();
802
		for(PrebookingOrder prebookingOrder : prebookingOrders) {
808
		for (PrebookingOrder prebookingOrder : prebookingOrders) {
803
			if(!catalogPrebookingMap.containsKey(prebookingOrder.getCatalogId())) {
809
			if (!catalogPrebookingMap.containsKey(prebookingOrder.getCatalogId())) {
804
				catalogPrebookingMap.put(prebookingOrder.getCatalogId(), new ArrayList<>());
810
				catalogPrebookingMap.put(prebookingOrder.getCatalogId(), new ArrayList<>());
805
			}
811
			}
806
			catalogPrebookingMap.get(prebookingOrder.getCatalogId()).add(prebookingOrder);
812
			catalogPrebookingMap.get(prebookingOrder.getCatalogId()).add(prebookingOrder);
807
			int prebookingId = prebookingOrder.getId();
813
			int prebookingId = prebookingOrder.getId();
808
			List<UserWalletHistory> history = walletService.getAllByReference(prebookingOrder.getFofoId(), prebookingId, WalletReferenceType.PREBOOKING_ORDER);
814
			List<UserWalletHistory> history = walletService.getAllByReference(prebookingOrder.getFofoId(), prebookingId,
-
 
815
					WalletReferenceType.PREBOOKING_ORDER);
809
			long totalAmount  = history.stream().collect(Collectors.summingLong(x->x.getAmount()));
816
			long totalAmount = history.stream().collect(Collectors.summingLong(x -> x.getAmount()));
810
			//Refund is pending
817
			// Refund is pending
811
			if(history.size() > 0) {
818
			if (history.size() > 0) {
812
				if(totalAmount < 0) {
819
				if (totalAmount < 0) {
813
					prebookingCleared.put(prebookingId, false);
820
					prebookingCleared.put(prebookingId, false);
814
					LOGGER.info("Amount pending for prebooking id " + prebookingId + " amount is " + -totalAmount + " catalog id - {}", prebookingOrder.getCatalogId());
821
					LOGGER.info("Amount pending for prebooking id " + prebookingId + " amount is " + -totalAmount
-
 
822
							+ " catalog id - {}", prebookingOrder.getCatalogId());
815
				} else {
823
				} else {
816
					prebookingCleared.put(prebookingId, true);
824
					prebookingCleared.put(prebookingId, true);
817
				}
825
				}
818
			} else {
826
			} else {
819
				prebookingCleared.put(prebookingId, true);
827
				prebookingCleared.put(prebookingId, true);
820
				LOGGER.info("No entry in wallet for prebooking Id " + prebookingId);
828
				LOGGER.info("No entry in wallet for prebooking Id " + prebookingId);
821
			}
829
			}
822
		}
830
		}
823
		for(Map.Entry<Integer, List<PrebookingOrder>> entrySet : catalogPrebookingMap.entrySet()) {
831
		for (Map.Entry<Integer, List<PrebookingOrder>> entrySet : catalogPrebookingMap.entrySet()) {
824
			LOGGER.info("Catalog id {}, Size {}",  entrySet.getKey(), entrySet.getValue().size());
832
			LOGGER.info("Catalog id {}, Size {}", entrySet.getKey(), entrySet.getValue().size());
825
			Set<Integer> itemIds = itemRepository.selectAllByCatalogItemId(entrySet.getKey()).stream().map(x->x.getId()).collect(Collectors.toSet());
833
			Set<Integer> itemIds = itemRepository.selectAllByCatalogItemId(entrySet.getKey()).stream()
-
 
834
					.map(x -> x.getId()).collect(Collectors.toSet());
826
			List<PrebookingOrder> prebookings = entrySet.getValue();
835
			List<PrebookingOrder> prebookings = entrySet.getValue();
-
 
836
			Map<Integer, List<PrebookingOrder>> fofoMap = prebookings.stream()
827
			Map<Integer, List<PrebookingOrder>>fofoMap = prebookings.stream().collect(Collectors.groupingBy(x->x.getFofoId(), Collectors.toList()));
837
					.collect(Collectors.groupingBy(x -> x.getFofoId(), Collectors.toList()));
828
			for (Map.Entry<Integer, List<PrebookingOrder>> fofoMapEntry : fofoMap.entrySet()) {
838
			for (Map.Entry<Integer, List<PrebookingOrder>> fofoMapEntry : fofoMap.entrySet()) {
829
				int fofoId = fofoMapEntry.getKey();
839
				int fofoId = fofoMapEntry.getKey();
830
				int totalGrnCount = inventoryItemRepository.selectByFofoIdItemIds(fofoId, itemIds).size();
840
				int totalGrnCount = inventoryItemRepository.selectByFofoIdItemIds(fofoId, itemIds).size();
831
				List<PrebookingOrder> partnerBookings = fofoMapEntry.getValue();
841
				List<PrebookingOrder> partnerBookings = fofoMapEntry.getValue();
832
				for (PrebookingOrder partnerBooking : partnerBookings) {
842
				for (PrebookingOrder partnerBooking : partnerBookings) {
833
					if(prebookingCleared.get(partnerBooking.getId())) {
843
					if (prebookingCleared.get(partnerBooking.getId())) {
834
						totalGrnCount--;
844
						totalGrnCount--;
835
						if(totalGrnCount < 0) {
845
						if (totalGrnCount < 0) {
836
							totalGrnCount=0;
846
							totalGrnCount = 0;
837
							LOGGER.info("FofoId {}, No Grn But Refunded prebooking id {}", fofoId, partnerBooking.getId());
847
							LOGGER.info("FofoId {}, No Grn But Refunded prebooking id {}", fofoId,
-
 
848
									partnerBooking.getId());
838
							break;
849
							break;
839
						}
850
						}
840
					}
851
					}
841
				}
852
				}
842
				
853
 
843
				long toBeRefunded = partnerBookings.stream().filter(x->!prebookingCleared.get(x.getId())).limit(totalGrnCount).count();
854
				long toBeRefunded = partnerBookings.stream().filter(x -> !prebookingCleared.get(x.getId()))
-
 
855
						.limit(totalGrnCount).count();
844
				LOGGER.info("FofoId {}, Remaining Grn {}, toBeRefunded Prebooking {}",  fofoId, totalGrnCount, toBeRefunded);
856
				LOGGER.info("FofoId {}, Remaining Grn {}, toBeRefunded Prebooking {}", fofoId, totalGrnCount,
-
 
857
						toBeRefunded);
845
				partnerBookings.stream().filter(x->!prebookingCleared.get(x.getId()))
858
				partnerBookings.stream().filter(x -> !prebookingCleared.get(x.getId()))
846
				.filter(x->x.getCreateTimestamp().getYear()==2022).limit(totalGrnCount).forEach(x->{
859
						.filter(x -> x.getCreateTimestamp().getYear() == 2022).limit(totalGrnCount).forEach(x -> {
847
					try {
860
							try {
848
						purchaseService.sendPrebookingNotifyMessage(x);
861
								purchaseService.sendPrebookingNotifyMessage(x);
849
					} catch(Exception e) {
862
							} catch (Exception e) {
850
						LOGGER.info("could not notify");
863
								LOGGER.info("could not notify");
851
					}
864
							}
852
				});
865
						});
853
				
-
 
854
				
866
 
855
			}
867
			}
856
		}
868
		}
857
	}
869
	}
858
 
870
 
859
	public void fixGrn() throws Exception {
871
	public void fixGrn() throws Exception {
Line 1583... Line 1595...
1583
	DocumentRepository documentRepository;
1595
	DocumentRepository documentRepository;
1584
 
1596
 
1585
	@Autowired
1597
	@Autowired
1586
	com.spice.profitmandi.dao.repository.dtr.UserRepository dtrUserRepository;
1598
	com.spice.profitmandi.dao.repository.dtr.UserRepository dtrUserRepository;
1587
 
1599
 
-
 
1600
	@Autowired
-
 
1601
	private CreditAccountRepository creditAccountRepository;
-
 
1602
 
1588
	public void mandiiUser(String firstName, String lastName, String pan, String dob, String aadhaar, String gender,
1603
	public void mandiiUser(String firstName, String lastName, String pan, String dob, String aadhaar, String gender,
1589
			String father) throws Exception {
1604
			String father) throws Exception {
1590
		FofoStore fs = fofoStoreRepository.selectByPan(pan);
1605
		FofoStore fs = fofoStoreRepository.selectByPan(pan);
1591
		CustomRetailer cr = retailerService.getFofoRetailer(fs.getId());
1606
		CustomRetailer cr = retailerService.getFofoRetailer(fs.getId());
1592
		com.spice.profitmandi.dao.entity.dtr.User dtrUser = dtrUserRepository.selectByEmailId(cr.getEmail());
1607
		com.spice.profitmandi.dao.entity.dtr.User dtrUser = dtrUserRepository.selectByEmailId(cr.getEmail());
Line 1607... Line 1622...
1607
		}
1622
		}
1608
		mandiiUser.setGender(Gender.valueOf(gender));
1623
		mandiiUser.setGender(Gender.valueOf(gender));
1609
		mandiiService.createAccount(cr.getBusinessName(), mandiiUser);
1624
		mandiiService.createAccount(cr.getBusinessName(), mandiiUser);
1610
	}
1625
	}
1611
 
1626
 
1612
 
-
 
1613
	public void mandiiUsers(String pan) throws Exception {
1627
	public void mandiiUsers(String pan) throws Exception {
1614
		FofoStore fs = fofoStoreRepository.selectByPan(pan);
1628
		FofoStore fs = fofoStoreRepository.selectByPan(pan);
1615
 
1629
 
1616
		PartnerOnBoardingPanel pob = partnerOnBoardingPanelRepository.selectByCode(fs.getCode());
1630
		PartnerOnBoardingPanel pob = partnerOnBoardingPanelRepository.selectByCode(fs.getCode());
1617
		List<FofoKyc> fofoKycs = fofoKycRepository.selectByPartnerOnBoardingId(pob.getId());
1631
		List<FofoKyc> fofoKycs = fofoKycRepository.selectByPartnerOnBoardingId(pob.getId());
1618
		CustomRetailer cr = retailerService.getFofoRetailer(fs.getId());
1632
		CustomRetailer cr = retailerService.getFofoRetailer(fs.getId());
1619
		com.spice.profitmandi.dao.entity.dtr.User dtrUser = dtrUserRepository.selectByEmailId(cr.getEmail());
1633
		com.spice.profitmandi.dao.entity.dtr.User dtrUser = dtrUserRepository.selectByEmailId(cr.getEmail());
1620
 
-
 
-
 
1634
         boolean ca = false;
1621
		for (FofoKyc fk : fofoKycs) {
1635
		for (FofoKyc fk : fofoKycs) {
1622
 
1636
 
1623
			MandiiUser mandiiUser = mandiiService.getUser(fk.getFirstName(), fk.getLastName(), fk.getFatherName(),
1637
			MandiiUser mandiiUser = mandiiService.getUser(fk.getFirstName(), fk.getLastName(), fk.getFatherName(),
1624
					fk.getGender(), fk.getEmail(), pan, fk.getMobile(), fk.getDob(),
1638
					fk.getGender(), fk.getEmail(), pan, fk.getMobile(), fk.getDob(),
1625
					fk.getAddress1() + " " + fk.getAddress2() + " " + fk.getAddress3(), fk.getCity(), fk.getState(),
1639
					fk.getAddress1() + " " + fk.getAddress2() + " " + fk.getAddress3(), fk.getCity(), fk.getState(),
Line 1641... Line 1655...
1641
			Document adhaarB = documentRepository.selectById(fk.getPoaBack());
1655
			Document adhaarB = documentRepository.selectById(fk.getPoaBack());
1642
			File adharb = new File(adhaarB.getPath() + adhaarF.getName());
1656
			File adharb = new File(adhaarB.getPath() + adhaarF.getName());
1643
			String adhaarBEncodstring = encodeFileToBase64Binary(adharb);
1657
			String adhaarBEncodstring = encodeFileToBase64Binary(adharb);
1644
			mandiiService.documentUpload(pan, fk.getMobile(), "AADHAAR", adhaarBEncodstring, "BACK");
1658
			mandiiService.documentUpload(pan, fk.getMobile(), "AADHAAR", adhaarBEncodstring, "BACK");
1645
 
1659
 
1646
			mandiiService.createAccount(cr.getBusinessName(), mandiiUser);
1660
			ca = mandiiService.createAccount(cr.getBusinessName(), mandiiUser);
-
 
1661
 
-
 
1662
			
-
 
1663
			if(ca == true) {
-
 
1664
			AccountStatusResponseOut accountStatusResponseOut = mandiiService.getStatus(fs.getPan());
-
 
1665
 
-
 
1666
			this.setCreditAccount(fs.getId(), accountStatusResponseOut);
-
 
1667
			}
-
 
1668
 
-
 
1669
		}
-
 
1670
 
-
 
1671
	}
-
 
1672
 
-
 
1673
	private void setCreditAccount(int fofoId, AccountStatusResponseOut accountStatusResponseOut) {
-
 
1674
 
-
 
1675
		CreditAccount creditAccount = creditAccountRepository.selectByFofoIdAndGateway(fofoId, Gateway.MANDII);
-
 
1676
 
-
 
1677
		if (creditAccount == null) {
-
 
1678
 
-
 
1679
			creditAccount = new CreditAccount();
-
 
1680
 
-
 
1681
			creditAccount.setFofoId(fofoId);
-
 
1682
			creditAccount.setGateway(Gateway.MANDII);
1647
 
1683
 
1648
		}
1684
		}
-
 
1685
 
-
 
1686
		if (accountStatusResponseOut == null) {
-
 
1687
			creditAccount.setCreditStatus(CreditStatus.UNKNOWN);
-
 
1688
			creditAccount.setDescription("User company not found");
-
 
1689
 
-
 
1690
		} else {
-
 
1691
			if (accountStatusResponseOut.getSanctionLimit() != null) {
-
 
1692
				creditAccount.setSanctionedAmount(accountStatusResponseOut.getSanctionLimit().floatValue());
-
 
1693
			} else {
-
 
1694
				creditAccount.setSanctionedAmount(0);
-
 
1695
			}
-
 
1696
 
-
 
1697
			creditAccount.setInterestRate(accountStatusResponseOut.getRateOfInterest());
-
 
1698
			if (accountStatusResponseOut.getBalanceAmount() != null) {
-
 
1699
				creditAccount.setAvailableAmount(accountStatusResponseOut.getBalanceAmount().floatValue());
-
 
1700
			} else {
-
 
1701
				creditAccount.setAvailableAmount(0);
-
 
1702
			}
-
 
1703
 
-
 
1704
			if (accountStatusResponseOut.getCurrentStage() != null) {
-
 
1705
				creditAccount.setDescription(accountStatusResponseOut.getCurrentStage().toString());
-
 
1706
			}
-
 
1707
			if (accountStatusResponseOut.getStatus().equals(EligibilityStatusEnum.SANCTION_AVAILABLE)) {
-
 
1708
				creditAccount.setCreditStatus(CreditStatus.SANCTIONED);
-
 
1709
			} else if (accountStatusResponseOut.getStatus().equals(EligibilityStatusEnum.IN_ELIGIBLE)) {
-
 
1710
				creditAccount.setCreditStatus(CreditStatus.INELIGIBLE);
-
 
1711
			} else {
-
 
1712
 
-
 
1713
				creditAccount.setCreditStatus(CreditStatus.TO_BE_EVALUATED);
-
 
1714
			}
-
 
1715
		}
-
 
1716
 
-
 
1717
		creditAccount.setUpdatedOn(LocalDateTime.now());
-
 
1718
		creditAccountRepository.persist(creditAccount);
1649
	}
1719
	}
1650
 
1720
 
1651
	private static String encodeFileToBase64Binary(File file) throws Exception {
1721
	private static String encodeFileToBase64Binary(File file) throws Exception {
1652
		FileInputStream fileInputStreamReader = new FileInputStream(file);
1722
		FileInputStream fileInputStreamReader = new FileInputStream(file);
1653
		byte[] bytes = new byte[(int) file.length()];
1723
		byte[] bytes = new byte[(int) file.length()];