Example #1
0
	// If connected OK, write the posted values back, then...
	//--------------------------------------------------------
	else {
		fwrite($fp, $header.$workstring);
		$res= '';
		while(!feof($fp)) {
			$res .= fgets($fp, 1024);
		}
		fclose($fp);
		$error_description= "Response from $hostname: ".$res."\n";
		// Get the Order Details from the database
		$db= oseDB :: instance();
		// $invoice = $db->quote( $db->getEscaped($invoice));
		//$invoice = $db->quote($invoice);
		$where= array();
		$where[]= "`order_number`=".$db->quote($process->get('invoice')).' OR `payment_serial_number`='.$db->quote($process->get('invoice'));
		//$where[] = "`entry_type`= 'msc'" ;
		$payment= oseRegistry :: call('payment');
		$orderInfo = $payment->getOrder($where, 'obj');
		if(empty($orderInfo)) {
			$mailsubject= "PayPal IPN Fatal Error on your Site";
			$mailbody= "Can not search any order information with utilizing the order number feedbacked by The PayPal IPN
					----------------------------------\n
					Hostname: $hostname\n
					URI: $uri\n
					Invoice: ".$process->get('invoice')."\n";
			$emailObj= new stdClass();
			$emailObj->subject= $mailsubject;
			$emailObj->body= $mailbody;
			$apiEmail->sendToAdminGroup($emailObj, $oseMscConfig->admin_group);
			$res= 'Other Error!';
	// If connected OK, write the posted values back, then...
	//--------------------------------------------------------
	else {
		fwrite($fp, $header.$workstring);
		$res= '';
		while(!feof($fp)) {
			$res .= fgets($fp, 1024);
		}
		fclose($fp);
		$error_description= "Response from $hostname: ".$res."\n";
		// Get the Order Details from the database
		$db= oseDB :: instance();
		// $invoice = $db->quote( $db->getEscaped($invoice));
		//$invoice = $db->quote($invoice);
		$where= array();
		if($process->get('paypal_mode') == 'paypal_express')
		{
			$invoice = $process->get('invoice');
			if (empty($invoice))
			{
				return;
			}
			$where[]= "`order_number`=".$db->quote($invoice).' OR `payment_serial_number`='.$db->quote($invoice);
		}
		else
		{
			$invoice = $process->get('invoice');
			$recurring_payment_id = $process->get('recurring_payment_id');

			if (!empty($recurring_payment_id) && !empty($invoice))
			{