Updated ExecuteAgreement to Get Agreement Object at the end

This commit is contained in:
japatel
2014-12-15 15:42:58 -06:00
parent d24a4afdb6
commit 989357fb02
3 changed files with 97 additions and 68 deletions

View File

@@ -19,8 +19,20 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
ResultPrinter::printError("Executed an Agreement", "Agreement", $agreement->getId(), $_GET['token'], $ex);
exit(1);
}
ResultPrinter::printResult("Executed an Agreement", "Agreement", $agreement->getId(), $_GET['token'], $agreement);
// ## Get Agreement
// Make a get call to retrieve the executed agreement details
try {
$agreement = \PayPal\Api\Agreement::get($agreement->getId(), $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Get Agreement", "Agreement", null, null, $ex);
exit(1);
}
ResultPrinter::printResult("Get Agreement", "Agreement", $agreement->getId(), null, $agreement);
} else {
ResultPrinter::printResult("User Cancelled the Approval", null);
}