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();
     }
 }
예제 #2
0
use Att\Api\Payment\PaymentService;
// Use the app account settings from developer.att.com for the following values.
// Make sure that the API scope is set to Payment for the Payment API before
// retrieving the App Key and App Secret.
// Enter the value from the 'App Key' field obtained at developer.att.com
// in your app account.
$clientId = 'ENTER VALUE!';
// Enter the value from the 'App Secret' field obtained at developer.att.com
// in your app account.
$clientSecret = 'ENTER VALUE!';
// 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. */