completed initial setup

This commit is contained in:
2025-06-16 18:13:20 +02:00
parent b435c2e5f5
commit eee746a5d8
34 changed files with 817 additions and 3 deletions

View File

@@ -0,0 +1,11 @@
package zw.qantra.tm.domain.services;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import zw.qantra.tm.domain.repositories.ConfirmTransactionRepository;
@Service
@RequiredArgsConstructor
public class ConfirmTransactionService {
private final ConfirmTransactionRepository confirmTransactionRepository;
}

View File

@@ -0,0 +1,11 @@
package zw.qantra.tm.domain.services;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import zw.qantra.tm.domain.repositories.CurrencyRepository;
@Service
@RequiredArgsConstructor
public class CurrencyService {
private final CurrencyRepository currencyRepository;
}

View File

@@ -0,0 +1,11 @@
package zw.qantra.tm.domain.services;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import zw.qantra.tm.domain.repositories.IntegrationProcessorRepository;
@Service
@RequiredArgsConstructor
public class IntegrationProcessorService {
private final IntegrationProcessorRepository integrationProcessorRepository;
}

View File

@@ -0,0 +1,11 @@
package zw.qantra.tm.domain.services;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import zw.qantra.tm.domain.repositories.PaymentProcessorRepository;
@Service
@RequiredArgsConstructor
public class PaymentProcessorService {
private final PaymentProcessorRepository paymentProcessorRepository;
}

View File

@@ -0,0 +1,11 @@
package zw.qantra.tm.domain.services;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import zw.qantra.tm.domain.repositories.ProviderRepository;
@Service
@RequiredArgsConstructor
public class ProviderService {
private final ProviderRepository providerRepository;
}

View File

@@ -0,0 +1,11 @@
package zw.qantra.tm.domain.services;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import zw.qantra.tm.domain.repositories.SettingRepository;
@Service
@RequiredArgsConstructor
public class SettingService {
private final SettingRepository settingRepository;
}

View File

@@ -0,0 +1,21 @@
package zw.qantra.tm.domain.services;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import zw.qantra.tm.domain.models.PaymentProcessor;
import zw.qantra.tm.domain.models.Transaction;
import zw.qantra.tm.domain.repositories.TransactionRepository;
import zw.qantra.tm.domain.services.factories.PaymentProcessorFactory;
@Service
@RequiredArgsConstructor
public class TransactionService {
private final TransactionRepository transactionRepository;
private final PaymentProcessorFactory paymentProcessorFactory;
private Transaction bootstrap(Transaction transaction) {
String label = transaction.getType() + "_" + transaction.getPaymentProcessorLabel();
// PaymentProcessor paymentProcessor = paymentProcessorFactory.getPaymentProcessor(label);
return transaction;
}
}

View File

@@ -0,0 +1,40 @@
package zw.qantra.tm.domain.services.factories;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
@RequiredArgsConstructor
public class PaymentProcessorFactory implements ApplicationContextAware {
private final Logger logger = LoggerFactory.getLogger(this.getClass().getName());
private ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
public Object getPaymentProcessor(String paymentProcessorName) {
Object paymentProcessor;
try {
paymentProcessor = applicationContext.getBean(paymentProcessorName);
} catch (NoSuchBeanDefinitionException exception) {
logger.error("Couldn't find payment processor: {}", exception.getMessage());
return null;
} catch (BeansException e) {
logger.error("Error retrieving payment processor bean: {}", e.getMessage());
return null;
}
return paymentProcessor;
}
}

View File

@@ -0,0 +1,8 @@
package zw.qantra.tm.domain.services.processors;
import zw.qantra.tm.domain.models.Transaction;
public interface TransactionProcessorInterface {
Object process(Transaction transaction);
Object reverse(Transaction transaction);
}

View File

@@ -0,0 +1,25 @@
package zw.qantra.tm.domain.services.processors.confirmations;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import zw.qantra.tm.domain.models.Transaction;
import zw.qantra.tm.domain.services.processors.TransactionProcessorInterface;
import zw.qantra.tm.rest.RestService;
@Service("CONFIRM_POWERTEL_ZESA")
@RequiredArgsConstructor
public class ZesaConfirmationProcessor implements TransactionProcessorInterface {
private final RestService restService;
@Override
public Object process(Transaction transaction) {
return transaction;
}
@Override
public Object reverse(Transaction transaction) {
return transaction;
}
}