Esempio n. 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;
 }
Esempio n. 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;
 }
Esempio n. 3
0
// (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>";
    print_r($response);
    echo "</pre>";
} else {
    echo "<pre>";
    print_r($response);