Skip to main content

Invoice Microservice

The Invoice microservice manages billing-related data such as customer invoices. It integrates with external services (e.g., Zoho) and provides gRPC endpoints for querying and retrieving invoice data by various identifiers.

Models (invoice.go)

Invoice

Represents a billing invoice with customer and payment details.

FieldTypeDescription
InvoiceIDstringUnique ID of the invoice
CustomerNamestringName of the customer
CustomerIDstringID of the customer
StatusstringInvoice status (e.g., paid, unpaid, draft)
InvoiceNumberstringOfficial invoice number
ReferenceNumberstringReference tag or external ID
DatestringInvoice issue date
DueDatestringInvoice due date
DueDaysstringDays until due
ScheduleTimestringScheduled time for the invoice (if applicable)
CurrencyCodestringCode of the currency used
CurrencyIDstringInternal currency reference
Totalfloat64Total invoice amount
Balancefloat64Remaining balance due
CreatedTimestringTimestamp when the invoice was created
LastModifiedTimestringLast time the invoice was modified
RemindersSentintNumber of reminders sent
LastReminderSentDatestringTimestamp of last reminder sent
PaymentExpectedDatestringExpected payment date
LastPaymentDatestringTimestamp of last payment

Zoho Integration Models

  • ZohoInvoiceResponse: Holds response structure from Zoho's invoice list.
  • ZohoTokenResponse: Holds the access token from Zoho authentication.

gRPC API (invoice.proto)

Defines RPC methods for retrieving and listing invoice data.

Messages

  • Invoice: Mirrors the Invoice model.
  • InvoiceResponse: Contains a list of invoices and total count.
  • GetInvoiceByIDResponse: Encodes the invoice as raw bytes.
  • ListAllInvoicesRequest: Supports pagination.
  • GetInvoiceByIDRequest, GetInvoiceByUserIDRequest, GetInvoiceByOrgIDRequest: Query filters.
  • CheckResponse: Standard status response format.

Services

  • ListAllInvoices(ListAllInvoicesRequest) returns (InvoiceResponse)
  • GetInvoiceByID(GetInvoiceByIDRequest) returns (GetInvoiceByIDResponse)
  • GetInvoicesByUserID(GetInvoiceByUserIDRequest) returns (InvoiceResponse)
  • GetInvoicesByOrgID(GetInvoiceByOrgIDRequest) returns (InvoiceResponse)

These services allow the client to retrieve invoice data filtered by ID, user, or organization, with support for pagination.