$contract * @param array $sourceMetadata */ public function __construct( public string $canonicalType, public CaptureOutcome $outcome, public ?string $contractKey = null, public ?string $sourceEndpoint = null, public string $sourceVersion = 'v1.0', public ?string $sourceSchemaHash = null, public ?string $reasonCode = null, public array $contract = [], public array $sourceMetadata = [], ) {} public function capturable(): bool { return $this->outcome === CaptureOutcome::Captured && is_string($this->contractKey) && $this->contractKey !== '' && is_string($this->sourceEndpoint) && $this->sourceEndpoint !== ''; } }