/**
  * @test
  * Test case for permissions service integration
  */
 public function testCreateInvoiceForThirdParty()
 {
     $item1 = new InvoiceItemType('item_name1', '1', '1');
     $item2 = new InvoiceItemType('item_name2', '2', '2');
     $items = array($item1, $item2);
     $itemList = new InvoiceItemListType();
     $itemList->item = $items;
     $invoice = new InvoiceType('*****@*****.**', '*****@*****.**', $itemList, 'USD', 'DueOnReceipt');
     $requestEnvelope = new RequestEnvelope();
     $requestEnvelope->errorLanguage = "en_US";
     $createInvoiceRequest = new CreateInvoiceRequest($requestEnvelope, $invoice);
     $invoice_service = new InvoiceService();
     $invoice_service->setAccessToken("iHJRdaLaHlROHt6OxkH29I53ZvCHdgEhBdMWxu4OyoB9AaKkS5YlWw");
     $invoice_service->setTokenSecret("3M5zkwsU-F0OKhvsuSJmITYJueg");
     $ret = $invoice_service->CreateInvoice($createInvoiceRequest, 'jb-us-seller_api1.paypal.com');
     $this->assertNotNull($ret);
 }
Example #2
0
 		 Configuration::getAcctAndConfig() returns array that contains credential and config parameters
 */
 $invoiceService = new InvoiceService(Configuration::getAcctAndConfig());
 // required in third party permissioning
 if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
     $cred = new PPSignatureCredential("jb-us-seller_api1.paypal.com", "WX4WTU3S8MY44S7F", "AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy");
     $cred->setThirdPartyAuthorization(new PPTokenAuthorization($_POST['accessToken'], $_POST['tokenSecret']));
 }
 try {
     /*
     *  ## Making API call
     			 Invoke the appropriate method corresponding to API in service
     			 wrapper object
     */
     if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
         $createInvoiceResponse = $invoiceService->CreateInvoice($createInvoiceRequest, $cred);
     } else {
         $createInvoiceResponse = $invoiceService->CreateInvoice($createInvoiceRequest);
     }
 } catch (Exception $ex) {
     require_once 'error.php';
     exit;
 }
 echo "<table>";
 echo "<tr><td>Ack :</td><td><div id='Ack'>" . $createInvoiceResponse->responseEnvelope->ack . "</div> </td></tr>";
 echo "<tr><td>InvoiceID :</td><td><div id='InvoiceID'>" . $createInvoiceResponse->invoiceID . "</div> </td></tr>";
 echo "</table>";
 require 'ShowAllResponse.php';
 echo "<pre>";
 var_dump($createInvoiceResponse);
 echo "</pre>";