Ejemplo n.º 1
0
class UserOrderSelectForm(DomainForm):
    """
        用户订单查询:
    """
    year = IntegerField(validators=[DataRequired()], description="年")
    mouth = IntegerField(validators=[DataRequired()], description="月")
    page_index = IntegerField(default=1, description="页码")
    payment_type = IntegerField(description=PayTypeEnum.description())

    @stop_validate_if_error_occurred
    def validate_page_index(self, value):
        try:
            self.page_index.data = int(value.data)
        except:
            raise StopValidation("无效的page_index")

    @stop_validate_if_error_occurred
    def validate_payment_type(self, value):
        try:
            if not value.data or value.data == "0":
                self.payment_type.data = None
            else:
                self.payment_type.data = PayTypeEnum(int(value.data))
        except Exception as e:
            raise StopValidation("无效的payment_type")
Ejemplo n.º 2
0
 def validate_payment_type(self, value):
     try:
         if not value.data or value.data == "0":
             self.payment_type.data = None
         else:
             self.payment_type.data = PayTypeEnum(int(value.data))
     except Exception as e:
         raise StopValidation("无效的payment_type")
Ejemplo n.º 3
0
    def validate_pay_type(self, value):
        try:

            if value.data not in ["1", "2"]:
                raise StopValidation("无效的交易类型")

            self.pay_type.data = PayTypeEnum(int(value.data))
        except Exception as e:
            raise StopValidation("无效的交易类型")
Ejemplo n.º 4
0
 def order_type(self) -> PayTypeEnum:
     return PayTypeEnum(self._order_type)
Ejemplo n.º 5
0
from app.libs.error_code import ResponseSuccess
from app.enums.trade import PayMethodEnum, PaymentTypeEnum, PaymentFeeTypeEnum, SettleTypeEnum, PaymentBankEnum, \
    InterfaceTypeEnum, PayTypeEnum
from config import MerchantEnum

DescNamePair = api.model("DescNamePair", {
    "name": fields.String(),
    "desc": fields.String()
})

ChannelConfigQueryDoc = api.model('DocChannelConfigQuery', {
    "pay_type": fields.Integer(
        required=True,
        description='通道号',
        example=PayTypeEnum.description()
    ),
})

bank = fields.String(
    required=True,
    description='支持的银行',
    example=PaymentBankEnum.description()
)

payment_methods = fields.String(
    required=True,
    description='支付方法',
    example=PayMethodEnum.description()
)
Ejemplo n.º 6
0
 def validate_type(self, value):
     try:
         self.type.data = PayTypeEnum(int(value.data))
     except Exception as e:
         raise StopValidation("无效的订单类型")
Ejemplo n.º 7
0
    'BackOfficeConfigDetail', {
        'merchant': fields.List(fields.Nested(DescValuePair)),
        'payment_type': fields.List(fields.Nested(DescValuePair)),
        'deposit_channel': fields.List(fields.Nested(DescValuePair))
    })


class BackOfficeConfigResult(ResponseSuccess):
    data_model = BackOfficeConfigDetail


######################################################
# 订单通知
######################################################
OrderStateNotifyDoc = api.model(
    "OrderStateNotifyDoc", {
        "order_id":
        fields.Integer(
            required=True,
            description='订单号',
            example=11111,
        ),
        "order_type":
        fields.Integer(
            required=True,
            description='订单类型',
            example=PayTypeEnum.description_name_desc(
                values=[PayTypeEnum.DEPOSIT, PayTypeEnum.WITHDRAW]),
        ),
    })
Ejemplo n.º 8
0
        fields.String(
            description="交易流水号",
            example="",
        ),
        "amount":
        fields.String(
            description='订单金额',
            example="560.03",
        ),
        "create_time":
        fields.String(description='订单发起时间', example="2019-07-29"),
        "status":
        fields.String(description='订单状态',
                      example=OrderStateEnum.get_desc_list()),
        "order_type":
        fields.String(description='订单类型', example=PayTypeEnum.get_desc_list()),
        "pay_method":
        fields.String(description='支付方式',
                      example=PayMethodEnum.get_desc_list()),

        # 转账字段
        "out_account":
        fields.String(
            description='出款手机手号码',
            example="",
        ),
        "in_account":
        fields.String(
            description='收款手机号码',
            example="",
        ),
Ejemplo n.º 9
0
 def validate_pay_type(self, value):
     try:
         self.pay_type.data = PayTypeEnum(value.data)
     except Exception as e:
         raise StopValidation("无效的pay_type")
Ejemplo n.º 10
0
 def payment_way(self) -> PayTypeEnum:
     return PayTypeEnum(self._p_way)
Ejemplo n.º 11
0
    def get_transaction_list(cls, payment_type, uid, merchant, begin_time,
                             end_time, page_size, page_index):
        """
        查询交易历史记录
        :param payment_type: 
        :param uid: 
        :param merchant: 
        :param begin_time: 
        :param end_time: 
        :param page_size: 
        :param page_index: 
        :return: 
        """
        item_list = list()
        order_dict = dict()
        banks_dict = dict()

        if not payment_type or PayTypeEnum.is_order_pay(
                payment_type) or PayTypeEnum.REFUND == payment_type:
            # 包含充值/提款
            order_list = cls.query_order_list(uid=uid,
                                              merchant=merchant,
                                              begin_time=begin_time,
                                              end_time=end_time,
                                              payment_type=payment_type)
            order_dict = dict([(o.sys_tx_id, o) for o in order_list])
            banks_dict = cls.query_bank_card_dict(merchant, order_list)
            order_detail_dict = cls.query_order_detail_dict(
                uid=uid,
                merchant=merchant,
                begin_time=begin_time,
                end_time=end_time,
                payment_type=payment_type)

            if PayTypeEnum.REFUND != payment_type:
                item_list.extend([
                    cls.fill_order_item(item, banks_dict, order_detail_dict)
                    for item in order_list
                ])

        if not payment_type:
            # 所有其它类型
            _item_list = cls.query_multi_order_type_event(uid=uid,
                                                          merchant=merchant,
                                                          date=begin_time)
            item_list.extend([
                cls.fill_event(item, order_dict, banks_dict)
                for item in _item_list
            ])

        else:
            if PayTypeEnum.TRANSFER == payment_type:
                # 转账
                _item_list = cls.query_balance_event(uid=uid,
                                                     merchant=merchant,
                                                     date=begin_time,
                                                     order_type=payment_type)
                item_list.extend([cls.fill_event(item) for item in _item_list])

            elif PayTypeEnum.REFUND == payment_type:
                # 退款
                _item_list = cls.query_balance_event(uid=uid,
                                                     merchant=merchant,
                                                     date=begin_time,
                                                     order_type=payment_type)
                item_list.extend([
                    cls.fill_event(item, order_dict, banks_dict)
                    for item in _item_list
                ])

            elif PayTypeEnum.MANUALLY == payment_type:
                # 手动修改,系统调整
                _item_list = cls.query_balance_event(uid=uid,
                                                     merchant=merchant,
                                                     date=begin_time,
                                                     order_type=payment_type)
                item_list.extend([cls.fill_event(item) for item in _item_list])

        return Pagination.paginate_list(item_list,
                                        page_size,
                                        page_index,
                                        sort_key='create_time')
Ejemplo n.º 12
0
 def validate_order_type(self, value):
     try:
         self.order_type.data = PayTypeEnum.from_name(value.data)
     except Exception as e:
         raise StopValidation("无效的 order_id")
Ejemplo n.º 13
0
 def validate_payment_way(self, value):
     try:
         self.payment_way.data = PayTypeEnum.from_name(value.data)
     except Exception as e:
         raise StopValidation("无效的 payment_way")