/** * Returns the PayPal public certificate filename. * * @param string The environment to get the certificate for. * @return mixed The path and file of the certificate file, or a PayPal error object on failure. */ function getPayPalCertificateFile($environment) { $package_root = Services_PayPal::getPackageRoot(); $cert = $package_root . '/cert/' . strtolower($environment) . '.paypal.com.pem'; if (@(include "{$package_root}/conf/paypal-sdk.php")) { if (isset($__PP_CONFIG['paypal_cert_file']) && !empty($__PP_CONFIG['paypal_cert_file'])) { $cert = $__PP_CONFIG['paypal_cert_file'][$environment]; } } if (!file_exists($cert)) { return Services_PayPal::raiseError("Could not file Paypal public Certificate file '{$cert}'"); } return $cert; }
/** * Get information describing all types provided by the SDK. * @static */ function getTypeList() { $root_dir = Services_PayPal::getPackageRoot(); $types = "{$root_dir}/Type/*.php"; $files = glob($types); if (count($files) < 2) { return Services_PayPal::raiseError("Types not found in package! (Looked for '{$types}')"); } $retval = array(); foreach ($files as $type_files) { $retval[] = basename(substr($type_files, 0, strpos($type_files, '.'))); } return $retval; }