예제 #1
0
    def post(self):
        """
        通道管理: 获取通道配置信息
        :return:
        """
        form, error = ChannelConfigQueryForm().request_validate()
        if error:
            return error.as_response()

        pay_type = form.pay_type.data

        config_channels_dict = ChannelListHelper.get_config_channels(
            pay_type, ret_dict=True)

        if pay_type == PayTypeEnum.DEPOSIT:
            configs = [
                c for c in ChannelConfigEnum if
                c.value not in config_channels_dict and c.conf['payment_type']
            ]
        else:
            configs = [
                c for c in ChannelConfigEnum
                if c.value not in config_channels_dict
                and not c.conf['payment_type']
            ]

        channel_config_list = [
            dict(
                channel_id=i.value,
                channel_desc=i.desc,
                id=i.conf["id"],
                provider=i.conf["provider"],
                name=i.conf["name"],
                payment_type=i.conf["payment_type"].desc
                if i.conf['payment_type'] else '',
                payment_method=i.conf["payment_method"].desc
                if i.conf['payment_method'] else '',
            ) for i in configs
        ]

        data = dict(
            channel_config=channel_config_list,
            payment_fee_type=PaymentFeeTypeEnum.get_desc_value_pairs(),
            settlement_type=SettleTypeEnum.get_name_value_pairs(),
            channel_state=ChannelStateEnum.get_desc_value_pairs(),
            banks=PaymentBankEnum.get_desc_value_pairs(),
            # banks=[item.value for item in PaymentBankEnum],
            interfaces=InterfaceTypeEnum.get_name_value_pairs(),
            payment_method=PayMethodEnum.get_desc_value_pairs(),
            merchant_name=MerchantEnum.get_name_value_pairs(),
            payment_types=PaymentTypeEnum.get_desc_name_pairs(),
        )
        return ChannelConfigResult(bs_data=data).as_response()
예제 #2
0
 def post(self):
     """
     获取创建商户所需的配置信息
     :return:
     """
     result = dict(
         merchant_names=MerchantEnum.get_name_type_pairs(),
         payment_methods=PayMethodEnum.get_desc_value_pairs(),
         withdraw_type=DeliverTypeEnum.get_desc_value_pairs(),
         channels_withdraw=ChannelConfigEnum.get_withdraw_desc_name_pairs(),
         channels_deposit=ChannelConfigEnum.get_deposit_desc_name_pairs(),
     )
     return MerchantConfigResult(bs_data=result).as_response()