Repository navigation
Expand file tree
/
Copy pathapi_address.py
More file actions
110 lines (85 loc) · 4.32 KB
/
Copy pathapi_address.py
File metadata and controls
110 lines (85 loc) · 4.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
from typing import TypeVar
from src.gatepay.api.base_api import BaseApi
from src.gatepay.api.model.req.chain_req import ChainsReq
from src.gatepay.api.model.req.address.create_order_req import CreateOrderReq
from src.gatepay.api.model.req.create_refund_convert_req import CreateRefundConvertReq
from src.gatepay.api.model.req.address.create_refund_req import CreateRefundReq
from src.gatepay.api.model.req.currencies_req import CurrenciesReq
from src.gatepay.api.model.req.address.query_order_req import QueryOrderReq
from src.gatepay.api.model.req.supported_convert_currencies_req import SupportedConvertCurrenciesReq
from src.gatepay.api.model.req.transaction_detail_req import TransactionDetailReq
from src.gatepay.api.model.resp.chains_resp import ChainsResp
from src.gatepay.api.model.resp.address.create_order_resp import CreateOrderResp
from src.gatepay.api.model.resp.create_refund_convert_resp import CreateRefundConvertResp
from src.gatepay.api.model.resp.create_refund_resp import CreateRefundResp
from src.gatepay.api.model.resp.currencies_resp import CurrenciesResp
from src.gatepay.api.model.resp.address.query_order_resp import QueryOrderResp
from src.gatepay.api.model.resp.supported_convert_currencies_resp import SupportedConvertCurrenciesResp
from src.gatepay.api.model.resp.transaction_detail_resp import TransactionDetailResp
from src.gatepay.base_response import BaseResponse
from src.gatepay.gatepay_config import GatePayConfig
T = TypeVar('T')
class ApiAddress(BaseApi):
def __init__(self, gate_pay_config: GatePayConfig):
"""
初始化 ApiAddress 实例
:param gate_pay_config: GatePay配置
"""
super().__init__(gate_pay_config)
def get_address_chains(self, request: ChainsReq) -> 'BaseResponse[ChainsResp]':
"""
查询支持链列表
:param request: 请求参数
:return: ChainsResp
"""
return super().process_non_base_response(request, ChainsResp)
def get_address_currencies(self) -> 'BaseResponse[CurrenciesResp]':
"""
查询支持币种列表
:return: CurrenciesResp
"""
return super().process_non_base_response(CurrenciesReq(), CurrenciesResp)
def get_supported_convert_currencies(self,
request: SupportedConvertCurrenciesReq) -> 'BaseResponse[SupportedConvertCurrenciesResp]':
"""
创建闪兑地址支付单之前,根据订单币种查询支持闪兑的币种,
用户从支持闪兑的币种列表中选择实际支付币种创建闪兑支付订单
:param request: 请求参数, currency 订单币种
:return: SupportedConvertCurrenciesResp, currencies 支持闪兑到订单币种的币种列表
"""
return super().process_non_base_response(request, SupportedConvertCurrenciesResp)
def create_order(self, request: CreateOrderReq) -> 'BaseResponse[CreateOrderResp]':
"""
创建地址支付订单/下单
:param request: 请求参数
:return: CreateOrderResp
"""
return super().process_non_base_response(request, CreateOrderResp)
def query_order(self, request: QueryOrderReq) -> 'BaseResponse[QueryOrderResp]':
"""
查询地址支付订单详情
:param request: 请求参数
:return: QueryOrderResp
"""
return super().process_non_base_response(request, QueryOrderResp)
def create_refund(self, request: CreateRefundReq) -> 'BaseResponse[CreateRefundResp]':
"""
创建非闪兑支付单退款
:param request: 请求参数
:return: CreateRefundResp
"""
return super().process_non_base_response(request, CreateRefundResp)
def create_refund_convert(self, request: CreateRefundConvertReq) -> 'BaseResponse[CreateRefundConvertResp]':
"""
创建闪兑支付单退款
:param request: 请求参数
:return: CreateRefundConvertResp
"""
return super().process_non_base_response(request, CreateRefundConvertResp)
def transaction_detail(self, request: TransactionDetailReq) -> 'BaseResponse[TransactionDetailResp]':
"""
查询链上交易详情
:param request: 请求参数
:return: TransactionDetailResp
"""
return super().process_non_base_response(request, TransactionDetailResp)