Updating samples to use fluent setters + doc fixes

This commit is contained in:
aydiv
2013-08-22 17:24:04 +05:30
parent 14b9a13f8a
commit f4d687b52b
27 changed files with 422 additions and 893 deletions

View File

@@ -2,27 +2,32 @@
// ##Reauthorization Sample
// Sample showing how to do a reauthorization
// API used: v1/payments/authorization/{authorization_id}/reauthorize
require __DIR__ . '/../bootstrap.php';
use PayPal\Api\Authorization;
use PayPal\Api\Amount;
// ### Reauthorization
// Reauthorization is available only for PayPal account payments
// and not for credit card payments.
// You can reauthorize a payment only once 4 to 29
// days after the 3-day honor period for the original authorization
// has expired.
try {
// ###Reauthorization
// Retrieve a authorization id from authorization object
// by making a `Payment Using PayPal` with intent
// as `authorize`. You can reauthorize a payment only once 4 to 29
// days after 3-day honor period for the original authorization
// expires.
// ### Retrieve a authorization using the authorization id
$authorization = Authorization::get('7GH53639GA425732B', $apiContext);
$amount = new Amount();
$amount->setCurrency("USD");
$amount->setTotal("1.00");
// ### Reauthorize with amount being reauthorized
$authorization->setAmount($amount);
$reauthorization = $authorization->reauthorize($apiContext);
}catch (PayPal\Exception\PPConnectionException $ex){
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
@@ -31,7 +36,7 @@ try {
<html>
<body>
<div>
Reauthorize:
Reauthorization Id:
<?php echo $reauthorization->getId();?>
</div>
<pre>