flight-helper 0.0.6__py3-none-any.whl → 0.1.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flight_helper/models/dto/booking.py +1 -0
- flight_helper/models/dto/itinerary.py +1 -2
- flight_helper/models/dto/passenger.py +5 -1
- flight_helper/models/dto/payment.py +22 -21
- flight_helper/models/dto/procurement.py +1 -3
- {flight_helper-0.0.6.dist-info → flight_helper-0.1.3.dist-info}/METADATA +1 -1
- flight_helper-0.1.3.dist-info/RECORD +15 -0
- flight_helper-0.0.6.dist-info/RECORD +0 -15
- {flight_helper-0.0.6.dist-info → flight_helper-0.1.3.dist-info}/WHEEL +0 -0
- {flight_helper-0.0.6.dist-info → flight_helper-0.1.3.dist-info}/licenses/LICENSE +0 -0
- {flight_helper-0.0.6.dist-info → flight_helper-0.1.3.dist-info}/top_level.txt +0 -0
|
@@ -32,7 +32,7 @@ class QueryItineraryResponseDTO(BaseModel):
|
|
|
32
32
|
|
|
33
33
|
@field_validator("itinerary_info")
|
|
34
34
|
@classmethod
|
|
35
|
-
def validate_non_empty(cls,
|
|
35
|
+
def validate_non_empty(cls, v: List[ItineraryInfoDTO], info):
|
|
36
36
|
if len(v) == 0:
|
|
37
37
|
raise ValueError("至少需要一个乘客行程")
|
|
38
38
|
# 获取外层的 pre_order_no
|
|
@@ -55,4 +55,3 @@ class QueryItineraryRequestDTO(BaseModel):
|
|
|
55
55
|
user_id: Optional[str] = Field(default=None, description="采购平台登录用户的ID")
|
|
56
56
|
proxy: Optional[Dict[str, Any]] = Field(default=None, description="http的代理配置")
|
|
57
57
|
headers: Optional[Dict[str, Any]] = Field(default=None, description="自定义的http headers")
|
|
58
|
-
cookie_jar: Optional[CookieJar] = Field(default=None, description="自定义的CookieJar对象")
|
|
@@ -10,10 +10,14 @@
|
|
|
10
10
|
# ---------------------------------------------------------------------------------------------------------
|
|
11
11
|
"""
|
|
12
12
|
from typing import Optional, Literal
|
|
13
|
-
from pydantic import BaseModel, Field
|
|
13
|
+
from pydantic import BaseModel, Field, PositiveInt
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class PassengerDTO(BaseModel):
|
|
17
|
+
passenger_id: Optional[str] = Field(default=None, description="乘客ID")
|
|
18
|
+
segment_index: PositiveInt = Field(..., description="航段索引")
|
|
19
|
+
flight_id: Optional[str] = Field(default=None, description="航班ID")
|
|
20
|
+
table_id: Optional[str] = Field(default=None, description="乘客制表ID")
|
|
17
21
|
# 乘客基本信息
|
|
18
22
|
passenger_type: Literal["成人", "儿童", "婴儿"] = Field(
|
|
19
23
|
..., description="乘客类型,必须是:成人、儿童 或 婴儿"
|
|
@@ -16,22 +16,25 @@ SupportedChannels = Literal["微信", "支付宝", "汇付天下", "易宝支付
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class __BasePaymentDTO(BaseModel):
|
|
19
|
-
|
|
20
|
-
pay_protocol: Optional[str] = Field(default=None, description="支付在线收银台协议,例如:https")
|
|
21
|
-
|
|
22
|
-
channel_name: SupportedChannels = Field(
|
|
23
|
-
..., description=f'支付渠道,只能是其中之一:{SupportedChannels}'
|
|
24
|
-
)
|
|
19
|
+
channel_name: SupportedChannels = Field(..., description=f'支付渠道,只能是其中之一:{SupportedChannels}')
|
|
25
20
|
payment_type: str = Field(..., description="支付方式")
|
|
26
|
-
order_no: str = Field(..., description="报表平台订单号")
|
|
27
|
-
pre_order_no: Optional[str] = Field(default=None, description="采购平台订单号")
|
|
28
21
|
account: Optional[str] = Field(default=None, description="支付账号")
|
|
29
22
|
password: Optional[str] = Field(default=None, description="账号密码")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class PaymentResultDTO(__BasePaymentDTO):
|
|
26
|
+
order_no: str = Field(..., description="报表平台订单号")
|
|
27
|
+
pre_order_no: Optional[str] = Field(default=None, description="采购平台订单号")
|
|
30
28
|
pay_transaction: Optional[str] = Field(default=None, description="支付流水")
|
|
31
29
|
pay_amount: Optional[NonNegativeFloat] = Field(default=None, description="支付金额")
|
|
32
30
|
|
|
33
31
|
|
|
34
|
-
class
|
|
32
|
+
class __BasePaymentInputDTO(__BasePaymentDTO):
|
|
33
|
+
pay_domain: Optional[str] = Field(default=None, description="支付在线收银台域名,例如:www.ceair.com")
|
|
34
|
+
pay_protocol: Optional[str] = Field(default=None, description="支付在线收银台协议,例如:https")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class YBAccountPaymentInputDTO(__BasePaymentInputDTO):
|
|
35
38
|
"""易宝支付-账号支付"""
|
|
36
39
|
channel_name: Literal["易宝支付"] = Field(..., description="支付渠道")
|
|
37
40
|
payment_type: Literal["账户支付"] = Field(..., description="支付方式")
|
|
@@ -39,17 +42,17 @@ class YBAccountPaymentDTO(__BasePaymentDTO):
|
|
|
39
42
|
password: str = Field(..., description="账号密码")
|
|
40
43
|
|
|
41
44
|
|
|
42
|
-
class
|
|
45
|
+
class WeChatPaymentInputDTO(__BasePaymentInputDTO):
|
|
43
46
|
channel_name: Literal["微信"] = Field(..., description="支付渠道")
|
|
44
47
|
payment_type: Literal["二维码识别"] = Field(..., description="支付方式")
|
|
45
48
|
|
|
46
49
|
|
|
47
|
-
class
|
|
50
|
+
class AlipayPaymentInputDTO(__BasePaymentInputDTO):
|
|
48
51
|
channel_name: Literal["支付宝"] = Field(..., description="支付渠道")
|
|
49
52
|
payment_type: Literal["二维码识别"] = Field(..., description="支付方式")
|
|
50
53
|
|
|
51
54
|
|
|
52
|
-
class
|
|
55
|
+
class HFPaidAccountPaymentInputDTO(__BasePaymentInputDTO):
|
|
53
56
|
"""汇付天下-付款账户支付"""
|
|
54
57
|
channel_name: Literal["汇付天下"] = Field(..., description="支付渠道")
|
|
55
58
|
payment_type: Literal["付款账户支付"] = Field(..., description="支付方式")
|
|
@@ -58,12 +61,12 @@ class HFPaidAccountPaymentDTO(__BasePaymentDTO):
|
|
|
58
61
|
|
|
59
62
|
|
|
60
63
|
# 3. 创建联合类型,并指定 discriminator
|
|
61
|
-
|
|
64
|
+
PaymentInputDTO = Annotated[
|
|
62
65
|
Union[
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
YBAccountPaymentInputDTO,
|
|
67
|
+
WeChatPaymentInputDTO,
|
|
68
|
+
AlipayPaymentInputDTO,
|
|
69
|
+
HFPaidAccountPaymentInputDTO,
|
|
67
70
|
# TODO ... 其他支付方式
|
|
68
71
|
],
|
|
69
72
|
Field(discriminator='channel_name') # 或者用 'payment_type',看业务
|
|
@@ -71,7 +74,7 @@ PaymentRuestDTO = Annotated[
|
|
|
71
74
|
|
|
72
75
|
if __name__ == '__main__':
|
|
73
76
|
# 创建适配器
|
|
74
|
-
adapter = TypeAdapter(
|
|
77
|
+
adapter = TypeAdapter(PaymentInputDTO)
|
|
75
78
|
|
|
76
79
|
# 测试 1: 易宝支付
|
|
77
80
|
yb_data = {
|
|
@@ -81,11 +84,9 @@ if __name__ == '__main__':
|
|
|
81
84
|
"account": "yb123",
|
|
82
85
|
"password": "pass123"
|
|
83
86
|
}
|
|
84
|
-
yb =
|
|
85
|
-
yb.pay_transaction = "112312"
|
|
87
|
+
yb = PaymentResultDTO(**yb_data)
|
|
86
88
|
print(yb)
|
|
87
89
|
yb_payment = adapter.validate_python(yb_data)
|
|
88
|
-
yb_payment.pay_transaction = "123123123"
|
|
89
90
|
print(yb_payment)
|
|
90
91
|
print(type(yb_payment)) # <class '__main__.YBAccountPayment'>
|
|
91
92
|
|
|
@@ -22,11 +22,8 @@ class ProcurementInputDTO(BaseModel):
|
|
|
22
22
|
out_ticket_account: str = Field(..., description="出票账号")
|
|
23
23
|
purchase_account_type: str = Field(..., description="采购账号类型")
|
|
24
24
|
purchase_account: str = Field(..., description="采购账号")
|
|
25
|
-
purchase_amount: NegativeFloat = Field(..., description="采购金额")
|
|
26
25
|
remark: str = Field(..., description="备注,一般是由采购平台账号 + 账号密码拼接而成")
|
|
27
26
|
out_ticket_mobile: str = Field(..., description="出票手机,退改业务需要根据此手机号码来进行操作")
|
|
28
|
-
pay_transaction: str = Field(..., description="支付流水")
|
|
29
|
-
pre_order_no: str = Field(..., description="采购平台订单号")
|
|
30
27
|
|
|
31
28
|
|
|
32
29
|
class ProcurementReusltDTO(BaseModel):
|
|
@@ -34,3 +31,4 @@ class ProcurementReusltDTO(BaseModel):
|
|
|
34
31
|
order_no: PositiveInt = Field(..., description="订单号")
|
|
35
32
|
pay_transaction: Optional[str] = Field(default=None, description="支付流水")
|
|
36
33
|
pre_order_no: str = Field(..., description="采购平台订单号")
|
|
34
|
+
purchase_amount: NegativeFloat = Field(..., description="采购金额")
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
flight_helper/__init__.py,sha256=thrHOfIzem5D1k7RU4iPbsWOZJDhxvdDnJ_wuOrDZ30,475
|
|
2
|
+
flight_helper/models/__init__.py,sha256=58ly88YaKqeLEuPfKWB02-WZqxLaWHfqLGlH77DrF8g,475
|
|
3
|
+
flight_helper/models/dto/__init__.py,sha256=pCL0j7uw5uVeJOcdPos4Ax7Xr6B85rWHPVP8hQ3WxR4,484
|
|
4
|
+
flight_helper/models/dto/booking.py,sha256=cgWlB-0q3szAjEBHYLqxSehchAXWnGyFBEpGU0k9F7U,4287
|
|
5
|
+
flight_helper/models/dto/itinerary.py,sha256=-BaymWWSO6Ukra2P-DzOn1tv4djx2ewYoSdytnPAOT8,2979
|
|
6
|
+
flight_helper/models/dto/passenger.py,sha256=KXCDjdagIY6e_J7EidVlYtBXg66P3J28gq5oqG1NErk,1759
|
|
7
|
+
flight_helper/models/dto/payment.py,sha256=bM2FoE9k5gPInz_xyot8JKEUrrr_N2r12oJx1TDtCbM,4249
|
|
8
|
+
flight_helper/models/dto/procurement.py,sha256=OyoWIr2lQkO6UsyN3I9dPWYUKEy-LAXthReJ40308Rw,1797
|
|
9
|
+
flight_helper/validator/__init__.py,sha256=Eh60SrFKSaYwcOwLEn3z2lbxfmLUTjWgZR2B7yC-34c,478
|
|
10
|
+
flight_helper/validator/type_validator.py,sha256=CmXMIENl_1hqzN27pmXnS6hniXrN_hjfWnDKobmowWc,1128
|
|
11
|
+
flight_helper-0.1.3.dist-info/licenses/LICENSE,sha256=WtjCEwlcVzkh1ziO35P2qfVEkLjr87Flro7xlHz3CEY,11556
|
|
12
|
+
flight_helper-0.1.3.dist-info/METADATA,sha256=rpI0bnDfWGlr1m9mSes0Nkk1HA2oIz4AezDlgKqPR_M,14323
|
|
13
|
+
flight_helper-0.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
flight_helper-0.1.3.dist-info/top_level.txt,sha256=UcuL9Tgenq0in0bIdaANexg1HVpkOnRuvBN0iSaB2Nc,14
|
|
15
|
+
flight_helper-0.1.3.dist-info/RECORD,,
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
flight_helper/__init__.py,sha256=thrHOfIzem5D1k7RU4iPbsWOZJDhxvdDnJ_wuOrDZ30,475
|
|
2
|
-
flight_helper/models/__init__.py,sha256=58ly88YaKqeLEuPfKWB02-WZqxLaWHfqLGlH77DrF8g,475
|
|
3
|
-
flight_helper/models/dto/__init__.py,sha256=pCL0j7uw5uVeJOcdPos4Ax7Xr6B85rWHPVP8hQ3WxR4,484
|
|
4
|
-
flight_helper/models/dto/booking.py,sha256=ZsQtwfeItRsJa4VQLwUemWm25ydjKYAApPbuLpoyaSk,4215
|
|
5
|
-
flight_helper/models/dto/itinerary.py,sha256=blc7GSbsqJePHgnAyOClwaPr34fGAtGxRnQw4YvIX8Y,3081
|
|
6
|
-
flight_helper/models/dto/passenger.py,sha256=7Xd2pZp84C303yDwuZtcnpxkY1hi5oxyqd8fIcblYPY,1437
|
|
7
|
-
flight_helper/models/dto/payment.py,sha256=DA17AXlr73_0kU_3aAHwN2sasXzK1RrChYN0dNWu6-E,4192
|
|
8
|
-
flight_helper/models/dto/procurement.py,sha256=UjKhcGvxJuDtLkuzL5MutuAMihGiQwduZNZ40jCVQ_s,1937
|
|
9
|
-
flight_helper/validator/__init__.py,sha256=Eh60SrFKSaYwcOwLEn3z2lbxfmLUTjWgZR2B7yC-34c,478
|
|
10
|
-
flight_helper/validator/type_validator.py,sha256=CmXMIENl_1hqzN27pmXnS6hniXrN_hjfWnDKobmowWc,1128
|
|
11
|
-
flight_helper-0.0.6.dist-info/licenses/LICENSE,sha256=WtjCEwlcVzkh1ziO35P2qfVEkLjr87Flro7xlHz3CEY,11556
|
|
12
|
-
flight_helper-0.0.6.dist-info/METADATA,sha256=KI4tvpqCCh0bo3vyGpcq11W3RLl1Xxf_RJVFUxpEaj4,14323
|
|
13
|
-
flight_helper-0.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
-
flight_helper-0.0.6.dist-info/top_level.txt,sha256=UcuL9Tgenq0in0bIdaANexg1HVpkOnRuvBN0iSaB2Nc,14
|
|
15
|
-
flight_helper-0.0.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|