duandou9931 2014-01-22 08:15
浏览 20
已采纳

Payum Bundle发送空付款 - 和paypal接受它:) :(

I configure Bundle from this example http://payum.forma-dev.com/documentation/0.8/PayumBundle/simple_purchase_examples/paypal_express_checkout

When I go to /payment I am redirected to the PayPal site - but don't have any information about it.

enter image description here

There is info - you able to see details - but this is not true - i accept payment (without know price and desctiption - and payment succes !?

This Bundle is ready for use or working stage ?

config:

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: false
            storages:
                ed\partnerBundle\Entity\PaymentDetails:
                    doctrine:
                        driver: orm

routing :

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

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

actions in Payment Controller:

  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());



    }
  • 写回答

1条回答 默认 最新

  • dongqian1028 2014-01-22 09:16
    关注

    The behavior you described is possible, any problems here. To see payment details you have to configure additional fields. There is an example in the sandbox

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 CST仿真别人的模型结果仿真结果S参数完全不对
  • ¥15 误删注册表文件致win10无法开启
  • ¥15 请问在阿里云服务器中怎么利用数据库制作网站
  • ¥60 ESP32怎么烧录自启动程序
  • ¥50 html2canvas超出滚动条不显示
  • ¥15 java业务性能问题求解(sql,业务设计相关)
  • ¥15 52810 尾椎c三个a 写蓝牙地址
  • ¥15 elmos524.33 eeprom的读写问题
  • ¥15 用ADS设计一款的射频功率放大器
  • ¥15 怎么求交点连线的理论解?