diff --git a/backend/.env.example b/backend/.env.example index fa424f2..0d2eeee 100644 --- a/backend/.env.example +++ b/backend/.env.example @@ -53,4 +53,5 @@ ALIPAY_NOTIFY_URL=https://your-domain.example.com/alipay_callback ALIPAY_TRANSFER_API=alipay.fund.trans.uni.transfer ALIPAY_TRANSFER_QUERY_API=alipay.fund.trans.common.query ALIPAY_TRANSFER_SCENE_NAME=佣金报酬 +ALIPAY_TRANSFER_JOB_TYPE=问答任务参与者 ALIPAY_HTTP_TIMEOUT_SECONDS=30 diff --git a/backend/app/__pycache__/alipay_provider.cpython-313.pyc b/backend/app/__pycache__/alipay_provider.cpython-313.pyc index e7034d2..a900da4 100644 Binary files a/backend/app/__pycache__/alipay_provider.cpython-313.pyc and b/backend/app/__pycache__/alipay_provider.cpython-313.pyc differ diff --git a/backend/app/__pycache__/config.cpython-313.pyc b/backend/app/__pycache__/config.cpython-313.pyc index 4580213..50f41fc 100644 Binary files a/backend/app/__pycache__/config.cpython-313.pyc and b/backend/app/__pycache__/config.cpython-313.pyc differ diff --git a/backend/app/alipay_provider.py b/backend/app/alipay_provider.py index 1a4b65f..c9def05 100644 --- a/backend/app/alipay_provider.py +++ b/backend/app/alipay_provider.py @@ -28,6 +28,7 @@ def validate_configuration() -> None: ("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_TRANSFER_SCENE_NAME", settings.alipay_transfer_scene_name), + ("ALIPAY_TRANSFER_JOB_TYPE", settings.alipay_transfer_job_type), ) if not str(value or "").strip() ] 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.biz_scene = "DIRECT_TRANSFER" model.transfer_scene_name = settings.alipay_transfer_scene_name - business_name = TransferSceneReportInfo() - business_name.info_type = "业务名称" - business_name.info_content = "问大家问答任务" - business_description = TransferSceneReportInfo() - business_description.info_type = "业务描述" - business_description.info_content = f"用户完成问答任务后发放任务报酬,关联业务:{order_title}"[:100] - model.transfer_scene_report_infos = [business_name, business_description] + job_type = TransferSceneReportInfo() + job_type.info_type = "岗位类型" + job_type.info_content = settings.alipay_transfer_job_type[:32] + reward_description = TransferSceneReportInfo() + reward_description.info_type = "报酬说明" + reward_description.info_content = order_title[:32] + model.transfer_scene_report_infos = [job_type, reward_description] model.order_title = order_title[:128] payee = Participant() payee.identity = account diff --git a/backend/app/config.py b/backend/app/config.py index 3c037e6..2f918ad 100644 --- a/backend/app/config.py +++ b/backend/app/config.py @@ -78,6 +78,7 @@ class Settings: 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_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")) diff --git a/backend/tests/__pycache__/test_alipay_provider.cpython-313-pytest-9.1.1.pyc b/backend/tests/__pycache__/test_alipay_provider.cpython-313-pytest-9.1.1.pyc index 8878b59..7837d39 100644 Binary files a/backend/tests/__pycache__/test_alipay_provider.cpython-313-pytest-9.1.1.pyc and b/backend/tests/__pycache__/test_alipay_provider.cpython-313-pytest-9.1.1.pyc differ diff --git a/backend/tests/test_alipay_provider.py b/backend/tests/test_alipay_provider.py index dfa9bac..260610f 100644 --- a/backend/tests/test_alipay_provider.py +++ b/backend/tests/test_alipay_provider.py @@ -32,6 +32,7 @@ def test_transfer_parses_official_sdk_json_response(monkeypatch): }) monkeypatch.setattr(alipay_provider, "_client", lambda: client) monkeypatch.setattr(alipay_provider.settings, "alipay_transfer_scene_name", "佣金报酬") + monkeypatch.setattr(alipay_provider.settings, "alipay_transfer_job_type", "问答任务参与者") result = alipay_provider.transfer( out_biz_no="RF001", amount_fen=300, account="buyer@example.com", 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"]) assert biz_content["transfer_scene_name"] == "佣金报酬" assert biz_content["transfer_scene_report_infos"] == [ - {"info_content": "问大家问答任务", "info_type": "业务名称"}, - { - "info_content": "用户完成问答任务后发放任务报酬,关联业务:测试返款", - "info_type": "业务描述", - }, + {"info_content": "问答任务参与者", "info_type": "岗位类型"}, + {"info_content": "测试返款", "info_type": "报酬说明"}, ]