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")
|
||||
|
||||
2
src/main/resources/application-vusa.properties
Normal file
2
src/main/resources/application-vusa.properties
Normal file
@@ -0,0 +1,2 @@
|
||||
# sbz.merchant.url=http://localhost:24000/v1
|
||||
sbz.merchant.url=https://api.stewardpay.co.zw/lab/v2
|
||||
31
src/main/resources/liquibase-diff-changeLog.xml
Normal file
31
src/main/resources/liquibase-diff-changeLog.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
|
||||
<changeSet author="vk (generated)" id="1756328366833-1">
|
||||
<addColumn tableName="transaction">
|
||||
<column name="erp_journal_ref" type="varchar(255)"/>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
<changeSet author="vk (generated)" id="1756328366833-2">
|
||||
<addColumn tableName="transaction">
|
||||
<column name="erp_purchase_payment_ref" type="varchar(255)"/>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
<changeSet author="vk (generated)" id="1756328366833-3">
|
||||
<addColumn tableName="transaction">
|
||||
<column name="erp_purchase_ref" type="varchar(255)"/>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
<changeSet author="vk (generated)" id="1756328366833-4">
|
||||
<addColumn tableName="transaction">
|
||||
<column name="erp_sales_payment_ref" type="varchar(255)"/>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
<changeSet author="vk (generated)" id="1756328366833-5">
|
||||
<addColumn tableName="transaction">
|
||||
<column name="erp_sales_ref" type="varchar(255)"/>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
<changeSet author="vk (generated)" id="1756328366833-6">
|
||||
<dropColumn columnName="erp_ref" tableName="transaction"/>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
@@ -1,6 +1,6 @@
|
||||
changeLogFile=src/main/resources/liquibase-diff-changeLog.xml
|
||||
url=jdbc:postgresql://173.212.247.232:5432/qpay?serverTimezone=Africa/Harare&useLegacyDatetimeCode=false
|
||||
username=root
|
||||
url=jdbc:postgresql://173.212.247.232:5532/qpay?serverTimezone=Africa/Harare&useLegacyDatetimeCode=false
|
||||
username=postgres
|
||||
password=zdDZMzq6F4B4L1IUl
|
||||
|
||||
driver=org.postgresql.Driver
|
||||
|
||||
Reference in New Issue
Block a user