fix gmail scan null results

This commit is contained in:
heyethereum
2024-08-14 21:15:29 +08:00
parent 9adb53e7ab
commit b176e5c54f
7 changed files with 10 additions and 48 deletions

View File

@@ -138,6 +138,9 @@ public class QRCodeTypeService {
QRCodeModel<?> qrCodeModel = qrCodeFactoryProvider.createQRCodeInstance(scannedQR);
qrCodeModel.setDetails();
// Get classifications based on verifications
scannedQR.setResult(qrCodeModel.retrieveClassification());
return qrCodeModel;
}
// Returns Default type as text if it does not fit into any of the category

View File

@@ -1,30 +0,0 @@
package com.safeqr.app.qrcode.service;
import com.safeqr.app.qrcode.dto.request.QRCodePayload;
import com.safeqr.app.qrcode.dto.RedirectCountResponse;
import org.springframework.stereotype.Service;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Service
public class RedirectCountService {
private static final Logger logger = LoggerFactory.getLogger(RedirectCountService.class);
public Mono<RedirectCountResponse> countRedirects(QRCodePayload payload) {
String url = payload.getData();
logger.info("RedirectCountService: countRedirects: url={}", url);
return WebClient.create()
.get()
.uri("https://google.com")// replace with url when logic is complete
.exchangeToMono(response -> {
RedirectCountResponse redirectCountResponse = new RedirectCountResponse();
redirectCountResponse.setRedirectCount(response.cookies().size());
redirectCountResponse.setMessage("Redirect count calculated.");
return Mono.just(redirectCountResponse);
});
}
}

View File

@@ -31,6 +31,10 @@ public class SMSVerificationService {
}
public void parseSMSString(SMSEntity smsEntity, String smsto) throws IllegalArgumentException{
// Validate the string format
if (smsto == null || smsto.isEmpty()) {
throw new InvalidFormatExceptions("sms cannot be null or empty.");
}
// Remove the "SMSTO:" prefix
String data = smsto.substring(6);