Search in sources :

Example 6 with MiraklGetInvoicesRequest

use of com.mirakl.client.mmp.operator.request.payment.invoice.MiraklGetInvoicesRequest in project mirakl-hyperwallet-connector by paypal.

the class AbstractAccountingDocumentsExtractServiceImpl method getInvoicesForDateAndType.

protected List<HMCMiraklInvoice> getInvoicesForDateAndType(final Date delta, final InvoiceTypeEnum invoiceType) {
    final List<HMCMiraklInvoice> invoices = new ArrayList<>();
    int offset = 0;
    final MiraklGetInvoicesRequest accountingDocumentRequest = createAccountingDocumentRequest(delta, invoiceType);
    while (true) {
        accountingDocumentRequest.setOffset(offset);
        final HMCMiraklInvoices receivedInvoices = miraklMarketplacePlatformOperatorApiClient.getInvoices(accountingDocumentRequest);
        invoices.addAll(receivedInvoices.getHmcInvoices());
        if (receivedInvoices.getTotalCount() <= invoices.size()) {
            break;
        }
        offset += MIRAKL_MAX_RESULTS_PER_PAGE;
    }
    return invoices;
}
Also used : HMCMiraklInvoices(com.paypal.infrastructure.sdk.mirakl.domain.invoice.HMCMiraklInvoices) HMCMiraklInvoice(com.paypal.infrastructure.sdk.mirakl.domain.invoice.HMCMiraklInvoice) MiraklGetInvoicesRequest(com.mirakl.client.mmp.operator.request.payment.invoice.MiraklGetInvoicesRequest)

Aggregations

MiraklGetInvoicesRequest (com.mirakl.client.mmp.operator.request.payment.invoice.MiraklGetInvoicesRequest)6 Date (java.util.Date)4 Test (org.junit.jupiter.api.Test)4 MiraklAccountingDocumentType (com.mirakl.client.mmp.domain.accounting.document.MiraklAccountingDocumentType)1 HMCMiraklInvoice (com.paypal.infrastructure.sdk.mirakl.domain.invoice.HMCMiraklInvoice)1 HMCMiraklInvoices (com.paypal.infrastructure.sdk.mirakl.domain.invoice.HMCMiraklInvoices)1 CreditNoteModel (com.paypal.invoices.invoicesextract.model.CreditNoteModel)1 InvoiceModel (com.paypal.invoices.invoicesextract.model.InvoiceModel)1 NonNull (org.springframework.lang.NonNull)1