increase rounding mode to 4

This commit is contained in:
2025-12-02 23:12:32 +02:00
parent 0c2a39f851
commit 2b509cb7b7
4 changed files with 9 additions and 3 deletions

View File

@@ -24,5 +24,6 @@ public class SdkActionDto {
private Boolean sandbox; private Boolean sandbox;
private String paymentProcessorLabel; private String paymentProcessorLabel;
private String responseUrl; private String responseUrl;
private String returnUrl;
} }

View File

@@ -42,6 +42,8 @@ public class MPGSWebPaymentProcessor implements TransactionProcessorInterface {
private String clientSecret; private String clientSecret;
@Value("${steward.payment.processor.url}") @Value("${steward.payment.processor.url}")
private String url; private String url;
@Value("${mpgs.return-url}")
private String returnUrl;
@Override @Override
public Object process(Transaction transaction) throws Exception { public Object process(Transaction transaction) throws Exception {
@@ -75,6 +77,7 @@ public class MPGSWebPaymentProcessor implements TransactionProcessorInterface {
.sandbox(true) .sandbox(true)
.paymentProcessorLabel("MPGS") .paymentProcessorLabel("MPGS")
.responseUrl("https://stewardbank.co.zw") .responseUrl("https://stewardbank.co.zw")
.returnUrl(returnUrl + "/" + transaction.getReference())
.build(); .build();
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();

View File

@@ -119,9 +119,9 @@ public class PurchaseInvoiceHandler implements HandlerInterface {
Provider provider = providerService.getProviderRepository() Provider provider = providerService.getProviderRepository()
.findByClientId(transaction.getBillClientId()); .findByClientId(transaction.getBillClientId());
BigDecimal commissionPercentage = BigDecimal.valueOf(provider.getPercentageCommission()) BigDecimal commissionPercentage = BigDecimal.valueOf(provider.getPercentageCommission())
.divide(BigDecimal.valueOf(100), 2, RoundingMode.CEILING); .divide(BigDecimal.valueOf(100), 4, RoundingMode.CEILING);
BigDecimal commission = transaction.getAmount().multiply(commissionPercentage) BigDecimal commission = transaction.getAmount().multiply(commissionPercentage)
.setScale(2, RoundingMode.CEILING); .setScale(4, RoundingMode.CEILING);
BigDecimal amount = transaction.getAmount().subtract(commission); BigDecimal amount = transaction.getAmount().subtract(commission);
PurchaseTaxDto purchaseTaxDto = PurchaseTaxDto.builder() PurchaseTaxDto purchaseTaxDto = PurchaseTaxDto.builder()

View File

@@ -28,6 +28,8 @@ sbz.aggregator.encryption-key=91b5b3c7-860f-473c-ac5c-b12d9121819b
steward.payment.processor.url=${sbz.merchant.url} steward.payment.processor.url=${sbz.merchant.url}
mpgs.return-url=https://vdt.co.zw/#/return
# ERPNext Configuration # ERPNext Configuration
erpnext.url=http://62.171.179.108:8080/api erpnext.url=http://62.171.179.108:8080/api
erpnext.api.key=dff94c65b52ecbd erpnext.api.key=dff94c65b52ecbd