-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add AR Invoice Items support #103
feat: Add AR Invoice Items support #103
Conversation
WalkthroughThis pull request introduces a new class Changes
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🔇 Additional comments (2)sageintacctsdk/apis/constants.py (2)
The addition of the "WHENMODIFIED" field to CONTRACTDETAIL is consistent with other entities and improves change tracking capabilities.
The new ARINVOICEITEM mapping is well-structured and includes all necessary fields for AR Invoice Items support. The implementation:
Let's verify the field completeness against the API response: ✅ Verification successfulBased on the investigation through the codebase, I can now provide the final response: ARINVOICEITEM fields mapping appears complete and well-structured The implementation follows the standard SDK patterns:
While we couldn't find test files or API response samples to cross-reference, the field mapping is consistent with similar entity implementations in the SDK and covers all typical AR Invoice Item attributes including:
🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify if all fields in the API response are mapped
# Note: This helps ensure we haven't missed any fields from the actual API response
# Search for any test files or documentation containing sample AR Invoice Item responses
rg -A 5 "ARINVOICEITEM.*response" --type py
Length of output: 45 Script: #!/bin/bash
# Let's try a broader search to find any references to ARINVOICEITEM in tests or documentation
rg -i "arinvoiceitem" --type py -C 5
# Also search for any test data files
fd -e json -e yaml -e yml | xargs rg -l -i "arinvoiceitem"
Length of output: 4589 Script: #!/bin/bash
# Let's examine the ARInvoiceItems class implementation to understand the API usage
ast-grep --pattern 'class ARInvoiceItems(ApiBase) {
$$$
}'
# Also check for any get/read methods that might show field usage
rg -A 10 "def get|def read" sageintacctsdk/apis/ar_invoice_items.py
Length of output: 132 Script: #!/bin/bash
# Let's check the base class to understand the API patterns and field usage
rg -A 10 "class ApiBase" sageintacctsdk/apis/api_base.py
# Also check if there are any test files for AR Invoice Items
fd -e py | xargs rg -l "test.*ar.*invoice.*item" -i
Length of output: 575 Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
sageintacctsdk/sageintacctsdk.py (1)
7-7
: Consider maintaining alphabetical order in imports and initialization.While the changes are functionally correct, consider maintaining alphabetical order for consistency:
- DimensionValues, LocationEntities, ARInvoices, ARInvoiceItems, ARPayments, TaxDetails, GLDetail, Classes, JournalEntries,\ + DimensionValues, LocationEntities, ARInvoiceItems, ARInvoices, ARPayments, TaxDetails, GLDetail, Classes, JournalEntries,\ def __init__(...): # ... self.ap_payments = APPayments() self.allocation_entry = AllocationEntry() + self.ar_invoice_items = ARInvoiceItems() self.ar_invoices = ARInvoices() - self.ar_invoice_items = ARInvoiceItems() self.ar_payments = ARPayments()Also applies to: 58-58
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
sageintacctsdk/apis/__init__.py
(2 hunks)sageintacctsdk/apis/ar_invoice_items.py
(1 hunks)sageintacctsdk/apis/constants.py
(1 hunks)sageintacctsdk/sageintacctsdk.py
(6 hunks)
🔇 Additional comments (3)
sageintacctsdk/apis/__init__.py (1)
Line range hint 7-7
: LGTM!
The changes follow the existing pattern and maintain alphabetical order in both the imports and __all__
list.
Also applies to: 67-67
sageintacctsdk/sageintacctsdk.py (1)
106-106
: LGTM!
The update methods correctly include the new ar_invoice_items
instance, maintaining consistency with the existing pattern.
Also applies to: 151-151, 198-198, 243-243
sageintacctsdk/apis/constants.py (1)
577-688
: LGTM! The AR Invoice Items field mapping is comprehensive.
The new ARINVOICEITEM
entry includes a complete set of fields covering identification, accounting details, financial data, metadata, and dimensional relationships, aligning well with the PR objectives and standard accounting practices.
Let's verify the completeness of the field list against the API documentation:
✅ Verification successful
The AR Invoice Items field mapping is accurate and complete
The field mapping aligns with the SDK's implementation, which inherits from ApiBase and uses these fields for data operations. While there aren't explicit test files yet, the comprehensive field list covers all essential aspects of AR Invoice Items including identification, accounting details, financial data, metadata, and dimensional relationships.
Reasoning:
- The implementation in
ar_invoice_items.py
follows the SDK's standard pattern of using ApiBase with the dimension mapping. - The field list is thorough and includes all standard accounting fields needed for AR Invoice Items.
- The fields are consistent with other AR-related entities in the codebase (like ARInvoices).
- The mapping includes all necessary dimensions and relationships required for AR Invoice Item operations.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Search for any API documentation files that might contain AR Invoice Items field definitions
# to ensure we haven't missed any fields.
# Look for documentation files
fd -e md -e txt -e rst -e yaml -e json . | grep -i "api\|doc\|swagger\|openapi" | xargs rg -i "arinvoiceitem"
# Look for test files that might contain field usage examples
fd -e py "test_" | xargs rg "ARINVOICEITEM"
Length of output: 903
Script:
#!/bin/bash
# Let's examine the AR Invoice Items implementation and test files for field usage
# Check the implementation file
cat sageintacctsdk/apis/ar_invoice_items.py
# Look for test files specifically related to AR Invoice Items
fd -e py "test.*ar.*invoice.*item" -t f
Length of output: 313
class ARInvoiceItems(ApiBase): | ||
"""Class for AR Invoice Items APIs.""" | ||
def __init__(self): | ||
ApiBase.__init__(self, dimension='ARINVOICEITEM') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add comprehensive documentation and implement CRUD operations.
The class implementation is missing several key components:
- Add detailed class docstring explaining:
- Purpose and usage of AR Invoice Items
- Available operations
- Example usage with sample code
- Implement essential CRUD operations:
get()
- Retrieve AR Invoice Itemsquery()
- Query AR Invoice Items with filters- Other relevant operations based on the API capabilities
Here's a suggested implementation:
class ARInvoiceItems(ApiBase):
- """Class for AR Invoice Items APIs."""
+ """
+ Class for AR Invoice Items APIs.
+
+ The ARInvoiceItems class provides methods to interact with AR Invoice Items in Sage Intacct.
+ These are line items associated with AR Invoices that contain detailed information about
+ individual charges within an invoice.
+
+ Example:
+ >>> # Initialize AR Invoice Items
+ >>> ar_invoice_items = ARInvoiceItems()
+ >>>
+ >>> # Get AR Invoice Item by record number
+ >>> ar_invoice_item = ar_invoice_items.get(recordno='123')
+ >>>
+ >>> # Query AR Invoice Items
+ >>> items = ar_invoice_items.query()
+ """
def __init__(self):
+ """Initialize the AR Invoice Items API object."""
ApiBase.__init__(self, dimension='ARINVOICEITEM')
+
+ def get(self, recordno: str) -> dict:
+ """
+ Get AR Invoice Item by record number.
+
+ Args:
+ recordno: The RECORDNO of the AR Invoice Item
+
+ Returns:
+ A dictionary containing the AR Invoice Item details
+ """
+ return self.get_by_record_no(recordno)
+
+ def query(self, **kwargs) -> List[dict]:
+ """
+ Query AR Invoice Items based on filters.
+
+ Args:
+ **kwargs: Filters to apply to the query
+
+ Returns:
+ A list of dictionaries containing AR Invoice Items
+ """
+ return self.read(**kwargs)
Committable suggestion skipped: line range outside the PR's diff.
@rome-777 looks good to me - you'll also need to bump the release version. Thanks! |
@rome-777 Have approved PR! Thanks for your contribution!! Also special thanks for the detailed description 😅 |
No problem! Thanks for a quick review and approval! |
Description
This PR adds support for the AR Invoice Items object.
This object is not referenced in the API docs, however, it exists on invoices with associated line items. It is possible to query the line items object directly, which I tested on our developer sandbox. Currently, invoice queries will not return any line item data.
Bumps ver to 1.25.0
Invoice with line items in UI
Raw invoice data (retrieved in postman)
Request for Invoice Item (in postman)
Response for requested Invoice Item (in postman)
Summary by CodeRabbit
Summary by CodeRabbit
New Features
ARInvoiceItems
class for handling AR invoice items within the SDK.ARInvoiceItems
.ARINVOICEITEM
in the dimensions fields mapping.ar_invoice_items
to theSageIntacctSDK
class for improved interaction with AR invoice items.1.24.0
to1.25.0
.Bug Fixes
ar_invoice_items
member across multiple API management functions.