public function search()
 {
     $logger = new PPLoggingManager('SearchInvoices');
     // ##SearchInvoicesRequest
     // Use the SearchInvoiceRequest message to search an invoice.
     // The code for the language in which errors are returned, which must be
     // en_US.
     $requestEnvelope = new RequestEnvelope();
     $requestEnvelope->ErrorLanguage = "en_US";
     $parameters = new SearchParametersType();
     // Invoice amount search. It specifies the smallest amount to be
     // returned. If you pass a value for this field, you must also pass a
     // currencyCode value.
     $parameters->UpperAmount = "4.00";
     // Currency used for lower and upper amounts. It is required when you
     // specify lowerAmount or upperAmount.
     $parameters->CurrencyCode = "USD";
     // SearchInvoicesRequest which takes mandatory params:
     //
     // * `Request Envelope` - Information common to each API operation, such
     // as the language in which an error message is returned.
     // * `Merchant Email` - Email address of invoice creator.
     // * `SearchParameters` - Parameters constraining the search.
     // * `Page` - Page number of result set, starting with 1.
     // * `Page Size` - Number of results per page, between 1 and 100.
     $searchInvoicesRequest = new SearchInvoicesRequest($requestEnvelope, "*****@*****.**", $parameters, "1", "10");
     // ## Creating service wrapper object
     // Creating service wrapper object to make API call and loading
     // configuration file for your credentials and endpoint
     $service = new InvoiceService();
     try {
         // ## Making API call
         // Invoke the appropriate method corresponding to API in service
         // wrapper object
         $response = $service->SearchInvoices($searchInvoicesRequest);
     } catch (Exception $ex) {
         $logger->error("Error Message : " . $ex->getMessage());
     }
     // ## Accessing response parameters
     // You can access the response parameters using variables in
     // response object as shown below
     // ### Success values
     if ($response->responseEnvelope->ack == "Success") {
         // Number of invoices that matched the request.
         $logger->log("Count : " . $response->count);
     } else {
         $logger->error("API Error Message : " . $response->error[0]->message);
     }
     return $response;
 }
Ejemplo n.º 2
0
    }
    if ($_POST['creationDateStart'] != '' || $_POST['creationDateEnd'] != '') {
        $dateRange = new DateRangeType();
        $dateRange->startDate = $_POST['creationDateStart'];
        $dateRange->endDate = $_POST['creationDateEnd'];
        $parameters->creationDate = $dateRange;
    }
    $searchInvoicesRequest = new SearchInvoicesRequest($requestEnvelope, $merchantEmail, $parameters, $page, $pageSize);
    $logger->info("created GsearchInvoices Object");
    $invoiceService = new InvoiceService();
    // required in third party permissioning
    if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
        $invoiceService->setAccessToken($_POST['accessToken']);
        $invoiceService->setTokenSecret($_POST['tokenSecret']);
    }
    $searchInvoicesResponse = $invoiceService->SearchInvoices($searchInvoicesRequest);
    $logger->info("Received searchInvoices Response");
    var_dump($searchInvoicesResponse);
} else {
    ?>

<form method="POST">
<div id="apidetails">The SearchInvoice API operation is used to search for invoices that match input criteria.</div>
<div class="params">
<div class="param_name">Merchant Email</div>
<div class="param_value"><input type="text" name="merchantEmail" value="*****@*****.**"
	size="50" maxlength="260" /></div>
<!-- Search criteria -->
<div class="param_name">Email</div>
<div class="param_value">
	<input type="text" name="email" value="*****@*****.**" />