Пример #1
0
	function notifications () {
		if ($this->authentication()) {

			// Read incoming request data
			$data = trim(file_get_contents('php://input'));
			if(ECART_DEBUG) new EcartError($data,'google_incoming_request',ECART_DEBUG_ERR);

			// Handle notifications
			$XML = new xmlQuery($data);
			$type = $XML->context();
			if ( $type === false ) {
				if(ECART_DEBUG) new EcartError('Unable to determine context of request.','google_checkout_unknown_notification',ECART_DEBUG_ERR);
				return;
			}
			$serial = $XML->attr($type,'serial-number');

			$ack = true;
			switch($type) {
				case "new-order-notification": $this->order($XML); break;
				case "risk-information-notification": $this->risk($XML); break;
				case "order-state-change-notification": $this->state($XML); break;
				case "merchant-calculation-callback": $ack = $this->merchant_calc($XML); break;
				case "charge-amount-notification":	break;		// Not implemented
				case "refund-amount-notification":	$this->refund($XML); break;
				case "chargeback-amount-notification":		break;	// Not implemented
				case "authorization-amount-notification":	break;	// Not implemented
					break;
			}
			// Send acknowledgement
			if($ack) $this->acknowledge($serial);
		}
		exit();
	}