flight-helper 0.0.6__py3-none-any.whl → 0.1.7__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.
@@ -46,6 +46,7 @@ class BookingInputDTO(BaseModel):
46
46
 
47
47
 
48
48
  class OneWayBookingDTO(BaseModel):
49
+ order_no: str = Field(..., description="报表平台的订单号")
49
50
  # 航班信息
50
51
  dep_city: str = Field(..., description="起飞城市(中文)")
51
52
  arr_city: str = Field(..., description="抵达城市(中文)")
@@ -32,7 +32,7 @@ class QueryItineraryResponseDTO(BaseModel):
32
32
 
33
33
  @field_validator("itinerary_info")
34
34
  @classmethod
35
- def validate_non_empty(cls, info, v: List[ItineraryInfoDTO]):
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
- pay_domain: Optional[str] = Field(default=None, description="支付在线收银台域名,例如:www.ceair.com")
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 YBAccountPaymentDTO(__BasePaymentDTO):
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 WeChatPaymentDTO(__BasePaymentDTO):
45
+ class WeChatPaymentInputDTO(__BasePaymentInputDTO):
43
46
  channel_name: Literal["微信"] = Field(..., description="支付渠道")
44
47
  payment_type: Literal["二维码识别"] = Field(..., description="支付方式")
45
48
 
46
49
 
47
- class AlipayPaymentDTO(__BasePaymentDTO):
50
+ class AlipayPaymentInputDTO(__BasePaymentInputDTO):
48
51
  channel_name: Literal["支付宝"] = Field(..., description="支付渠道")
49
52
  payment_type: Literal["二维码识别"] = Field(..., description="支付方式")
50
53
 
51
54
 
52
- class HFPaidAccountPaymentDTO(__BasePaymentDTO):
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
- PaymentRuestDTO = Annotated[
64
+ PaymentInputDTO = Annotated[
62
65
  Union[
63
- YBAccountPaymentDTO,
64
- WeChatPaymentDTO,
65
- AlipayPaymentDTO,
66
- HFPaidAccountPaymentDTO,
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(PaymentRuestDTO)
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 = YBAccountPaymentDTO(**yb_data)
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
 
@@ -9,7 +9,7 @@
9
9
  # Copyright ©2011-2026. Hunan xxxxxxx Company limited. All rights reserved.
10
10
  # ---------------------------------------------------------------------------------------------------------
11
11
  """
12
- from typing import Optional
12
+ from typing import Optional, List, Literal
13
13
  from pydantic import BaseModel, PositiveInt, NegativeFloat, Field
14
14
 
15
15
 
@@ -18,19 +18,37 @@ class ProcurementInputDTO(BaseModel):
18
18
  pl_domain: str = Field(..., description="平台域名,例如:www.ceair.com")
19
19
  pl_protocol: str = Field(..., description="平台协议,例如:https")
20
20
  out_ticket_platform_type: str = Field(..., description="出票平台类型")
21
+ out_ticket_platform_type_id: int = Field(..., description="出票平台类型ID")
21
22
  out_ticket_platform: str = Field(..., description="出票平台")
22
- out_ticket_account: str = Field(..., description="出票账号")
23
- purchase_account_type: str = Field(..., description="采购账号类型")
24
- purchase_account: str = Field(..., description="采购账号")
25
- purchase_amount: NegativeFloat = Field(..., description="采购金额")
23
+ account_number: str = Field(..., description="出票账号", alias="out_ticket_account")
24
+
25
+ type_name: str = Field(..., description="采购账号类型", alias="purchase_account_type")
26
+ account_id: str = Field(..., description="采购账号ID", alias="purchase_account_id")
27
+ account_name: str = Field(..., description="采购账号", alias="purchase_account")
28
+
26
29
  remark: str = Field(..., description="备注,一般是由采购平台账号 + 账号密码拼接而成")
30
+
31
+ out_ticket_account: str = Field(..., description="账号", alias="account")
32
+ out_ticket_account_id: int = Field(..., description="账号ID")
33
+ out_ticket_account_pawword: str = Field(..., description="密码", alias="pawword")
34
+
27
35
  out_ticket_mobile: str = Field(..., description="出票手机,退改业务需要根据此手机号码来进行操作")
28
- pay_transaction: str = Field(..., description="支付流水")
29
- pre_order_no: str = Field(..., description="采购平台订单号")
30
36
 
31
37
 
32
38
  class ProcurementReusltDTO(BaseModel):
33
39
  # 平台信息
34
40
  order_no: PositiveInt = Field(..., description="订单号")
35
- pay_transaction: Optional[str] = Field(default=None, description="支付流水")
36
- pre_order_no: str = Field(..., description="采购平台订单号")
41
+ transaction_amount: NegativeFloat = Field(..., description="采购金额", alias="purchase_amount")
42
+ segment_index: Optional[int] = Field(default=None, description="采购航段")
43
+ passenger_names: Optional[List[str]] = Field(default=None, description="采购乘客")
44
+ passenger_type: Literal["成人", "儿童", "婴儿"] = Field(
45
+ ..., description="乘客类型,必须是:成人、儿童 或 婴儿"
46
+ )
47
+ flight_ids: Optional[List[str]] = Field(default=None, description="航班ID列表")
48
+ passenger_ids: Optional[List[str]] = Field(default=None, description="乘客ID列表")
49
+ pay_transaction: Optional[str] = Field(default=None, description="对账标识")
50
+ air_co_order_id: str = Field(..., description="官网订单号")
51
+
52
+
53
+ class FillProcurementInputDTO(ProcurementInputDTO, ProcurementReusltDTO):
54
+ pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flight_helper
3
- Version: 0.0.6
3
+ Version: 0.1.7
4
4
  Summary: flight helper python package
5
5
  Author-email: ckf10000 <ckf10000@sina.com>
6
6
  License: Apache License
@@ -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=k_c5wOxPyWsxB3NUvXnuBYD0_P7Ehb9yInDSHNjvO7M,2932
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.7.dist-info/licenses/LICENSE,sha256=WtjCEwlcVzkh1ziO35P2qfVEkLjr87Flro7xlHz3CEY,11556
12
+ flight_helper-0.1.7.dist-info/METADATA,sha256=6hDKwrIOgjmR1QRm747HQbp_rGS_EcFcFy7pbrdNdTo,14323
13
+ flight_helper-0.1.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
+ flight_helper-0.1.7.dist-info/top_level.txt,sha256=UcuL9Tgenq0in0bIdaANexg1HVpkOnRuvBN0iSaB2Nc,14
15
+ flight_helper-0.1.7.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,,