Hi -

I'm working on a gateway module for Diamond Mind/NMI (Diamond Mind is really just a private label service powered by NMI)

I have a working module from NMI for Ubercart and am trying to port the relevant bits to a module for Pay. I'm just trying to trace through to sort out why I'm getting an error back with an 'invalid username' from the gateway. How do I best trace what is being posted to the gateway URL? Ideally I'd like to see that printed to the screen instead of sending so I can see before it goes off to get rejected. Any pointers would be most appreciated! (Especially since I'm sure I'm missing an obvious answer)

Thanks,

Jason

ps - and yes, very much hoping to post it as a project once it's working so others can benefit

Comments

jpamental’s picture

Update - got it working. Turned out I needed to deal with the POST issue outlined here:

http://plosquare.blogspot.com/2010/03/solution-for-post-empty-after.html

and the override the execute($activity) function, making sure the header is set correctly, like so:


  function execute($activity) {
    $this->activity = $activity;
    if ($request = $this->gateway_request()) {
      $ret = drupal_http_request($this->gateway_url(), array('Content-Type' => 'application/x-www-form-urlencoded'), 'POST', $this->gateway_request()); // headers set here to correct for POST type error in form submission
      if ($ret->error) {
        watchdog('payment', "Gateway Error: @err Payment NOT processed.", array('@err' => $ret->error));
        $this->activity->data = (array) $ret;
        return FALSE;
      }
      else {
        return $this->gateway_response($ret->data);
      }
    }
  }

This avoided any need to touch the Pay module itself, but I'm wondering if this may be a problem for other modules as well and it could belong in there as well.

Jason

ahashem’s picture

Hi Jason,
I'm currently working on NMI payment gateway and may be some integration with ubercart, I see you've done a good progress here.
Please let me know if you've any updates or published project posted.

Thanks in advance,
Hashem