2

I'm building custom gateway for Payum library, and I have to use the unsafe notify request to complete the payment

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
)

Everything is working find, except that I don't know how to get Payment Token by using the refNumber so I can complete the purchase.

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;
    }
}
Khaled Attia
  • 111
  • 3
  • 8

1 Answers1

0

You store token's hash to refNumber, do you? If so, there are several ways to go:

  1. You can create your own notify controller where you can use this refNumber + http request verifier to get the token. once you have the token you can processed as usual by passing the token to gateway execute method.

  2. You can inject (pass as constructor argument) the http request verifier to the notify action, do the validation etc

Maksim Kotlyar
  • 3,821
  • 27
  • 31