fix(v4): align create-invoice wire-body with docs; drop Currency (closes #434) - #443
Conversation
Closes #434. Fetched https://yandex.ru/dev/direct/doc/dg-v4/reference/CreateInvoice 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:CreateInvoice example_param updated; notes record the docs verification (Docs-verified 2026-05-28) and the rationale for keeping --currency in CLI. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The v4 docs (dg-v4/reference/CreateInvoice) 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 create-invoice - Simplify _invoice_payments_param helper (no more currency arg) - Bump version 0.3.14 -> 0.3.15, add CHANGELOG BREAKING CHANGES entry - Update README example, v4_contracts.py notes, and stale test assertion Closes #434. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Upgraded to BREAKING per user direction: «надо делать как в документации 1 в 1, удалять все, чего нет». Latest commit:
Docs re-verified 2026-05-28 — Tests: 1909 passed, 50 skipped. Merge coordination: this PR, #441 (TransferMoney) and #442 (PayCampaigns) all bump version |
# Conflicts: # CHANGELOG.md
|
@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 20s —— View job Claude PR Review
Verdict: LGTM — no critical issues foundFocused review per the request (bugs, security, logic errors, data loss, perf). I did not flag style, naming, or formatting. What I checked1. Wire-body change is correct and complete
2. Click option removal is internally consistent
3. Contract + tests + docs match
4. Versioning / release hygiene
5. No security or data-loss concerns
Minor observation (non-blocking)
|
|
@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 1m 33s —— View job Claude PR Re-Review (focused: critical issues only)
Verdict: LGTM — no critical issues foundFocused on bugs, security, logic errors, data-loss, performance per the request. No style/naming nits. What I verified1. Wire-body change is correct and internally consistent
2. No data-loss risk from the BREAKING removal
3. Contract, tests, and docs are aligned
4. Versioning and merge coordination
5. No security or perf concerns
Findings: none blockingNothing else to flag at the requested severity level. |
The opt-in live-write test for CreateInvoice still built its request body with "Currency": "RUB", a leftover from before the docs-1:1 alignment (PR #443, commit 2308ef3) that removed Currency from the CreateInvoice wire body. The test is gated by YANDEX_DIRECT_LIVE_FINANCE_WRITE=1 so it never failed in a normal pytest run, but a real run would have sent a field the official CreateInvoice docs do not define. Align the test body with the docs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…#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 <bemyownrobot@gmail.com> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Summary
Non-breaking change. Fetched https://yandex.ru/dev/direct/doc/dg-v4/reference/CreateInvoice 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:create_invoiceand_invoice_payments_param— dropCurrencyfromPayments[]items; update help text on--currency.direct_cli/v4_contracts.py:CreateInvoice—example_paramupdated;notesrecord the docs verification (Docs-verified 2026-05-28).tests/test_v4finance_money.py— assertions updated to expect wire-body withoutCurrency.Test plan
pytest tests/test_v4finance_money.py tests/test_v4finance_read.py tests/test_comprehensive.py tests/test_cli.py— 129 passing.Closes #434. Part of milestone 22.
🤖 Generated with Claude Code