<?php

declare (strict_types=1);
namespace DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Service\Ucp\Checkout\Payment\Processor;

use WC_Order;
use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Service\Ucp\Checkout\Payment\PaymentHandlerInterface;
use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Service\Ucp\Checkout\Payment\PaymentResult;
/**
 * Mock payment processor for testing.
 */
final class MockPaymentProcessor implements PaymentHandlerInterface
{
    public function supports(string $handler_id): bool
    {
        return $handler_id === 'mock_payment_handler';
    }
    public function process(WC_Order $order, array $instrument): PaymentResult
    {
        $token = $instrument['credential']['token'] ?? '';
        if ('fail_token' === $token) {
            return PaymentResult::failed('Simulated payment failure');
        }
        return PaymentResult::success('mock_txn_' . \time());
    }
}
