fix(v4): align pay-campaigns wire-body with docs; drop Currency (closes #433)#442
Conversation
Closes #433. Fetched https://yandex.ru/dev/direct/doc/dg-v4/reference/PayCampaigns and confirmed the PayCampElement object carries only CampaignID and Sum; Sum is in conventional units ("условные единицы") with no Currency field anywhere in the request body. Non-breaking change. The --currency CLI option is kept for backward compatibility (its value is no longer forwarded to the API wire-body). Help text updated to explain. Tests assert the wire-body has no Currency on Payments[] items. v4_contracts.py:PayCampaigns example_param updated to match; notes record the docs verification and the Overdraft retention rationale (docs list only Bank; Overdraft is kept as a historical undocumented value used by sandbox flow). Co-Authored-By: Claude Opus 4.7 <[email protected]>
The v4 docs (dg-v4/reference/PayCampaigns) define PayCampElement with only CampaignID and Sum. Currency is not part of the wire-body and was never forwarded to the API. The previous non-breaking shim accepted --currency for backward compatibility; per user direction, the CLI must mirror docs strictly, so the option is removed entirely. - Remove --currency Click option from pay-campaigns - Bump version 0.3.14 -> 0.3.15, add CHANGELOG BREAKING CHANGES entry - Update README example, v4_contracts.py notes, and stale test assertions Closes #433. Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
Upgraded to BREAKING per user direction: «надо делать как в документации 1 в 1, удалять все, чего нет». Latest commit:
Docs re-verified 2026-05-28 — Tests: 1909 passed, 50 skipped. Title still says |
Strict 1:1 docs alignment per user direction: «удалять все, чего нет». The v4 docs (dg-v4/reference/PayCampaigns#PayMethod) list only `Bank` as a supported PayMethod value. `Overdraft` was retained in the CLI choices as a historical undocumented value for sandbox flow, but nothing in the public docs guarantees it. - Remove `Overdraft` from V4_PAY_METHODS - Replace test_pay_campaigns_allows_overdraft_without_contract with test_pay_campaigns_rejects_undocumented_pay_method (Click Choice rejects the value before reaching the API) - Update test_pay_campaigns_rejects_non_positive_campaign_ids to use Bank + --contract-id (Overdraft is no longer accepted) - Add second BREAKING line to CHANGELOG 0.3.15 - Update v4_contracts.py notes Closes #433. Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
Second BREAKING commit added — full audit per «удалять все, чего нет»:
Tests: 1909 passed, 50 skipped. This PR now contains two BREAKING changes for
If sandbox still supports |
# Conflicts: # CHANGELOG.md # README.md
Two sentences in PayCampaigns.notes restated "no Currency in wire-body"; consolidate to a single docs-verified statement matching the TransferMoney style. Also update tests/API_COVERAGE.md to reflect that PayCampaigns now mirrors TransferMoney (PayCampElement = CampaignID + Sum, no Currency) and that PayMethod is restricted to 'Bank'.
|
@claude review. Focus on critical issues: bugs, security vulnerabilities, logical errors, data loss risks, performance problems. Do NOT nitpick style, naming conventions, minor formatting, or subjective preferences — only flag issues that could break functionality or cause real harm in production. |
|
Claude finished @axisrow's task in 2m 30s —— View job Review
Scope of review: critical issues only (bugs, security, logic, data loss, performance). Style/naming/formatting intentionally skipped per request. Findings1. Live-API risk from dropping The PR drops
Per the «1 в 1 с документацией» rule the team has adopted, this is the right call — but I'd flag in the release notes / a follow-up that anyone on a non-RUB agency contract should sanity-check the next invoice. The 2. The author already calls out the mitigation path in PR comment 2 (re-introduce with 3. Dead branch (cosmetic, not a bug). ℹ️
Similarly 4. PR title vs commit message mismatch — already flagged by author. ℹ️ PR title is 5. No security or perf issues found. ✓ Finance token handling, masking, and dry-run gating are unchanged. VerdictNo blocking bugs. The change is internally consistent: option removed, wire-body, contract example, docs example, README, and tests are all updated coherently. The main thing worth tracking is item (1) — the inability to live-verify on a non-RUB contract — which justifies a brief mention in the changelog / a smoke-test follow-up if/when finance credentials are available. |
|
Triage of the review:
|
…#441/#442/#443) (#450) PRs #441/#442/#443 dropped the obligatory Live 4 input parameter Currency from PayCampElement on transfer-money, pay-campaigns, and create-invoice; #442 additionally dropped the valid Overdraft PayMethod. The commits cited dg-v4/reference/<Method> as the verification source. That URL is legacy v4 (pre-Live), where PayCampElement is {CampaignID, Sum} only. The CLI ships these commands in the v4finance Live group and must mirror dg-v4/live/<Method>. Verified 2026-05-29 by curling the live pages: - dg-v4/live/TransferMoney → PayCampElement = {CampaignID, Sum, Currency}; changelog "Новое в версии Live 4: Входной параметр Currency стал обязательным". - dg-v4/live/PayCampaigns → PayCampElement = {CampaignID, Sum, Currency}; same changelog plus "Добавлен метод оплаты Overdraft". - dg-v4/live/CreateInvoice → PayCampElement = {CampaignID, Sum, Currency}. Restored: - --currency (required, Choice: RUB/CHF/EUR/KZT/TRY/UAH/USD/BYN) on transfer-money, pay-campaigns, create-invoice. - Currency emitted on every Payments[] / FromCampaigns[] / ToCampaigns[] item. - Overdraft re-enabled in V4_PAY_METHODS; --contract-id remains required only when --pay-method Bank. Updated v4_contracts.py example_param and notes (now pointing at dg-v4/live/*); updated tests/test_v4finance_money.py and tests/test_v4_contracts.py expectations; updated README, CHANGELOG (0.3.16 BREAKING CHANGES), scripts/test_dangerous_commands.sh checklist, tests/API_COVERAGE.md, and the opt-in live-write test for CreateInvoice. Bumped version to 0.3.16. Audit trail: #125 (comment) Co-authored-by: hapi <[email protected]> Co-authored-by: Claude Opus 4.7 <[email protected]>
Summary
Non-breaking change. Fetched https://yandex.ru/dev/direct/doc/dg-v4/reference/PayCampaigns and confirmed that
PayCampElementcarries onlyCampaignIDandSum(in conventional units / условные единицы). NoCurrencyfield exists in the docs-defined request body.This PR aligns the wire-body with the docs without breaking the CLI surface:
--currencyoption is kept for backward compatibility.--currencynow explains the behaviour.Changes
direct_cli/commands/v4finance.py:pay_campaigns— dropCurrencyfromPayments[]items; update help text on--currency.direct_cli/v4_contracts.py:PayCampaigns—example_paramupdated;notesrecord the docs verification (Docs-verified 2026-05-28) and the Overdraft retention rationale (docs list onlyBank; CLI keepsOverdraftas historical undocumented value).tests/test_v4finance_money.py— assertions updated to expect wire-body withoutCurrency.Verification
Live API was not re-verified due to absence of finance credentials. CLI users keeping
--currency RUBin their scripts continue to work; the silent value drop only changes the JSON sent over the wire.Test plan
pytest tests/test_v4finance_money.py tests/test_v4finance_read.py tests/test_comprehensive.py tests/test_cli.py— 129 passing.Closes #433. Part of milestone 22. Supersedes branch
feat/milestone-22-close-433-pay-campaigns(closed without merge).🤖 Generated with Claude Code