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_\App\Entity\Payment" 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:
Relevant snippets:
payum.yaml
payum:
storages:
App\Entity\Payment: { doctrine: orm }
security:
token_storage:
App\Entity\PaymentToken: { doctrine: orm }
gateways: [...]
Entity\Payment
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Payum\Core\Model\Payment as BasePayment;
/**
* @ORM\Table
* @ORM\Entity
*/
class Payment extends BasePayment
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*
* @var integer $id
*/
protected $id;
}
Entity\PaymentToken
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Payum\Core\Model\Token;
/**
* @ORM\Table
* @ORM\Entity
*/
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: 'App\Entity'
alias: App
dql:
numeric_functions:
Rand: App\DQL\RandFunction
Snippet to create the payment
$storage = $this->payum->getStorage('App\Entity\Payment');
$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!
okay it seems like there was a problem with a relation to the payment entity. I had another entity which had an many-to-one relation with the payment entity. By removing it and acting the payment entity without any relations it worked just fine...
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
Symfony compares favorably with other PHP frameworks in terms of reliability and maturity. This framework appeared a long time ago, in 2005, that is, it has existed much longer than most of the other tools we are considering. It is popular for its web standards compliance and PHP design patterns.
https://symfony.com/
Welcome to the Q&A site for web developers. Here you can ask a question about the problem you are facing and get answers from other experts. We have created a user-friendly interface so that you can quickly and free of charge ask a question about a web programming problem. We also invite other experts to join our community and help other members who ask questions. In addition, you can use our search for questions with a solution.
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.