Removing Dependency from SDK Core Project

- Copied files required for Rest API SDK
- Removed PPApiContext and directly connected APIContext with PPConfigManager
- Removed duplicate data storage of configuration and credentials.
- Code Style Fixes
- Remove build.xml file as it is not required anymore
- Updated the samples
- Updated the documentations
This commit is contained in:
japatel
2014-10-06 11:16:47 -05:00
parent bb7654b0b8
commit 49b80f76af
150 changed files with 10975 additions and 6525 deletions

View File

@@ -0,0 +1,37 @@
<!DOCTYPE html><html lang="en"><head><title>payments/Reauthorization</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/Reauthorization"><meta name="groc-project-path" content="sample/payments/Reauthorization.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/Reauthorization.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h2 id="reauthorization-sample">Reauthorization Sample</h2>
<p>This sample code demonstrates how you can reauthorize a PayPal
account payment.
API used: v1/payments/authorization/{authorization_id}/reauthorize</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Authorization</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Amount</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="reauthorization">Reauthorization</h3>
<p>Reauthorization is available only for PayPal account payments
and not for credit card payments.</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>You can reauthorize a payment only once 4 to 29
days after the 3-day honor period for the original authorization
has expired.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="lookup-authorization-using-the-authorization-id">Lookup authorization using the authorization id</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"> <span class="hljs-variable">$authorization</span> = Authorization::get(<span class="hljs-string">'7GH53639GA425732B'</span>, <span class="hljs-variable">$apiContext</span>);
<span class="hljs-variable">$amount</span> = <span class="hljs-keyword">new</span> Amount();
<span class="hljs-variable">$amount</span>-&gt;setCurrency(<span class="hljs-string">"USD"</span>);
<span class="hljs-variable">$amount</span>-&gt;setTotal(<span class="hljs-string">"1.00"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="reauthorize-with-amount-being-reauthorized">Reauthorize with amount being reauthorized</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"> <span class="hljs-variable">$authorization</span>-&gt;setAmount(<span class="hljs-variable">$amount</span>);
<span class="hljs-variable">$reauthorization</span> = <span class="hljs-variable">$authorization</span>-&gt;reauthorize(<span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Reauthorize a payment&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;
Reauthorization Id:
<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$reauthorization</span>-&gt;getId();<span class="hljs-preprocessor">?&gt;</span>
&lt;/div&gt;
&lt;pre&gt;
<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$reauthorization</span>-&gt;toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?&gt;</span>
&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>