示例#1
0
        } else {
            $_SESSION['msgType'] = array('from' => 'user', 'type' => 'error', 'var' => "multiple", 'val' => "Invalid image format selected.");
        }
    }
}
if (isset($_POST["submitverifiedstatus"])) {
    require_once '../../includes/paypal/config.php';
    require_once '../../includes/paypal/paypal.class.php';
    // Create PayPal object.
    $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject);
    $PayPal = new PayPal_Adaptive($PayPalConfig);
    // Prepare request arrays
    $GetVerifiedStatusFields = array('EmailAddress' => $_POST['paypalemail'], 'FirstName' => $_POST['paypalfname'], 'LastName' => $_POST['paypallname'], 'MatchCriteria' => 'NAME');
    $PayPalRequestData = array('GetVerifiedStatusFields' => $GetVerifiedStatusFields);
    // Pass data into class for processing with PayPal and load the response array into $PayPalResult
    $PayPalResult = $PayPal->GetVerifiedStatus($PayPalRequestData);
    // Write the contents of the response array to the screen for demo purposes.
    /*echo '<pre />';
    	print_r($PayPalResult);
    	echo $PayPalResult['AccountStatus'];*/
    if ($PayPalResult['AccountStatus'] == "VERIFIED") {
        $paypalemail = base64_encode($_POST['paypalemail']);
        $paypalFname = $_POST['paypalfname'];
        $paypalLname = $_POST['paypallname'];
        $con->update("UPDATE users SET paypalUserAccount='{$paypalemail}', paypalFname='{$paypalFname}', paypalLname='{$paypalLname}'\n\t\t\t\tWHERE `userId` = '" . $_SESSION['userId'] . "'");
        /****** Paypal Adaptive REFUND permission code *******/
        $PayPal = new PayPal_Adaptive($PayPalConfig);
        // Prepare request arrays
        $Scope = array('REFUND');
        $RequestPermissionsFields = array('Scope' => $Scope, 'Callback' => $base_url . 'profile/edit/');
        //print_r($RequestPermissionsFields);