Files
Chartwell/Books/Accounting/AccountsReceivable/AccountsReceivableCommon.txt
2026-04-08 12:47:30 -04:00

459 lines
20 KiB
Plaintext

RAG Knowledge Chunks for CMH.HFA.Accounting.AccountsReceivable.Common
---
Title: Adjustment Base Class - Common Adjustment Properties
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: Adjustment
• type: concept
• domain: Adjustments
• system: Oracle
Content: Purpose: Abstract base class defining common properties for invoice and credit memo adjustments in Oracle AR.
Core Properties:
• AdjustmentId, AdjustmentNumber: Identifiers
• OrgId, CustomerTrxId, ReceivablesTrxId: Oracle references
• TransactionAdjustmentType, AdjustmentType: Classification
• Amount (string), ApplyDate, GlDate (DateOnly): Financial data
• PaymentScheduleId, SetOfBooksId: Accounting references
• Comments, CurrencyCode, Status, ReasonCode: Metadata
Special JSON Properties:
• BusinessUnit: Mapped from "__FLEX_Context"
• RequiresApproval: Mapped from "Attribute1"
Inheritance: InvoiceAdjustment and CreditMemoAdjustment inherit from this base.
Example Questions:
• What properties are common to all adjustments?
• How is BusinessUnit mapped in adjustment JSON?
• What is the base class for invoice adjustments?
---
Title: InvoiceAdjustment DTO - Invoice Adjustment Type
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: InvoiceAdjustment
• type: concept
• domain: Invoice Adjustments
• system: Oracle
Content: Purpose: Data structure representing invoice-specific adjustments, inheriting all properties from Adjustment base class.
Structure:
• Inherits all properties from Adjustment abstract class
• No additional properties defined
• Used to distinguish invoice adjustments from credit memo adjustments at type level
Usage: Provides strong typing for invoice adjustment operations while leveraging common adjustment properties from base class.
Example Questions:
• What type represents invoice adjustments?
• Does InvoiceAdjustment have unique properties?
• What class does InvoiceAdjustment inherit from?
---
Title: CreditMemoAdjustment DTO - Credit Memo Adjustment Type
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: CreditMemoAdjustment
• type: concept
• domain: Credit Memo Adjustments
• system: Oracle
Content: Purpose: Data structure representing credit memo-specific adjustments, inheriting all properties from Adjustment base class.
Structure:
• Inherits all properties from Adjustment abstract class
• No additional properties defined
• Used to distinguish credit memo adjustments from invoice adjustments at type level
Usage: Provides strong typing for credit memo adjustment operations while leveraging common adjustment properties from base class.
Example Questions:
• What type represents credit memo adjustments?
• Does CreditMemoAdjustment have unique properties?
• What class does CreditMemoAdjustment inherit from?
---
Title: Installment DTO - Invoice Payment Schedule Structure
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: Installment
• type: concept
• domain: Installments
• system: Oracle
Content: Purpose: Data structure representing invoice payment installments with balance and payment tracking.
Key Properties:
• TransactionId (long): Invoice transaction identifier
• InstallmentId (string): Installment identifier (JSON mapped from "Installment")
• InstallmentSequence (int): Payment order sequence
• InstallmentDueDate (string): Due date
• InstallmentOriginalAmount, InstallmentBalanceDue (decimal): Amount tracking
• AmountApplied, AmountCredited, AmountAdjusted, AmountInDispute (string): Payment details
• InstallmentStatus (string): Status (e.g., "Open", "Closed")
Computed Property:
• AmountAdjustedDecimal: Parses AmountAdjusted to decimal (returns 0 if parse fails)
Example Questions:
• What fields define an installment?
• How is InstallmentBalanceDue tracked?
• What computed property parses AmountAdjusted?
---
Title: CreditMemo DTO - Credit Memo Transaction Structure
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: CreditMemo
• type: concept
• domain: Credit Memos
• system: Oracle
Content: Purpose: Data structure representing Oracle credit memo transactions with line items and unapplied balance tracking.
Key Properties:
• TransactionId, TransactionNumber, DocumentNumber: Identifiers
• TransactionSource, TransactionType, CreditReason: Classification
• TransactionDate, AccountingDate (DateOnly): Dates
• CurrencyCode, LegalEntityId, UnappliedBalance: Financial data
• CustomerAccountNumber, SitePurposeSiteNumber: Customer references
• BusinessUnit, BusinessGroup, GenerateBill: Business context
• ReceivablesCreditMemoLines (List<CreditMemoLine>): Line items (JSON: "receivablesCreditMemoLines")
Computed Property:
• UnappliedBalanceDecimal: Parses UnappliedBalance to decimal (returns 0 if parse fails)
Example Questions:
• What structure represents Oracle credit memos?
• How is UnappliedBalance accessed as decimal?
• What property contains credit memo line items?
---
Title: CreditMemoLine DTO - Credit Memo Line Item Structure
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: CreditMemoLine
• type: concept
• domain: Credit Memos
• system: Oracle
Content: Purpose: Data structure representing individual line items within credit memo transactions.
Properties:
• TransactionLineId (string): Line identifier (JSON mapped from "TransactionLineID")
• LineNumber (string): Line sequence number
• Description (string): Line description
• Quantity (int): Item quantity
• UnitPrice (decimal): Unit price
• MemoLine (string): Memo line reference
• CreatedBy, LastUpdatedBy (string): Audit fields
• CreationDate, LastUpdateDate (DateTime): Audit timestamps
Usage: Collection of CreditMemoLine objects stored in CreditMemo.ReceivablesCreditMemoLines.
Example Questions:
• What defines a credit memo line item?
• How is line item identifier mapped from JSON?
• What audit fields are tracked on credit memo lines?
---
Title: OracleIntegrationBase - Base Oracle OIC Integration
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: OracleIntegrationBase
• type: component
• domain: Integration
• system: Oracle OIC
Content: Purpose: Abstract base class for Oracle Integration Cloud (OIC) integrations providing authentication and request building.
Processing Logic:
• OicBaseUrl(): Constructs "https://erp-{oicEnv}-oicintegration-idq4hj6bgo2f-ia.integration.us-ashburn-1.ocp.oraclecloud.com"
• GetRequestAsync(): Retrieves credentials from AWS Parameter Store, creates authenticated Flurl request with basic auth
• UpdateEndpoint(): Appends endpoint path to existing Flurl request URL
Secret Keys:
• {environment}-hfa-oic-username
• {environment}-hfa-oic-password
• {environment}-hfa-oic-environment
Key Rule: Throws exception if ENVIRONMENT variable not set.
Example Questions:
• How do Oracle integrations authenticate?
• What is the OIC base URL structure?
• Where are OIC credentials retrieved from?
---
Title: SecretString Service - AWS Parameter Store Integration
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: SecretString
• type: component
• domain: Configuration
• system: AWS Parameter Store
Content: Purpose: Service for retrieving encrypted secrets from AWS Systems Manager Parameter Store.
Interface: ISecretString with GetSecretString(string key) method.
Processing Logic:
• Creates AmazonSimpleSystemsManagementClient
• Builds GetParameterRequest with key and WithDecryption = true
• Calls GetParameterAsync
• Returns Parameter.Value from response
Usage: Injected into integration classes to retrieve OIC credentials, mail relay certificates, and other secrets.
Example Questions:
• How are secrets retrieved from Parameter Store?
• What service retrieves encrypted parameters?
• Is decryption enabled for secret retrieval?
---
Title: MailRelayService - Email Relay Integration
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: MailRelayService
• type: component
• domain: Email/Notifications
• system: Mail Relay
Content: Purpose: Service for sending emails via Clayton's mail relay infrastructure with SSL certificate validation.
Configuration:
• Production: "mailrelay.cct-eto.com"
• Non-production: "mailrelay.dev.cct-eto.com"
• Port: 587
• EnableSsl: true, Timeout: 30000ms
Processing Logic:
• Validates fromAddress and toAddress not null/empty
• Creates SmtpClient via ISmtpClientFactory
• Configures TLS certificate validation from Parameter Store
• Sends MailMessage with optional attachments
• Returns true on success, false on failure
Key Rules:
• IsBodyHtml = false (plain text)
• Thread-safe certificate validation callback
• Restores existing ServerCertificateValidationCallback after send
Example Questions:
• How do I send emails via mail relay?
• What SMTP server is used for production?
• What port does mail relay use?
---
Title: UnappliedNotificationHelper - Notification Utility Methods
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: UnappliedNotificationHelper
• type: component
• domain: Notifications
• system: N/A
Content: Purpose: Static utility methods for unapplied notification Lambda functions providing logging and subject line formatting.
Methods:
• SafeLog(string message): Wraps LambdaLogger.Log in try-catch for test environment compatibility
• GetEnvironmentPrefixedSubject(string baseSubject): Adds environment prefix to subject for non-production emails
Subject Line Logic:
• Production: Returns baseSubject unchanged
• Non-production: Prepends capitalized environment name (e.g., "Dev: {baseSubject}")
• Default environment: "dev" if null/empty/whitespace
Example Questions:
• How do I prefix email subjects by environment?
• What utility provides safe logging for tests?
• How are production vs non-production email subjects distinguished?
---
Title: Environment-Based Email Subject Prefix Rule
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: UnappliedNotificationHelper
• type: rule
• domain: Notifications
• system: N/A
Content: Purpose: Defines rule for prefixing email subjects based on deployment environment.
Logic:
• Read ENVIRONMENT variable (default: "dev" if null/empty/whitespace)
• Trim and convert to lowercase
• If environment == "prod": return baseSubject unchanged
• Else: capitalize first character, return "{CapitalizedEnv}: {baseSubject}"
Examples:
• prod: "Unapplied Cash Receipt Notification"
• dev: "Dev: Unapplied Cash Receipt Notification"
• sit: "Sit: Unapplied Cash Receipt Notification"
Example Questions:
• How are email subjects prefixed by environment?
• Do production emails have subject prefixes?
• What format is used for non-production subject prefixes?
---
Title: IMailRelayService Interface - Email Service Contract
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: IMailRelayService
• type: component
• domain: Email/Notifications
• system: Mail Relay
Content: Purpose: Interface defining contract for mail relay email services.
Methods:
• SendEmail(fromAddress, toAddress, subject, body): Sends plain text email
• SendEmail(fromAddress, toAddress, subject, body, attachments): Sends plain text email with optional attachments
Requirements:
• fromAddress must use noreply_* format
• Body is plain text (not HTML)
• Returns true on success, false on failure
Usage: Implemented by MailRelayService, injectable for testing and dependency management.
Example Questions:
• What interface defines email sending?
• What format is required for sender addresses?
• Do mail relay methods support attachments?
---
Title: ISmtpClientFactory Interface - SMTP Client Factory Contract
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: ISmtpClientFactory
• type: component
• domain: Email/Notifications
• system: SMTP
Content: Purpose: Factory interface for creating SMTP client instances, enabling dependency injection and testing.
Method:
• CreateSmtpClient(string host, int port): Creates configured SmtpClient instance
Purpose: Enables mocking SMTP clients in unit tests to avoid real network I/O.
Implementations:
• DefaultSmtpClientFactory: Creates real SmtpClient for production
• Test mocks: Provide fake/mock implementations for testing
Example Questions:
• How do I inject SMTP client creation?
• What factory creates SMTP clients?
• How are SMTP clients mocked for testing?
---
Title: DefaultSmtpClientFactory - Production SMTP Client Factory
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: DefaultSmtpClientFactory
• type: component
• domain: Email/Notifications
• system: SMTP
Content: Purpose: Default implementation of ISmtpClientFactory that creates real SMTP client instances for production use.
Implementation:
• CreateSmtpClient(string host, int port): Returns new SmtpClient(host, port)
Usage: Registered in dependency injection container as singleton for production scenarios where actual email sending is required.
Example Questions:
• What creates real SMTP clients?
• How is ISmtpClientFactory implemented for production?
• What factory is used for actual email sending?
---
Title: NewtonsoftJsonLambdaSerializer - Lambda JSON Serialization
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: NewtonsoftJsonLambdaSerializer
• type: component
• domain: Serialization
• system: AWS Lambda
Content: Purpose: Custom Lambda serializer using Newtonsoft.Json with specific configuration for Lambda function input/output.
Configuration:
• NullValueHandling: Ignore (omit null properties)
• Converters: StringEnumConverter (serialize enums as strings)
Methods:
• Serialize<T>(): Writes object to response stream as JSON, resets stream position to beginning
• Deserialize<T>(): Reads object from request stream as JSON
Global Settings: Sets JsonConvert.DefaultSettings on instantiation.
Usage: Applied to Lambda functions via [assembly: LambdaSerializer(typeof(NewtonsoftJsonLambdaSerializer))].
Example Questions:
• How do Lambdas serialize JSON?
• What JSON settings are used for Lambda functions?
• How are enums serialized in Lambda responses?
---
Title: CommonBaseLambdaService - Base Lambda Service with DI
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: CommonBaseLambdaService
• type: component
• domain: Lambda Infrastructure
• system: AWS Lambda
Content: Purpose: Abstract base class for Lambda services providing dependency injection capabilities.
Processing Logic:
• ConfigureStartup(IStartup startup): Creates ServiceCollection, calls startup.ConfigureServices(), builds ServiceProvider
• GetService<T>(): Resolves service instance from built ServiceProvider
Usage: Lambda classes inherit from this to access dependency-injected services (integrations, helpers, etc.).
Pattern: Constructor initializes dependencies via ConfigureStartup(), then GetService<T>() retrieves instances.
Example Questions:
• How do Lambda functions access dependency injection?
• What base class provides DI for Lambdas?
• How are services resolved in Lambda functions?
---
Title: IStartup Interface - Service Configuration Contract
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: IStartup
• type: component
• domain: Configuration
• system: N/A
Content: Purpose: Interface defining contract for configuring dependency injection services.
Method:
• ConfigureServices(IServiceCollection service): Registers services into DI container
Usage: Implemented by startup classes to define service registrations for Lambda functions.
Pattern: Lambda base classes call ConfigureServices() to build ServiceProvider for dependency resolution.
Example Questions:
• What interface configures DI services?
• How do startups register dependencies?
• What method registers services in DI container?
---
Title: ComonStartup - Common Service Configuration
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: ComonStartup
• type: component
• domain: Configuration
• system: N/A
Content: Purpose: Abstract base startup class that registers common services used across Lambda functions.
Registered Services (Singleton):
• IMailRelayService → MailRelayService
• ISecretString → SecretString
Usage: Lambda-specific startup classes inherit from ComonStartup to include common service registrations plus their own specific services.
Pattern: Provides consistent service registration baseline across all Lambda projects in solution.
Example Questions:
• What services are registered by default?
• What startup class provides common services?
• How are mail relay and secret services registered?
---
Title: Mail Relay Environment-Based Server Selection
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: MailRelayService
• type: rule
• domain: Email/Notifications
• system: Mail Relay
Content: Purpose: Defines rule for selecting mail relay server based on deployment environment.
Server Selection Logic:
• Read ENVIRONMENT variable (default: "dev" if null)
• Convert to lowercase
• If environment == "prod": Use "mailrelay.cct-eto.com"
• Else (dev, sit, etc.): Use "mailrelay.dev.cct-eto.com"
Configuration:
• Port: 587 (all environments)
• SSL: Enabled (all environments)
Example Questions:
• What mail relay server is used in production?
• How is mail server selected by environment?
• What port is used for mail relay?
---
Title: Mail Relay TLS Certificate Validation
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: MailRelayService
• type: workflow
• domain: Email/Notifications
• system: Mail Relay
Content: Purpose: Configures TLS certificate validation for mail relay SMTP connections.
Workflow:
1. Retrieve cached certificate from Parameter Store (or cache)
2. Lock _tlsCallbackLock for thread safety
3. Set ServicePointManager.ServerCertificateValidationCallback
4. Add certificate to chain.ChainPolicy.ExtraStore
5. Build certificate chain: chain.Build((X509Certificate2)cert)
6. Return validation result (true if valid)
7. Restore previous callback after email sent
Key Rules:
• Certificate cached after first retrieval (_cachedCertificate)
• Thread-safe callback management
• Returns null-safe (skips if certificate null)
Example Questions:
• How is mail relay TLS validated?
• How are mail relay certificates cached?
• What ensures thread-safe certificate validation?
---
Title: Installment AmountAdjustedDecimal Parsing Rule
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: Installment
• type: rule
• domain: Installments
• system: Oracle
Content: Purpose: Provides safe decimal parsing of string-based AmountAdjusted field.
Parsing Logic:
• decimal.TryParse(AmountAdjusted, out var amount)
• Returns parsed amount if successful
• Returns 0m if parse fails
Property: AmountAdjustedDecimal (computed, read-only)
Usage: Enables numeric operations on adjustment amounts without exception risk from invalid string values.
Example Questions:
• How is AmountAdjusted converted to decimal?
• What happens if AmountAdjusted parsing fails?
• What computed property provides decimal adjustment amount?
---
Title: CreditMemo UnappliedBalanceDecimal Parsing Rule
Metadata:
• module: CMH.HFA.Accounting.AccountsReceivable.Common
• component: CreditMemo
• type: rule
• domain: Credit Memos
• system: Oracle
Content: Purpose: Provides safe decimal parsing of string-based UnappliedBalance field.
Parsing Logic:
• Decimal.TryParse(UnappliedBalance, out decimal unappliedBalanceDecimal)
• Returns parsed value if successful
• Returns 0 if parse fails
Property: UnappliedBalanceDecimal (computed, read-only)
Usage: Enables numeric comparisons and calculations on credit memo balances without exception risk from invalid string values.
Example Questions:
• How is UnappliedBalance converted to decimal?
• What happens if UnappliedBalance parsing fails?
• What computed property provides decimal unapplied balance?
---
This completes the RAG knowledge chunks for the CMH.HFA.Accounting.AccountsReceivable.Common module. Each chunk is atomic, non-overlapping, and optimized for retrieval-augmented generation with precise technical details about common models, integration services, and infrastructure components.