/** * @access public * @param string $environment * @param string $domain * @param string $api * @param string $version * @throws OpenPayU_Exception_Configuration */ public static function setEnvironment($environment = 'secure', $domain = 'payu.com', $api = 'api/', $version = 'v2_1/') { $environment = strtolower($environment); $domain = strtolower($domain) . '/'; if (!in_array($environment, self::$_availableEnvironment)) { throw new OpenPayU_Exception_Configuration($environment . ' - is not valid environment'); } if ($environment == 'secure') { self::$env = $environment; self::$serviceDomain = $domain; self::$serviceUrl = 'https://' . $environment . '.' . $domain . $api . $version; } else { if ($environment == 'custom') { self::$env = $environment; self::$serviceUrl = $domain . $api . $version; } } }
public static function setEnvironment($value = 'sandbox', $domain = 'payu.pl', $country = 'pl') { $value = strtolower($value); $domain = strtolower($domain); $country = strtolower($country); if ($value == 'sandbox' || $value == 'secure') { self::$env = $value; self::$serviceDomain = $domain; self::$serviceUrl = 'https://' . $value . '.' . $domain . '/' . $country . '/standard/'; self::$summaryUrl = self::$serviceUrl . 'co/summary'; self::$authUrl = self::$serviceUrl . 'oauth/user/authorize'; } else { if ($value == 'custom') { self::$env = $value; self::$serviceUrl = $domain . '/' . $country . '/standard/'; self::$summaryUrl = self::$serviceUrl . 'co/summary'; self::$authUrl = self::$serviceUrl . 'oauth/user/authorize'; } else { throw new Exception('Invalid value:$value for environment. Proper values are: "sandbox" or "secure".'); } } }
/** * @access public * @param string $value * @param string $domain * @param string $country * @throws OpenPayU_Exception_Configuration */ public static function setEnvironment($value = 'secure', $domain = 'payu.com', $country = 'pl', $api = 'api/', $version = 'v2_1/') { $value = strtolower($value); $domain = strtolower($domain) . '/'; if (!in_array($value, self::$_availableEnvironment)) { throw new OpenPayU_Exception_Configuration($value . ' - is not valid environment'); } if ($value == 'secure') { self::$env = $value; self::$serviceDomain = $domain; self::$serviceUrl = 'https://' . $value . '.' . $domain . $api . $version; self::$summaryUrl = self::$serviceUrl . 'co/summary'; self::$authUrl = self::$serviceUrl . 'oauth/user/authorize'; } else { if ($value == 'custom') { self::$env = $value; self::$serviceUrl = $domain . $api . $version; self::$summaryUrl = self::$serviceUrl . 'co/summary'; self::$authUrl = self::$serviceUrl . 'oauth/user/authorize'; } } }