fixes on cusotmeref
This commit is contained in:
@@ -100,10 +100,6 @@ public class JournalEntryHandler implements LogicHandler<Transaction, Transactio
|
||||
headers.add("Authorization", basicAuth);
|
||||
headers.add("Cookie", sid);
|
||||
|
||||
User user = userService.getUserRepository().findById(UUID.fromString(transaction.getUserId())).orElse(null);
|
||||
if(user == null)
|
||||
throw new ApiException("Could not find user");
|
||||
|
||||
JournalEntryAccountDto expenseEntry = JournalEntryAccountDto.builder()
|
||||
.doctype("Journal Entry Account")
|
||||
.account(gatewayExpenseAccount)
|
||||
|
||||
@@ -95,9 +95,11 @@ public class PaymentEntryHandler implements LogicHandler<Transaction, Transactio
|
||||
headers.add("Authorization", basicAuth);
|
||||
headers.add("Cookie", sid);
|
||||
|
||||
String erpCustomerRef = "";
|
||||
User user = userService.getUserRepository().findById(UUID.fromString(transaction.getUserId())).orElse(null);
|
||||
if(user == null)
|
||||
throw new ApiException("Could not find user");
|
||||
if(user == null){
|
||||
erpCustomerRef = "Anonymous";
|
||||
}
|
||||
|
||||
BigDecimal amount = transaction.getAmount().add(transaction.getGatewayCharge());
|
||||
|
||||
@@ -112,7 +114,7 @@ public class PaymentEntryHandler implements LogicHandler<Transaction, Transactio
|
||||
.company(erpnextCompany)
|
||||
.docstatus(1)
|
||||
.paymentType("Receive")
|
||||
.party(user.getErpCustomerRef())
|
||||
.party(erpCustomerRef)
|
||||
.partyType("Customer")
|
||||
.paidFrom(accountsReceivableAccount)
|
||||
.paidTo(cashAccount)
|
||||
|
||||
@@ -98,10 +98,6 @@ public class PurchaseInvoiceHandler implements LogicHandler<Transaction, Transac
|
||||
headers.add("Authorization", basicAuth);
|
||||
headers.add("Cookie", sid);
|
||||
|
||||
User user = userService.getUserRepository().findById(UUID.fromString(transaction.getUserId())).orElse(null);
|
||||
if(user == null)
|
||||
throw new ApiException("Could not find user");
|
||||
|
||||
PurchaseInvoiceItemDto purchaseInvoiceItemDto = PurchaseInvoiceItemDto.builder()
|
||||
.doctype("Purchase Invoice Item")
|
||||
.uom("Nos")
|
||||
|
||||
@@ -101,10 +101,6 @@ public class PurchasePaymentEntryHandler implements LogicHandler<Transaction, Tr
|
||||
headers.add("Authorization", basicAuth);
|
||||
headers.add("Cookie", sid);
|
||||
|
||||
User user = userService.getUserRepository().findById(UUID.fromString(transaction.getUserId())).orElse(null);
|
||||
if(user == null)
|
||||
throw new ApiException("Could not find user");
|
||||
|
||||
Provider provider = providerService.getProviderRepository()
|
||||
.findByClientId(transaction.getBillClientId());
|
||||
BigDecimal commissionPercentage = BigDecimal.valueOf(provider.getPercentageCommission())
|
||||
|
||||
@@ -92,13 +92,15 @@ public class SalesInvoiceHandler implements LogicHandler<Transaction, Transactio
|
||||
headers.add("Authorization", basicAuth);
|
||||
headers.add("Cookie", sid);
|
||||
|
||||
String erpCustomerRef = "";
|
||||
User user = userService.getUserRepository().findById(UUID.fromString(transaction.getUserId())).orElse(null);
|
||||
if(user == null)
|
||||
throw new ApiException("Could not find user");
|
||||
if(user == null){
|
||||
erpCustomerRef = "Anonymous";
|
||||
}
|
||||
|
||||
SalesInvoiceDto salesInvoiceDto = SalesInvoiceDto.builder()
|
||||
.doctype("Sales Invoice")
|
||||
.customer(user.getErpCustomerRef())
|
||||
.customer(erpCustomerRef)
|
||||
.postingDate(transaction.getCreatedAt().toLocalDate().toString())
|
||||
.dueDate(transaction.getCreatedAt().toLocalDate().toString())
|
||||
.company(erpnextCompany)
|
||||
|
||||
Reference in New Issue
Block a user