forked from LiveCarta/PayPal-PHP-SDK
Helper Function to Retrieve Specific Link from Model Object
- Helper Methods in Payment and Agreement to get ApprovalLink - Fixes #195
This commit is contained in:
@@ -71,14 +71,9 @@ try {
|
||||
|
||||
// ### Get redirect url
|
||||
// The API response provides the url that you must redirect
|
||||
// the buyer to. Retrieve the url from the $agreement->getLinks()
|
||||
// the buyer to. Retrieve the url from the $agreement->getApprovalLink()
|
||||
// method
|
||||
foreach ($agreement->getLinks() as $link) {
|
||||
if ($link->getRel() == 'approval_url') {
|
||||
$approvalUrl = $link->getHref();
|
||||
break;
|
||||
}
|
||||
}
|
||||
$approvalUrl = $agreement->getApprovalLink();
|
||||
|
||||
} catch (Exception $ex) {
|
||||
ResultPrinter::printError("Created Billing Agreement.", "Agreement", null, $request, $ex);
|
||||
|
||||
@@ -108,12 +108,7 @@ try {
|
||||
// The API response provides the url that you must redirect
|
||||
// the buyer to. Retrieve the url from the $payment->getLinks()
|
||||
// method
|
||||
foreach ($payment->getLinks() as $link) {
|
||||
if ($link->getRel() == 'approval_url') {
|
||||
$approvalUrl = $link->getHref();
|
||||
break;
|
||||
}
|
||||
}
|
||||
$approvalUrl = $payment->getApprovalLink();
|
||||
|
||||
ResultPrinter::printResult("Created Payment Authorization Using PayPal. Please visit the URL to Authorize.", "Payment", "<a href='$approvalUrl' >$approvalUrl</a>", $request, $payment);
|
||||
|
||||
|
||||
@@ -104,14 +104,9 @@ try {
|
||||
|
||||
// ### Get redirect url
|
||||
// The API response provides the url that you must redirect
|
||||
// the buyer to. Retrieve the url from the $payment->getLinks()
|
||||
// the buyer to. Retrieve the url from the $payment->getApprovalLink()
|
||||
// method
|
||||
foreach ($payment->getLinks() as $link) {
|
||||
if ($link->getRel() == 'approval_url') {
|
||||
$approvalUrl = $link->getHref();
|
||||
break;
|
||||
}
|
||||
}
|
||||
$approvalUrl = $payment->getApprovalLink();
|
||||
|
||||
ResultPrinter::printResult("Created Payment Using PayPal. Please visit the URL to Approve.", "Payment", "<a href='$approvalUrl' >$approvalUrl</a>", $request, $payment);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user