Operational Integrations – Acumatica Financial Sync

A daily console command synchronizes Prep Network’s event financials with Acumatica. It builds time-bounded reports, pushes Cash Sale and Journal Transaction entries, and supports both Stripe-powered transactions and database-sourced ticket/attendee counts.


⚙️ Command Configuration

The AcumaticaSync command is defined in app/Console/Commands/AcumaticaSync.php:

Property Value
Signature acumatica:sync {date?} {--event=*} – Optionally sync a specific date or event IDs
Description Send daily event transactions to Acumatica; supports filtering by event IDs.

It’s scheduled to run every night at 2 AM via routes/console.php:

Schedule::command('acumatica:sync')
    ->dailyAt('2:00')
    ->sentryMonitor()
    ->onOneServer();

📅 Overall Workflow

flowchart TD
  A[Set Date Range] --> B[Sync Event Templates]
  B --> C[Create Daily Cash Sales]
  C --> D{Is Today the 1st?}
  D -->|No| E[Logout & Finish]
  D -->|Yes| F[Create Monthly ACH Sales]
  F --> G[Create Monthly Journal Entries]
  G --> E
  1. Set Date Range: Determine the report date, plus start/end timestamps .
  2. Sync Event Templates: Create/update Acumatica projects for upcoming events .
  3. Daily Cash Sales: Pull Stripe charges/refunds; batch by event and revenue type; push Cash Sale entries .
  4. Monthly ACH Sales (1st of month): Search Stripe for ACH payments; push Cash Sale entries for prior month .
  5. Monthly Journal Entries (1st of month):
    • Gate Tickets via AttendanceTicket counts
    • Showcase Attendees via Attendee counts
      and post Journal Transaction entries .
  6. Logout & Finish: End Acumatica session and report errors if any.

🔑 Core Classes & Methods

AcumaticaSync (Console Command)

class AcumaticaSync extends Command
{
    protected $signature = 'acumatica:sync {date?} {--event=*}';
    protected $description = 'Send daily event transactions to Acumatica.';

    private DateTime      $date;
    private string        $startDate;
    private string        $endDate;
    private array         $eventIds;
    private Client        $client;
    private ?string       $token;
    private StripeClient  $stripe;

    public function __construct() { /* init Guzzle & Stripe  */ }
    public function handle(): void { /* main workflow  */ }

    private function setDate(): DateTime     { /* yesterday or arg  */ }
    private function setStartDate(): string  { /* midnight CDT  */ }
    private function setEndDate(): string    { /* 23:59:59 CDT  */ }
    public  function generateToken(): string { /* Acumatica OAuth2  */ }

    private function syncEvents(): void       { /* loop upcoming events  */ }
    private function syncEventTemplate(Event $e): object { /* PUT /Project */ }

    private function dailyCashSale(): void    { /* fetch & batch Stripe; PUT /CashSale  */ }
    private function getTransactions(): array { /* PaymentIntent & Refund grouping  */ }

    public  function monthlyACHSales(): void { /* search Stripe, filter ACH, PUT /CashSale  */ }
    public  function createMonthlyJournalEntries(): void {
        /* build Details from AttendanceTicket & Attendee; PUT /JournalTransaction  */
    }

    // Helpers
    private function getAccount(string $brand, string $type, string $payment): string { /* map accounts  */ }
    private function getSubAccount(string $state): string                             { /* map state codes  */ }
    private function getTask(string $paymentType): string                             { /* map tasks  */ }
    private function getTemplate(string $brand, string $eventType): string            { /* select Acumatica template  */ }
    private function getBrandAbbreviation(string $brand): string                      { /* shorten brand names */ }
}

🔗 Dependencies & Configuration

  • Guzzle HTTP for Acumatica API calls
  • Stripe PHP SDK for transaction retrieval
  • Hard-coded Acumatica credentials in code – consider moving to .env!
  • Models: Event, Payment, AttendanceTicket, Attendee, Invoice
  • Mail: AcumaticaErrorReportMail for error alerts
{
  "title": "Security Warning",
  "content": "Credentials are hard-coded in `AcumaticaSync`; move to environment variables for safety."
}

🚀 Usage

Run manually or rely on scheduler:

# Sync yesterday's transactions for all events
php artisan acumatica:sync

# Sync for a specific date or event IDs
php artisan acumatica:sync 2025-11-11 --event=12 --event=34

✨ This integration ensures Prep Network’s event financials remain in sync with Acumatica, automating daily revenue posting and monthly reconciliations.