Add get bill endpoint with Bill type aligned to bills.json schema#547
Add get bill endpoint with Bill type aligned to bills.json schema#547
Conversation
Co-authored-by: hassidtal <122451381+hassidtal@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request adds support for retrieving bill resources via the /bills/:id endpoint in the Unit Node SDK. The implementation follows established patterns in the codebase for simple resource classes with get methods, similar to Institutions and Disputes resources.
Changes:
- New
Billtype definition with status union type and comprehensive attributes/relationships - New
Billsresource class with a singleget(id)method - Integration with the main
Unitclass to expose the bills resource - Test coverage for both type validation and the get endpoint
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| types/bill.ts | Defines the Bill interface with BillStatus union type, standard attributes (createdAt, status, amount, description, reason, tags), and relationships (account, customer, customers, transaction) |
| resources/bills.ts | Implements Bills resource class extending BaseResource with a get method to retrieve a bill by ID |
| unit.ts | Adds Bills resource to the Unit class constructor and public properties |
| types/index.ts | Exports bill types for external consumption |
| resources/index.ts | Exports Bills resource class for external consumption |
| tests/bills.spec.ts | Adds tests for Bill type structure and get endpoint functionality |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… status Co-authored-by: hassidtal <122451381+hassidtal@users.noreply.github.com>
…schema Co-authored-by: hassidtal <122451381+hassidtal@users.noreply.github.com>
|
@copilot look at the attributes and statuses, the types/bill.ts is not align with https://github.com/unit-finance/unit-finance/blob/master/Unit.Api/schemas/public/bills.json |
The |
Co-authored-by: hassidtal <122451381+hassidtal@users.noreply.github.com>
Adds
GET /bills/:idsupport and aBilltype fully aligned to thebills.jsonschema. Previous iterations had the wrong statuses, attributes, and relationships (copied from payment types rather than the bill domain).types/bill.tsBillStatus:"Draft" | "Pending" | "Scheduled" | "Paid" | "PaymentInProgress" | "FundsPushed" | "DeductionPaymentFailed" | "VendorPaymentFailed" | "RefundInitiated" | "Refunded" | "CancellationInitiated" | "Canceled" | "Archived"BillFailureReason: full union of ACH/check failure codes (present onDeductionPaymentFailed/VendorPaymentFailed)BillLineItem,PlatformPaymentMethod,ExternalPaymentMethod,BillPaymentMethod: supporting types for line items and payment schedulingstatus,version,createdAt,updatedAtcurrency,lineItems,billDate,dueDate,invoiceNumber,description,tax,total,paymentMethod,tags,failureReasonorg(required);vendor,customer,billFile,fee,payment,linkedAccount(optional)resources/bills.ts💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.