Merge pull request #17625 from demeritcowboy/missing-activitytype-5.27
[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
ba1e1ab6 13if (defined('PANTHEON_ENVIRONMENT')) {
2af2cd60 14 ini_set('session.save_handler', 'files');
15}
6a488035
TO
16session_start();
17
18require_once '../civicrm.config.php';
19require_once 'CRM/Core/Config.php';
20
d523d24a 21CRM_Core_Config::singleton();
414e3596 22$log = new CRM_Utils_SystemLogger();
6c8d1617 23$log->alert('payment_notification processor_name=Payment_Express', $_REQUEST);
6a488035
TO
24/*
25 * Get the password from the Payment Processor's table based on the DPS user id
26 * being passed back from the server
27 */
28
29$query = "
f2e565d0
DL
30SELECT url_site, password, user_name, signature
31FROM civicrm_payment_processor
c8484da9 32LEFT JOIN civicrm_payment_processor_type ON civicrm_payment_processor_type.id = civicrm_payment_processor.payment_processor_type_id
f2e565d0
DL
33WHERE civicrm_payment_processor_type.name = 'Payment_Express'
34AND user_name = %1
6a488035
TO
35";
36$params = array(1 => array($_GET['userid'], 'String'));
37
38$dpsSettings = CRM_Core_DAO::executeQuery($query, $params);
39while ($dpsSettings->fetch()) {
56fdfc52
TO
40 $dpsUrl = $dpsSettings->url_site;
41 $dpsUser = $dpsSettings->user_name;
42 $dpsKey = $dpsSettings->password;
6a488035
TO
43 $dpsMacKey = $dpsSettings->signature;
44}
45
46if ($dpsMacKey) {
47 $method = "pxaccess";
48}
49else {
50 $method = "pxpay";
51}
52
53require_once 'CRM/Core/Payment/PaymentExpressIPN.php';
54$rawPostData = $_GET['result'];
55CRM_Core_Payment_PaymentExpressIPN::main($method, $rawPostData, $dpsUrl, $dpsUser, $dpsKey, $dpsMacKey);