Fixing handling of PPConnectionException in sample code

This commit is contained in:
aydiv
2013-08-20 15:49:40 +05:30
parent 975afcda1b
commit 6126997abf
29 changed files with 612 additions and 601 deletions

View File

@@ -14,16 +14,17 @@ use PayPal\Api\Payment;
use PayPal\Api\FundingInstrument;
use PayPal\Api\Transaction;
// create payment to get authorization Id
$authId = createAuthorization($apiContext);
// ### GetAuthorization
// GetAuthorization by posting to the APIService
// using a valid ApiContext (See bootstrap.php for more on `ApiContext`)
// The return object contains the status;
try {
// create payment to get authorization Id
$authId = createAuthorization($apiContext);
$authorization = Authorization::get($authId, $apiContext);
} catch (\PPConnectionException $ex) {
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
@@ -85,4 +86,4 @@ function createAuthorization($apiContext)
$resArray = $paymnt->toArray();
return $authId = $resArray['transactions'][0]['related_resources'][0]['authorization']['id'];
}
}