Fix default location type CRM-12157
[civicrm-core.git] / extern / pxIPN.php
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
14 session_start();
15
16 require_once '../civicrm.config.php';
17 require_once 'CRM/Core/Config.php';
18
19 $config = CRM_Core_Config::singleton();
20
21 /*
22 * Get the password from the Payment Processor's table based on the DPS user id
23 * being passed back from the server
24 */
25
26 $query = "
27 SELECT url_site, password, user_name, signature
28 FROM civicrm_payment_processor
29 WHERE payment_processor_type = 'Payment_Express'
30 AND user_name = %1
31 ";
32 $params = array(1 => array($_GET['userid'], 'String'));
33
34 $dpsSettings = CRM_Core_DAO::executeQuery($query, $params);
35 while ($dpsSettings->fetch()) {
36 $dpsUrl = $dpsSettings->url_site;
37 $dpsUser = $dpsSettings->user_name;
38 $dpsKey = $dpsSettings->password;
39 $dpsMacKey = $dpsSettings->signature;
40 }
41
42 if ($dpsMacKey) {
43 $method = "pxaccess";
44 }
45 else {
46 $method = "pxpay";
47 }
48
49 require_once 'CRM/Core/Payment/PaymentExpressIPN.php';
50 $rawPostData = $_GET['result'];
51 CRM_Core_Payment_PaymentExpressIPN::main($method, $rawPostData, $dpsUrl, $dpsUser, $dpsKey, $dpsMacKey);