/** * Send a <notification-history-request> request to Google Checkout * * info: {@link http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API_Notification_History_API.html} * * @param string $sn serial number * @param string $npt next page token * @param array $orders array of string google order numbers * @param array $nt array of string notification types * @param array $st array of tracking data where tracking code => carrier * @param string @st string of start time in format YYYY-MM-DD[T]HH:MM:SS[Timezone] ie * 2010-05-01T05:00:00Z * @param string @et string of end time in format YYYY-MM-DD[T]HH:MM:SS[Timezone] ie * 2010-05-02T05:00:00Z * @param string $cp path to SSL certificates for peer validation */ function SendNotificationHistoryRequest($sn = null, $npt = null, $orders = array(), $nt = array(), $st = null, $et = null, $cp = null) { $postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; $postargs .= "<notification-history-request xmlns=\"" . $this->schema_url . "\">"; if (isset($sn)) { $postargs .= "<serial-number>" . $sn . "</serial-number>"; } elseif (isset($npt)) { $postargs .= "<next-page-token>" . $npt . "</next-page-token>"; } else { if (isset($orders) && count($orders) > 0) { $postargs .= "<order-numbers>"; foreach ($orders as $order) { $postargs .= "<google-order-number>" . $order . "</google-order-number>"; } $postargs .= "</order-numbers>"; } if (isset($nt) && count($nt) > 0) { $postargs .= "<notification-types>"; foreach ($nt as $notification_type) { $postargs .= "<notification-type>" . $notification_type . "</notification-type"; } $postargs .= "</notification-types>"; } if (isset($st) && isset($et)) { $postargs .= "<start-time>" . $st . "</start-time>"; $postargs .= "<end-time>" . $et . "</end-time>"; } } $postargs .= "</notification-history-request>"; $Grequest = new GoogleRequest($this->merchant_id, $this->merchant_key, $this->server_type); $GRequest->SetCertificatePath($cp); return $Grequest->SendReq($Grequest->GetReportUrl(), $Grequest->GetAuthenticationHeaders(), $postargs); }
function RequestToken() { $this->request_token_xml = $this->GetTokenRequestXML(); //create GRequest object + post xml (googlecart.php line: 962) require_once 'library/googlerequest.php'; $GRequest = new GoogleRequest($this->merchant_id, $this->merchant_key); /*---------------------------------------------------------------------------------------------------*/ $GRequest->SetCertificatePath("/etc/ssl/certs/ca-certificates.crt"); $this->token_response_xml = $GRequest->SendReq($this->server_url, $GRequest->GetAuthenticationHeaders(), $this->request_token_xml); //Check response code if ($this->token_response_xml[0] == "200") { require_once 'xml-processing/gc_XmlParser.php'; $GXmlParser = new gc_XmlParser($this->token_response_xml[1]); $data = $GXmlParser->GetData(); $this->continue_token = $data['notification-data-token-response']['continue-token']['VALUE']; return $this->continue_token; } else { return false; } }