/** * @test */ public function checkSendInvoice() { $env = new RequestEnvelope(); $env->errorLanguage = "en_US"; $env->detailLevel = "ReturnAll"; $req = new SendInvoiceRequest(); $req->invoiceID = self::$invoicID; $req->requestEnvelope = $env; $invc = new InvoiceService(); $ret = $invc->SendInvoice($req); $this->assertNotNull($ret); $this->assertNotNull($ret->invoiceID); $this->assertEquals(0, count($ret->error)); }
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) { $sendInvoiceResponse = $invoiceService->SendInvoice($sendInvoiceRequest, $cred); } else { $sendInvoiceResponse = $invoiceService->SendInvoice($sendInvoiceRequest); } } catch (Exception $ex) { require_once 'error.php'; exit; } echo "<table>"; echo "<tr><td>Ack :</td><td><div id='Ack'>" . $sendInvoiceResponse->responseEnvelope->ack . "</div> </td></tr>"; echo "<tr><td>InvoiceID :</td><td><div id='InvoiceID'>" . $sendInvoiceResponse->invoiceID . "</div> </td></tr>"; echo "</table>"; require 'ShowAllResponse.php'; echo "<pre>"; var_dump($sendInvoiceResponse); echo "</pre>";