Skip to content

Error when calling capture method #522

@tsdevelopment

Description

@tsdevelopment

When I install the bundle with a fresh Symfony 5.2 installation I got the following error:

Attempted to load class "MergeQuery" from namespace "League\Uri\Modifiers".
Did you forget a "use" statement for another namespace?

My configuration:

payum:
    storages:
        App\Entity\Payment: { doctrine: orm }

    security:
        token_storage:
            App\Entity\PaymentToken: { doctrine: orm }

    gateways:
        paypal_express_checkout:
            factory: paypal_express_checkout
            username: ****
            password: ****
            signature: ****
<?php

namespace App\Controller;

use App\Entity\Payment;
use Payum\Core\Payum;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

class PaymentController extends AbstractController
{
    private Payum $payum;

    public function __construct(Payum $payum)
    {
        $this->payum = $payum;
    }

    #[Route('/payment', name: 'payment')]
    public function index(): Response
    {
        $storage = $this->payum->getStorage(Payment::class);

        /** @var Payment $payment */
        $payment = $storage->create();
        $payment->setNumber(uniqid());
        $payment->setCurrencyCode('EUR');
        $payment->setTotalAmount(123); // 1.23 EUR
        $payment->setDescription('A description');
        $payment->setClientId('anId');
        $payment->setClientEmail('foo@example.com');

        $storage->update($payment);

        $captureToken = $this->payum->getTokenFactory()->createCaptureToken(
            'paypal_express_checkout',
            $payment,
            'done' // the route to redirect after capture
        );

        return $this->redirect($captureToken->getTargetUrl());
    }
}

Seems to be a problem with the https://github.com/thephpleague/uri package that is used in payum/payumb/c the packages changed and moved the methodes in it's own packages. Currently the bundle is not useable :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions