$serverName = $_SERVER['SERVER_NAME']; $serverPort = $_SERVER['SERVER_PORT']; $url = dirname('http://' . $serverName . ':' . $serverPort . $_SERVER['REQUEST_URI']); $returnURL = $url . "/AddBankAccountDetails.php"; $cancelURL = $url . "/AddBankAccount.php"; $cancelUrlDescription = "cancelurl"; $returnUrlDescription = "returnurl"; $weboptions = new WebOptionsType(); $weboptions->returnUrl = $returnURL; $weboptions->cancelUrl = $cancelURL; $weboptions->returnUrlDescription = $returnUrlDescription; $weboptions->cancelUrlDescription = $cancelUrlDescription; $ABARequest->webOptions = $weboptions; $aa = new AdaptiveAccounts(); //$aa->sandBoxEmailAddress = $sandboxEmail; $response = $aa->AddBankAccount($ABARequest); if (strtoupper($aa->isSuccess) == 'FAILURE') { $_SESSION['FAULTMSG'] = $aa->getLastError(); $location = "APIError.php"; header("Location: {$location}"); } else { $location = "AddBankAccountDetails.php"; $_SESSION['BankAdded'] = $response; header("Location: {$location}"); } } catch (Exception $ex) { $fault = new FaultMessage(); $errorData = new ErrorData(); $errorData->errorId = $ex->getFile(); $errorData->message = $ex->getMessage(); $fault->error = $errorData;
function AddBankAccountDirect($tempReturn1) { $bankCountryCode = 'US'; $bankName = 'Huntington Bank'; $routingNumber = '021473030'; $bankAccountNumber = (string) rand(160000, 169999); $confirmationType = 'NONE'; $emailid = $tempReturn1['emailAddress']; $accounttype = 'CHECKING'; /* Make the call to PayPal to Add Bank as funding source If an error occured, show the resulting errors */ $ABARequest = new AddBankAccountRequest(); $ABARequest->bankCountryCode = $bankCountryCode; $ABARequest->bankName = $bankName; $ABARequest->routingNumber = $routingNumber; $ABARequest->bankAccountNumber = $bankAccountNumber; $ABARequest->confirmationType = $confirmationType; $ABARequest->bankAccountType = $accounttype; $ABARequest->emailAddress = $emailid; $ABARequest->createAccountKey = $tempReturn1['createAccountKey']; $rEnvelope = new RequestEnvelope(); $rEnvelope->errorLanguage = "en_US"; $ABARequest->requestEnvelope = $rEnvelope; $serverName = 'localhost'; $serverPort = '8082'; $url = dirname('http://' . $serverName . ':' . $serverPort . '/REQUEST_URI/'); $returnURL = $url . "/AddBankAccountDetails.php"; $cancelURL = $url . "/AddBankAccount.php"; $cancelUrlDescription = 'cancelurl'; $returnUrlDescription = 'returnurl'; $weboptions = new WebOptionsType(); $weboptions->returnUrl = $returnURL; $weboptions->cancelUrl = $cancelURL; $weboptions->returnUrlDescription = $returnUrlDescription; $weboptions->cancelUrlDescription = $cancelUrlDescription; $ABARequest->webOptions = $weboptions; $aa = new AdaptiveAccounts(); $aa->sandBoxEmailAddress = '*****@*****.**'; $response = $aa->AddBankAccount($ABARequest); if (strtoupper($aa->isSuccess) == 'FAILURE') { $FaultMsg = $aa->getLastError(); echo "Transaction add bank direct: 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 "Add bank Account - Direct API call Successful! \n"; } }