修改佣金报酬场景

This commit is contained in:
db_huang 2026-10-31 17:11:17 +08:00
parent fa3517afbb
commit 29ae53e593
7 changed files with 13 additions and 12 deletions

View File

@ -53,4 +53,5 @@ ALIPAY_NOTIFY_URL=https://your-domain.example.com/alipay_callback
ALIPAY_TRANSFER_API=alipay.fund.trans.uni.transfer ALIPAY_TRANSFER_API=alipay.fund.trans.uni.transfer
ALIPAY_TRANSFER_QUERY_API=alipay.fund.trans.common.query ALIPAY_TRANSFER_QUERY_API=alipay.fund.trans.common.query
ALIPAY_TRANSFER_SCENE_NAME=佣金报酬 ALIPAY_TRANSFER_SCENE_NAME=佣金报酬
ALIPAY_TRANSFER_JOB_TYPE=问答任务参与者
ALIPAY_HTTP_TIMEOUT_SECONDS=30 ALIPAY_HTTP_TIMEOUT_SECONDS=30

View File

@ -28,6 +28,7 @@ def validate_configuration() -> None:
("ALIPAY_APP_PRIVATE_KEY_PATH", settings.alipay_app_private_key_path), ("ALIPAY_APP_PRIVATE_KEY_PATH", settings.alipay_app_private_key_path),
("ALIPAY_PUBLIC_KEY_PATH 或 ALIPAY_ALIPAY_PUBLIC_CERT_PATH", settings.alipay_public_key_path or settings.alipay_alipay_public_cert_path), ("ALIPAY_PUBLIC_KEY_PATH 或 ALIPAY_ALIPAY_PUBLIC_CERT_PATH", settings.alipay_public_key_path or settings.alipay_alipay_public_cert_path),
("ALIPAY_TRANSFER_SCENE_NAME", settings.alipay_transfer_scene_name), ("ALIPAY_TRANSFER_SCENE_NAME", settings.alipay_transfer_scene_name),
("ALIPAY_TRANSFER_JOB_TYPE", settings.alipay_transfer_job_type),
) if not str(value or "").strip() ) if not str(value or "").strip()
] ]
if missing: if missing:
@ -268,13 +269,13 @@ def transfer(*, out_biz_no: str, amount_fen: int, account: str, payee_name: str,
model.product_code = "TRANS_ACCOUNT_NO_PWD" model.product_code = "TRANS_ACCOUNT_NO_PWD"
model.biz_scene = "DIRECT_TRANSFER" model.biz_scene = "DIRECT_TRANSFER"
model.transfer_scene_name = settings.alipay_transfer_scene_name model.transfer_scene_name = settings.alipay_transfer_scene_name
business_name = TransferSceneReportInfo() job_type = TransferSceneReportInfo()
business_name.info_type = "业务名称" job_type.info_type = "岗位类型"
business_name.info_content = "问大家问答任务" job_type.info_content = settings.alipay_transfer_job_type[:32]
business_description = TransferSceneReportInfo() reward_description = TransferSceneReportInfo()
business_description.info_type = "业务描述" reward_description.info_type = "报酬说明"
business_description.info_content = f"用户完成问答任务后发放任务报酬,关联业务:{order_title}"[:100] reward_description.info_content = order_title[:32]
model.transfer_scene_report_infos = [business_name, business_description] model.transfer_scene_report_infos = [job_type, reward_description]
model.order_title = order_title[:128] model.order_title = order_title[:128]
payee = Participant() payee = Participant()
payee.identity = account payee.identity = account

View File

@ -78,6 +78,7 @@ class Settings:
alipay_transfer_api = os.getenv("ALIPAY_TRANSFER_API", "alipay.fund.trans.uni.transfer") alipay_transfer_api = os.getenv("ALIPAY_TRANSFER_API", "alipay.fund.trans.uni.transfer")
alipay_transfer_query_api = os.getenv("ALIPAY_TRANSFER_QUERY_API", "alipay.fund.trans.common.query") alipay_transfer_query_api = os.getenv("ALIPAY_TRANSFER_QUERY_API", "alipay.fund.trans.common.query")
alipay_transfer_scene_name = os.getenv("ALIPAY_TRANSFER_SCENE_NAME", "").strip() alipay_transfer_scene_name = os.getenv("ALIPAY_TRANSFER_SCENE_NAME", "").strip()
alipay_transfer_job_type = os.getenv("ALIPAY_TRANSFER_JOB_TYPE", "").strip()
alipay_http_timeout_seconds = int(os.getenv("ALIPAY_HTTP_TIMEOUT_SECONDS", "30")) alipay_http_timeout_seconds = int(os.getenv("ALIPAY_HTTP_TIMEOUT_SECONDS", "30"))

View File

@ -32,6 +32,7 @@ def test_transfer_parses_official_sdk_json_response(monkeypatch):
}) })
monkeypatch.setattr(alipay_provider, "_client", lambda: client) monkeypatch.setattr(alipay_provider, "_client", lambda: client)
monkeypatch.setattr(alipay_provider.settings, "alipay_transfer_scene_name", "佣金报酬") monkeypatch.setattr(alipay_provider.settings, "alipay_transfer_scene_name", "佣金报酬")
monkeypatch.setattr(alipay_provider.settings, "alipay_transfer_job_type", "问答任务参与者")
result = alipay_provider.transfer( result = alipay_provider.transfer(
out_biz_no="RF001", amount_fen=300, account="buyer@example.com", out_biz_no="RF001", amount_fen=300, account="buyer@example.com",
payee_name="测试收款人", order_title="测试返款", payee_name="测试收款人", order_title="测试返款",
@ -40,11 +41,8 @@ def test_transfer_parses_official_sdk_json_response(monkeypatch):
biz_content = json.loads(client.params["biz_content"]) biz_content = json.loads(client.params["biz_content"])
assert biz_content["transfer_scene_name"] == "佣金报酬" assert biz_content["transfer_scene_name"] == "佣金报酬"
assert biz_content["transfer_scene_report_infos"] == [ assert biz_content["transfer_scene_report_infos"] == [
{"info_content": "问大家问答任务", "info_type": "业务名称"}, {"info_content": "问答任务参与者", "info_type": "岗位类型"},
{ {"info_content": "测试返款", "info_type": "报酬说明"},
"info_content": "用户完成问答任务后发放任务报酬,关联业务:测试返款",
"info_type": "业务描述",
},
] ]