CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Trying to write a Sagepay Forms Payment processor - advice needed
Pages: 1 [2]

Author Topic: Trying to write a Sagepay Forms Payment processor - advice needed  (Read 7717 times)

Parvez

  • I post occasionally
  • **
  • Posts: 91
  • Karma: 7
Re: Trying to write a Sagepay Forms Payment processor - advice needed
October 01, 2009, 04:18:42 am
I'm almost there now, have the transaction going through to sage pay pages and sage pay responding back.

There are a couple of loose ends I need to tie up though, mainly around coding standards/placement more then anything else.

The code has been based on the Paypal integration, so if you look at that you should see a very similar structure.

Problem 1

Sage pay responds (once the user has completed their transaction on their pages) with a post to CiviCRM. I currently have this posting to something like https://xxx/sites/all/modules/civicrm/extern/protXresult.php?reset=x&contactID=x&contributionID=x&module=contribute&membershipID=x.

Sage pay then expects a response from the page that is posted to, so I have the following bit of code in the completeTransaction routine within the BaseProtxResult.php.


        // Setup return to be sent out to the screen so that Sage Page can complete its transaction
        // Now show the relevant output to the screen so that Sage Pay knows where to be redirected to
        $url    = ( $input['component'] == 'event' ) ? 'civicrm/event/register' : 'civicrm/contribute/transact';
        $returnURL = CRM_Utils_System::url( $url,
                                            "_qf_ThankYou_display=1&qfKey={$params['qfKey']}",
                                            true, null, false );

        ob_flush();
        $eoln = chr(13) . chr(10);
        echo "Status=OK" . $eoln;
        echo "StatusDetail=" . $eoln;
        echo "RedirectURL=" . $returnURL . $eoln;


This works if everything is fine. But if there is a problem, i.e. CiviCRM doesn't recognise the transaction id then Sage page is expecting the statsu to be not ok and the status detail to highlight the problem.

This is the coding problem that I have got to, where should I be placing this code? I need to be able to let Sage Pay know that we are not happy to carry on with this transaction so that it gets voided on their part but at the moment the code is setup to exit and write log messages at any point of failure. So how should I amend this?

Problem 2

I've totally forgotten what this problem was, will come back and update once I'm done.

I'd say I'm 95% there with the integration, its not production quality yet i.e. it doesn't handle failures yet as above, but with a bit of help from the community I can probably get this tied up in the next couple of days and release it back to the community.

Thanks

Parvez

Pages: 1 [2]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Trying to write a Sagepay Forms Payment processor - advice needed

This forum was archived on 2017-11-26.