use of com.mirakl.client.mmp.operator.request.payment.invoice.MiraklGetInvoicesRequest in project mirakl-hyperwallet-connector by paypal.
the class MiraklCreditNotesExtractServiceImplTest method createAccountingDocumentRequest_shouldReturnRequestWithInvoiceType.
@Test
void createAccountingDocumentRequest_shouldReturnRequestWithInvoiceType() {
final Date date = new Date();
final MiraklGetInvoicesRequest result = testObj.createAccountingDocumentRequest(date, InvoiceTypeEnum.MANUAL_CREDIT);
assertThat(result.getMax()).isEqualTo(100);
assertThat(result.getStartDate()).isEqualTo(date);
assertThat(result.getType()).isEqualTo(MANUAL_CREDIT);
assertThat(result.getPaymentStatus()).isEqualTo(PENDING);
assertThat(result.getStates()).containsExactly(COMPLETE);
}
use of com.mirakl.client.mmp.operator.request.payment.invoice.MiraklGetInvoicesRequest in project mirakl-hyperwallet-connector by paypal.
the class MiraklInvoicesExtractServiceImplTest method getInvoices_shouldReturnListOfInvoiceModels.
@Test
void getInvoices_shouldReturnListOfInvoiceModels() {
TimeMachine.useFixedClockAt(LocalDateTime.of(2020, 11, 10, 20, 0, 55));
final Date now = DateUtil.convertToDate(TimeMachine.now(), ZoneId.systemDefault());
when(miraklMarketplacePlatformOperatorApiClientMock.getInvoices(any())).thenReturn(miraklInvoicesOneMock);
when(miraklInvoicesOneMock.getHmcInvoices()).thenReturn(List.of(miraklInvoiceOneMock, miraklInvoiceTwoMock));
when(miraklInvoicesOneMock.getTotalCount()).thenReturn(2L);
when(miraklInvoiceToInvoiceModelConverterMock.convert(miraklInvoiceOneMock)).thenReturn(invoiceModelOneMock);
when(miraklInvoiceToInvoiceModelConverterMock.convert(miraklInvoiceTwoMock)).thenReturn(invoiceModelTwoMock);
final List<InvoiceModel> invoices = testObj.getAccountingDocuments(now);
verify(miraklMarketplacePlatformOperatorApiClientMock).getInvoices(miraklGetInvoicesRequestArgumentCaptor.capture());
final MiraklGetInvoicesRequest miraklGetInvoicesRequest = miraklGetInvoicesRequestArgumentCaptor.getValue();
assertThat(miraklGetInvoicesRequest.getStartDate()).isEqualTo(now);
assertThat(miraklGetInvoicesRequest.getStates()).isEqualTo(List.of(MiraklAccountingDocumentState.COMPLETE));
assertThat(miraklGetInvoicesRequest.getPaymentStatus()).isEqualTo(MiraklAccountingDocumentPaymentStatus.PENDING);
assertThat(invoices).containsExactlyInAnyOrder(invoiceModelOneMock, invoiceModelTwoMock);
}
use of com.mirakl.client.mmp.operator.request.payment.invoice.MiraklGetInvoicesRequest in project mirakl-hyperwallet-connector by paypal.
the class MiraklCreditNotesExtractServiceImplTest method getAccountingDocuments_shouldReturnListOfCreditNoteModels.
@Test
void getAccountingDocuments_shouldReturnListOfCreditNoteModels() {
TimeMachine.useFixedClockAt(LocalDateTime.of(2020, 11, 10, 20, 0, 55));
final Date now = DateUtil.convertToDate(TimeMachine.now(), ZoneId.systemDefault());
when(miraklMarketplacePlatformOperatorApiClientMock.getInvoices(any())).thenReturn(miraklInvoicesOneMock);
when(miraklInvoicesOneMock.getHmcInvoices()).thenReturn(List.of(miraklInvoiceOneMock, miraklInvoiceTwoMock));
when(miraklInvoiceToCreditNoteModelConverter.convert(miraklInvoiceOneMock)).thenReturn(creditNoteOneMock);
when(miraklInvoiceToCreditNoteModelConverter.convert(miraklInvoiceTwoMock)).thenReturn(creditNoteTwoMock);
final List<CreditNoteModel> creditNoteList = testObj.getAccountingDocuments(now);
verify(miraklMarketplacePlatformOperatorApiClientMock).getInvoices(miraklGetInvoicesRequestArgumentCaptor.capture());
final MiraklGetInvoicesRequest miraklGetInvoicesRequest = miraklGetInvoicesRequestArgumentCaptor.getValue();
assertThat(miraklGetInvoicesRequest.getStartDate()).isEqualTo(now);
assertThat(miraklGetInvoicesRequest.getStates()).isEqualTo(List.of(COMPLETE));
assertThat(miraklGetInvoicesRequest.getPaymentStatus()).isEqualTo(PENDING);
assertThat(creditNoteList).containsExactlyInAnyOrder(creditNoteOneMock, creditNoteTwoMock);
}
use of com.mirakl.client.mmp.operator.request.payment.invoice.MiraklGetInvoicesRequest in project mirakl-hyperwallet-connector by paypal.
the class MiraklInvoicesExtractServiceImplTest method createAccountingDocumentRequest_shouldReturnRequestWithInvoiceType.
@Test
void createAccountingDocumentRequest_shouldReturnRequestWithInvoiceType() {
final Date date = new Date();
final MiraklGetInvoicesRequest result = testObj.createAccountingDocumentRequest(date, InvoiceTypeEnum.AUTO_INVOICE);
assertThat(result.getMax()).isEqualTo(100);
assertThat(result.getStartDate()).isEqualTo(date);
assertThat(result.getType()).isEqualTo(AUTO_INVOICE);
assertThat(result.getPaymentStatus()).isEqualTo(PENDING);
assertThat(result.getStates()).containsExactly(COMPLETE);
}
use of com.mirakl.client.mmp.operator.request.payment.invoice.MiraklGetInvoicesRequest in project mirakl-hyperwallet-connector by paypal.
the class AbstractAccountingDocumentsExtractServiceImpl method createAccountingDocumentRequest.
@NonNull
protected MiraklGetInvoicesRequest createAccountingDocumentRequest(final Date delta, final InvoiceTypeEnum invoiceType) {
final MiraklGetInvoicesRequest miraklGetInvoicesRequest = new MiraklGetInvoicesRequest();
miraklGetInvoicesRequest.setStartDate(delta);
miraklGetInvoicesRequest.setPaymentStatus(MiraklAccountingDocumentPaymentStatus.PENDING);
miraklGetInvoicesRequest.addState(MiraklAccountingDocumentState.COMPLETE);
miraklGetInvoicesRequest.setType(EnumUtils.getEnum(MiraklAccountingDocumentType.class, invoiceType.name()));
miraklGetInvoicesRequest.setMax(MIRAKL_MAX_RESULTS_PER_PAGE);
return miraklGetInvoicesRequest;
}
Aggregations