@Test public void testRestrictAccessByTag() throws Exception { final CheckoutServiceFacadeImpl facade = new CheckoutServiceFacadeImpl(null, null, null, null, null, null, null, null); assertFalse(facade.restrictAccessByTag(null, null)); assertFalse(facade.restrictAccessByTag(" ", null)); assertFalse(facade.restrictAccessByTag(null, " ")); assertFalse(facade.restrictAccessByTag("", "")); assertFalse(facade.restrictAccessByTag("tag1", "tag1,tag2,tag3")); assertFalse(facade.restrictAccessByTag("tag2", "tag1,tag2,tag3")); assertFalse(facade.restrictAccessByTag("tag3", "tag1,tag2,tag3")); assertTrue(facade.restrictAccessByTag("tag4", "tag1,tag2,tag3")); assertTrue(facade.restrictAccessByTag("", "tag1,tag2,tag3")); assertTrue(facade.restrictAccessByTag(" ", "tag1,tag2,tag3")); assertTrue(facade.restrictAccessByTag(null, "tag1,tag2,tag3")); }
boolean restrictAccessByTag(final String customerTags, final String restrictToCustomerTags) { if (StringUtils.isNotBlank(restrictToCustomerTags)) { final List<String> allowedTags = Arrays.asList(StringUtils.split(restrictToCustomerTags, ',')); if (StringUtils.isNotBlank(customerTags)) { final List<String> existingTags = Arrays.asList(StringUtils.split(customerTags, ' ')); for (final String existingTag : existingTags) { if (allowedTags.contains(existingTag)) { return false; } } } return true; } return false; }
CheckoutServiceFacadeImpl implements CheckoutServiceFacade { boolean restrictAccessByTag(final String customerTags, final String restrictToCustomerTags) { if (StringUtils.isNotBlank(restrictToCustomerTags)) { final List<String> allowedTags = Arrays.asList(StringUtils.split(restrictToCustomerTags, ',')); if (StringUtils.isNotBlank(customerTags)) { final List<String> existingTags = Arrays.asList(StringUtils.split(customerTags, ' ')); for (final String existingTag : existingTags) { if (allowedTags.contains(existingTag)) { return false; } } } return true; } return false; } }
CheckoutServiceFacadeImpl implements CheckoutServiceFacade { boolean restrictAccessByTag(final String customerTags, final String restrictToCustomerTags) { if (StringUtils.isNotBlank(restrictToCustomerTags)) { final List<String> allowedTags = Arrays.asList(StringUtils.split(restrictToCustomerTags, ',')); if (StringUtils.isNotBlank(customerTags)) { final List<String> existingTags = Arrays.asList(StringUtils.split(customerTags, ' ')); for (final String existingTag : existingTags) { if (allowedTags.contains(existingTag)) { return false; } } } return true; } return false; } CheckoutServiceFacadeImpl(final CustomerOrderService customerOrderService,
                                     final AmountCalculationStrategy amountCalculationStrategy,
                                     final DeliveryTimeEstimationVisitor deliveryTimeEstimationVisitor,
                                     final CustomerOrderPaymentService customerOrderPaymentService,
                                     final CarrierSlaService carrierSlaService,
                                     final PaymentProcessorFactory paymentProcessorFactory,
                                     final PaymentModulesManager paymentModulesManager,
                                     final ReportGenerator reportGenerator); }
CheckoutServiceFacadeImpl implements CheckoutServiceFacade { boolean restrictAccessByTag(final String customerTags, final String restrictToCustomerTags) { if (StringUtils.isNotBlank(restrictToCustomerTags)) { final List<String> allowedTags = Arrays.asList(StringUtils.split(restrictToCustomerTags, ',')); if (StringUtils.isNotBlank(customerTags)) { final List<String> existingTags = Arrays.asList(StringUtils.split(customerTags, ' ')); for (final String existingTag : existingTags) { if (allowedTags.contains(existingTag)) { return false; } } } return true; } return false; } CheckoutServiceFacadeImpl(final CustomerOrderService customerOrderService,
                                     final AmountCalculationStrategy amountCalculationStrategy,
                                     final DeliveryTimeEstimationVisitor deliveryTimeEstimationVisitor,
                                     final CustomerOrderPaymentService customerOrderPaymentService,
                                     final CarrierSlaService carrierSlaService,
                                     final PaymentProcessorFactory paymentProcessorFactory,
                                     final PaymentModulesManager paymentModulesManager,
                                     final ReportGenerator reportGenerator); @Override CustomerOrder findByReference(final String reference); @Override CustomerOrder findByGuid(final String shoppingCartGuid); @Override Total getOrderTotal(final CustomerOrder customerOrder); @Override PriceModel getOrderTotalSub(final CustomerOrder customerOrder, final ShoppingCart cart); @Override PriceModel getOrderTotalAmount(final CustomerOrder customerOrder, final ShoppingCart cart); @Override Total getOrderDeliveryTotal(final CustomerOrder customerOrder, final CustomerOrderDelivery delivery); @Override PriceModel getOrderDeliveryTotalSub(final CustomerOrder customerOrder, final CustomerOrderDelivery delivery, final ShoppingCart cart); @Override PriceModel getOrderDeliveryTotalShipping(final CustomerOrder customerOrder, final CustomerOrderDelivery delivery, final ShoppingCart cart); @Override List<CustomerOrderPayment> findPaymentRecordsByOrderNumber(final String orderNumber); @Override Payment createPaymentToAuthorize(final CustomerOrder order); @Override PaymentGateway getOrderPaymentGateway(final CustomerOrder order); @Override List<Pair<PaymentGatewayDescriptor, String>> getPaymentGatewaysDescriptors(final Shop shop, final ShoppingCart cart); @Override boolean isOrderPaymentSuccessful(final CustomerOrder customerOrder); @Override Set<String> getOrderPromoCodes(final CustomerOrder customerOrder); @Override Set<String> getOrderShippingPromoCodes(final CustomerOrderDelivery orderDelivery); @Override Set<String> getOrderItemPromoCodes(final CartItem orderDeliveryDet); @Override CartValidityModel validateCart(final ShoppingCart shoppingCart); @Override CustomerOrder createFromCart(final ShoppingCart shoppingCart); @Override void estimateDeliveryTimeForOnlinePaymentOrder(final CustomerOrder customerOrder); @Override Map<String, Boolean> isMultipleDeliveryAllowedForCart(final ShoppingCart shoppingCart); @Override CustomerOrder update(final CustomerOrder customerOrder); @Override void printOrderByReference(final String reference, final OutputStream outputStream); }
CheckoutServiceFacadeImpl implements CheckoutServiceFacade { boolean restrictAccessByTag(final String customerTags, final String restrictToCustomerTags) { if (StringUtils.isNotBlank(restrictToCustomerTags)) { final List<String> allowedTags = Arrays.asList(StringUtils.split(restrictToCustomerTags, ',')); if (StringUtils.isNotBlank(customerTags)) { final List<String> existingTags = Arrays.asList(StringUtils.split(customerTags, ' ')); for (final String existingTag : existingTags) { if (allowedTags.contains(existingTag)) { return false; } } } return true; } return false; } CheckoutServiceFacadeImpl(final CustomerOrderService customerOrderService,
                                     final AmountCalculationStrategy amountCalculationStrategy,
                                     final DeliveryTimeEstimationVisitor deliveryTimeEstimationVisitor,
                                     final CustomerOrderPaymentService customerOrderPaymentService,
                                     final CarrierSlaService carrierSlaService,
                                     final PaymentProcessorFactory paymentProcessorFactory,
                                     final PaymentModulesManager paymentModulesManager,
                                     final ReportGenerator reportGenerator); @Override CustomerOrder findByReference(final String reference); @Override CustomerOrder findByGuid(final String shoppingCartGuid); @Override Total getOrderTotal(final CustomerOrder customerOrder); @Override PriceModel getOrderTotalSub(final CustomerOrder customerOrder, final ShoppingCart cart); @Override PriceModel getOrderTotalAmount(final CustomerOrder customerOrder, final ShoppingCart cart); @Override Total getOrderDeliveryTotal(final CustomerOrder customerOrder, final CustomerOrderDelivery delivery); @Override PriceModel getOrderDeliveryTotalSub(final CustomerOrder customerOrder, final CustomerOrderDelivery delivery, final ShoppingCart cart); @Override PriceModel getOrderDeliveryTotalShipping(final CustomerOrder customerOrder, final CustomerOrderDelivery delivery, final ShoppingCart cart); @Override List<CustomerOrderPayment> findPaymentRecordsByOrderNumber(final String orderNumber); @Override Payment createPaymentToAuthorize(final CustomerOrder order); @Override PaymentGateway getOrderPaymentGateway(final CustomerOrder order); @Override List<Pair<PaymentGatewayDescriptor, String>> getPaymentGatewaysDescriptors(final Shop shop, final ShoppingCart cart); @Override boolean isOrderPaymentSuccessful(final CustomerOrder customerOrder); @Override Set<String> getOrderPromoCodes(final CustomerOrder customerOrder); @Override Set<String> getOrderShippingPromoCodes(final CustomerOrderDelivery orderDelivery); @Override Set<String> getOrderItemPromoCodes(final CartItem orderDeliveryDet); @Override CartValidityModel validateCart(final ShoppingCart shoppingCart); @Override CustomerOrder createFromCart(final ShoppingCart shoppingCart); @Override void estimateDeliveryTimeForOnlinePaymentOrder(final CustomerOrder customerOrder); @Override Map<String, Boolean> isMultipleDeliveryAllowedForCart(final ShoppingCart shoppingCart); @Override CustomerOrder update(final CustomerOrder customerOrder); @Override void printOrderByReference(final String reference, final OutputStream outputStream);  }