示例#1
0
# coding=utf-8
from __future__ import unicode_literals

from . import biz_entry_mod as mod
from api_x.utils import response
from pytoolbox.util.log import get_logger
from api_x.zyt.biz import bankcard

logger = get_logger(__name__)


@mod.route('/bankcard/<card_no>/bin', methods=['GET'])
def query_bin(card_no):
    try:
        card_bin = bankcard.query_bin(card_no)
        return response.success(**(card_bin.to_dict()))
    except Exception as e:
        logger.exception(e)
        return response.bad_request(msg=e.message)
示例#2
0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from decimal import Decimal
from flask import g, render_template, redirect, url_for, flash, request
from flask.ext.login import current_user
from . import pay_to_lvye_mod as mod
from pub_site.pay_to_lvye.forms import PayToLvyeForm
from pub_site import pay_client
from pytoolbox.util.log import get_logger
from . import dba
from pub_site import config
from pub_site.auth.utils import login_required

_logger = get_logger(__name__, level=os.getenv('LOG_LEVEL', 'INFO'))


@mod.before_request
def set_current_channel():
    g.current_channel = 'pay_to_lvye'


@mod.route('/pay_to_lvye', methods=['GET', 'POST'])
@login_required
def pay_to_lvye():
    user_id = current_user.user_id
    form = PayToLvyeForm()
    if form.validate_on_submit():
        amount = Decimal(form.amount.data)
        comment = form.comment.data
        pay_to_lvye_record = dba.add_pay_to_lvye_record(user_id, amount, "付款给绿野", comment)