@php( $headerOption = \App\Http\Controllers\Controller::getHeaderOptions( '', $subTitle ?? '' ) ) @php($headingOptions = [ ' Merchants', ]) @extends('admin.layouts.layout', $headerOption) @section('content')
{{-- Validation errors --}} @if($errors->any())
{{ $errors->first() }}
@endif {{-- Date range form --}}
Run TSYS Transaction Sync
@csrf

Syncs TSYS transaction reports for all type-2 merchants with a valid MID. This may take several minutes depending on the number of merchants and the date range.

@if(!empty($ran)) {{-- Status banner --}} @if(!empty($result)) @php($summary = $result['summary']) @if($summary['failed'] === 0)
Sync completed successfully — {{ $summary['successful'] }} merchant(s) processed.
@elseif($summary['successful'] === 0)
Sync failed — all {{ $summary['failed'] }} merchant(s) encountered errors.
@else
Sync completed with partial failures — {{ $summary['successful'] }} succeeded, {{ $summary['failed'] }} failed.
@endif @else
Command exited with code {{ $exitCode }}.
@endif {{-- Summary KPI cards --}} @if(!empty($result)) @php($summary = $result['summary']) @php($dbSaved = 0) @php(preg_match('/DB records saved\/updated:\s*(\d+)/', $output ?? '', $dbMatch)) @php($dbSaved = isset($dbMatch[1]) ? (int)$dbMatch[1] : 0)
Date Range
{{ $result['date_range']['from'] }} → {{ $result['date_range']['to'] }}
Total Merchants
{{ number_format($summary['total']) }}
Successful
{{ number_format($summary['successful']) }}
Failed
{{ number_format($summary['failed']) }}
DB Records Saved / Updated
{{ number_format($dbSaved) }}
@endif {{-- Per-merchant results table --}} @if(!empty($result['merchants']))
Per-Merchant Results
@foreach($result['merchants'] as $m) @php($hasError = !empty($m['error']) || $m['key_status'] === 'failed') @endforeach
Merchant ID MID DBA Device ID Key Status Reports Status
{{ $m['merchant_id'] }} {{ $m['mid'] }} {{ $m['dba'] ?? '—' }} {{ $m['device_id'] ?? '—' }} @if($m['key_status'] === 'success') Success @elseif($m['key_status'] === 'failed') Failed @else {{ $m['key_status'] }} @endif @if(!empty($m['reports'])) @php($reportOk = collect($m['reports'])->where('status', 'success')->count()) @php($reportErr = collect($m['reports'])->where('status', 'error')->count()) @php($reportTotal = count($m['reports'])) {{ $reportOk }}/{{ $reportTotal }} OK @if($reportErr > 0) {{ $reportErr }} err @endif @else @endif @if($hasError) {{ $m['error'] ?? 'Key generation failed' }} @else OK @endif
@endif {{-- Collapsible raw output --}}
Raw Command Output
{{ $output ?? '' }}
@endif {{-- end ran --}}
@endsection @push('page_script') @endpush