/**
  * Display response message to user with submitted user-supplied data
  *
  * @param $data Array: array of posted data from form
  * @param $responseMsg String: message supplied by fnPayflowDisplayResults function
  */
 function fnPayflowDisplayApprovedResults($data, $responseMsg)
 {
     global $wgOut;
     $thankyoupage = $this->adapter->getGlobal('ThankYouPage');
     if ($thankyoupage) {
         $wgOut->redirect($thankyoupage);
     } else {
         // display response message
         $wgOut->addHTML('<h3 class="response_message">' . $responseMsg . '</h3>');
         // translate country code into text
         $countries = GatewayForm::getCountries();
         $rows = array('title' => array(wfMsg('donate_interface-post-transaction')), 'amount' => array(wfMsg('donate_interface-donor-amount'), $data['amount']), 'email' => array(wfMsg('donate_interface-donor-email'), $data['email']), 'name' => array(wfMsg('donate_interface-donor-name'), $data['fname'], $data['mname'], $data['lname']), 'address' => array(wfMsg('donate_interface-donor-address'), $data['street'], $data['city'], $data['state'], $data['zip'], $countries[$data['country']]));
         // if we want to show the response
         $wgOut->addHTML(Xml::buildTable($rows, array('class' => 'submitted-response')));
     }
 }
 /**
  * Builds minfraud query from user input
  * @return array containing hash for minfraud query
  */
 public function build_query(array $data)
 {
     // mapping of data keys -> minfraud array keys
     $map = array("city" => "city", "region" => "state", "postal" => "zip", "country" => "country", "domain" => "email", "emailMD5" => "email", "bin" => "card_num", "txnID" => "contribution_tracking_id");
     // minfraud license key
     $minfraud_array["license_key"] = $this->minfraud_license_key;
     // user's IP address
     $minfraud_array["i"] = $this->gateway_adapter->getGlobal("Test") ? '12.12.12.12' : wfGetIP();
     // user's user agent
     global $wgRequest;
     $minfraud_array["user_agent"] = $wgRequest->getHeader('user-agent');
     // user's language
     $minfraud_array['accept_language'] = $wgRequest->getHeader('accept-language');
     // fetch the array of country codes
     $country_codes = GatewayForm::getCountries();
     // loop through the map and add pertinent values from $data to the hash
     foreach ($map as $key => $value) {
         // do some data processing to clean up values for minfraud
         switch ($key) {
             case "domain":
                 // get just the domain from the email address
                 $newdata[$value] = substr(strstr($data[$value], '@'), 1);
                 break;
             case "bin":
                 // get just the first 6 digits from CC#
                 $newdata[$value] = substr($data[$value], 0, 6);
                 break;
             case "country":
                 $newdata[$value] = $country_codes[$data[$value]];
                 break;
             default:
                 $newdata[$value] = $data[$value];
         }
         $minfraud_array[$key] = $newdata[$value];
     }
     return $minfraud_array;
 }
Esempio n. 3
0
 /**
  * Generate the menu select of countries
  * This function is not used by any RapidHTML forms.
  * @fixme It would be great if we could default the country to the user's locale
  * @fixme We should also do a locale-based asort on the country dropdown
  * 	(see http://us.php.net/asort)
  * @return string
  */
 public function generateCountryDropdown($defaultCountry = null)
 {
     $country_options = '';
     // create a new array of countries with potentially translated country names for alphabetizing later
     foreach (GatewayForm::getCountries() as $iso_value => $full_name) {
         $countries[$iso_value] = wfMsg('donate_interface-country-dropdown-' . $iso_value);
     }
     // alphabetically sort the country names
     asort($countries, SORT_STRING);
     // generate a dropdown option for each country
     foreach ($countries as $iso_value => $full_name) {
         // Note: If the server has the php5-geoip package, $this->getEscapedValue( 'country' ) will
         // always have a value.
         if ($this->getEscapedValue('country')) {
             $selected = $iso_value == $this->getEscapedValue('country') ? true : false;
         } else {
             $selected = $iso_value == $defaultCountry ? true : false;
             // Select default
         }
         $country_options .= Xml::option($full_name, $iso_value, $selected);
     }
     // build the actual select
     $country_menu = Xml::openElement('select', array('name' => 'country', 'id' => 'country'));
     $country_menu .= Xml::option(wfMsg('donate_interface-select-country'), '', false);
     $country_menu .= $country_options;
     $country_menu .= Xml::closeElement('select');
     return $country_menu;
 }
 /**
  * Constructor - set up the new special page
  */
 public function __construct()
 {
     $this->adapter = new GlobalCollectAdapter();
     parent::__construct();
     //the next layer up will know who we are.
 }