docs: add TSDoc to BillingService methods and helpers - #1376
Emmzydice1 wants to merge 3 commits into
Conversation
|
Thanks for the contribution! We reviewed this PR while merging the open queue and couldn't merge it yet. Here's what needs fixing:
This branch also has merge conflicts with |
…public-methods-with Resolves merge conflicts against CalloraOrg/Callora-Backend@1518ce6 (73 commit(s) behind) so the PR is mergeable.
|
@greatest0fallt1me — thanks for the review. Addressed all three points:
The branch is based on current |
Adds TSDoc to BillingService (class, constructor, deduct, deductBulk, getByRequestId) and to the exported helpers parseUsdcToContractUnits, formatContractUnitsToUsdc and isTransientSorobanError. Corrects the result-flag documentation to the flags that actually exist (drops the nonexistent possibleTransient field) and restores the billing test suites the previous commits had deleted/corrupted.
|
@greatest0fallt1me Thanks — the points from the review are addressed:
Verified locally on this branch head with Node 20:
Please re-review. |
Overview
This PR adds TSDoc annotations to the public
BillingServicemethods and exported helpers insrc/services/billing.ts, documenting parameters, return flags, thrown errors, precision rules, and concurrency guarantees. It also aligns the documented result-flag semantics withdocs/billing-idempotency.mdand adds test coverage in the billing test suites to lock in the documented behavior.Related Issue
Changes
📝 BillingService TSDoc
src/services/billing.tsBillingServicemethods (deduct,deductBulk,getByRequestId) covering@param,@returns,@throws, and examples.docs/billing-idempotency.md.parseUsdcToContractUnits,formatContractUnitsToUsdc, andisTransientSorobanError, including precision/rounding rules and transient-error classification.🧪 Tests
src/__tests__/billing-credits.test.tssrc/__tests__/billing-index.test.tsgetByRequestIdreturn shape anddeductBulkper-item flag handling.📚 Docs
docs/billing-idempotency.mdVerification Results
deduct,deductBulk,getByRequestIddocumented with@param,@returns,@throws, examplesparseUsdcToContractUnits,formatContractUnitsToUsdc,isTransientSorobanErrordocument precision/rounding and error classificationnpm run lintpassesSecurity and Failure-Mode Handling
@throwspaths make failure modes explicit (invalid amounts, transient Soroban errors, duplicate request IDs) so callers handle them rather than silently misreporting pending rows as successes.Compatibility
Non-goals
Closes #1342