Example #1
0
 /**
  * @param  $params
  * @return mixed
  */
 public function getAccountInfo(array $params = [])
 {
     if (!$params) {
         return false;
     }
     if (!isset($params['email'])) {
         throw new \Exception("Email cannot be blank.", 400);
     }
     $getVerifiedStatus = new GetVerifiedStatusRequest();
     $accountIdentifier = new AccountIdentifierType();
     $accountIdentifier->emailAddress = $params['email'];
     $getVerifiedStatus->accountIdentifier = $accountIdentifier;
     $getVerifiedStatus->matchCriteria = 'NONE';
     if (isset($params['matchCriteria']) && strtolower($params['matchCriteria']) == 'name') {
         $getVerifiedStatus->matchCriteria = 'NAME';
         if (!isset($params['firstName']) || !isset($params['lastName'])) {
             throw new \Exception("Firstname or lastname cannot be blank.", 400);
         }
         $getVerifiedStatus->firstName = $params['firstName'];
         $getVerifiedStatus->lastName = $params['lastName'];
     }
     $getVerifiedStatus->requestEnvelope = ['errorLanguage' => 'en_US', 'detailLevel' => 'ReturnAll'];
     $service = new AdaptiveAccountsService($this->_credentials);
     try {
         $response = $service->GetVerifiedStatus($getVerifiedStatus);
     } catch (Exception $ex) {
         return false;
     }
     return $response;
 }
Example #2
0
 /**
  * @param  $params
  * @return mixed
  */
 public function getAccountInfo(array $params = [])
 {
     if (!$params) {
         return false;
     }
     $getVerifiedStatus = new GetVerifiedStatusRequest();
     $accountIdentifier = new AccountIdentifierType();
     $accountIdentifier->emailAddress = $params['email'];
     $getVerifiedStatus->accountIdentifier = $accountIdentifier;
     $getVerifiedStatus->firstName = $params['firstName'];
     $getVerifiedStatus->lastName = $params['lastName'];
     $getVerifiedStatus->matchCriteria = 'NAME';
     $getVerifiedStatus->requestEnvelope = ['errorLanguage' => 'en_US', 'detailLevel' => 'ReturnAll'];
     $service = new AdaptiveAccountsService($this->_credentials);
     try {
         $response = $service->GetVerifiedStatus($getVerifiedStatus);
     } catch (Exception $ex) {
         return false;
     }
     return $response;
 }
Example #3
0
    if (isset($_REQUEST['cancelURL'])) {
        $cancelURL = $_REQUEST['cancelURL'];
    } else {
        $cancelURL = $url . "/CreateAccount.html.php";
    }
    $webOption = new WebOptionsType();
    $webOption->cancelUrl = $cancelURL;
    $webOption->cancelUrlDescription = $_REQUEST['cancelURLDescription'];
    $webOption->returnUrl = $returnURL;
    $webOption->returnUrlDescription = $_REQUEST['returnURLDescription'];
    $addPaymentCard->webOptions = $webOption;
}
// ## Creating service wrapper object
// Creating service wrapper object to make API call
//Configuration::getAcctAndConfig() returns array that contains credential and config parameters
$service = new AdaptiveAccountsService(Configuration::getAcctAndConfig());
try {
    // ## Making API call
    // invoke the appropriate method corresponding to API in service
    // wrapper object
    $response = $service->AddPaymentCard($addPaymentCard);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
// ## Accessing response parameters
// You can access the response parameters as shown below
$ack = strtoupper($response->responseEnvelope->ack);
if ($ack != "SUCCESS") {
    echo "<b>Error </b>";
    echo "<pre>";
Example #4
0
$createAccountRequest->taxId = $_POST['taxId'];
$clientDetails = new ClientDetailsType();
$clientDetails->ipAddress = '127.0.0.1';
$createAccountRequest->clientDetails = $clientDetails;
if (isset($_REQUEST['notificationURL'])) {
    $createAccountRequest->notificationURL = $_REQUEST['notificationURL'];
}
if ($_REQUEST['accountType'] == "Business") {
    $createAccountRequest->businessInfo = $businessInfo;
}
/*
* ## Creating service wrapper object
	  Creating service wrapper object to make API call 
	  Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$service = new AdaptiveAccountsService(Configuration::getAcctAndConfig());
try {
    /*
    *  ## Making API call
    		   invoke the appropriate method corresponding to API in service
    		   wrapper object
    */
    $response = $service->CreateAccount($createAccountRequest);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
$ack = strtoupper($response->responseEnvelope->ack);
if ($ack != "SUCCESS") {
    echo "<b>Error </b>";
    echo "<pre>";
Example #5
0
$accountIdentifier = new AccountIdentifierType();
// (Required)Email address associated with the PayPal account:
// one of the unique identifiers of the account.
$accountIdentifier->emailAddress = $_REQUEST['emailAddress'];
$getVerifiedStatus->accountIdentifier = $accountIdentifier;
// (Required) The first name of the PayPal account holder.
// Required if matchCriteria is NAME.
$getVerifiedStatus->firstName = $_REQUEST['firstName'];
// (Required) The last name of the PayPal account holder.
// Required if matchCriteria is NAME.
$getVerifiedStatus->lastName = $_REQUEST['lastName'];
$getVerifiedStatus->matchCriteria = $_REQUEST['matchCriteria'];
// ## Creating service wrapper object
// Creating service wrapper object to make API call
//Configuration::getAcctAndConfig() returns array that contains credential and config parameters
$service = new AdaptiveAccountsService(Configuration::getAcctAndConfig());
try {
    // ## Making API call
    // invoke the appropriate method corresponding to API in service
    // wrapper object
    $response = $service->GetVerifiedStatus($getVerifiedStatus);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
// ## Accessing response parameters
// You can access the response parameters as shown below
$ack = strtoupper($response->responseEnvelope->ack);
if ($ack != "SUCCESS") {
    echo "<b>Error </b>";
    echo "<pre>";
Example #6
0
// (Optional) The code for the country in which the user account
// is located. You do not need to provide this country code if
// you are passing the createAccount key. Allowable values are:
$getUserAgreement->countryCode = $_REQUEST['countryCode'];
// (Optional) The key returned for this account in the
// CreateAccountResponse message in the createAccountKey field.
// If you specify this key, do not pass a country code or
// language code. Doing so will result in an error.
$getUserAgreement->createAccountKey = $_REQUEST['createAccountKey'];
// (Optional) The code indicating the language to be used for
// the agreement.
$getUserAgreement->languageCode = $_REQUEST['languageCode'];
// ## Creating service wrapper object
// Creating service wrapper object to make API call
//Configuration::getAcctAndConfig() returns array that contains credential and config parameters
$service = new AdaptiveAccountsService(Configuration::getAcctAndConfig());
try {
    // ## Making API call
    // invoke the appropriate method corresponding to API in service
    // wrapper object
    $response = $service->GetUserAgreement($getUserAgreement);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
// ## Accessing response parameters
// You can access the response parameters as shown below
$ack = strtoupper($response->responseEnvelope->ack);
if ($ack != "SUCCESS") {
    echo "<b>Error </b>";
    echo "<pre>";
Example #7
0
    if ($_REQUEST['cancelURL'] != null) {
        $cancelURL = $_REQUEST['cancelURL'];
    } else {
        $cancelURL = $url . "/AddBankAccount.html.php";
    }
    $webOption = new WebOptionsType();
    $webOption->cancelUrl = $cancelURL;
    $webOption->cancelUrlDescription = $_REQUEST['cancelURLDescription'];
    $webOption->returnUrl = $returnURL;
    $webOption->returnUrlDescription = $_REQUEST['returnURLDescription'];
    $addBankAccount->webOptions = $webOption;
}
// ## Creating service wrapper object
// Creating service wrapper object to make API call
//Configuration::getAcctAndConfig() returns array that contains credential and config parameters
$service = new AdaptiveAccountsService(Configuration::getAcctAndConfig());
try {
    // ## Making API call
    // invoke the appropriate method corresponding to API in service
    // wrapper object
    $response = $service->AddBankAccount($addBankAccount);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
// ## Accessing response parameters
// You can access the response parameters as shown below
$ack = strtoupper($response->responseEnvelope->ack);
if ($ack != "SUCCESS") {
    echo "<b>Error </b>";
    echo "<pre>";
/*
 * (Optional) The email address of the PayPal account to which
 * the funding source was added in the AddPaymentCard or
 * AddBankAccount request. You must specify either the accountId
 * or mailAddress when making this request, but never both in
 * the same request.
 */
$setFundingSourceConfirmed->emailAddress = $_REQUEST['emailAddress'];
/*
 * (Required) The funding source key returned in the AddBankAccount or AddPaymentCard response.
 */
$setFundingSourceConfirmed->fundingSourceKey = $_REQUEST['fundingSourceKey'];
// ## Creating service wrapper object
// Creating service wrapper object to make API call
//Configuration::getAcctAndConfig() returns array that contains credential and config parameters
$service = new AdaptiveAccountsService(Configuration::getAcctAndConfig());
try {
    // ## Making API call
    // invoke the appropriate method corresponding to API in service
    // wrapper object
    $response = $service->SetFundingSourceConfirmed($setFundingSourceConfirmed);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
// ## Accessing response parameters
// You can access the response parameters as shown below
$ack = strtoupper($response->responseEnvelope->ack);
if ($ack != "SUCCESS") {
    echo "<b>Error </b>";
    echo "<pre>";