generateNumber() public static méthode

Generates the successive invoice number.
public static generateNumber ( ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : InvoiceNumber
$apiContext PayPal\Rest\ApiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
$restCall PayPal\Transport\PayPalRestCall is the Rest Call Service that is used to make rest calls
Résultat InvoiceNumber
<?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;
 /**
  * @dataProvider mockProvider
  * @param Invoice $obj
  */
 public function testGenerateNumber($obj, $mockApiContext)
 {
     $mockPPRestCall = $this->getMockBuilder('\\PayPal\\Transport\\PayPalRestCall')->disableOriginalConstructor()->getMock();
     $mockPPRestCall->expects($this->any())->method('execute')->will($this->returnValue(InvoiceNumberTest::getJson()));
     $result = $obj->generateNumber($mockApiContext, $mockPPRestCall);
     $this->assertNotNull($result);
 }