2014-01-21 65 views
1

我在symfony2中配置PayumBundle但不工作:)PayumBundle安全标头无效

我没有重定向到贝宝网站。

我得到错误 - '错误','付款失败',我可以找到一些信息?

更新1

我foud错误:在的var_dump($状态)

'L_SHORTMESSAGE0'=>字符串 '安全性错误'(长度= 14) 'L_LONGMESSAGE0'=>字符串“Security头是无效'(长度= 28)

当我关闭在配置沙箱im重定向到贝宝,但我没有填充金额,付款名称 - 如何配置它?

我配置它从这个例子http://payum.forma-dev.com/documentation/0.8/PayumBundle/simple_purchase_examples/paypal_express_checkout

配置:

payum: 
    security: 
     token_storage: 
      ed\partnerBundle\Entity\PayumSecurityToken: 
       doctrine: 
        driver: orm 
    contexts: 
     frei_payment: 
      paypal_express_checkout_nvp: 
       api: 
        options: 
         username: 'myusername' 
         password: 'mypass' 
         signature: 'mysing' 
         sandbox: true 
      storages: 
       ed\partnerBundle\Entity\PaymentDetails: 
        doctrine: 
         driver: orm 

路由:在支付控制器

payment_start: 
    pattern: /payment 
    defaults: { _controller: edpartnerBundle:Payment:preparePaypalExpressCheckoutPayment } 

edpartner_payment_done: 
    pattern: /payment/done 
    defaults: { _controller: edpartnerBundle:Payment:done } 

动作:

public function doneAction(){ 

     $request = $this->getRequest(); 

     $token = $this->get('payum.security.http_request_verifier')->verify($request); 

     $payment = $this->get('payum')->getPayment($token->getPaymentName()); 

     $status = new BinaryMaskStatusRequest($token); 
     $payment->execute($status); 

     if ($status->isSuccess()) { 
      $this->getUser()->addCredits(100); 
      $this->getRequest()->getSession()->getFlashBag()->set(
       'notice', 
       'Payment success. Credits were added' 
      ); 
     } else if ($status->isPending()) { 
      $this->getRequest()->getSession()->getFlashBag()->set(
       'notice', 
       'Payment is still pending. Credits were not added' 
      ); 
     } else { 
      $this->getRequest()->getSession()->getFlashBag()->set('error', 'Payment failed'); 
     } 

     return $this->redirect('homepage'); 



    } 

    /** 
    */ 
    public function preparePaypalExpressCheckoutPaymentAction(){ 

     $paymentName = 'my_payment'; 

     $storage = $this->get('payum')->getStorageForClass(
      'ed\partnerBundle\Entity\PaymentDetails', 
      $paymentName 
     ); 

     /** @var \ed\partnerBundle\Entity\PaymentDetails $paymentDetails */ 
     $paymentDetails = $storage->createModel(); 
     $paymentDetails['PAYMENTREQUEST_0_CURRENCYCODE'] = 'USD'; 
     $paymentDetails['PAYMENTREQUEST_0_AMT'] = 1.23; 
     $storage->updateModel($paymentDetails); 

     $captureToken = $this->get('payum.security.token_factory')->createCaptureToken(
      $paymentName, 
      $paymentDetails, 
      'edpartner_payment_done' // the route to redirect after capture; 
     ); 

     $paymentDetails['INVNUM'] = $paymentDetails->getId(); 
     $paymentDetails['RETURNURL'] = $captureToken->getTargetUrl(); 
     $paymentDetails['CANCELURL'] = $captureToken->getTargetUrl(); 
     $storage->updateModel($paymentDetails); 


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



    } 

我去在浏览器中的付款网址,并将我重定向到主页我看到数据库中的新记录 - 但我没有进行任何付款 - 为什么我没有重定向到PayPal付款?

回答

2

确定发现的错误 - 这是沙盒错误 - 正常的API密钥 - 不允许沙箱模式 - 可惜它没有在捆绑安装手册中描述 - 和捆绑不会抛出任何异常 - 没有信息的简单重定向。 ..

+0

这是几次在这里问。其实Payum将所有信息保存到您的详细信息模型中。你将不得不在L_ERRORLONG0(类似这样的)字段中找到文本“Security header invalid”。 –

+0

查看详细信息,只要你有一些麻烦。它必须包含payum可以从网关获取的所有详细信息。 –

+0

你可以检查这个问题,例如:http://stackoverflow.com/questions/18548701/payum-symfony2-bundle-not-redirecting-me-to-paypal-on-paypal-express-checkout –