private function handleNotary() { try { if (!isset($_REQUEST['signPayload'])) { return; } $payload = $_REQUEST['payload']; $req = new NotaryService($this->apiFQDN, $this->clientId, $this->clientSecret); $this->results['notary'] = $req->getNotary($payload); } catch (Exception $e) { $this->errors['notary'] = $e->getMessage(); } }
// Create the service for requesting an OAuth access token. $osrvc = new OAuthTokenService('https://api.att.com', $clientId, $clientSecret); // Get the OAuth access token using the Payment scope. $token = $osrvc->getToken('Payment'); // Create the service for interacting with the Notary API $notarySrvc = new NotaryService('https://api.att.com', $clientId, $clientSecret); // Create the service for interacting with the Payment API $paymentSrvc = new PaymentService('https://api.att.com', $token); // The following try/catch blocks can be used to test the methods of the // Payment API. To test a specific method, comment out the other try/catch blocks. /* This try/catch block tests the getNotary method. */ try { // Specify the payload. $payload = 'ENTER VALUE!'; // Send the request for getting the notary. $response = $notarySrvc->getNotary($payload); echo 'signature: ' . $response->getSignature() . "\n"; } catch (ServiceException $se) { echo $se->getErrorResponse(); } /* This try/catch block tests the getTransactionStatus method. */ try { // Specify the transaction type. For example: $type = 'TransactionId'; $type = 'ENTER VALUE!'; // Specify the transaction value. $value = 'ENTER VALUE!'; // Send the request for the transaction status. $response = $paymentSrvc->getTransactionStatus($type, $value); echo 'transaction IsSuccess: ' . $response['IsSuccess'] . "\n"; } catch (ServiceException $se) { echo $se->getErrorResponse();