Search in sources :

Example 1 with PaymentType

use of com.salesmanager.core.model.payments.PaymentType in project shopizer by shopizer-ecommerce.

the class PaymentServiceImpl method getAcceptedPaymentMethods.

@Override
public List<PaymentMethod> getAcceptedPaymentMethods(MerchantStore store) throws ServiceException {
    Map<String, IntegrationConfiguration> modules = this.getPaymentModulesConfigured(store);
    List<PaymentMethod> returnModules = new ArrayList<PaymentMethod>();
    for (String module : modules.keySet()) {
        IntegrationConfiguration config = modules.get(module);
        if (config.isActive()) {
            IntegrationModule md = this.getPaymentMethodByCode(store, config.getModuleCode());
            if (md == null) {
                continue;
            }
            PaymentMethod paymentMethod = new PaymentMethod();
            paymentMethod.setDefaultSelected(config.isDefaultSelected());
            paymentMethod.setPaymentMethodCode(config.getModuleCode());
            paymentMethod.setModule(md);
            paymentMethod.setInformations(config);
            PaymentType type = PaymentType.fromString(md.getType());
            paymentMethod.setPaymentType(type);
            returnModules.add(paymentMethod);
        }
    }
    return returnModules;
}
Also used : IntegrationConfiguration(com.salesmanager.core.model.system.IntegrationConfiguration) ArrayList(java.util.ArrayList) PaymentMethod(com.salesmanager.core.model.payments.PaymentMethod) PaymentType(com.salesmanager.core.model.payments.PaymentType) IntegrationModule(com.salesmanager.core.model.system.IntegrationModule)

Aggregations

PaymentMethod (com.salesmanager.core.model.payments.PaymentMethod)1 PaymentType (com.salesmanager.core.model.payments.PaymentType)1 IntegrationConfiguration (com.salesmanager.core.model.system.IntegrationConfiguration)1 IntegrationModule (com.salesmanager.core.model.system.IntegrationModule)1 ArrayList (java.util.ArrayList)1