<?php // Include required library files. require_once '../includes/config.php'; require_once '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.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 $Scope = array('EXPRESS_CHECKOUT', 'DIRECT_PAYMENT', 'SETTLEMENT_CONSOLIDATION', 'SETTLEMENT_REPORTING', 'AUTH_CAPTURE', 'MOBILE_CHECKOUT', 'BILLING_AGREEMENT', 'REFERENCE_TRANSACTION', 'AIR_TRAVEL', 'MASS_PAY', 'TRANSACTION_DETAILS', 'TRANSACTION_SEARCH', 'RECURRING_PAYMENTS', 'ACCOUNT_BALANCE', 'ENCRYPTED_WEBSITE_PAYMENTS', 'REFUND', 'NON_REFERENCED_CREDIT', 'BUTTON_MANAGER', 'MANAGE_PENDING_TRANSACTION_STATUS', 'RECURRING_PAYMENT_REPORT', 'EXTENDED_PRO_PROCESSING_REPORT', 'EXCEPTION_PROCESSING_REPORT', 'ACCOUNT_MANAGEMENT_PERMISSIONS', 'ACCESS_BASIC_PERSONAL_DATA', 'ACCESS_ADVANCED_PERSONAL_DATA'); $RequestPermissionsFields = array('Scope' => $Scope, 'Callback' => ''); $PayPalRequestData = array('RequestPermissionsFields' => $RequestPermissionsFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->RequestPermissions($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
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); $PayPalRequestData = array('RequestPermissionsFields' => $RequestPermissionsFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalPer = $PayPal->RequestPermissions($PayPalRequestData); $_SESSION['msgType'] = array('from' => 'user', 'type' => 'error', 'var' => "multiple", 'val' => "Your Paypal Account is Added Successfuly"); redirect($PayPalPer['RedirectURL']); //redirect($base_url."profile/edit/"); } else { $_SESSION['msgType'] = array('from' => 'user', 'type' => 'error', 'var' => "multiple", 'val' => "Problem Verifying your Paypal Business Account, Please Try Again"); redirect($base_url . "profile/edit/"); } } if (isset($_POST["submitaccset"]) && isset($_POST['newpasswd'])) { extract($_POST); $obj = new validation(); $obj->add_fields($newpasswd, 'min=6', 'Enter Password atleast 6. characters long'); $obj->add_fields($newpasswd, 'max=25', 'Password should not be more than 25 characters long'); $obj->add_fields($newpasswd, 'alphanumUD', "Passord" . ER_ALPHANUM); $obj->add_fields($confpasswd, 'alphanumUD', "Confirmed passord" . ER_ALPHANUM);