docs: add TSDoc to BillingService methods and helpers - #1376
Open
Emmzydice1 wants to merge 3 commits into
Open
Emmzydice1 wants to merge 3 commits into
Emmzydice1 wants to merge 3 commits into
Conversation
Contributor
|
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.
Contributor
Author
|
@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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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