@Test public void test() { assertEquals(expected, paymentConfigurationAgeFilter.isValid(configuration, cart)); }
@Override public boolean isValid(WirecardPaymentConfigurationModel configuration, AbstractOrderModel order) { boolean valid = true; if (configuration != null && order != null) { Short age = configuration.getYears(); if (age != null && order.getDeliveryAddress() != null) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR, LAST_HOUR_OF_DAY); calendar.set(Calendar.MINUTE, LAST_MINUTE); Date dateOfBirth; if (order.getDeliveryAddress().getDateOfBirth() != null) { dateOfBirth = order.getDeliveryAddress().getDateOfBirth(); } else{ dateOfBirth = calendar.getTime(); } calendar.add(Calendar.YEAR, -age); valid = calendar.getTime().compareTo(dateOfBirth) >= 0; } } return valid; }
PaymentConfigurationAgeFilter implements PaymentConfigurationFilter { @Override public boolean isValid(WirecardPaymentConfigurationModel configuration, AbstractOrderModel order) { boolean valid = true; if (configuration != null && order != null) { Short age = configuration.getYears(); if (age != null && order.getDeliveryAddress() != null) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR, LAST_HOUR_OF_DAY); calendar.set(Calendar.MINUTE, LAST_MINUTE); Date dateOfBirth; if (order.getDeliveryAddress().getDateOfBirth() != null) { dateOfBirth = order.getDeliveryAddress().getDateOfBirth(); } else{ dateOfBirth = calendar.getTime(); } calendar.add(Calendar.YEAR, -age); valid = calendar.getTime().compareTo(dateOfBirth) >= 0; } } return valid; } }
PaymentConfigurationAgeFilter implements PaymentConfigurationFilter { @Override public boolean isValid(WirecardPaymentConfigurationModel configuration, AbstractOrderModel order) { boolean valid = true; if (configuration != null && order != null) { Short age = configuration.getYears(); if (age != null && order.getDeliveryAddress() != null) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR, LAST_HOUR_OF_DAY); calendar.set(Calendar.MINUTE, LAST_MINUTE); Date dateOfBirth; if (order.getDeliveryAddress().getDateOfBirth() != null) { dateOfBirth = order.getDeliveryAddress().getDateOfBirth(); } else{ dateOfBirth = calendar.getTime(); } calendar.add(Calendar.YEAR, -age); valid = calendar.getTime().compareTo(dateOfBirth) >= 0; } } return valid; }  }
PaymentConfigurationAgeFilter implements PaymentConfigurationFilter { @Override public boolean isValid(WirecardPaymentConfigurationModel configuration, AbstractOrderModel order) { boolean valid = true; if (configuration != null && order != null) { Short age = configuration.getYears(); if (age != null && order.getDeliveryAddress() != null) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR, LAST_HOUR_OF_DAY); calendar.set(Calendar.MINUTE, LAST_MINUTE); Date dateOfBirth; if (order.getDeliveryAddress().getDateOfBirth() != null) { dateOfBirth = order.getDeliveryAddress().getDateOfBirth(); } else{ dateOfBirth = calendar.getTime(); } calendar.add(Calendar.YEAR, -age); valid = calendar.getTime().compareTo(dateOfBirth) >= 0; } } return valid; }  @Override boolean isValid(WirecardPaymentConfigurationModel configuration, AbstractOrderModel order); }
PaymentConfigurationAgeFilter implements PaymentConfigurationFilter { @Override public boolean isValid(WirecardPaymentConfigurationModel configuration, AbstractOrderModel order) { boolean valid = true; if (configuration != null && order != null) { Short age = configuration.getYears(); if (age != null && order.getDeliveryAddress() != null) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR, LAST_HOUR_OF_DAY); calendar.set(Calendar.MINUTE, LAST_MINUTE); Date dateOfBirth; if (order.getDeliveryAddress().getDateOfBirth() != null) { dateOfBirth = order.getDeliveryAddress().getDateOfBirth(); } else{ dateOfBirth = calendar.getTime(); } calendar.add(Calendar.YEAR, -age); valid = calendar.getTime().compareTo(dateOfBirth) >= 0; } } return valid; }  @Override boolean isValid(WirecardPaymentConfigurationModel configuration, AbstractOrderModel order);  }