getAll() public static method

Retrieves the template information of the merchant.
public static getAll ( array $params = [], ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : Templates
$params array
$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
return Templates
示例#1
0
 /**
  * @dataProvider mockProvider
  * @param Templates $obj
  */
 public function testGetAll($obj, $mockApiContext)
 {
     $mockPPRestCall = $this->getMockBuilder('\\PayPal\\Transport\\PayPalRestCall')->disableOriginalConstructor()->getMock();
     $mockPPRestCall->expects($this->any())->method('execute')->will($this->returnValue(TemplatesTest::getJson()));
     $params = array();
     $result = $obj->getAll($params, $mockApiContext, $mockPPRestCall);
     $this->assertNotNull($result);
 }
<?php

use PayPal\Api\Templates;
require 'CreateInvoiceTemplate.php';
try {
    $templates = Templates::getAll(array("fields" => "all"), $apiContext);
} catch (Exception $ex) {
    // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
    ResultPrinter::printError("Get all Templates", "Templates", null, null, $ex);
    exit(1);
}
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Get all Templates", "Templates", null, null, $templates);
return $templates;