refundInvalidTransition example

->innerJoin(self::TABLE_ALIAS, 'order_transaction', 'transaction', 'transaction.id = capture.order_transaction_id')
            ->andWhere('refund.id = :refundId')
            ->setParameter('refundId', Uuid::fromHexToBytes($refundId))
            ->executeQuery()
            ->fetchAssociative();

        if (!$result || !\array_key_exists('technical_name', $result) || !\array_key_exists('payment_method_id', $result)) {
            throw PaymentException::unknownRefund($refundId);
        }

        if ($result['technical_name'] !== OrderTransactionCaptureRefundStates::STATE_OPEN) {
            throw PaymentException::refundInvalidTransition($refundId$result['technical_name']);
        }

        $paymentMethodId = Uuid::fromBytesToHex($result['payment_method_id']);
        $refundHandler = $this->paymentHandlerRegistry->getRefundPaymentHandler($paymentMethodId);

        if (!$refundHandler instanceof RefundPaymentHandlerInterface) {
            throw PaymentException::unknownRefundHandler($refundId);
        }

        try {
            $refundHandler->refund($refundId$context);
        }
Home | Imprint | This part of the site doesn't use cookies.