forked from LiveCarta/PayPal-PHP-SDK
Updated Invoicing APIs
- Updated Model objects. - Updated Samples. - Updated Tests.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
12
sample/doc/invoice/GetNextInvoiceNumber.html
Normal file
12
sample/doc/invoice/GetNextInvoiceNumber.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>invoice/GetNextInvoiceNumber</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="invoice/GetNextInvoiceNumber"><meta name="groc-project-path" content="invoice/GetNextInvoiceNumber.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">invoice/GetNextInvoiceNumber.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor"><?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="get-next-invoice-number-sample">Get Next Invoice Number Sample</h1>
|
||||
<p>This sample code demonstrate how you can retrieve
|
||||
the next invoice number.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</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">Invoice</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="get-next-invoice-number">Get Next Invoice Number</h3>
|
||||
<p>To generate the successive invoice number for the merchant, use below code.
|
||||
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
|
||||
<span class="hljs-variable">$number</span> = Invoice::generateNumber(<span class="hljs-variable">$apiContext</span>);
|
||||
} <span class="hljs-keyword">catch</span> (<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY</p></div></div><div class="code"><div class="wrapper"> ResultPrinter::printError(<span class="hljs-string">"Get Next Invoice Number"</span>, <span class="hljs-string">"InvoiceNumber"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$ex</span>);
|
||||
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||
}</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY</p></div></div><div class="code"><div class="wrapper"> ResultPrinter::printResult(<span class="hljs-string">"Get Next Invoice Number"</span>, <span class="hljs-string">"InvoiceNumber"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$number</span>, <span class="hljs-variable">$number</span>);
|
||||
|
||||
<span class="hljs-keyword">return</span> <span class="hljs-variable">$number</span>;</div></div></div></div></body></html>
|
||||
@@ -1186,6 +1186,17 @@ if (PHP_SAPI == 'cli') {
|
||||
</div>
|
||||
<!-- List group -->
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Generate Next Invoice Number</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="invoice/GetNextInvoiceNumber.php" class="btn btn-primary pull-left execute"> Try It <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/invoice/GetNextInvoiceNumber.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Create an Invoice</h5></div>
|
||||
|
||||
24
sample/invoice/GetNextInvoiceNumber.php
Normal file
24
sample/invoice/GetNextInvoiceNumber.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
// # Get Next Invoice Number Sample
|
||||
// This sample code demonstrate how you can retrieve
|
||||
// the next invoice number.
|
||||
|
||||
require '../bootstrap.php';
|
||||
use PayPal\Api\Invoice;
|
||||
|
||||
// ### Get Next Invoice Number
|
||||
// To generate the successive invoice number for the merchant, use below code.
|
||||
// (See bootstrap.php for more on `ApiContext`)
|
||||
try {
|
||||
$number = Invoice::generateNumber($apiContext);
|
||||
} catch (Exception $ex) {
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Get Next Invoice Number", "InvoiceNumber", null, null, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Get Next Invoice Number", "InvoiceNumber", null, $number, $number);
|
||||
|
||||
return $number;
|
||||
Reference in New Issue
Block a user