<?php

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

/**
 * Standardized result of a payment processing operation.
 */
final class PaymentResult
{
    private bool $success;
    private ?string $error;
    private string $transaction_id;
    private function __construct(bool $success, string $transaction_id = '', ?string $error = null)
    {
        $this->success = $success;
        $this->transaction_id = $transaction_id;
        $this->error = $error;
    }
    public static function success(string $transaction_id): self
    {
        return new self(\true, $transaction_id);
    }
    public static function failed(string $error): self
    {
        return new self(\false, '', $error);
    }
    public function is_success(): bool
    {
        return $this->success;
    }
    public function get_error(): ?string
    {
        return $this->error;
    }
    public function get_transaction_id(): string
    {
        return $this->transaction_id;
    }
}
