File indexing completed on 2025-05-04 05:32:13
0001 <?php 0002 /** 0003 * ocs-webserver 0004 * 0005 * Copyright 2016 by pling GmbH. 0006 * 0007 * This file is part of ocs-webserver. 0008 * 0009 * This program is free software: you can redistribute it and/or modify 0010 * it under the terms of the GNU Affero General Public License as 0011 * published by the Free Software Foundation, either version 3 of the 0012 * License, or (at your option) any later version. 0013 * 0014 * This program is distributed in the hope that it will be useful, 0015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 * GNU Affero General Public License for more details. 0018 * 0019 * You should have received a copy of the GNU Affero General Public License 0020 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0021 **/ 0022 0023 class Local_Payment_PayPal_AdaptiveAccounts_Account 0024 extends Local_Payment_Paypal_Base 0025 implements Local_Payment_AccountInterface 0026 { 0027 0028 const SUCCESS = 'Success'; 0029 const VERIFIED = 'VERIFIED'; 0030 const RESPONSE_ENVELOPE_ACK = 'responseEnvelope_ack'; 0031 const ACCOUNT_STATUS = 'accountStatus'; 0032 0033 const API_ADAPTIVE_ACCOUNTS = 'AdaptiveAccounts'; 0034 0035 const OPERATION_GET_VERIFIED_STATUS = 'GetVerifiedStatus'; 0036 0037 0038 protected $_ipnNotificationUrl; 0039 protected $_cancelUrl; 0040 protected $_returnUrl; 0041 0042 /** @var \Local_Payment_PayPal_UserData */ 0043 protected $_paymentUserData; 0044 protected $_dataIpn; 0045 0046 0047 /** 0048 * @param Local_Payment_UserDataInterface $userData 0049 * @param string $matchCriteria 0050 * @return bool 0051 */ 0052 public function verifyAccount($userData, $matchCriteria = 'NAME') 0053 { 0054 $requestParameters = array( 0055 'emailAddress' => $userData->getPaymentUserId(), 0056 'firstName' => $userData->getFirstName(), 0057 'lastName' => $userData->getLastName(), 0058 'matchCriteria' => $matchCriteria 0059 ); 0060 0061 $response = $this->_makeRequest($requestParameters, self::API_ADAPTIVE_ACCOUNTS, self::OPERATION_GET_VERIFIED_STATUS); 0062 0063 return $response->isRequestSuccessful() AND $response->isVerifiedAccount(); 0064 } 0065 0066 /** 0067 * @param Local_Payment_UserDataInterface $userData 0068 * @throws Exception 0069 */ 0070 public function setUserDataStore($userData) 0071 { 0072 if (false === ($userData instanceof Local_Payment_UserDataInterface)) { 0073 throw new Exception('Wrong data type for user data'); 0074 } 0075 $this->_paymentUserData = $userData; 0076 } 0077 0078 /** 0079 * @return Local_Payment_PayPal_UserData 0080 */ 0081 public function getUserDataStore() 0082 { 0083 return $this->_paymentUserData; 0084 } 0085 0086 }