|
|
@@ -80,15 +80,32 @@ async def create_institution_controller(
|
|
|
elif not data.get("effective_end_date") and data.get("effective_time_type") == "unlimited":
|
|
|
# 长期有效:设为2099年底
|
|
|
data["effective_end_date"] = "2099-12-31 23:59:59"
|
|
|
+ # 默认使用规则(支付宝必填)
|
|
|
+ if not data.get("standard_info_list"):
|
|
|
+ single_limit = data.get("single_limit", 0)
|
|
|
+ standard_info = {
|
|
|
+ "standard_name": data.get("institution_name", "默认规则"),
|
|
|
+ "standard_desc": f"单笔限额{single_limit}元" if single_limit else "通用规则",
|
|
|
+ "consume_mode": "DEFAULT",
|
|
|
+ "payment_policy": "PERSONAL",
|
|
|
+ "personal_qrcode_mode": 0,
|
|
|
+ }
|
|
|
+ if single_limit:
|
|
|
+ standard_info["standard_condition_info_list"] = [
|
|
|
+ {"rule_factor": "SINGLE_LIMIT", "rule_name": "单笔消费金额", "rule_value": str(single_limit)}
|
|
|
+ ]
|
|
|
+ data["standard_info_list"] = [standard_info]
|
|
|
institution_create_model = AlipayEbppInvoiceInstitutionCreateModel.from_alipay_dict(data)
|
|
|
|
|
|
# 解析适用成员数据
|
|
|
scope_data = None
|
|
|
adapter_type = data.get("applicable_scope")
|
|
|
- if adapter_type and adapter_type != "NONE":
|
|
|
+ if adapter_type and adapter_type not in ("NONE", "none"):
|
|
|
+ ADAPTER_TYPE_MAP = {"all": "ALL", "employee": "EMPLOYEE_SELECT", "department": "DEPARTMENT_SELECT"}
|
|
|
+ mapped_adapter = ADAPTER_TYPE_MAP.get(adapter_type, adapter_type)
|
|
|
scope_data = {
|
|
|
- "adapter_type": adapter_type,
|
|
|
- "owner_type": data.get("scope_owner_type", "EMPLOYEE"),
|
|
|
+ "adapter_type": mapped_adapter,
|
|
|
+ "owner_type": data.get("scope_owner_type", "ENTERPRISE_PAY_UID"),
|
|
|
"add_owner_id_list": data.get("scope_owner_id_list"),
|
|
|
}
|
|
|
|