public boolean ifAlreadyExists(Merchant merchant, Wallets wallet) { String merchantId = template .opsForValue() .get("merchant." + merchant.getName() + wallet.getRedisMerchantIdKey()); return merchantId == null ? false : true; }
public Merchant getDetails(String merchantName) { String baseKey = "merchant." + merchantName; Merchant merchant = new Merchant(); // or use template directly merchant.setName(template.opsForValue().get(baseKey + ".name")); merchant.setPhoneNumber(template.opsForValue().get(baseKey + ".phone")); merchant.setEmail(template.opsForValue().get(baseKey + ".email")); merchant .getWalletMerchantId() .put( Wallets.PAYTM, template.opsForValue().get(baseKey + Wallets.PAYTM.getRedisMerchantIdKey())); merchant .getWalletMerchantId() .put( Wallets.PAYUMONEY, template.opsForValue().get(baseKey + Wallets.PAYUMONEY.getRedisMerchantIdKey())); merchant .getWalletMerchantId() .put( Wallets.CITRUS, template.opsForValue().get(baseKey + Wallets.CITRUS.getRedisMerchantIdKey())); return merchant; }