export

package
v1.0.53 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreditTopupCSV added in v1.0.36

type CreditTopupCSV struct {
	TopupID             string `csv:"topup_id"`
	ExternalID          string `csv:"external_id"`
	CustomerName        string `csv:"name"`
	WalletID            string `csv:"wallet_id"`
	Amount              string `csv:"amount"`                // Decimal as string
	CreditBalanceBefore string `csv:"credit_balance_before"` // Decimal as string
	CreditBalanceAfter  string `csv:"credit_balance_after"`  // Decimal as string
	ReferenceID         string `csv:"reference_id"`
	TransactionReason   string `csv:"transaction_reason"`
	CreatedAt           string `csv:"created_at"` // RFC3339 format
}

CreditTopupCSV represents the CSV structure for credit topup export

type CreditTopupExporter added in v1.0.36

type CreditTopupExporter struct {
	// contains filtered or unexported fields
}

CreditTopupExporter handles credit topup export operations

func NewCreditTopupExporter added in v1.0.36

func NewCreditTopupExporter(
	walletRepo wallet.Repository,
	integrationFactory *integration.Factory,
	logger *logger.Logger,
) *CreditTopupExporter

NewCreditTopupExporter creates a new credit topup exporter

func (*CreditTopupExporter) GetFilenamePrefix added in v1.0.36

func (e *CreditTopupExporter) GetFilenamePrefix() string

GetFilenamePrefix returns the prefix for the exported file

func (*CreditTopupExporter) PrepareData added in v1.0.36

func (e *CreditTopupExporter) PrepareData(ctx context.Context, request *dto.ExportRequest) ([]byte, int, error)

PrepareData fetches credit topup data in batches and converts it to CSV format

type CreditUsageCSV added in v1.0.47

type CreditUsageCSV struct {
	CustomerName       string `csv:"name"`
	CustomerExternalID string `csv:"customer_external_id"`
	CustomerID         string `csv:"customer_id"`
	CurrentBalance     string `csv:"current_balance"`
	RealtimeBalance    string `csv:"real_time_balance"`
	NumberOfWallets    int    `csv:"number_of_wallets"`
}

CreditUsageCSV represents the CSV structure for credit usage export

type CreditUsageExporter added in v1.0.47

type CreditUsageExporter struct {
	// contains filtered or unexported fields
}

CreditUsageExporter handles credit usage export operations

func NewCreditUsageExporter added in v1.0.47

func NewCreditUsageExporter(
	walletRepo wallet.Repository,
	customerRepo customer.Repository,
	walletBalanceGetter WalletBalanceGetter,
	integrationFactory *integration.Factory,
	logger *logger.Logger,
) *CreditUsageExporter

NewCreditUsageExporter creates a new credit usage exporter

func (*CreditUsageExporter) GetFilenamePrefix added in v1.0.47

func (e *CreditUsageExporter) GetFilenamePrefix() string

GetFilenamePrefix returns the prefix for the exported file

func (*CreditUsageExporter) PrepareData added in v1.0.47

func (e *CreditUsageExporter) PrepareData(ctx context.Context, request *dto.ExportRequest) ([]byte, int, error)

PrepareData fetches credit usage data and converts it to CSV format

type EventExporter

type EventExporter struct {
	// contains filtered or unexported fields
}

EventExporter handles feature usage export operations

func NewEventExporter

func NewEventExporter(
	featureUsageRepo events.FeatureUsageRepository,
	integrationFactory *integration.Factory,
	logger *logger.Logger,
) *EventExporter

NewEventExporter creates a new event exporter

func (*EventExporter) GetFilenamePrefix

func (e *EventExporter) GetFilenamePrefix() string

GetFilenamePrefix returns the prefix for the exported file

func (*EventExporter) PrepareData

func (e *EventExporter) PrepareData(ctx context.Context, request *dto.ExportRequest) ([]byte, int, error)

PrepareData fetches feature usage data in batches and converts it to CSV format

type ExportService

type ExportService struct {
	// contains filtered or unexported fields
}

ExportService handles export operations for different entity types

func NewExportService

func NewExportService(
	featureUsageRepo events.FeatureUsageRepository,
	invoiceRepo invoice.Repository,
	connectionRepo connection.Repository,
	integrationFactory *integration.Factory,
	logger *logger.Logger,
) *ExportService

NewExportService creates a new export service

func NewExportServiceWithWallet added in v1.0.36

func NewExportServiceWithWallet(
	featureUsageRepo events.FeatureUsageRepository,
	invoiceRepo invoice.Repository,
	walletRepo wallet.Repository,
	walletBalanceGetter WalletBalanceGetter,
	customerRepo customer.Repository,
	connectionRepo connection.Repository,
	integrationFactory *integration.Factory,
	logger *logger.Logger,
) *ExportService

NewExportServiceWithWallet creates a new export service with wallet repository

func (*ExportService) Export

func (s *ExportService) Export(ctx context.Context, request *dto.ExportRequest) (*dto.ExportResponse, error)

Export routes the export request to the appropriate entity exporter

type Exporter

type Exporter interface {
	// PrepareData fetches and prepares data for export
	PrepareData(ctx context.Context, request *dto.ExportRequest) ([]byte, int, error)

	// GetFilenamePrefix returns the prefix for the exported file
	GetFilenamePrefix() string
}

Exporter defines the interface for entity-specific exporters

type FeatureUsageCSV

type FeatureUsageCSV struct {
	ID                 string `csv:"id"`
	TenantID           string `csv:"tenant_id"`
	EnvironmentID      string `csv:"environment_id"`
	ExternalCustomerID string `csv:"external_customer_id"`
	CustomerID         string `csv:"customer_id"`
	SubscriptionID     string `csv:"subscription_id"`
	SubLineItemID      string `csv:"sub_line_item_id"`
	PriceID            string `csv:"price_id"`
	MeterID            string `csv:"meter_id"`
	FeatureID          string `csv:"feature_id"`
	EventName          string `csv:"event_name"`
	Source             string `csv:"source"`
	Timestamp          string `csv:"timestamp"`   // RFC3339 format
	IngestedAt         string `csv:"ingested_at"` // RFC3339 format
	PeriodID           string `csv:"period_id"`   // Billing period ID (uint64 as string)
	QtyTotal           string `csv:"qty_total"`   // Total quantity (decimal as string)
	Properties         string `csv:"properties"`  // Event properties as JSON string
	UniqueHash         string `csv:"unique_hash"` // Deduplication hash
}

FeatureUsageCSV represents the CSV structure for feature usage export

type InvoiceCSV

type InvoiceCSV struct {
	ID               string `csv:"id"`
	TenantID         string `csv:"tenant_id"`
	EnvironmentID    string `csv:"environment_id"`
	CustomerID       string `csv:"customer_id"`
	SubscriptionID   string `csv:"subscription_id"`
	InvoiceNumber    string `csv:"invoice_number"`
	InvoiceType      string `csv:"invoice_type"`
	InvoiceStatus    string `csv:"invoice_status"`
	PaymentStatus    string `csv:"payment_status"`
	Currency         string `csv:"currency"`
	AmountDue        string `csv:"amount_due"`        // Decimal as string
	AmountPaid       string `csv:"amount_paid"`       // Decimal as string
	AmountRemaining  string `csv:"amount_remaining"`  // Decimal as string
	Subtotal         string `csv:"subtotal"`          // Decimal as string
	Total            string `csv:"total"`             // Decimal as string
	TotalDiscount    string `csv:"total_discount"`    // Decimal as string
	TotalTax         string `csv:"total_tax"`         // Decimal as string
	AdjustmentAmount string `csv:"adjustment_amount"` // Decimal as string
	RefundedAmount   string `csv:"refunded_amount"`   // Decimal as string
	BillingSequence  string `csv:"billing_sequence"`  // Integer as string
	Description      string `csv:"description"`
	DueDate          string `csv:"due_date"`     // RFC3339 format
	PaidAt           string `csv:"paid_at"`      // RFC3339 format
	VoidedAt         string `csv:"voided_at"`    // RFC3339 format
	FinalizedAt      string `csv:"finalized_at"` // RFC3339 format
	BillingPeriod    string `csv:"billing_period"`
	PeriodStart      string `csv:"period_start"` // RFC3339 format
	PeriodEnd        string `csv:"period_end"`   // RFC3339 format
	InvoicePDFURL    string `csv:"invoice_pdf_url"`
	BillingReason    string `csv:"billing_reason"`
	Metadata         string `csv:"metadata"` // JSON string
	IdempotencyKey   string `csv:"idempotency_key"`
	Version          string `csv:"version"` // Integer as string
	Status           string `csv:"status"`
	CreatedBy        string `csv:"created_by"`
	UpdatedBy        string `csv:"updated_by"`
	CreatedAt        string `csv:"created_at"` // RFC3339 format
	UpdatedAt        string `csv:"updated_at"` // RFC3339 format
}

InvoiceCSV represents the CSV structure for invoice export

type InvoiceExporter

type InvoiceExporter struct {
	// contains filtered or unexported fields
}

InvoiceExporter handles invoice export operations

func NewInvoiceExporter

func NewInvoiceExporter(
	invoiceRepo invoice.Repository,
	integrationFactory *integration.Factory,
	logger *logger.Logger,
) *InvoiceExporter

NewInvoiceExporter creates a new invoice exporter

func (*InvoiceExporter) GetFilenamePrefix

func (e *InvoiceExporter) GetFilenamePrefix() string

GetFilenamePrefix returns the prefix for the exported file

func (*InvoiceExporter) PrepareData

func (e *InvoiceExporter) PrepareData(ctx context.Context, request *dto.ExportRequest) ([]byte, int, error)

PrepareData fetches invoice data in batches and converts it to CSV format

type WalletBalanceGetter added in v1.0.47

type WalletBalanceGetter interface {
	GetWalletBalanceV2(ctx context.Context, walletID string) (*dto.WalletBalanceResponse, error)
}

WalletBalanceGetter is an interface for getting wallet balance This avoids import cycle with service package

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL