private function setEndpoint()
{
if (isset($this->config['service.EndPoint.IPN'])) {
$url = $this->config['service.EndPoint.IPN'];
} else {
if (isset($this->config['mode'])) {
if (strtoupper($this->config['mode']) == 'SANDBOX') {
$url = PPConstants::IPN_SANDBOX_ENDPOINT;
} else {
if (strtoupper($this->config['mode']) == 'LIVE') {
$url = PPConstants::IPN_LIVE_ENDPOINT;
} else {
if (strtoupper($this->config['mode']) == 'TLS') {
$url = PPConstants::IPN_TLS_ENDPOINT;
} else {
throw new PPConfigurationException('mode should be LIVE, TLS or SANDBOX');
}
}
}
} else {
throw new PPConfigurationException('You must set one of mode OR service.endpoint.IPN parameters');
}
}
return $url;
}