Defaulting Mode to Sandbox

- Eliminate the need to define config for mode
This commit is contained in:
japatel
2014-12-18 14:04:19 -06:00
parent 20038e7525
commit 4cb951f8b2
3 changed files with 15 additions and 16 deletions

View File

@@ -3,7 +3,7 @@
* Sample bootstrap file.
*/
// Include the composer autoloader
// Include the composer Autoloader
// The location of your project's vendor autoloader.
$composerAutoload = dirname(dirname(dirname(__DIR__))) . '/autoload.php';
if (!file_exists($composerAutoload)) {
@@ -35,11 +35,14 @@ $apiContext = getApiContext($clientId, $clientSecret);
return $apiContext;
/**
* Helper method for getting an APIContext for all calls
*
* @param string $clientId Client ID
* @param string $clientSecret Client Secret
* @return PayPal\Rest\ApiContext
*/
function getApiContext($clientId, $clientSecret)
{
// #### SDK configuration
// Register the sdk_config.ini file in current directory
// as the configuration source.
/*
@@ -62,17 +65,10 @@ function getApiContext($clientId, $clientSecret)
)
);
// Partner Attribution Id
// Use this header if you are a PayPal partner. Specify a unique BN Code to receive revenue attribution. To learn more or to request a BN Code, contact your Partner Manager or visit the PayPal Partner Portal .
$apiContext->addRequestHeader('PayPal-Partner-Attribution-Id', '123123123');
// #### SDK configuration
// Comment this line out and uncomment the PP_CONFIG_PATH
// 'define' block if you want to use static file
// based configuration
$apiContext->setConfig(
array(
'mode' => 'sandbox',
@@ -86,5 +82,10 @@ function getApiContext($clientId, $clientSecret)
)
);
// Partner Attribution Id
// Use this header if you are a PayPal partner. Specify a unique BN Code to receive revenue attribution.
// To learn more or to request a BN Code, contact your Partner Manager or visit the PayPal Partner Portal
// $apiContext->addRequestHeader('PayPal-Partner-Attribution-Id', '123123123');
return $apiContext;
}