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".');
         }
     }
 }
예제 #2
0
 /**
  * @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';
         }
     }
 }