Search in sources :

Example 1 with HMCMiraklInvoices

use of com.paypal.infrastructure.sdk.mirakl.domain.invoice.HMCMiraklInvoices in project mirakl-hyperwallet-connector by paypal.

the class MiraklMarketplacePlatformOperatorApiClientWrapperImplTest method getInvoices_shouldCallSDKGetInvoicesMethod.

@Test
void getInvoices_shouldCallSDKGetInvoicesMethod() {
    doReturn(hmcMiraklInvoicesMock).when(testObj).getHmcMiraklInvoices(miraklGetInvoicesRequestMock);
    final HMCMiraklInvoices invoices = testObj.getInvoices(miraklGetInvoicesRequestMock);
    assertThat(invoices).isEqualTo(hmcMiraklInvoicesMock);
}
Also used : HMCMiraklInvoices(com.paypal.infrastructure.sdk.mirakl.domain.invoice.HMCMiraklInvoices) Test(org.junit.jupiter.api.Test)

Example 2 with HMCMiraklInvoices

use of com.paypal.infrastructure.sdk.mirakl.domain.invoice.HMCMiraklInvoices 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

HMCMiraklInvoices (com.paypal.infrastructure.sdk.mirakl.domain.invoice.HMCMiraklInvoices)2 MiraklGetInvoicesRequest (com.mirakl.client.mmp.operator.request.payment.invoice.MiraklGetInvoicesRequest)1 HMCMiraklInvoice (com.paypal.infrastructure.sdk.mirakl.domain.invoice.HMCMiraklInvoice)1 Test (org.junit.jupiter.api.Test)1