|
|
|
@ -11,6 +11,8 @@ import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.time.LocalDate;
|
|
|
|
import java.time.LocalDate;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
@ -124,8 +126,17 @@ public class TransactionService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Object processAccToAccTransaction(AccountToAccountDTO accountToAccountDTO, String tokenHeader) {
|
|
|
|
public Object processAccToAccTransaction(AccountToAccountDTO accountToAccountDTO, String tokenHeader) {
|
|
|
|
|
|
|
|
BigDecimal creditAmount = accountToAccountDTO.getCreditAcc().getSgtGntramtfc();
|
|
|
|
|
|
|
|
BigDecimal debitAmount = accountToAccountDTO.getDebitAcc().getSgtGntramtfc();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!creditAmount.equals(debitAmount)) {
|
|
|
|
|
|
|
|
return ResponseEntity
|
|
|
|
|
|
|
|
.badRequest()
|
|
|
|
|
|
|
|
.body("Credit and Debit amounts must be equal");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String porOrgacode = accountToAccountDTO.getPorOrgacode();
|
|
|
|
String porOrgacode = accountToAccountDTO.getPorOrgacode();
|
|
|
|
String url = depositURI + "/deposit/" + "transactions/account-account";
|
|
|
|
String url = depositURI + "/deposit" + "/organizations/" + porOrgacode + "/transactions" + ACONNECT + "/account-to-account";
|
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
|
headers.set("Authorization", tokenHeader);
|
|
|
|
headers.set("Authorization", tokenHeader);
|
|
|
|
headers.set("POR_ORGACODE", porOrgacode);
|
|
|
|
headers.set("POR_ORGACODE", porOrgacode);
|
|
|
|
@ -151,9 +162,18 @@ public class TransactionService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Object processGLtoAccTransaction(GlToAccountDTO glToAccountDTO, String tokenHeader) {
|
|
|
|
public Object processGLtoAccTransaction(GlToAccountDTO glToAccountDTO, String tokenHeader) {
|
|
|
|
|
|
|
|
BigDecimal creditAmount = glToAccountDTO.getCreditAcc().getSgtGntramtfc();
|
|
|
|
|
|
|
|
BigDecimal debitAmount = glToAccountDTO.getDebitGl().getSgtGntramtfc();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!creditAmount.equals(debitAmount)) {
|
|
|
|
|
|
|
|
return ResponseEntity
|
|
|
|
|
|
|
|
.badRequest()
|
|
|
|
|
|
|
|
.body("Credit and Debit amounts must be equal");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String porOrgacode = glToAccountDTO.getPorOrgacode();
|
|
|
|
String porOrgacode = glToAccountDTO.getPorOrgacode();
|
|
|
|
String url = depositURI + "/deposit/" + "transactions/gl-account";
|
|
|
|
String url = depositURI + "/deposit" + "/organizations/" + porOrgacode + "/transactions" + ACONNECT + "/gl-to-account";
|
|
|
|
|
|
|
|
|
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
|
headers.set("Authorization", tokenHeader);
|
|
|
|
headers.set("Authorization", tokenHeader);
|
|
|
|
headers.set("POR_ORGACODE", porOrgacode);
|
|
|
|
headers.set("POR_ORGACODE", porOrgacode);
|
|
|
|
|