2014-01-21 141 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 –