Example #1
0
File: admin.py Project: romaia/stoq
def register_payment_methods(store):
    """Registers the payment methods and creates persistent
    domain classes associated with them.
    """
    from stoqlib.domain.payment.method import PaymentMethod
    from stoqlib.domain.payment.operation import get_payment_operation_manager

    log.info("Registering payment operations")
    pom = get_payment_operation_manager()

    log.info("Creating domain objects for payment methods")
    account = sysparam(store).IMBALANCE_ACCOUNT
    for operation_name in pom.get_operation_names():
        operation = pom.get(operation_name)
        pm = store.find(PaymentMethod, method_name=operation_name).one()
        if pm is None:
            pm = PaymentMethod(store=store,
                               method_name=operation_name,
                               destination_account=account,
                               max_installments=operation.max_installments)
Example #2
0
def register_payment_methods(store):
    """Registers the payment methods and creates persistent
    domain classes associated with them.
    """
    from stoqlib.domain.payment.method import PaymentMethod
    from stoqlib.domain.payment.operation import get_payment_operation_manager

    log.info("Registering payment operations")
    pom = get_payment_operation_manager()

    log.info("Creating domain objects for payment methods")
    account = sysparam(store).IMBALANCE_ACCOUNT
    for operation_name in pom.get_operation_names():
        operation = pom.get(operation_name)
        pm = store.find(PaymentMethod, method_name=operation_name).one()
        if pm is None:
            pm = PaymentMethod(store=store,
                               method_name=operation_name,
                               destination_account=account,
                               max_installments=operation.max_installments)