Fixing Breaking Changes in ItemList

This commit is contained in:
japatel
2014-10-14 16:54:43 -05:00
parent dc2ac0fd63
commit 89855f4624
18 changed files with 632 additions and 75 deletions

View File

@@ -24,8 +24,12 @@ use PayPal\Auth\OAuthTokenCredential;
error_reporting(E_ALL);
// Replace these values by entering your own ClientId and Secret by visiting https://developer.paypal.com/webapps/developer/applications/myapps
$clientId = 'AYSq3RDGsmBLJE-otTkBtM-jBRd1TCQwFf9RGfwddNXWz0uFU9ztymylOhRS';
$clientSecret = 'EGnHDxD_qRPdaLdZz8iCr8N7_MzF-YHPTkjs6NKYQvQSBngp4PTTVWkPZRbL';
/** @var \Paypal\Rest\ApiContext $apiContext */
$apiContext = getApiContext();
$apiContext = getApiContext($clientId, $clientSecret);
return $apiContext;
/**
@@ -33,7 +37,7 @@ return $apiContext;
*
* @return PayPal\Rest\ApiContext
*/
function getApiContext()
function getApiContext($clientId, $clientSecret)
{
// ### Api context
@@ -44,8 +48,8 @@ function getApiContext()
$apiContext = new ApiContext(
new OAuthTokenCredential(
'EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM',
'EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM'
$clientId,
$clientSecret
)
);

View File

@@ -2,13 +2,10 @@
require __DIR__ . '/../bootstrap.php';
$clientId = 'AYSq3RDGsmBLJE-otTkBtM-jBRd1TCQwFf9RGfwddNXWz0uFU9ztymylOhRS';
$clientSecret = 'EGnHDxD_qRPdaLdZz8iCr8N7_MzF-YHPTkjs6NKYQvQSBngp4PTTVWkPZRbL';
$baseUrl = getBaseUrl() . '/ExecuteAuth.php?success=true';
$baseUrl = getBaseUrl() . '/UserConsentRedirect.php?success=true';
//Get User Consent
// The clientId is stored in the bootstrap file
$redirectUrl = \PayPal\Auth\Openid\PPOpenIdSession::getAuthorizationUrl(
$baseUrl,
array('profile', 'email', 'phone'),

View File

@@ -0,0 +1,23 @@
<?php
require __DIR__ . '/../bootstrap.php';
// You can retrieve the refresh token by executing ObtainUserConsent.php and store the refresh token
$refreshToken = 'yzX4AkmMyBKR4on7vB5he-tDu38s24Zy-kTibhSuqA8kTdy0Yinxj7NpAyULx0bxqC5G8dbXOt0aVMlMmtpiVmSzhcjVZhYDM7WUQLC9KpaXGBHyltJPkLLQkXE';
$params = array(
'refresh_token' => $refreshToken,
'redirect_uri' => getBaseUrl() . '/UserConsentRedirect.php?success=true',
'client_id' => $clientId,
'client_secret' => $clientSecret
);
try {
$tokenInfo = new \PayPal\Auth\Openid\PPOpenIdTokeninfo();
$tokenInfo = $tokenInfo->createFromRefreshToken($params, $apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
}
print_result("Obtained Access Token From Refresh Token", "Access Token", $tokenInfo->getAccessToken(), $tokenInfo);

View File

@@ -9,21 +9,17 @@
require __DIR__ . '/../bootstrap.php';
$clientId = 'AYSq3RDGsmBLJE-otTkBtM-jBRd1TCQwFf9RGfwddNXWz0uFU9ztymylOhRS';
$clientSecret = 'EGnHDxD_qRPdaLdZz8iCr8N7_MzF-YHPTkjs6NKYQvQSBngp4PTTVWkPZRbL';
use PayPal\Api\ExecutePayment;
use PayPal\Api\Payment;
use PayPal\Api\PaymentExecution;
session_start();
if(isset($_GET['success']) && $_GET['success'] == 'true') {
$code = $_GET['code'];
$params = array(
'code' => $code,
'redirect_uri' => getBaseUrl() . '/ExecuteAuth.php?success=true',
'redirect_uri' => getBaseUrl() . '/UserConsentRedirect.php?success=true',
'client_id' => $clientId,
'client_secret' => $clientSecret
);
@@ -34,6 +30,7 @@ if(isset($_GET['success']) && $_GET['success'] == 'true') {
var_dump($ex->getData());
exit(1);
}
echo $accessToken->toJSON(JSON_PRETTY_PRINT);
print_result("Obtained Access Token", "Access Token", $accessToken->getAccessToken(), $accessToken);
}

View File

@@ -1,43 +1,43 @@
## This is an example configuration file for the SDK.
## The sample scripts configure the SDK dynamically
## but you can choose to go for file based configuration
## in simpler apps (See bootstrap.php for more).
;Connection Information
[Http]
http.ConnectionTimeOut = 30
http.Retry = 1
;http.Proxy=http://[username:password]@hostname[:port]
;Service Configuration
[Service]
mode=sandbox ; can be set to sandbox / live
;Logging Information
[Log]
log.LogEnabled=true
; When using a relative path, the log file is created
; relative to the .php file that is the entry point
; for this request. You can also provide an absolute
; path here
log.FileName=../PayPal.log
; Logging level can be one of FINE, INFO, WARN or ERROR
; Logging is most verbose in the 'FINE' level and
; decreases as you proceed towards ERROR
log.LogLevel=FINE
;Validation Configuration
[validation]
; If validation is set to strict, the PPModel would make sure that
; there are proper accessors (Getters and Setters) for each model
; objects. Accepted value is
; 'log' : logs the error message to logger only (default)
; 'strict' : throws a php notice message
; 'disable' : disable the validation
validation.level=strict
## This is an example configuration file for the SDK.
## The sample scripts configure the SDK dynamically
## but you can choose to go for file based configuration
## in simpler apps (See bootstrap.php for more).
;Connection Information
[Http]
http.ConnectionTimeOut = 30
http.Retry = 1
;http.Proxy=http://[username:password]@hostname[:port]
;Service Configuration
[Service]
mode=sandbox ; can be set to sandbox / live
;Logging Information
[Log]
log.LogEnabled=true
; When using a relative path, the log file is created
; relative to the .php file that is the entry point
; for this request. You can also provide an absolute
; path here
log.FileName=../PayPal.log
; Logging level can be one of FINE, INFO, WARN or ERROR
; Logging is most verbose in the 'FINE' level and
; decreases as you proceed towards ERROR
log.LogLevel=FINE
;Validation Configuration
[validation]
; If validation is set to strict, the PPModel would make sure that
; there are proper accessors (Getters and Setters) for each model
; objects. Accepted value is
; 'log' : logs the error message to logger only (default)
; 'strict' : throws a php notice message
; 'disable' : disable the validation
validation.level=strict