working implementation for poc
This commit is contained in:
@@ -58,6 +58,13 @@ public class Transaction extends BaseEntity {
|
||||
private String paymentProcessorName;
|
||||
private String providerImage;
|
||||
private String paymentProcessorImage;
|
||||
|
||||
private String erpSalesRef;
|
||||
private String erpJournalRef;
|
||||
private String erpSalesPaymentRef;
|
||||
private String erpPurchaseRef;
|
||||
private String erpPurchasePaymentRef;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private RequestType type;
|
||||
@Enumerated(EnumType.STRING)
|
||||
|
||||
@@ -61,6 +61,7 @@ public class TransactionService {
|
||||
String label = transaction.getType() + "_" +
|
||||
provider.getIntegrationProcessorLabel();
|
||||
logger.info("label: {}", label);
|
||||
transaction.setIntegrationProcessorLabel(provider.getIntegrationProcessorLabel()); // for reference purposes
|
||||
|
||||
TransactionProcessorInterface transactionProcessorInterface =
|
||||
(TransactionProcessorInterface) paymentProcessorFactory.getPaymentProcessor(label);
|
||||
|
||||
@@ -50,7 +50,9 @@ public class CalculateChargesHandler implements LogicHandler<Transaction, Transa
|
||||
}
|
||||
if(isPresent) break; // we've found a matching condition, no need to check rest of conditions
|
||||
}
|
||||
if(!isPresent) continue; // if we did not find a match, means this charge does not apply to this transaction
|
||||
// if we did not find a match, means this charge does not apply to this transaction
|
||||
// also implies there is no need to check exemptions
|
||||
if(!isPresent) continue;
|
||||
|
||||
boolean isExempt = false;
|
||||
for (ChargeCondition chargeCondition: charge.getExcludes()){
|
||||
|
||||
@@ -14,7 +14,6 @@ import zw.qantra.tm.domain.services.processors.handlers.LogicHandler;
|
||||
public class SalesInvoiceHandler implements LogicHandler<Transaction, Transaction>{
|
||||
Logger logger = LoggerFactory.getLogger(SalesInvoiceHandler.class);
|
||||
|
||||
|
||||
@Override
|
||||
public Transaction process(Transaction transaction) {
|
||||
logger.info("Processing sales invoice for transaction: {}", transaction.getReference());
|
||||
|
||||
@@ -42,7 +42,10 @@ public class EcocashRemotePaymentProcessor implements TransactionProcessorInterf
|
||||
String token = restService.getMerchantToken();
|
||||
|
||||
// send total less gateway charges
|
||||
BigDecimal totalAmount = transaction.getAmount().add(transaction.getTax()).add(transaction.getCharge());
|
||||
BigDecimal totalAmount = transaction.getAmount()
|
||||
.add(transaction.getTax())
|
||||
.add(transaction.getCharge())
|
||||
.add(transaction.getGatewayCharge());
|
||||
|
||||
String concat = clientId+
|
||||
encryptionKey+
|
||||
|
||||
@@ -43,7 +43,10 @@ public class MPGSWebPaymentProcessor implements TransactionProcessorInterface {
|
||||
String token = restService.getMerchantToken();
|
||||
|
||||
// send total less gateway charges
|
||||
BigDecimal totalAmount = transaction.getAmount().add(transaction.getTax()).add(transaction.getCharge());
|
||||
BigDecimal totalAmount = transaction.getAmount()
|
||||
.add(transaction.getTax())
|
||||
.add(transaction.getCharge())
|
||||
.add(transaction.getGatewayCharge());
|
||||
|
||||
String concat = clientId+
|
||||
encryptionKey+
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package zw.qantra.tm.domain.services.processors.payments;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
@@ -41,10 +42,15 @@ public class StewardWebPaymentProcessor implements TransactionProcessorInterface
|
||||
logger.info("processing transaction");
|
||||
String token = restService.getMerchantToken();
|
||||
|
||||
BigDecimal totalAmount = transaction.getAmount()
|
||||
.add(transaction.getTax())
|
||||
.add(transaction.getCharge())
|
||||
.add(transaction.getGatewayCharge());
|
||||
|
||||
String concat = clientId+
|
||||
encryptionKey+
|
||||
transaction.getCreditPhone()+
|
||||
transaction.getAmount();
|
||||
totalAmount;
|
||||
|
||||
String hex = getHash(concat);
|
||||
|
||||
@@ -52,7 +58,7 @@ public class StewardWebPaymentProcessor implements TransactionProcessorInterface
|
||||
.clientId(clientId)
|
||||
.clientSecret(clientSecret)
|
||||
.phone(transaction.getCreditPhone())
|
||||
.amount(transaction.getAmount().toString())
|
||||
.amount(totalAmount.toString())
|
||||
.currency(transaction.getDebitCurrency().toString())
|
||||
.hash(hex)
|
||||
.authType("WEB")
|
||||
|
||||
Reference in New Issue
Block a user