如何为不安全的请求创建NotifyAction?

时间:2015-07-03 15:43:31

标签: php payum

我正在为Payum库构建自定义网关,我必须使用不安全的通知请求来完成付款

https://example.com/payment/notify/unsafe/GATEWAY_NAME?amount=100.0&paymentDate=2015-07-03:15:10:57&hashCode=e10b795dd5f52540ca3039ce1af325b4&voucherNumber=6921760593&voucherStatus=PAID&refNumber=asda22sd&currency=USD

Array
(
    [amount] => 100.0
    [paymentDate] => 2015-07-03:15:10:57
    [hashCode] => e10b795dd5f52540ca3039ce1af325b4
    [voucherNumber] => 6921760593
    [voucherStatus] => PAID
    [refNumber] => asda22sd
    [currency] => USD
)

除了我不知道如何使用Payment Token获取refNumber以便我完成购买外,所有内容都有效。

NotifyAction.php:

class NotifyAction extends GatewayAwareAction
{
    /**
     * {@inheritDoc}
     */
    public function execute($request)
    {
        /** @var $request Notify */
        RequestNotSupportedException::assertSupports($this, $request);

        $this->gateway->execute($httpRequest = new GetHttpRequest());
        $details = $httpRequest->query;

        var_dump($details);
        throw new HttpResponse(null, 200);
    }
    /**
     * {@inheritDoc}
     */
    public function supports($request)
    {
        return $request instanceof Notify;
    }
}

1 个答案:

答案 0 :(得分:0)

您将令牌的哈希存储到refNumber,对吗?如果是这样,有几种方法可以:

  1. 您可以创建自己的通知控制器,您可以使用此refNumber + http请求验证程序获取令牌。一旦获得了令牌,就可以像往常一样将令牌传递给网关执行方法。

  2. 您可以将http请求验证程序注入(作为构造函数参数传递)到通知操作,执行验证等