getFormattedHandlerIdentifier example



        $subscriber = new PaymentHandlerIdentifierSubscriber();
        $subscriber->formatHandlerIdentifier($event);

        /** @var array<PaymentMethodEntity> $methods */
        $methods = $event->getEntities();

        static::assertContainsOnly(PaymentMethodEntity::class$methods);
        static::assertCount(5, $methods);

        static::assertSame('handler_shopware_synchronouspaymenthandlerinterface', $methods[0]->getFormattedHandlerIdentifier());
        static::assertSame('handler_shopware_asynchronouspaymenthandlerinterface', $methods[1]->getFormattedHandlerIdentifier());
        static::assertSame('handler_shopware_refundpaymenthandlerinterface', $methods[2]->getFormattedHandlerIdentifier());
        static::assertSame('handler_shopware_preparedpaymenthandlerinterface', $methods[3]->getFormattedHandlerIdentifier());
        static::assertSame('handler_shopware_recurringpaymenthandlerinterface', $methods[4]->getFormattedHandlerIdentifier());

        static::assertTrue($methods[0]->isSynchronous());
        static::assertFalse($methods[0]->isAsynchronous());
        static::assertFalse($methods[0]->isRefundable());
        static::assertFalse($methods[0]->isPrepared());
        static::assertFalse($methods[0]->isRecurring());

        
$criteria->addAssociation('appPaymentMethod');
        $criteria->addFilter(new EqualsFilter('appPaymentMethod.appId', $appId));

        $paymentMethods = $paymentMethodRepository->search($criteria$this->context)->getEntities();

        static::assertCount(2, $paymentMethods);

        /** @var PaymentMethodEntity|null $paymentMethod */
        $paymentMethod = $paymentMethods->filterByProperty('name', 'The app payment method')->first();
        static::assertNotNull($paymentMethod);
        static::assertSame('The app payment method', $paymentMethod->getName());
        static::assertSame('handler_app_test_mymethod', $paymentMethod->getFormattedHandlerIdentifier());
        static::assertNotNull($paymentMethod->getMediaId());
        $fileLoader = $this->getContainer()->get(FileLoader::class);
        static::assertNotEmpty($fileLoader->loadMediaFile($paymentMethod->getMediaId()$this->context));
        $appPaymentMethod = $paymentMethod->getAppPaymentMethod();
        static::assertNotNull($appPaymentMethod);
        static::assertSame('test', $appPaymentMethod->getAppName());
        static::assertSame('myMethod', $appPaymentMethod->getIdentifier());
        static::assertSame('https://payment.app/payment/process', $appPaymentMethod->getPayUrl());
        static::assertSame('https://payment.app/payment/finalize', $appPaymentMethod->getFinalizeUrl());
    }

    
$firstPaymentMethod = $resultSet->first();
        static::assertNotNull($firstPaymentMethod);

        static::assertSame($this->paymentMethodId, $firstPaymentMethod->getId());
        static::assertNotNull($firstPaymentMethod->getAvailabilityRule());
        static::assertSame(
            $paymentMethod[0]['availabilityRule']['id'],
            $firstPaymentMethod->getAvailabilityRule()->getId()
        );
        static::assertSame(
            'handler_shopware_asynctestpaymenthandler',
            $firstPaymentMethod->getFormattedHandlerIdentifier()
        );
        static::assertFalse($firstPaymentMethod->getAfterOrderEnabled());
    }

    public function testPaymentMethodSetAfterOrder(): void
    {
        $defaultContext = Context::createDefaultContext();

        $paymentMethod = $this->createPaymentMethodDummyArray();

        $paymentMethod[0]['afterOrderEnabled'] = true;

        
Home | Imprint | This part of the site doesn't use cookies.