예제 #1
0
 /**
  * Redirects the browser to the consent flow page for creating a new 
  * subscription.
  *
  * @param string $FQDN     fully qualified domain name
  * @param string $clientId client id
  * @param Notary $notary   notary
  *
  * @return void
  */
 public static function newSubscription($FQDN, $clientId, Notary $notary)
 {
     $url = PaymentService::_getURL($FQDN, $clientId, $notary, false);
     header('Location: ' . $url);
 }
 private function handleNewTransaction()
 {
     try {
         if (!isset($_REQUEST['newTransaction'])) {
             return;
         }
         $cost = $this->_minTransValue;
         if (strcmp($_REQUEST['product'], '2') == 0) {
             $cost = $this->_maxTransValue;
         }
         $notary = $this->getTransactionNotary($cost);
         $_SESSION['notary'] = serialize($notary);
         // redirect
         PaymentService::newTransaction($this->apiFQDN, $this->clientId, $notary);
     } catch (Exception $e) {
         $this->errors['newTrans'] = $e->getMessage();
     }
 }
예제 #3
0
// 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. */
try {
    // Specify the transaction type. For example: $type = 'TransactionId';