Skip to content

Commit

Permalink
Corrección de NPE al exportar txt del Banco del Caribe
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosaparadam committed Oct 20, 2022
1 parent 45b79a8 commit fa81f72
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,13 @@ public int exportToFile(List<MPaySelectionCheck> checks, File file, StringBuffer
businessPartnerEmail = "";
}
// String Account Type
String businessPartnerAccountType = "CTE";
if(businessPartnerAccount.getBankAccountType().equals(MBPBankAccount.BANKACCOUNTTYPE_Savings)) {
businessPartnerAccountType = "AHO";
}
AtomicReference<String> businessPartnerAccountType = new AtomicReference<String>("CTE");
Optional<String> maybeBusinessPartnerAccountType = Optional.ofNullable(businessPartnerAccount.getBankAccountType());
maybeBusinessPartnerAccountType.ifPresent(accountType -> {
if (accountType.equals(MBPBankAccount.BANKACCOUNTTYPE_Savings))
businessPartnerAccountType.set("AHO");
});

// Validate
if(Optional.ofNullable(businessPartnerAccountNo).isPresent()
&& Optional.ofNullable(businessPartnerName).isPresent()) {
Expand All @@ -147,7 +150,7 @@ public int exportToFile(List<MPaySelectionCheck> checks, File file, StringBuffer
.append(SEPARATOR) // Blank Space
.append(businessPartnerAccountNo) // Third Party Account Code
.append(SEPARATOR) // Blank Space
.append(businessPartnerAccountType) // Account Type Saving = AHO, Checking = CTE
.append(businessPartnerAccountType.get()) // Account Type Saving = AHO, Checking = CTE
.append(SEPARATOR) // Blank Space
.append(currencyType) // Currency Type 0 = VES
.append(SEPARATOR) // Blank Space
Expand Down

0 comments on commit fa81f72

Please sign in to comment.