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