コード例 #1
0
    $APCRequest->cardVerificationNumber = $cardVerificationNumber;
    $APCRequest->billingAddress = $bAddress;
    $APCRequest->nameOnCard = $nameOnCard;
    $rEnvelope = new RequestEnvelope();
    $rEnvelope->errorLanguage = "en_US";
    $APCRequest->requestEnvelope = $rEnvelope;
    $serverName = $_SERVER['SERVER_NAME'];
    $serverPort = $_SERVER['SERVER_PORT'];
    $url = dirname('http://' . $serverName . ':' . $serverPort . $_SERVER['REQUEST_URI']);
    $returnURL = $url . "/AddPaymentCardDirectDetails.php";
    $cancelURL = $url . "/AddPaymentCardDirect.php";
    $cancelUrlDescription = "cancelurl";
    $returnUrlDescription = "returnurl";
    $aa = new AdaptiveAccounts();
    //$aa->sandBoxEmailAddress = $sandboxEmail;
    $response = $aa->AddPaymentCard($APCRequest);
    if (strtoupper($aa->isSuccess) == 'FAILURE') {
        $_SESSION['FAULTMSG'] = $aa->getLastError();
        $location = "APIError.php";
        header("Location: {$location}");
    } else {
        $location = "AddPaymentCardDirectDetails.php";
        $_SESSION['CardAdded'] = $response;
        header("Location: {$location}");
    }
} catch (Exception $ex) {
    $fault = new FaultMessage();
    $errorData = new ErrorData();
    $errorData->errorId = $ex->getFile();
    $errorData->message = $ex->getMessage();
    $fault->error = $errorData;
コード例 #2
0
function AddPaymentCardDirect($tempReturn2)
{
    $emailid = $tempReturn2['emailAddress'];
    $cardtype = 'Visa';
    $cardNumber = Cardnumbergenerator();
    $confirmationType = 'NONE';
    $expirationDate = new CardDateType();
    $expirationDate->month = '01';
    $expirationDate->year = '2014';
    $nameOnCard = new NameType();
    $nameOnCard->firstName = 'John';
    $nameOnCard->lastName = 'Deo';
    $bAddress = new AddressType();
    $bAddress->line1 = '1 Main St';
    $bAddress->line2 = '2nd cross';
    $bAddress->city = 'San Jose';
    $bAddress->state = 'CA';
    $bAddress->postalCode = '95131';
    $bAddress->countryCode = 'US';
    $APCRequest = new AddPaymentCardRequest();
    $APCRequest->cardNumber = $cardNumber;
    $APCRequest->cardVerificationNumber = '956';
    $APCRequest->confirmationType = $confirmationType;
    $APCRequest->emailAddress = $emailid;
    $APCRequest->cardType = $cardtype;
    $APCRequest->expirationDate = $expirationDate;
    $APCRequest->billingAddress = $bAddress;
    $APCRequest->nameOnCard = $nameOnCard;
    $APCRequest->createAccountKey = $tempReturn2['createAccountKey'];
    $rEnvelope = new RequestEnvelope();
    $rEnvelope->errorLanguage = "en_US";
    $APCRequest->requestEnvelope = $rEnvelope;
    $serverName = 'localhost';
    $serverPort = '8082';
    $url = dirname('http://' . $serverName . ':' . $serverPort . '/REQUEST_URI/');
    $returnURL = $url . "/AddPaymentCardDetails.php";
    $cancelURL = $url . "/AddPaymentCard.php";
    $cancelUrlDescription = "cancelurl";
    $returnUrlDescription = "returnurl";
    $aa = new AdaptiveAccounts();
    //$aa->sandBoxEmailAddress = $sandboxEmail;
    $response = $aa->AddPaymentCard($APCRequest);
    if (strtoupper($aa->isSuccess) == 'FAILURE') {
        $FaultMsg = $aa->getLastError();
        echo "Transaction Add Payment Card direct Failed: error Id: ";
        if (is_array($FaultMsg->error)) {
            echo $FaultMsg->error[0]->errorId . ", error message: " . $FaultMsg->error[0]->message;
        } else {
            echo $FaultMsg->error->errorId . ", error message: " . $FaultMsg->error->message;
        }
    } else {
        echo "AddPaymentCard -Direct - Direct API call Successful! \n";
    }
}