| Line 2799... |
Line 2799... |
| 2799 |
public void attachToffeeInvoices() throws Exception {
|
2799 |
public void attachToffeeInvoices() throws Exception {
|
| 2800 |
List<InsurancePolicy> insurancePolicies = insurancePolicyRepository.selectAllByProviderId(3, Optional.of(false));
|
2800 |
List<InsurancePolicy> insurancePolicies = insurancePolicyRepository.selectAllByProviderId(3, Optional.of(false));
|
| 2801 |
for (InsurancePolicy insurancePolicy : insurancePolicies) {
|
2801 |
for (InsurancePolicy insurancePolicy : insurancePolicies) {
|
| 2802 |
String invoiceNumber = insurancePolicy.getInvoiceNumber();
|
2802 |
String invoiceNumber = insurancePolicy.getInvoiceNumber();
|
| 2803 |
FofoOrder fofoOrder = fofoOrderRepository.selectByInvoiceNumber(invoiceNumber);
|
2803 |
FofoOrder fofoOrder = fofoOrderRepository.selectByInvoiceNumber(invoiceNumber);
|
| 2804 |
InvoicePdfModel pdfModel = orderService.getInvoicePdfModel(fofoOrder.getId());
|
2804 |
com.spice.profitmandi.common.model.InvoicePdfModel pdfModel = orderService.getInvoicePdfModel(fofoOrder.getId());
|
| 2805 |
java.io.ByteArrayOutputStream byteArrayOutputStream = new java.io.ByteArrayOutputStream();
|
2805 |
java.io.ByteArrayOutputStream byteArrayOutputStream = new java.io.ByteArrayOutputStream();
|
| 2806 |
PdfUtils.generateAndWrite(Arrays.asList(pdfModel), byteArrayOutputStream);
|
2806 |
PdfUtils.generateAndWrite(Arrays.asList(pdfModel), byteArrayOutputStream);
|
| 2807 |
String pdfInvoiceString = "data:application/pdf;base64," + Base64.getEncoder().encodeToString(byteArrayOutputStream.toByteArray());
|
2807 |
String pdfInvoiceString = "data:application/pdf;base64," + Base64.getEncoder().encodeToString(byteArrayOutputStream.toByteArray());
|
| 2808 |
boolean attached = toffeeService.attachInvoice(insurancePolicy.getPolicyNumber().split("#")[1], pdfInvoiceString);
|
2808 |
boolean attached = toffeeService.attachInvoice(insurancePolicy.getPolicyNumber().split("#")[1], pdfInvoiceString);
|
| 2809 |
if (attached) {
|
2809 |
if (attached) {
|