我的应用程序Symfony 2.5有问题。我想整合Paypal Express结账但获取信息:
PayPal-Response was not successful: Debug-Token: 27b2ab3a5b382 10419: Express Checkout PayerID is missing. (Express Checkout PayerID is missing.)10406: Transaction refused because of an invalid argument. See a`enter code here`dditional error messages for details. (The PayerID value is invalid.)
我正在使用Paypal Sandbox帐户。我创建了App,然后我去了Account Details / API Credentials并复制到app / config.yml用户名,密码和签名。交易数据将保存到订单和付款表中。 控制器" / orders / 8 / payment / create"也会出现错误"用户必须授权交易"。但重新加载页面后,我上面会闪烁。
config.yml
jms_payment_core:
encryption:
secret: def00000093fb9f5f5b2c8657099xxxxxxxxxxxxxxxxxxxxec66409b58b5ee91e0be53f836bb05ea6c91aeaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
jms_payment_paypal:
username: poczta-facilitator_api1.xxxxx.pl
password: KVGAQBAxxxxxxxxxxxxxx
signature: Aaose356mD-hOFG7cGBTPyxxxxxxxxxxxxxxxxxx
return_url: https://xxxxxxx
cancel_url: https://xxxxxxx
debug: true

OrdersController.php
<?php
namespace Adevo\AdminBundle\Controller;
use JMS\Payment\CoreBundle\Form\ChoosePaymentMethodType;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use JMS\Payment\CoreBundle\PluginController\Result;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
use Adevo\AdminBundle\Entity\Order;
/**
* @Route("/orders")
*/
class OrdersController extends Controller {
/**
* @Route(
* "/new/{amount}"
* )
*/
public function newAction($amount) {
$em = $this->getDoctrine()->getManager();
$order = new Order($amount);
$em->persist($order);
$em->flush();
return $this->redirect($this->generateUrl('app_orders_show', [
'id' => $order->getId(),
]));
}
/**
* @Route("/{id}/show",
* name="app_orders_show"
* )
* @Template
*/
public function showAction(Request $request, Order $order) {
$form = $this->createForm('jms_choose_payment_method', null, [
'amount' => $order->getAmount(),
'currency' => 'EUR',
'default_method' => 'payment_paypal', // Optional
// 'predefined_data' => array(
// 'paypal_express_checkout' => array(
// 'return_url' => $this->router->generate('payment_complete', array(
// 'orderNumber' => $order->getOrderNumber(),
// ), true),
// 'cancel_url' => $this->router->generate('payment_cancel', array(
// 'orderNumber' => $order->getOrderNumber(),
// ), true)
// ),
// ),
]);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$ppc = $this->get('payment.plugin_controller');
$ppc->createPaymentInstruction($instruction = $form->getData());
$order->setPaymentInstruction($instruction);
$em = $this->getDoctrine()->getManager();
$em->persist($order);
$em->flush($order);
return $this->redirect($this->generateUrl('app_orders_paymentcreate', [
'id' => $order->getId(),
]));
}
return [
'order' => $order,
'form' => $form->createView(),
];
}
private function createPayment($order) {
$instruction = $order->getPaymentInstruction();
$pendingTransaction = $instruction->getPendingTransaction();
if ($pendingTransaction !== null) {
return $pendingTransaction->getPayment();
}
$ppc = $this->get('payment.plugin_controller');
$amount = $instruction->getAmount() - $instruction->getDepositedAmount();
return $ppc->createPayment($instruction->getId(), $amount);
}
/**
* @Route("/{id}/payment/create",
* name="app_orders_paymentcreate"
* )
*
*/
public function paymentCreateAction(Order $order) {
$payment = $this->createPayment($order);
$ppc = $this->get('payment.plugin_controller');
$result = $ppc->approveAndDeposit($payment->getId(), $payment->getTargetAmount());
if ($result->getStatus() === Result::STATUS_SUCCESS) {
return $this->redirect($this->generateUrl('app_orders_paymentcomplete', [
'id' => $order->getId(),
]));
}
throw $result->getPluginException();
//return new Response('Payment not complete');
// In a real-world application you wouldn't throw the exception. You would,
// for example, redirect to the showAction with a flash message informing
// the user that the payment was not successful.
}
/**
* @Route("/{id}/payment/complete",
* name="app_orders_paymentcomplete"
* )
*
*/
public function paymentCompleteAction(Order $order) {
return new Response('Payment complete');
}
}
&#13;
Order.php - &gt;实体
<?php
namespace Adevo\AdminBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use JMS\Payment\CoreBundle\Entity\PaymentInstruction;
/**
* @ORM\Table(name="orders")
* @ORM\Entity
*/
class Order
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/** @ORM\OneToOne(targetEntity="JMS\Payment\CoreBundle\Entity\PaymentInstruction") */
private $paymentInstruction;
/** @ORM\Column(type="decimal", precision=10, scale=5) */
private $amount;
public function __construct($amount)
{
$this->amount = $amount;
}
public function getId()
{
return $this->id;
}
public function getAmount()
{
return $this->amount;
}
public function getPaymentInstruction()
{
return $this->paymentInstruction;
}
public function setPaymentInstruction(PaymentInstruction $instruction)
{
$this->paymentInstruction = $instruction;
}
}
&#13;
Logs - 1 error
INFO - Matched route "app_orders_paymentcreate" (parameters: "_controller": "Adevo\AdminBundle\Controller\OrdersController::paymentCreateAction", "id": "12", "_route": "app_orders_paymentcreate")
DEBUG - Read SecurityContext from the session
DEBUG - Reloading user from user provider.
DEBUG - SELECT t0.id AS id_1, t0.google_id AS google_id_2, t0.username AS username_3, t0.name AS name_4, t0.surname AS surname_5, t0.description AS description_6, t0.email AS email_7, t0.password AS password_8, t0.account_non_expired AS account_non_expired_9, t0.account_non_locked AS account_non_locked_10, t0.credentials_non_expired AS credentials_non_expired_11, t0.enabled AS enabled_12, t0.roles AS roles_13, t0.action_token AS action_token_14, t0.register_date AS register_date_15, t0.avatar AS avatar_16, t0.updateDate AS updateDate_17 FROM users t0 WHERE t0.id = ?
DEBUG - Username "tomek" was reloaded from user provider.
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener::injectLogger".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener::injectLogger".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener::injectLogger".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\FragmentListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Knp\Bundle\PaginatorBundle\Subscriber\SlidingPaginationSubscriber::onKernelRequest".
DEBUG - SELECT t0.id AS id_1, t0.amount AS amount_2, t0.paymentInstruction_id AS paymentInstruction_id_3 FROM orders t0 WHERE t0.id = ?
DEBUG - Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController".
DEBUG - SELECT t0.amount AS amount_1, t0.approved_amount AS approved_amount_2, t0.approving_amount AS approving_amount_3, t0.created_at AS created_at_4, t0.credited_amount AS credited_amount_5, t0.crediting_amount AS crediting_amount_6, t0.currency AS currency_7, t0.deposited_amount AS deposited_amount_8, t0.depositing_amount AS depositing_amount_9, t0.extended_data AS extended_data_10, t0.payment_system_name AS payment_system_name_11, t0.reversing_approved_amount AS reversing_approved_amount_12, t0.reversing_credited_amount AS reversing_credited_amount_13, t0.reversing_deposited_amount AS reversing_deposited_amount_14, t0.state AS state_15, t0.updated_at AS updated_at_16, t0.id AS id_17 FROM payment_instructions t0 WHERE t0.id = ?
DEBUG - SELECT t0.approved_amount AS approved_amount_1, t0.approving_amount AS approving_amount_2, t0.credited_amount AS credited_amount_3, t0.crediting_amount AS crediting_amount_4, t0.deposited_amount AS deposited_amount_5, t0.depositing_amount AS depositing_amount_6, t0.expiration_date AS expiration_date_7, t0.reversing_approved_amount AS reversing_approved_amount_8, t0.reversing_credited_amount AS reversing_credited_amount_9, t0.reversing_deposited_amount AS reversing_deposited_amount_10, t0.state AS state_11, t0.target_amount AS target_amount_12, t0.attention_required AS attention_required_13, t0.expired AS expired_14, t0.created_at AS created_at_15, t0.updated_at AS updated_at_16, t0.id AS id_17, t0.payment_instruction_id AS payment_instruction_id_18 FROM payments t0 WHERE t0.payment_instruction_id = ?
DEBUG - SELECT t0.attention_required AS attention_required_1, t0.created_at AS created_at_2, t0.credited_amount AS credited_amount_3, t0.crediting_amount AS crediting_amount_4, t0.reversing_amount AS reversing_amount_5, t0.state AS state_6, t0.target_amount AS target_amount_7, t0.updated_at AS updated_at_8, t0.id AS id_9, t0.payment_instruction_id AS payment_instruction_id_10, t0.payment_id AS payment_id_11 FROM credits t0 WHERE t0.payment_instruction_id = ?
DEBUG - SELECT t0.amount AS amount_1, t0.approved_amount AS approved_amount_2, t0.approving_amount AS approving_amount_3, t0.created_at AS created_at_4, t0.credited_amount AS credited_amount_5, t0.crediting_amount AS crediting_amount_6, t0.currency AS currency_7, t0.deposited_amount AS deposited_amount_8, t0.depositing_amount AS depositing_amount_9, t0.extended_data AS extended_data_10, t0.payment_system_name AS payment_system_name_11, t0.reversing_approved_amount AS reversing_approved_amount_12, t0.reversing_credited_amount AS reversing_credited_amount_13, t0.reversing_deposited_amount AS reversing_deposited_amount_14, t0.state AS state_15, t0.updated_at AS updated_at_16, t0.id AS id_17 FROM payment_instructions t0 WHERE t0.id = ? LIMIT 1
DEBUG - "START TRANSACTION"
DEBUG - INSERT INTO payments (approved_amount, approving_amount, credited_amount, crediting_amount, deposited_amount, depositing_amount, expiration_date, reversing_approved_amount, reversing_credited_amount, reversing_deposited_amount, state, target_amount, attention_required, expired, created_at, updated_at, payment_instruction_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
DEBUG - "COMMIT"
DEBUG - "START TRANSACTION"
DEBUG - SELECT t0.approved_amount AS approved_amount_1, t0.approving_amount AS approving_amount_2, t0.credited_amount AS credited_amount_3, t0.crediting_amount AS crediting_amount_4, t0.deposited_amount AS deposited_amount_5, t0.depositing_amount AS depositing_amount_6, t0.expiration_date AS expiration_date_7, t0.reversing_approved_amount AS reversing_approved_amount_8, t0.reversing_credited_amount AS reversing_credited_amount_9, t0.reversing_deposited_amount AS reversing_deposited_amount_10, t0.state AS state_11, t0.target_amount AS target_amount_12, t0.attention_required AS attention_required_13, t0.expired AS expired_14, t0.created_at AS created_at_15, t0.updated_at AS updated_at_16, t0.id AS id_17, t0.payment_instruction_id AS payment_instruction_id_18 FROM payments t0 WHERE t0.id = ? FOR UPDATE
DEBUG - SELECT t0.extended_data AS extended_data_1, t0.processed_amount AS processed_amount_2, t0.reason_code AS reason_code_3, t0.reference_number AS reference_number_4, t0.requested_amount AS requested_amount_5, t0.response_code AS response_code_6, t0.state AS state_7, t0.created_at AS created_at_8, t0.updated_at AS updated_at_9, t0.tracking_id AS tracking_id_10, t0.transaction_type AS transaction_type_11, t0.id AS id_12, t0.credit_id AS credit_id_13, t0.payment_id AS payment_id_14 FROM financial_transactions t0 WHERE t0.payment_id = ?
DEBUG - INSERT INTO financial_transactions (extended_data, processed_amount, reason_code, reference_number, requested_amount, response_code, state, created_at, updated_at, tracking_id, transaction_type, credit_id, payment_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
DEBUG - UPDATE payment_instructions SET approving_amount = ?, depositing_amount = ?, extended_data = ?, updated_at = ? WHERE id = ?
DEBUG - UPDATE payments SET approving_amount = ?, depositing_amount = ?, state = ?, updated_at = ? WHERE id = ?
DEBUG - "COMMIT"
CRITICAL - Uncaught PHP Exception JMS\Payment\CoreBundle\Plugin\Exception\ActionRequiredException: "User must authorize the transaction." at /home/users/adevo/public_html/babayaga.adevo.pl/vendor/jms/payment-paypal-bundle/JMS/Payment/PaypalBundle/Plugin/ExpressCheckoutPlugin.php line 303
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener::injectLogger".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener::injectLogger".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener::injectLogger".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\FragmentListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Knp\Bundle\PaginatorBundle\Subscriber\SlidingPaginationSubscriber::onKernelRequest".
DEBUG - Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController".
WARNING - Defining the initRuntime() method in the "form" extension is deprecated since version 1.23. Use the `needs_environment` option to get the Twig_Environment instance in filters, functions, or tests; or explicitly implement Twig_Extension_InitRuntimeInterface if needed (not recommended).
WARNING - Defining the initRuntime() method in the "adevo_news_extension" extension is deprecated since version 1.23. Use the `needs_environment` option to get the Twig_Environment instance in filters, functions, or tests; or explicitly implement Twig_Extension_InitRuntimeInterface if needed (not recommended).
WARNING - Defining the initRuntime() method in the "adevo_admin_extension" extension is deprecated since version 1.23. Use the `needs_environment` option to get the Twig_Environment instance in filters, functions, or tests; or explicitly implement Twig_Extension_InitRuntimeInterface if needed (not recommended).
&#13;
答案 0 :(得分:1)