Symfony Payum Bundle: Storage Extension for "Proxies__CG__AppEntityPayment" is registered to the gateway

  doctrine, doctrine-odm, payum, php, symfony

for many hours I am searching for a solution for following bug:

I want to perform a payment with a gateway (stripe and paypal + offline for testing) but everytime I want to open the capture link I get following exception:

Request Capture{model: Identity} is not supported. Make sure the storage extension for "Proxies_CG_AppEntityPayment" is registered to the gateway. Make sure the storage find method returns an instance by id "1". Make sure the gateway supports the requests and there is an action which supports this request (The method returns true). There may be a bug, so look for a related issue on the issue tracker.

I have following configuration:

  • PHP 7.4
  • payum/payum-bundle v2.4
  • symfony 5.2.3

Relevant snippets:

payum.yaml

payum:
    storages:
        AppEntityPayment: { doctrine: orm }

    security:
        token_storage:
            AppEntityPaymentToken: { doctrine: orm }

    gateways: [...]

EntityPayment

<?php

namespace AppEntity;

use DoctrineORMMapping as ORM;
use PayumCoreModelPayment as BasePayment;

/**
 * @ORMTable
 * @ORMEntity
 */
class Payment extends BasePayment
{
    /**
     * @ORMColumn(name="id", type="integer")
     * @ORMId
     * @ORMGeneratedValue(strategy="IDENTITY")
     *
     * @var integer $id
     */
    protected $id;
}

EntityPaymentToken

<?php

namespace AppEntity;

use DoctrineORMMapping as ORM;
use PayumCoreModelToken;

/**
 * @ORMTable
 * @ORMEntity
 */
class PaymentToken extends Token
{

}

doctrine.yaml (config/packages)

doctrine:
    dbal:
        url: '%env(resolve:DATABASE_URL)%'

        # IMPORTANT: You MUST configure your server version,
        # either here or in the DATABASE_URL env var (see .env file)
        #server_version: '5.7'
    orm:
        auto_generate_proxy_classes: true
        naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
        auto_mapping: true
        mappings:
            App:
                is_bundle: false
                type: annotation
                dir: '%kernel.project_dir%/src/Entity'
                prefix: 'AppEntity'
                alias: App
        dql:
            numeric_functions:
                Rand: AppDQLRandFunction

Snippet to create the payment

$storage = $this->payum->getStorage('AppEntityPayment');

$payment = $storage->create();
$payment->setNumber(uniqid());
$payment->setCurrencyCode('EUR');
$payment->setDescription('[...]');
$payment->setClientId($user->getId());
$payment->setClientEmail($user->getEmail());

$storage->update($payment);

$captureToken = $this->payum->getTokenFactory()->createCaptureToken(
    'offline',
    $payment,
    'index'
);

and by Opening the capture URL ($capureToken->getTargetURL()) I get the exception from above. I tried different solutions from other stackoverflow-posts like clearing the cache, warmup with no-dev and other methods but nothing worked. I followed the (in some cases horrible) documentation of payum and the bundle many times with exact the same snippets but without any results.

I just hope that someone here can help me, otherwise I’m kinda screwed up.

Thank you!

Source: Ask PHP

LEAVE A COMMENT