home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (uc_google_checkout.pages.inc)

This example Drupal source code file (uc_google_checkout.pages.inc) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

array, break, case, checkout, function, header, if, input, merchant_id, merchant_key, php, watchdog, watchdog_error, xml

The uc_google_checkout.pages.inc Drupal example source code

<?php
// $Id: uc_google_checkout.pages.inc,v 1.1.2.6 2010/08/11 17:51:04 islandusurper Exp $

/**
 * @file
 * Google Checkout administration menu items.
 *
 */

function uc_google_checkout_callback() {
  if (variable_get('uc_google_checkout_mode', 'checkout') == 'checkout') {
    $merchant_id = variable_get('uc_google_checkout_merchant_id', '');
    $merchant_key = variable_get('uc_google_checkout_merchant_key', '');
  }
  else {
    $merchant_id = variable_get('uc_google_checkout_test_merchant_id', '');
    $merchant_key = variable_get('uc_google_checkout_test_merchant_key', '');
  }

  //watchdog('google', check_plain($_SERVER['PHP_AUTH_USER']), NULL, WATCHDOG_NOTICE);
  if ($_SERVER['PHP_AUTH_USER'] != $merchant_id || $_SERVER['PHP_AUTH_PW'] != $merchant_key) {
    watchdog('google', 'HTTP Authorization header does not match settings.', array(), WATCHDOG_ERROR);
    return MENU_ACCESS_DENIED;
  }
  $input = file_get_contents('php://input');
  //watchdog('google', print_r(check_plain($input), TRUE), NULL, WATCHDOG_NOTICE);
  $xml = new SimpleXMLElement($input);
  switch ($xml->getName()) {
    case 'merchant-calculation-callback':
      //uc_google_checkout_merchant_calculation($xml);
    break;
    case 'new-order-notification':
      uc_google_checkout_new_order($xml);
    break;
    case 'order-state-change-notification':
      uc_google_checkout_order_state_change($xml);
    break;
    case 'risk-information-notification':
      uc_google_checkout_accept_risk($xml);
    break;
    case 'charge-amount-notification':
      uc_google_checkout_charge_order($xml);
    break;
    case 'refund-amount-notification':
      uc_google_checkout_refund_order($xml);
    break;
    default:
      watchdog('google', 'Unknown notification document: @xml', array('@xml' => $input), WATCHDOG_ERROR);
      $output = uc_google_checkout_notification_acknowledgement($xml->{'serial-number'});
  }
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal uc_google_checkout.pages.inc source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.