- {{ __('ID') }} {{ $merchant->merchant_key ?: __('Pending') }}
- {{ __('Gateways') }} {{ $gatewayCount }}
- {{ __('Fee') }} {{ number_format((float) ($merchant->fee ?? 0), 2) }}%
@extends('frontend.layouts.user.index') @section('title', __('Merchants')) @push('styles') @endpush @section('content') @php $walletCurrencyCodes = collect($walletCurrencyCodes ?? []) ->map(fn ($code): string => strtoupper((string) $code)) ->filter() ->unique() ->values(); $currencyCodesFor = function ($merchant) { $codes = $merchant->supportedCurrencies->pluck('code'); if ($codes->isEmpty() && $merchant->currency?->code) { $codes = collect([$merchant->currency->code]); } return $codes ->map(fn ($code): string => strtoupper((string) $code)) ->filter() ->unique() ->values(); }; $gatewayCountFor = function ($merchant) use ($currencyCodesFor, $walletCurrencyCodes): int { $walletReadyCodes = $currencyCodesFor($merchant)->intersect($walletCurrencyCodes)->values(); return $merchant->paymentMethods ->filter(fn (\App\Models\DepositMethod $method): bool => (bool) $method->status && $method->type === \App\Enums\MethodType::AUTOMATIC && $walletReadyCodes->contains(strtoupper((string) $method->currency))) ->count(); }; $approvedCount = $merchants->filter(fn ($merchant) => $merchant->status === \App\Enums\MerchantStatus::APPROVED)->count(); $pendingCount = $merchants->filter(fn ($merchant) => $merchant->status === \App\Enums\MerchantStatus::PENDING)->count(); $currencyCodes = $merchants ->flatMap(fn ($merchant) => $currencyCodesFor($merchant)) ->filter() ->unique() ->values(); $walletReadyCurrencyCodes = $currencyCodes->intersect($walletCurrencyCodes)->values(); $statusInsightFor = function ($merchant, int $gatewayCount, $missingWalletCodes): array { if ($merchant->status === \App\Enums\MerchantStatus::PENDING) { return [ 'tone' => 'warning', 'icon' => 'fa-hourglass-half', 'label' => __('Under admin review'), 'detail' => __('Production unlocks after approval.'), ]; } if ($merchant->status === \App\Enums\MerchantStatus::DISABLED) { return [ 'tone' => 'danger', 'icon' => 'fa-ban', 'label' => __('Shop disabled'), 'detail' => __('Payments and live API are paused.'), ]; } if ($merchant->status === \App\Enums\MerchantStatus::REJECTED) { return [ 'tone' => 'danger', 'icon' => 'fa-circle-xmark', 'label' => __('Review rejected'), 'detail' => __('Update profile or contact support.'), ]; } if ($missingWalletCodes->isNotEmpty()) { return [ 'tone' => 'warning', 'icon' => 'fa-wallet', 'label' => __('Wallet missing'), 'detail' => __('Activate :currencies wallet before checkout.', ['currencies' => $missingWalletCodes->implode(', ')]), ]; } if ($gatewayCount < 1) { return [ 'tone' => 'warning', 'icon' => 'fa-credit-card', 'label' => __('Gateway missing'), 'detail' => __('Select a matching gateway in API config.'), ]; } return [ 'tone' => 'success', 'icon' => 'fa-circle-check', 'label' => __('Ready for payments'), 'detail' => __('Wallet, API, and gateway are ready.'), ]; }; @endphp
{{ __('Create a merchant once, select supported wallet currencies, then connect payment links or API checkout after approval.') }}