Merge remote-tracking branch 'upstream/4.4' into 4.4-4.5-2014-10-01-19-08-00
[civicrm-core.git] / extern / pxIPN.php
CommitLineData
6a488035
TO
1<?php
2
3/*
4 * PxPay Functionality Copyright (C) 2008 Lucas Baker,
5 * Logistic Information Systems Limited (Logis)
6 * PxAccess Functionality Copyright (C) 2008 Eileen McNaughton
7 * Licensed to CiviCRM under the Academic Free License version 3.0.
8 *
9 * Grateful acknowledgements go to Donald Lobo for invaluable assistance
10 * in creating this payment processor module
11 */
12
13
14session_start();
15
16require_once '../civicrm.config.php';
17require_once 'CRM/Core/Config.php';
18
19$config = CRM_Core_Config::singleton();
414e3596 20$log = new CRM_Utils_SystemLogger();
6c8d1617 21$log->alert('payment_notification processor_name=Payment_Express', $_REQUEST);
6a488035
TO
22/*
23 * Get the password from the Payment Processor's table based on the DPS user id
24 * being passed back from the server
25 */
26
27$query = "
f2e565d0
DL
28SELECT url_site, password, user_name, signature
29FROM civicrm_payment_processor
c8484da9 30LEFT JOIN civicrm_payment_processor_type ON civicrm_payment_processor_type.id = civicrm_payment_processor.payment_processor_type_id
f2e565d0
DL
31WHERE civicrm_payment_processor_type.name = 'Payment_Express'
32AND user_name = %1
6a488035
TO
33";
34$params = array(1 => array($_GET['userid'], 'String'));
35
36$dpsSettings = CRM_Core_DAO::executeQuery($query, $params);
37while ($dpsSettings->fetch()) {
38 $dpsUrl = $dpsSettings->url_site;
39 $dpsUser = $dpsSettings->user_name;
40 $dpsKey = $dpsSettings->password;
41 $dpsMacKey = $dpsSettings->signature;
42}
43
44if ($dpsMacKey) {
45 $method = "pxaccess";
46}
47else {
48 $method = "pxpay";
49}
50
51require_once 'CRM/Core/Payment/PaymentExpressIPN.php';
52$rawPostData = $_GET['result'];
53CRM_Core_Payment_PaymentExpressIPN::main($method, $rawPostData, $dpsUrl, $dpsUser, $dpsKey, $dpsMacKey);