from ocyan.core import plugins as core_plugin


class PaymentPluginConfig(core_plugin.OcyanPluginConfig):
    def contribute_to_payment_methods(self, payment_methods):
        return payment_methods

    def contribute_to_direct_payment_methods(self, direct_payment_methods):
        return direct_payment_methods


def get_payment_plugins():
    return core_plugin.get_plugins(cls=PaymentPluginConfig)


def get_payment_method_choices():
    payment_plugins = get_payment_plugins()
    return payment_plugins.pipe("contribute_to_payment_methods", [])


def get_direct_payment_method_choices():
    payment_plugins = get_payment_plugins()
    return payment_plugins.pipe("contribute_to_direct_payment_methods", {})
