Skip to content

Commit

Permalink
Hot fix for transfers table null data (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
danishjamal104 authored Sep 30, 2022
1 parent 24d0e95 commit f5b7f61
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
13 changes: 12 additions & 1 deletion src/main/java/hu/dpc/phee/operator/importer/RecordParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import hu.dpc.phee.operator.entity.batch.Transaction;
import hu.dpc.phee.operator.entity.task.Task;
import hu.dpc.phee.operator.entity.task.TaskRepository;
import hu.dpc.phee.operator.entity.tenant.ThreadLocalContextUtil;
import hu.dpc.phee.operator.entity.transactionrequest.TransactionRequest;
import hu.dpc.phee.operator.entity.transactionrequest.TransactionRequestRepository;
import hu.dpc.phee.operator.entity.transfer.Transfer;
Expand All @@ -28,6 +29,7 @@

import java.io.FileReader;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
Expand Down Expand Up @@ -143,7 +145,7 @@ public void addVariableToEntity(DocumentContext newVariable, String bpmnProcessI
batchRepository.save(batch);

if (!bpmnProcess.getId().equalsIgnoreCase("bulk_processor")) {
logger.info("Inside if condition");
logger.info("Inside if condition {}", name);
if (name.equals("filename")) {
logger.info("store filename {} in tempDocStore for instance {}", strip(value), workflowInstanceKey);
tempDocumentStore.storeBatchFileName(workflowInstanceKey, value);
Expand Down Expand Up @@ -313,6 +315,15 @@ private void updateTransferTableForBatch(Long workflowInstanceKey, Long complete
transfer.setWorkflowInstanceKey(workflowInstanceKey);
transfer.setBatchId(strip(tempDocumentStore.getBatchId(workflowInstanceKey)));
transfer.setCompletedAt(new Date(completeTimestamp));

transfer.setPayeeDfspId(batch.getPaymentMode());
transfer.setPayerDfspId(ThreadLocalContextUtil.getTenant().getSchemaName());

transfer.setPayeeFeeCurrency(transaction.getCurrency());
transfer.setPayeeFee(BigDecimal.ZERO);
transfer.setPayerFeeCurrency(transaction.getCurrency());
transfer.setPayerFee(BigDecimal.ZERO);

BatchFormatToTransferMapper.updateTransferUsingBatchDetails(transfer, batch);

transferRepository.save(transfer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,17 @@ public static Transfer mapToTransferEntity(Transaction transaction) {
Transfer transfer = new Transfer();

transfer.setAmount(BigDecimal.valueOf(Long.parseLong(transaction.getAmount())));
transfer.setPayeePartyIdType("accountnumber");
transfer.setPayeePartyId(transaction.getAccountNumber());
// below condition check will make sure backward compatibility with old batch format
if (transaction.getAccountNumber() != null && !transaction.getAccountNumber().equalsIgnoreCase("")) {
transfer.setPayeePartyId(transaction.getAccountNumber());
transfer.setPayeePartyIdType("accountnumber");
} else {
transfer.setPayeePartyId(transaction.getPayeeIdentifier());
transfer.setPayeePartyIdType(transaction.getPayeeIdentifierType());
}
// below 2 fields will work only for new CSV specs
transfer.setPayerPartyIdType(transaction.getPayerIdentifierType());
transfer.setPayerPartyId(transaction.getPayerIdentifier());
transfer.setDirection("UNKNOWN");
transfer.setCurrency(transaction.getCurrency());
TransferStatus status;
Expand Down

0 comments on commit f5b7f61

Please sign in to comment.