@Test public void testGetPaymentGateway() { PaymentGateway paymentGateway = paymentModulesManager.getPaymentGateway("testPaymentGatewayLabel", "SHOIP1"); assertNotNull(paymentGateway); assertEquals("testPaymentGateway", paymentGateway.getLabel()); }
@Override public PaymentGateway getPaymentGateway(final String paymentGatewayLabel, final String shopCode) { for (final Map.Entry<String, PaymentModule> moduleEntry : paymentModulesMap.entrySet()) { for (final PaymentGatewayDescriptor pgDescriptor : moduleEntry.getValue().getPaymentGateways()) { if (pgDescriptor.getLabel().equals(paymentGatewayLabel)) { final Map<String, Object> context = new HashMap<>(); context.put("shopCode", shopCode); context.put("descriptor", pgDescriptor); context.put("pgLabel", pgDescriptor.getLabel()); context.put("label", pgDescriptor.getLabel().replace("Label", "")); final PaymentGatewayConfigurationVisitor visitor = new PaymentGatewayConfigurationVisitorImpl(context); final PaymentGateway pg = serviceLocator.getServiceInstance( pgDescriptor.getUrl(), PaymentGateway.class, pgDescriptor.getLogin(), pgDescriptor.getPassword() ); visitor.visit(pg); return pg; } } } LOG.error("Payment gateway {} not found", paymentGatewayLabel); return null; }
PaymentModulesManagerImpl implements PaymentModulesManager { @Override public PaymentGateway getPaymentGateway(final String paymentGatewayLabel, final String shopCode) { for (final Map.Entry<String, PaymentModule> moduleEntry : paymentModulesMap.entrySet()) { for (final PaymentGatewayDescriptor pgDescriptor : moduleEntry.getValue().getPaymentGateways()) { if (pgDescriptor.getLabel().equals(paymentGatewayLabel)) { final Map<String, Object> context = new HashMap<>(); context.put("shopCode", shopCode); context.put("descriptor", pgDescriptor); context.put("pgLabel", pgDescriptor.getLabel()); context.put("label", pgDescriptor.getLabel().replace("Label", "")); final PaymentGatewayConfigurationVisitor visitor = new PaymentGatewayConfigurationVisitorImpl(context); final PaymentGateway pg = serviceLocator.getServiceInstance( pgDescriptor.getUrl(), PaymentGateway.class, pgDescriptor.getLogin(), pgDescriptor.getPassword() ); visitor.visit(pg); return pg; } } } LOG.error("Payment gateway {} not found", paymentGatewayLabel); return null; } }
PaymentModulesManagerImpl implements PaymentModulesManager { @Override public PaymentGateway getPaymentGateway(final String paymentGatewayLabel, final String shopCode) { for (final Map.Entry<String, PaymentModule> moduleEntry : paymentModulesMap.entrySet()) { for (final PaymentGatewayDescriptor pgDescriptor : moduleEntry.getValue().getPaymentGateways()) { if (pgDescriptor.getLabel().equals(paymentGatewayLabel)) { final Map<String, Object> context = new HashMap<>(); context.put("shopCode", shopCode); context.put("descriptor", pgDescriptor); context.put("pgLabel", pgDescriptor.getLabel()); context.put("label", pgDescriptor.getLabel().replace("Label", "")); final PaymentGatewayConfigurationVisitor visitor = new PaymentGatewayConfigurationVisitorImpl(context); final PaymentGateway pg = serviceLocator.getServiceInstance( pgDescriptor.getUrl(), PaymentGateway.class, pgDescriptor.getLogin(), pgDescriptor.getPassword() ); visitor.visit(pg); return pg; } } } LOG.error("Payment gateway {} not found", paymentGatewayLabel); return null; } PaymentModulesManagerImpl(final ServiceLocator serviceLocator,
                                     final SystemService systemService,
                                     final ShopService shopService); }
PaymentModulesManagerImpl implements PaymentModulesManager { @Override public PaymentGateway getPaymentGateway(final String paymentGatewayLabel, final String shopCode) { for (final Map.Entry<String, PaymentModule> moduleEntry : paymentModulesMap.entrySet()) { for (final PaymentGatewayDescriptor pgDescriptor : moduleEntry.getValue().getPaymentGateways()) { if (pgDescriptor.getLabel().equals(paymentGatewayLabel)) { final Map<String, Object> context = new HashMap<>(); context.put("shopCode", shopCode); context.put("descriptor", pgDescriptor); context.put("pgLabel", pgDescriptor.getLabel()); context.put("label", pgDescriptor.getLabel().replace("Label", "")); final PaymentGatewayConfigurationVisitor visitor = new PaymentGatewayConfigurationVisitorImpl(context); final PaymentGateway pg = serviceLocator.getServiceInstance( pgDescriptor.getUrl(), PaymentGateway.class, pgDescriptor.getLogin(), pgDescriptor.getPassword() ); visitor.visit(pg); return pg; } } } LOG.error("Payment gateway {} not found", paymentGatewayLabel); return null; } PaymentModulesManagerImpl(final ServiceLocator serviceLocator,
                                     final SystemService systemService,
                                     final ShopService shopService); @Override Collection<PaymentModule> getPaymentModules(); @Override Collection<PaymentGatewayDescriptor> getPaymentGatewaysDescriptors(final String paymentModuleLabel); @Override void allowPaymentGateway(final String label); @Override void allowPaymentGatewayForShop(final String label, final String shopCode); @Override void disallowPaymentGateway(final String label); @Override void disallowPaymentGatewayForShop(final String label, final String shopCode); @Override List<PaymentGatewayDescriptor> getPaymentGatewaysDescriptors(final boolean includeDisabled, final String shopCode); @Override PaymentGateway getPaymentGateway(final String paymentGatewayLabel, final String shopCode); @Override void register(final PaymentModule paymentModule); }
PaymentModulesManagerImpl implements PaymentModulesManager { @Override public PaymentGateway getPaymentGateway(final String paymentGatewayLabel, final String shopCode) { for (final Map.Entry<String, PaymentModule> moduleEntry : paymentModulesMap.entrySet()) { for (final PaymentGatewayDescriptor pgDescriptor : moduleEntry.getValue().getPaymentGateways()) { if (pgDescriptor.getLabel().equals(paymentGatewayLabel)) { final Map<String, Object> context = new HashMap<>(); context.put("shopCode", shopCode); context.put("descriptor", pgDescriptor); context.put("pgLabel", pgDescriptor.getLabel()); context.put("label", pgDescriptor.getLabel().replace("Label", "")); final PaymentGatewayConfigurationVisitor visitor = new PaymentGatewayConfigurationVisitorImpl(context); final PaymentGateway pg = serviceLocator.getServiceInstance( pgDescriptor.getUrl(), PaymentGateway.class, pgDescriptor.getLogin(), pgDescriptor.getPassword() ); visitor.visit(pg); return pg; } } } LOG.error("Payment gateway {} not found", paymentGatewayLabel); return null; } PaymentModulesManagerImpl(final ServiceLocator serviceLocator,
                                     final SystemService systemService,
                                     final ShopService shopService); @Override Collection<PaymentModule> getPaymentModules(); @Override Collection<PaymentGatewayDescriptor> getPaymentGatewaysDescriptors(final String paymentModuleLabel); @Override void allowPaymentGateway(final String label); @Override void allowPaymentGatewayForShop(final String label, final String shopCode); @Override void disallowPaymentGateway(final String label); @Override void disallowPaymentGatewayForShop(final String label, final String shopCode); @Override List<PaymentGatewayDescriptor> getPaymentGatewaysDescriptors(final boolean includeDisabled, final String shopCode); @Override PaymentGateway getPaymentGateway(final String paymentGatewayLabel, final String shopCode); @Override void register(final PaymentModule paymentModule);  }