use of com.paypal.invoices.invoicesextract.model.InvoiceModel in project mirakl-hyperwallet-connector by paypal.
the class OperatorInvoiceModelToHyperwalletPaymentConverterTest method convert_shouldReturnNullWhenCommissionIsZero.
@Test
void convert_shouldReturnNullWhenCommissionIsZero() {
// @formatter:off
final InvoiceModel invoice = InvoiceModel.builder().destinationToken(DESTINATION_TOKEN).shopId(SHOP_ID).invoiceNumber(INVOICE_NUMBER).transferAmountToOperator(0.0D).currencyIsoCode(CURRENCY_ISO_CODE).build();
// @formatter:on
final HyperwalletPayment result = testObj.convert(invoice);
assertThat(result).isNull();
}
use of com.paypal.invoices.invoicesextract.model.InvoiceModel in project mirakl-hyperwallet-connector by paypal.
the class OperatorInvoiceModelToHyperwalletPaymentConverterTest method convert_shouldConvertAnInvoiceIntoHyperwalletPayment.
@Test
void convert_shouldConvertAnInvoiceIntoHyperwalletPayment() {
final Double transferAmountToOperator = 100.10D;
when(hyperwalletSDKServiceMock.getProgramTokenByHyperwalletProgram(HYPERWALLET_PROGRAM)).thenReturn(PROGRAM_TOKEN);
when(invoicesOperatorCommissionsConfigMock.getBankAccountToken(HYPERWALLET_PROGRAM)).thenReturn(OPERATOR_BANK_ACCOUNT_TOKEN);
// @formatter:off
final InvoiceModel invoice = InvoiceModel.builder().hyperwalletProgram(HYPERWALLET_PROGRAM).destinationToken(DESTINATION_TOKEN).shopId(SHOP_ID).invoiceNumber(INVOICE_NUMBER).transferAmountToOperator(transferAmountToOperator).currencyIsoCode(CURRENCY_ISO_CODE).build();
// @formatter:on
final HyperwalletPayment result = testObj.convert(invoice);
assertThat(result.getDestinationToken()).isEqualTo(OPERATOR_BANK_ACCOUNT_TOKEN);
assertThat(result.getClientPaymentId()).isEqualTo(INVOICE_NUMBER + PAYMENT_OPERATOR_SUFFIX);
assertThat(result.getAmount()).isEqualTo(transferAmountToOperator);
assertThat(result.getCurrency()).isEqualTo(CURRENCY_ISO_CODE);
assertThat(result.getPurpose()).isEqualTo("OTHER");
assertThat(result.getProgramToken()).isEqualTo(PROGRAM_TOKEN);
}
Aggregations