Skip to content
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: implement core logic in SDK #2

Merged
merged 7 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,300 changes: 1,300 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ packages = [
python = ">=3.9"
singer-sdk = { version="~=0.41.0", extras = [] }
fs-s3fs = { version = "~=1.1.1", optional = true }
xmltodict = "^0.14.2"

[tool.poetry.group.dev.dependencies]
pytest = ">=8"
Expand Down
37 changes: 0 additions & 37 deletions tap_intacct/client.py

This file was deleted.

71 changes: 71 additions & 0 deletions tap_intacct/const.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
REQUIRED_CONFIG_KEYS = [
"company_id",
"sender_id",
"sender_password",
"user_id",
"user_password",
]

KEY_PROPERTIES = {
"accounts_payable_bills": ["RECORDNO"],
"accounts_payable_payments": ["RECORDNO"],
"accounts_payable_vendors": ["VENDORID"],
"accounts_payable_bank_accounts": ["RECORDNO"],
"checking_accounts": ["RECORDNO"],
"savings_accounts": ["RECORDNO"],
"card_accounts": ["RECORDNO"],
"classes": ["RECORDNO"],
"tasks": ["RECORDNO"],
"general_ledger_accounts": ["RECORDNO"],
"general_ledger_details": ["RECORDNO"],
"general_ledger_journal_entries": ["RECORDNO"],
"general_ledger_journal_entry_lines": ["RECORDNO"],
"projects": ["RECORDNO"],
"invoices": ["RECORDNO"],
"adjustments": ["RECORDNO"],
"customers": ["RECORDNO"],
"deposits": ["RECORDNO"],
"items": ["RECORDNO"],
"invoice_items": ["RECORDNO"],
"adjustment_items": ["RECORDNO"],
"departments": ["DEPARTMENTID"],
"audit_history": ["ID"],
"locations": ["RECORDNO"],
}

# List of available objects with their internal object-reference/endpoint name.
INTACCT_OBJECTS = {
"accounts_payable_bills": "APBILL",
"accounts_payable_payments": "APPYMT",
"accounts_payable_vendors": "VENDOR",
"accounts_payable_bank_accounts": "PROVIDERBANKACCOUNT",
"checking_accounts": "CHECKINGACCOUNT",
"savings_accounts": "SAVINGSACCOUNT",
"card_accounts": "CREDITCARD",
"classes": "CLASS",
"tasks": "TASK",
"general_ledger_accounts": "GLACCOUNT",
"general_ledger_details": "GLDETAIL",
"general_ledger_journal_entries": "GLBATCH",
"general_ledger_journal_entry_lines": "GLENTRY",
"projects": "PROJECT",
"invoices": "ARINVOICE",
"adjustments": "ARADJUSTMENT",
"customers": "CUSTOMER",
"deposits": "DEPOSIT",
"items": "ITEM",
"invoice_items": "ARINVOICEITEM",
"adjustment_items": "ARADJUSTMENTITEM",
"departments": "DEPARTMENT",
# "audit_history": "AUDITHISTORY",
"locations": "LOCATION"
}

REP_KEYS = {"audit_history": "ACCESSTIME"}

IGNORE_FIELDS = ["PASSWORD"]


GET_BY_DATE_FIELD = "WHENMODIFIED"

DEFAULT_API_URL = "https://api.intacct.com/ia/xml/xmlgw.phtml"
70 changes: 70 additions & 0 deletions tap_intacct/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
"""Sage Intacct SDK Exceptions."""


class SageIntacctSDKError(Exception):
"""The base exception class for SageIntacctSDK.

Parameters:
msg (str): Short description of the error.
response: Error response from the API call.
"""

def __init__(self, msg, response=None):
super(SageIntacctSDKError, self).__init__(msg)
self.message = msg
self.response = response

def __str__(self):
return repr(self.message)


class ExpiredTokenError(SageIntacctSDKError):
"""Expired (old) access token, 498 error."""


class InvalidTokenError(SageIntacctSDKError):
"""Wrong/non-existing access token, 401 error."""


class NoPrivilegeError(SageIntacctSDKError):
"""The user has insufficient privilege, 403 error."""


class WrongParamsError(SageIntacctSDKError):
"""Some of the parameters (HTTP params or request body) are wrong, 400 error."""


class NotFoundItemError(SageIntacctSDKError):
"""Not found the item from URL, 404 error."""


class InternalServerError(SageIntacctSDKError):
"""The rest SageIntacctSDK errors, 500 error."""


class InvalidRequest(SageIntacctSDKError):
"""The rest SageIntacctSDK errors, 500 error."""


class AuthFailure(SageIntacctSDKError):
"""The rest SageIntacctSDK errors, 500 error."""


class InvalidXmlResponse(Exception):
pass


class BadGatewayError(Exception):
pass


class OfflineServiceError(Exception):
pass


class RateLimitError(Exception):
pass


class PleaseTryAgainLaterError(Exception):
pass
Loading
Loading