You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
virt/web/app/Services/Payment/PaymentOrderCreationExcepti...

36 lines
1.0 KiB
PHP

<?php
namespace App\Services\Payment;
/** Classified outcome of one non-idempotent provider order submission. */
final class PaymentOrderCreationException extends \RuntimeException
{
public bool $effectMayHaveApplied;
public bool $safeToResubmit;
public string $failureCode;
private function __construct(string $message, string $failureCode,
bool $effectMayHaveApplied, bool $safeToResubmit)
{
parent::__construct($message);
$this->failureCode = $failureCode;
$this->effectMayHaveApplied = $effectMayHaveApplied;
$this->safeToResubmit = $safeToResubmit;
}
public static function rejected(string $message): self
{
return new self($message, 'payment_order_rejected', false, true);
}
public static function notDispatched(string $message): self
{
return new self($message, 'payment_order_not_dispatched', false, true);
}
public static function unknown(string $message): self
{
return new self($message, 'payment_creation_unknown', true, false);
}
}