

Public Member Functions | |
| EWPProfile ($id, &$handler) | |
| validate () | |
| getCertificateId () | |
| setCertificateId ($filename) | |
| getCertificateFile () | |
| setCertificateFile ($filename) | |
| getButtonImage () | |
| setButtonImage ($url) | |
| getUrl () | |
| setUrl ($url) | |
| setPrivateKeyFile ($filename) | |
| getPrivateKeyFile () | |
| setPrivateKeyPassword ($password) | |
| getPrivateKeyPassword () | |
| _getSerializeList () | |
| getInstance ($id, &$handler) | |
| _load () | |
| getID () | |
| loadEnvironments () | |
| save () | |
| setEnvironment ($environment) | |
| getEnvironment () | |
| getValidEnvironments () | |
Public Attributes | |
| $_privateKeyFile | |
| $_privateKeyPassword | |
| $_buttonImageURL | |
| $_buttonURL | |
| $_certificateId | |
| $_certificateFile | |
| $_environment | |
| $_validEnvironments = array() | |
| $_handler | |
| $_handler_id | |
Definition at line 20 of file EWP.php.
|
||||||||||||
|
Class constructor
Definition at line 69 of file EWP.php.
|
|
|
Returns an array of member variables names which should be included when storing the profile.
Reimplemented from Profile. Definition at line 238 of file EWP.php. 00239 { 00240 return array('environment', 'certificateId', 'certificateFile', 'privateKeyFile', 'buttonImageURL', 'buttonURL'); 00241 }
|
|
|
Loads the profile data from the defined handler.
Definition at line 67 of file Profile.php. References $value, Profile::_getSerializeList(), PEAR::isError(), Profile::loadEnvironments(), and Services_PayPal::raiseError(). 00068 { 00069 $loaded_data = $this->_handler->loadProfile($this->_handler_id); 00070 $expected_keys = $this->_getSerializeList(); 00071 00072 if (!is_a($this->_handler, 'ProfileHandler_Array')) { 00073 $expected_keys[] = 'classname'; 00074 } 00075 00076 if (Services_PayPal::isError($loaded_data)) { 00077 foreach ($expected_keys as $key) { 00078 $ikey = "_$key"; 00079 $this->$ikey = null; 00080 } 00081 00082 return Services_PayPal::raiseError("Could not load data for non-existant profile '{$this->_handler_id}'"); 00083 } 00084 00085 $expected_keys = array_flip($expected_keys); 00086 foreach ($loaded_data as $key => $value) { 00087 $ikey = "_$key"; 00088 $this->$ikey = $value; 00089 unset($expected_keys[$key]); 00090 } 00091 00092 if (!empty($expected_keys)) { 00093 $key_list = implode(', ', array_flip($expected_keys)); 00094 return Services_PayPal::raiseError("The following values were expected but not found in the profile data: $key_list"); 00095 } 00096 00097 return $this->loadEnvironments(); 00098 }
|
|
|
Returns the URL where the button image is
Definition at line 149 of file EWP.php.
|
|
|
Get the merchant certificate file associated with the profile
Definition at line 125 of file EWP.php.
|
|
|
Get the merchant certificate id associated with the profile
Definition at line 105 of file EWP.php.
|
|
|
Get the environment associated with the profile.
Definition at line 198 of file Profile.php.
|
|
|
Definition at line 100 of file Profile.php.
|
|
||||||||||||
|
Factory for creating instances of the EWPProfile. Used when providing an existing Profile ID to load from
Reimplemented from Profile. Definition at line 251 of file EWP.php. References $result, and PEAR::isError(). 00252 { 00253 $classname = __CLASS__; 00254 $inst = new $classname($id, $handler); 00255 $result = $inst->_load(); 00256 00257 if (Services_PayPal::isError($result)) { 00258 return $result; 00259 } 00260 00261 return $inst; 00262 }
|
|
|
Get the merchant private key file associated with the profile
Definition at line 206 of file EWP.php.
|
|
|
Get the merchant private key password
Definition at line 226 of file EWP.php.
|
|
|
Returns the URL where the button will post to
Definition at line 169 of file EWP.php.
|
|
|
Returns an array of valid Environments
Definition at line 208 of file Profile.php. References PEAR::isError(), and Profile::loadEnvironments(). Referenced by Profile::setEnvironment(). 00209 { 00210 if (empty($this->_validEnvironments)) { 00211 $res = $this->loadEnvironments(); 00212 if (Services_PayPal::isError($res)) { 00213 return $res; 00214 } 00215 } 00216 00217 return $this->_validEnvironments; 00218 }
|
|
|
Loads the environment names from the endpoint map.
Definition at line 115 of file Profile.php. References Services_PayPal::getEndpoints(), Services_PayPal::getWSDLVersion(), PEAR::isError(), and Services_PayPal::raiseError(). Referenced by Profile::_load(), and Profile::getValidEnvironments(). 00116 { 00117 $version = Services_PayPal::getWSDLVersion(); 00118 $endpoints = Services_PayPal::getEndpoints(); 00119 if (Services_PayPal::isError($endpoints)) { 00120 return $endpoints; 00121 } 00122 00123 foreach ($endpoints as $range) { 00124 if ($version >= $range['min'] && 00125 $version <= $range['max']) { 00126 foreach (array_keys($range['environments']) as $environment) { 00127 $this->_validEnvironments[] = strtolower($environment); 00128 } 00129 return true; 00130 } 00131 } 00132 00133 return Services_PayPal::raiseError("Could not find any endpoint mappings for WSDL version '$version'"); 00134 }
|
|
|
Saves the profile data to the defined handler.
Definition at line 142 of file Profile.php. References $data, $value, $values, and Profile::_getSerializeList(). 00143 { 00144 $values = $this->_getSerializeList(); 00145 foreach ($values as $value) { 00146 $ivalue = "_$value"; 00147 if (isset($this->$ivalue)) { 00148 $data[$value] = $this->$ivalue; 00149 } else { 00150 $data[$value] = null; 00151 } 00152 } 00153 00154 $data['classname'] = get_class($this); 00155 00156 return $this->_handler->saveProfile($data, $this->_handler_id); 00157 }
|
|
|
Set the URL where the button image is
Definition at line 159 of file EWP.php.
|
|
|
Set the merchant certificate file associated with the profile
Definition at line 135 of file EWP.php. References $filename, and Services_PayPal::raiseError(). 00136 { 00137 if (!file_exists($filename)) { 00138 return Services_PayPal::raiseError("The private key '$filename' does not exist"); 00139 } 00140 00141 $this->_certificateFile = $filename; 00142 }
|
|
|
Set the merchant certificate id associated with the profile
Definition at line 115 of file EWP.php. References $filename. 00116 { 00117 $this->_certificateId = $filename; 00118 }
|
|
|
Set the environment associated with this profile.
Definition at line 176 of file Profile.php. References Profile::getValidEnvironments(), PEAR::isError(), and Services_PayPal::raiseError(). 00177 { 00178 $environment = strtolower($environment); 00179 00180 $envs = $this->getValidEnvironments(); 00181 if (Services_PayPal::isError($envs)) { 00182 return $envs; 00183 } 00184 00185 if (in_array($environment, $envs)) { 00186 $this->_environment = $environment; 00187 return true; 00188 } 00189 00190 return Services_PayPal::raiseError("Invalid Environment Specified"); 00191 }
|
|
|
Set the Merchant private key file
Definition at line 190 of file EWP.php. References $filename, and Services_PayPal::raiseError(). 00191 { 00192 if (!file_exists($filename)) { 00193 return Services_PayPal::raiseError("The private key '$filename' does not exist"); 00194 } 00195 00196 $this->_privateKeyFile = $filename; 00197 00198 return true; 00199 }
|
|
|
Set the merchant private key password
Definition at line 216 of file EWP.php. References $password. 00217 { 00218 $this->_privateKeyPassword = $password; 00219 }
|
|
|
Sets the URL where the button will post to
Definition at line 179 of file EWP.php.
|
|
|
Validates the profile data currently loaded before use.
Definition at line 79 of file EWP.php. References Services_PayPal::raiseError(). 00080 { 00081 if (empty($this->_certificateFile)) { 00082 return Services_PayPal::raiseError("Certificate File must be set!"); 00083 } 00084 if (empty($this->_certificateId)) { 00085 return Services_PayPal::raiseError("Certificate ID must be set."); 00086 } 00087 if (empty($this->_environment)) { 00088 return Services_PayPal::raiseError("Environment must be set."); 00089 } 00090 if (!file_exists($this->_certificateFile)) { 00091 return Services_PayPal::raiseError("Could not find certificate file '{$this->_certificateFile}'"); 00092 } 00093 if (!in_array(strtolower($this->_environment), $this->_validEnvironments, true)) { 00094 return Services_PayPal::raiseError("Environment '{$this->_environment}' is not a valid environment."); 00095 } 00096 00097 return true; 00098 }
|
|
|
The URL to the button image private |
|
|
The URL the button posts to private |
|
|
The location of the .pem certificate file. private |
|
|
The PayPal-assigned id of the certificate. private |
|
|
Which environment should API calls be made against?
Definition at line 29 of file Profile.php. |
|
|
The ProfileHandler instance associated with this Profile. protected Definition at line 44 of file Profile.php. |
|
|
Definition at line 45 of file Profile.php. |
|
|
The private Key file private |
|
|
The password on the private key. private |
|
|
The list of valid environments that API calls can be executed against. protected Definition at line 37 of file Profile.php. |
1.4.4