Location: PHPKode > projects > MembersGear > membersgear/includes/PaygearWebserviceClient.php
<?php
/*
 *	$Id: client1.php,v 1.3 2007/11/06 14:48:24 snichol Exp $
 *
 *	Client sample that should get a fault response.
 *
 *	Service: SOAP endpoint
 *	Payload: rpc/encoded
 *	Transport: http
 *	Authentication: none
 */
 

require_once(CONFIG_DIR.'/config.php'); 
require_once(INCLUDE_DIR.'/nusoapwebservice/nusoap.php');

class PaygearWebserviceClient
{

    var $moClient; 
    
    function __construct()
    {
        $proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
        $proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
        $proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
        $proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
        $useCURL = isset($_POST['usecurl']) ? $_POST['usecurl'] : '0';

        if(function_exists('curl_exec')) 
              $this->moClient->curl=true;
              
        
        $this->moClient = new nusoap_client(PAYGEAR_WEB_URL."/MembersiteWebservice.asmx?WSDL", true,$proxyhost, $proxyport, $proxyusername, $proxypassword);
        //$this->moClient = new nusoap_client("http://localhost:1002/sscPayGear/MembersiteWebservice.asmx?WSDL", true,$proxyhost, $proxyport, $proxyusername, $proxypassword);
        
        //$client = new nusoap_client("http://soap.amazon.com/onca/soap2", false,
        //    $proxyhost, $proxyport, $proxyusername, $proxypassword);
        $err = $this->moClient->getError();
        if ($err) {
            echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
            echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
            exit();
        }
      
     
    }
    
    function ViewMasterValue($psMaster)
    {
        $lsMaster = array('Master'=>$psMaster);
        $WebServiceResponse = $this->moClient->call('ViewMasterValues', $lsMaster); 
        
        if ($this->moClient->fault) 
            return false;
        else
        {
            $lErr = $this->moClient->getError();
            if($lErr)
                return false;
        }
        
        $WebServiceResponse = $WebServiceResponse['ViewMasterValuesResult']['string'];
        
        foreach($WebServiceResponse as $key=>$value)
        {
            $value = explode(',',$value);
            $result[$value[0]] = $value[1];
        }
        
        return $result;
        
    }
    
    function is_membersite_approved($pPaygearVendorId, $pWebUrl)
    {   
        $pWebUrl=get_root_domain($pWebUrl);
        
        $pPaygearVendorId = decrypt($pPaygearVendorId);
        $ls_site_approved = array('paygear_vendorid'=>$pPaygearVendorId,'membersite_url'=>$pWebUrl);
        $WebServiceResponse = $this->moClient->call('Is_Membersite_Approved', $ls_site_approved); 
        
        if ($this->moClient->fault) 
            return false;
        else
        {
            $lErr = $this->moClient->getError();
            if($lErr)
                return false;
        }
        //print_r($WebServiceResponse);die; 
        //$WebServiceResponse = $WebServiceResponse['Is_Membersite_ApprovedResult'];
        
        foreach($WebServiceResponse as $key=>$value)
        {   
            $value = explode('!@#$%^*()',$value);
            
            $result[$value[0]] = $value[1];
        }
        
        return $result;
        
    }
    
    
    
    function AvailablePaymentProcessors($psPaygearUserName)
    {
        $lsPaygearUserName = array('PaygearUserName'=>$psPaygearUserName);
        $WebServiceResponse = $this->moClient->call('AvailablePaymentProcessors', $lsPaygearUserName); 
        
        if ($this->moClient->fault) 
            return false;
        else
        {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        }
        
        $WebServiceResponse = $WebServiceResponse['AvailablePaymentProcessorsResult']['string'];
        //print_r($WebServiceResponse);
        
        foreach($WebServiceResponse as $key=>$value)
        {
            $value = explode(',',$value);
            $result[$value[0]] = $value[1];
        }
        
        return $result;
        
    }
    
    
    function GetCategories()
    {
        //$lsPaygearUserName = array('PaygearUserName'=>$psPaygearUserName);
        $WebServiceResponse = $this->moClient->call('GetCategories'); 
        
        if ($this->moClient->fault) 
            return false;
        else
        {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        }
        
        $WebServiceResponse = $WebServiceResponse['GetCategoriesResult']['string'];
        //print_r($WebServiceResponse);
        //die;
        foreach($WebServiceResponse as $key=>$value)
        {
            $value = explode(',',$value);
            $result[] = $value;//$value[0]$value[1];
        }
        
        return $result;
        
    }
    
    
    function getPayGearUserId($puserName,$pPassword,$pSeceSalt)
    {
         $lsPayGearParameteres = array('PaygearUserName'=>$puserName,'SecretPassword'=>$pPassword,'SecretKeywords'=>$pSeceSalt);
         $WebServiceResponse = $this->moClient->call('GetUserID', $lsPayGearParameteres); 
        
        if ($this->moClient->fault) 
            return false;
        else
        {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
        }
         $userid=$WebServiceResponse['GetUserIDResult'];
         return $userid; 
        
    }
    
    
    function freePorductEntry($ProductId,$PaymentOptionId,$FirstName,$LastName,$Email,$Address,$City,$State,
                             $ZiporPostalCode,$Country,$Phone,$spFirstName,$spLastName,$spEmail,$spAddress,$spCity,
                              $spState,$spZip,$spCountry,$spPhone,$IPAddress)
                              
    {
      $arr=array( 'ProductId'=>$ProductId,
                  'PaymentOptionId'=>$PaymentOptionId,
                   'FirstName'=>$FirstName,
                   'LastName'=>$LastName,
                   'Email'  =>$Email,
                   'Address' =>$Address,
                   'City' =>$City,
                   'State'=>$State,
                   'ZiporPostalCode'=>$ZiporPostalCode,
                   'Country'=>$Country,
                   'Phone'=>$Phone,
                   'spFirstName'=>$spFirstName,
                   'spLastName'=>$spLastName,
                   'spEmail'=>$spEmail,
                   'spAddress'=>$spAddress,
                   'spCity'=>$spCity,
                   'spState'=>$spState,
                   'spZip'=>$spZip,
                   'spCountry'=>$spCountry,
                   'spPhone'=>$spPhone,
                   'IPAddress'=>$IPAddress
                 );
                   
           $WebServiceResponse = $this->moClient->call('FreeSaleTransactionEntry', $arr);   
        
            if ($this->moClient->fault) 
                return false;
            else
            {
                $lErr = $this->moClient->getError();
                if($lErr)
                {   //echo $lErr;
                    return false;
                }   
            }
            
           // $WebServiceResponse = $WebServiceResponse['AddPaygearProduct']['string'];
            //print_r($WebServiceResponse);
               
            $result=$WebServiceResponse;
            
            return $result; 
        
        
    }
    function AddPaygearProduct($pVendorID,$pPrice,$pName,$pLogo,$pKeyword,$pDescription,$pCCEmail1,$pCCEmail2,
                              $pProductStatusid,$pIsAllAffiliateApprovedByDefault,$pIsRequiredShippingInformation,
                              $pIsRequiredPersonalInformation,$pIPNUrl,$pIPNSecretCode,$pIsEmailNotificationOnEachSales,
                              $pDisplayLogoOnCheckoutPage,$pIsApproved,$pIsProhibited,$pCreatedBy,$pIpAddress,
                              $pIsDeleted,$pIsLinkedWithMemberSite,$pCategories,$pPayPalPageStyle)
                              
    {
        
        $lamembershipproductinfo = array('VendorID'=>$pVendorID,
                                         'Price'   =>$pPrice,
                                         'Name'    =>$pName,
                                         'Logo'    =>$pLogo,
                                         'Keywords'=>$pKeyword,
                                         'Description'=>$pDescription,
                                         'CCEmail1'=>$pCCEmail1,
                                         'CCEmail2'=>$pCCEmail2,
                                         'ProductStatusID'=>$pProductStatusid,
                                         'IsAllAffiliateApprovedByDefault'=>$pIsAllAffiliateApprovedByDefault,
                                         'IsRequiredShippingInformation'=>$pIsRequiredShippingInformation,
                                         'IsRequiredPersonalInformation'=>$pIsRequiredPersonalInformation,
                                         'IPNUrl'=>$pIPNUrl,
                                         'IPNSecretCode'=>$pIPNSecretCode,
                                         'IsEmailNotificationOnEachSales'=>$pIsEmailNotificationOnEachSales,
                                         'DisplayLogoOnCheckoutPage'=>$pDisplayLogoOnCheckoutPage,
                                         'IsApproved'=>$pIsApproved,
                                         'IsProhibited'=>$pIsProhibited,
                                         'CreatedBy'=>$pCreatedBy,
                                         'IpAddress'=>$pIpAddress,
                                         'IsDeleted'=>$pIsDeleted,
                                         'IsLinkedWithMemberSite'=>$pIsLinkedWithMemberSite,
                                         'Categories'=>$pCategories,
                                         'PaypalPageStyle'=>$pPayPalPageStyle);
                                         
        $WebServiceResponse = $this->moClient->call('AddPaygearProduct', $lamembershipproductinfo); 
        
        if ($this->moClient->fault) 
            return false;
        else
        {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        }
        
       // $WebServiceResponse = $WebServiceResponse['AddPaygearProduct']['string'];
        //print_r($WebServiceResponse);
           
        $result=$WebServiceResponse['AddPaygearProductResult'];
        
        return $result;
        
    }    
    
    function AddPaygearProductPaymentOptions($pProductID,$pPrice,$pIsSubscription,$pRecurringChargePeriod,$pRecurringChargePeriodTypeID,
                                             $pRecurringTimes,$pRecurringPrice,$pProductTrialAmount,$pProductTrialPeriod,$pProductTrialPeriodTypeID,
                                             $pIsTrialSubscription,$pProductTrialRecurringTimes,$pProductTrialRecurringPrice,$pIsActive,$pIsDefault,
                                             $pSalesPageURL,$pThankYouPageURL,$pIsPaypalAvailable,$pIsAuthorizeAvailable,$pIs2CheckoutAvailable,
                                             $pIsGoogleCheckoutAvailable,$pCreatedBy,$pIpAddress)
                                             
    {
           $lamembershipproducpaymentoptiontinfo = array('ProductID'                  =>$pProductID,
                                                         'Price'                      =>$pPrice,
                                                         'IsSubscription'             =>$pIsSubscription,
                                                         'RecurringChargePeriod'      =>$pRecurringChargePeriod,
                                                         'RecurringChargePeriodTypeID'=>$pRecurringChargePeriodTypeID,
                                                         'RecurringTimes'             =>$pRecurringTimes,
                                                         'RecurringPrice'            =>$pRecurringPrice,
                                                         'ProductTrialAmount'        =>$pProductTrialAmount,
                                                         'ProductTrialPeriod'        =>$pProductTrialPeriod,
                                                         'ProductTrialPeriodTypeID'  =>$pProductTrialPeriodTypeID,
                                                         'IsTrialSubscription'       =>$pIsTrialSubscription,
                                                         'ProductTrialRecurringTimes'=>$pProductTrialRecurringTimes,
                                                         'ProductTrialRecurringPrice'=>$pProductTrialRecurringPrice,
                                                         'IsActive'                  =>$pIsActive,
                                                         'IsDefault'                 =>$pIsDefault,
                                                         'SalesPageURL'              =>$pSalesPageURL,
                                                         'ThankYouPageURL'           =>$pThankYouPageURL,
                                                         'IsPaypalAvailable'         =>$pIsPaypalAvailable,
                                                         'IsAuthorizeAvailable'      =>$pIsAuthorizeAvailable,
                                                         'Is2CheckoutAvailable'      =>$pIs2CheckoutAvailable,
                                                         'IsGoogleCheckoutAvailable' =>$pIsGoogleCheckoutAvailable ,
                                                         'CreatedBy'                 =>$pCreatedBy,
                                                         'IpAddress'                 =>$pIpAddress);
                                         
        $WebServiceResponse = $this->moClient->call('AddPaygearProductPaymentOptions', $lamembershipproducpaymentoptiontinfo); 
        
        if ($this->moClient->fault) 
            return false;
        else
        {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        }
        
       // $WebServiceResponse = $WebServiceResponse['AddPaygearProduct']['string'];
        //print_r($WebServiceResponse);
           
        $result=$WebServiceResponse['AddPaygearProductPaymentOptionsResult'];
        
        return $result;
        
    } 
    
     function UpdatePaygearProduct ($pProductId,$pVendorID,$pPrice,$pName,$pLogo,$pKeyword,$pDescription,$pCCEmail1,$pCCEmail2,
                              $pProductStatusid,$pIsAllAffiliateApprovedByDefault,$pIsRequiredShippingInformation,
                              $pIsRequiredPersonalInformation,$pIPNUrl,$pIPNSecretCode,$pIsEmailNotificationOnEachSales,
                              $pDisplayLogoOnCheckoutPage,$pIsDeleted,$pModifiedBy, 
                              $pIpAddress,$pIsLinkedWithMemberSite,$pCategories,$pPayPalPageStyle)
                              
    {
        $lamembershipproductupdateinfo = array('ProductId' =>$pProductId,
                                         'VendorID' =>$pVendorID,
                                         'Price'   =>$pPrice,
                                         'Name'    =>$pName,
                                         'Logo'    =>$pLogo,
                                         'Keywords'=>$pKeyword,
                                         'Description'=>$pDescription,
                                         'CCEmail1'=>$pCCEmail1,
                                         'CCEmail2'=>$pCCEmail2,
                                         'ProductStatusID'=>$pProductStatusid,
                                         'IsAllAffiliateApprovedByDefault'=>$pIsAllAffiliateApprovedByDefault,
                                         'IsRequiredShippingInformation'=>$pIsRequiredShippingInformation,
                                         'IsRequiredPersonalInformation'=>$pIsRequiredPersonalInformation,
                                         'IPNUrl'=>$pIPNUrl,
                                         'IPNSecretCode'=>$pIPNSecretCode,
                                         'IsEmailNotificationOnEachSales'=>$pIsEmailNotificationOnEachSales,
                                         'DisplayLogoOnCheckoutPage'=>$pDisplayLogoOnCheckoutPage,
                                         'IsDeleted'=>$pIsDeleted ,
                                         'ModifiedBy'=>$pModifiedBy,
                                         'IpAddress'=>$pIpAddress,
                                         'IsLinkedWithMemberSite'=>$pIsLinkedWithMemberSite,
                                         'Categories'=>$pCategories,
                                         'PaypalPageStyle'=>$pPayPalPageStyle);
                                         
        $WebServiceResponse = $this->moClient->call('UpdatePaygearProduct', $lamembershipproductupdateinfo); 
        
        if ($this->moClient->fault) 
            return false;
        else
        {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        }
        
       // $WebServiceResponse = $WebServiceResponse['AddPaygearProduct']['string'];
        //print_r($WebServiceResponse);
           
        $result=$WebServiceResponse['UpdatePaygearProductResult'];
        
        return $result;
        
    }
      function UpdatePaygearProductPaymentOptions ($pID,$pProductID,$pPrice,$pIsSubscription,$pRecurringChargePeriod,$pRecurringChargePeriodTypeID,
                                             $pRecurringTimes,$pRecurringPrice,$pProductTrialAmount,$pProductTrialPeriod,$pProductTrialPeriodTypeID,
                                             $pIsTrialSubscription,$pProductTrialRecurringTimes,$pProductTrialRecurringPrice,$pIsActive,$pIsDefault,
                                             $pSalesPageURL,$pThankYouPageURL,$pIsPaypalAvailable,$pIsAuthorizeAvailable,$pIs2CheckoutAvailable,
                                             $pIsGoogleCheckoutAvailable,$pModifiedBy,$pIpAddress,$pIsOneTimeOffer)
                                             
    {
           $lamembershipproducpaymentoptionupdateinfo = array('ID'                         =>$pID,
                                                         'ProductID'                  =>$pProductID,
                                                         'Price'                      =>$pPrice,
                                                         'IsSubscription'             =>$pIsSubscription,
                                                         'RecurringChargePeriod'      =>$pRecurringChargePeriod,
                                                         'RecurringChargePeriodTypeID'=>$pRecurringChargePeriodTypeID,
                                                         'RecurringTimes'             =>$pRecurringTimes,
                                                         'RecurringPrice'            =>$pRecurringPrice,
                                                         'ProductTrialAmount'        =>$pProductTrialAmount,
                                                         'ProductTrialPeriod'        =>$pProductTrialPeriod,
                                                         'ProductTrialPeriodTypeID'  =>$pProductTrialPeriodTypeID,
                                                         'IsTrialSubscription'       =>$pIsTrialSubscription,
                                                         'ProductTrialRecurringTimes'=>$pProductTrialRecurringTimes,
                                                         'ProductTrialRecurringPrice'=>$pProductTrialRecurringPrice,
                                                         'IsActive'                  =>$pIsActive,
                                                         'IsDefault'                 =>$pIsDefault,
                                                         'SalesPageURL'              =>$pSalesPageURL,
                                                         'ThankYouPageURL'           =>$pThankYouPageURL,
                                                         'IsPaypalAvailable'         =>$pIsPaypalAvailable,
                                                         'IsAuthorizeAvailable'      =>$pIsAuthorizeAvailable,
                                                         'Is2CheckoutAvailable'      =>$pIs2CheckoutAvailable,
                                                         'IsGoogleCheckoutAvailable' =>$pIsGoogleCheckoutAvailable,
                                                         'ModifiedBy'                 =>$pModifiedBy,
                                                         'IpAddress'                 =>$pIpAddress,
                                                         'IsOneTimeOffer'            =>$pIsOneTimeOffer);
                                         

  
        $WebServiceResponse = $this->moClient->call('UpdatePaygearProductPaymentOptions', $lamembershipproducpaymentoptionupdateinfo); 
        
        if ($this->moClient->fault) 
            return false;
        else
        {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        }
        
       // $WebServiceResponse = $WebServiceResponse['AddPaygearProduct']['string'];
        //print_r($WebServiceResponse);
           
        $result=$WebServiceResponse['UpdatePaygearProductPaymentOptionsResult'];
        
        return $result;
        
    }
    function DeletePaygearProduct ($pDeletePaygearProduct)
    {
           $lsPayGearParameteres = array('ProductId'=>$pDeletePaygearProduct);
           $WebServiceResponse = $this->moClient->call('DeletePaygearProduct', $lsPayGearParameteres); 
           if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         $result=$WebServiceResponse['DeletePaygearProductResult'];
         return $result;
     
    }  
    
    function get_product_upsell_yes_no($paygear_product_id)
    {
           $lsPayGearParameteres = array('UpSellId'=>$paygear_product_id);
           $WebServiceResponse = $this->moClient->call('GetUpsellProductButtons', $lsPayGearParameteres); 
           if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         $result=$WebServiceResponse['GetUpsellProductButtonsResult'];
         return $result;
     
    } 
           
    function DeletePaygearProductPaymentOptions($pID)
    {
         $lsPayGearParameteres = array('ID'=>$pID);
         $WebServiceResponse = $this->moClient->call('DeletePaygearProductPaymentOptions', $lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         $result=$WebServiceResponse['DeletePaygearProductPaymentOptionsResult'];
         return $result;
        
        
    } 
    function GetPaygearProduct ($pProductId)
    {
         $lsPayGearParameteres = array('ProductId'=>$pProductId);
         $WebServiceResponse = $this->moClient->call('GetPaygearProduct', $lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         $result=$WebServiceResponse['GetPaygearProductResult'];
         return $result['string'];
        
        
    } 
    
    function GetPaygearProductPaymentOptionById($pId)
    {
         $lsPayGearParameteres = array('Id'=>$pId);
         $WebServiceResponse = $this->moClient->call('GetPaygearProductPaymentOptionById', $lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         $result=$WebServiceResponse['GetPaygearProductPaymentOptionByIdResult'];
        
         return $result['string'];
    }
    
    function GetProductWithPaymentOption($pId)
    {
         $lsPayGearParameteres = array('ProductId'=>$pId);
         $WebServiceResponse = $this->moClient->call('GetProductWithPaymentOption', $lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         $result=$WebServiceResponse['GetProductWithPaymentOptionResult'];
        
         return $result;
    }
    
    function GetDefaultPaymentOptionsofProduct($pId)
    {
         $lsPayGearParameteres = array('ProductId'=>$pId);
         $WebServiceResponse = $this->moClient->call('GetDefaultPaymentOptionsofProduct', $lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         $result=$WebServiceResponse['GetDefaultPaymentOptionsofProductResult'];
        
         return $result['string'];
    }
    
    function GetPayGearAllProductsForVendor($paygear_vendor_id)
    {
         $lsPayGearParameteres = array('VendorId'=>$paygear_vendor_id);
         $WebServiceResponse = $this->moClient->call('GetVendorPaygearProducts', $lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         $result=$WebServiceResponse['GetVendorPaygearProductsResult'];
        
         return $result['string'];
    }
    
    function UpdatePaygearProductStatusIsLinkedWithMemberSite($pProductId,$pIsLinkedWithMemberSite)
    {                                                                       
         $lsPayGearParameteres = array('ProductId'=>$pProductId,
                                       'IsLinkedWithMemberSite'=>$pIsLinkedWithMemberSite);
         $WebServiceResponse = $this->moClient->call('UpdatePaygearProductStatusIsLinkedWithMemberSite',$lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         
         return $WebServiceResponse;
    }
   function getVendorSalesData($puserId,$pStartDate,$pEndDate,$pReportType,$pIsRefundChecked,$pIsBonusChecked,$pIsChargeBackChecked,$pIsAffiliateCommissionChecked,$pIsPaygearCommissionChecked,$pLastName,$pEmail,$pAffiliate,$pItem,$pVendorName)
    {
      $lsPayGearParameteres = array('VendorId'=>$puserId,
                                       'Startdate'=>$pStartDate,'EndDate'=>$pEndDate,'ReportType'=>$pReportType,'IsRefundChecked'=>$pIsRefundChecked,
                                      'IsBonusChecked'=>$pIsBonusChecked,'IsChargeBackChecked'=>$pIsChargeBackChecked,'IsAffiliateCommissionChecked'=>$pIsAffiliateCommissionChecked,
                                      'IsPaygearCommissionChecked'=>$pIsPaygearCommissionChecked,'LastName'=>$pLastName,'Email'=>$pEmail,'Affiliate'=>$pAffiliate,'Item'=>$pItem,'VendorName'=>$pVendorName);
           
        
     
      $WebServiceResponse = $this->moClient->call('GetPaygearVendorTotalSalesData',$lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else  
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         return $WebServiceResponse; 
        
    }
    
    
    function getVendorSalesDataByEtranId($petransactionId,$vendor_id)
    {
      $lsPayGearParameteres = array('eTransactionID'=>$petransactionId,'VendorOrAffiliateID'=>$vendor_id);
      $WebServiceResponse = $this->moClient->call('SearchPaygearSaleByETransaction',$lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else  
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         return $WebServiceResponse; 
        
    }
     
     
     
    function getVendorSalesDataByOrderId($orderId,$vendor_id)
    {
      $lsPayGearParameteres = array('OrderId'=>$orderId,'VendorOrAffiliateID'=>$vendor_id);
      $WebServiceResponse = $this->moClient->call('SearchPaygearSaleByOrderId',$lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else  
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         return $WebServiceResponse; 
        
    }
    
    function getPaygearAffiliate($venderName)
    {
       
          $lsPayGearParameteres = array('UserName'=>$venderName);
          $WebServiceResponse = $this->moClient->call('GetUserIdByUserName',$lsPayGearParameteres); 
             if ($this->moClient->fault) 
                return false;
              else  
             {
                $lErr = $this->moClient->getError();
                if($lErr)
                {   //echo $lErr;
                    return false;
                }   
            
             }
             return $WebServiceResponse; 
    }
    
    function getPaygearAffiliateLink($productPaymentOption,$affiliateName)
    {
       
          $lsPayGearParameteres = array('ProductPaymentOptionID'=>$productPaymentOption,'AffiliateName'=>$affiliateName);
          $WebServiceResponse = $this->moClient->call('GetAffiliateCampaignLink',$lsPayGearParameteres); 
             if ($this->moClient->fault) 
                return false;
              else  
             {
                $lErr = $this->moClient->getError();
                if($lErr)
                {   //echo $lErr;
                    return false;
                }   
            
             }
             return $WebServiceResponse; 
    }
    
    function GetPaygearPresetTimeDurations()
    {
          $WebServiceResponse = $this->moClient->call('GetPaygearPresetTimeDurations'); 
         if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         return $WebServiceResponse['GetPaygearPresetTimeDurationsResult']['string'];
        
    }    
    function GetPaygearVendorTotalProfitData($pVendorId,$pStartdate,$pEndDate,$pReportType)
    {
      $lsPayGearParameteres = array('VendorId'=>$pVendorId,
                                    'Startdate'=>$pStartdate,
                                    'EndDate'=>$pEndDate,
                                    'ReportType'=>$pReportType);
           
        
     
      $WebServiceResponse = $this->moClient->call('GetPaygearVendorTotalProfitData',$lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         return $WebServiceResponse['GetPaygearVendorTotalProfitDataResult']['ArrayOfString'];
        
    }   
      function GetPaygearTransactionDetailByOrderIdAndEtransactionID($pOrderId,$pEtransactionID)
    {
      $lsPayGearParameteres = array('OrderId'=>$pOrderId,
                                    'EtransactionID'=>$pEtransactionID);
                                    
    $WebServiceResponse = $this->moClient->call('GetPaygearTransactionDetailByOrderIdAndEtransactionID',$lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         return $WebServiceResponse['GetPaygearTransactionDetailByOrderIdAndEtransactionIDResult']['string'];
        
    }
    
   function IsUpsellProductsPriceOver_10000($MainProductId,$FirstLevelProductId,$SecondLevelProductId,$ThirdLevelProductId)
    {
      $lsPayGearParameteres = array('MainProductId'=>$MainProductId,
                                    'FirstLevelProductId'=>$FirstLevelProductId,
                                     'SecondLevelProductId'=>$SecondLevelProductId,
                                     'ThirdLevelProductId'=>$ThirdLevelProductId
                                    );
                                    
         $WebServiceResponse = $this->moClient->call('IsUpsellProductsPriceOver_10000',$lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         return $WebServiceResponse['IsUpsellProductsPriceOver_10000Result'];
        
    }
       
     function AddManualOrderEntry ($pPaygearProductId,$pPaygearPaymentOptionId,$pP_FirstName,$pP_LastName,
                                   $pP_Email,$pP_Address1,$pP_City,$pP_State,$pP_ZiporPostalCode,$pP_Country,
                                   $pP_Phone,$pP_SPAddress1,$pP_SPCity,$pP_SPState,$pP_SpZip,$pP_SPCountry,
                                   $pP_SPPhone,$pP_UserHostAddress)
    {
        $lsPayGearParameteres = array('PaygearProductId'=>$pPaygearProductId,
                                    'PaygearPaymentOptionId'=>$pPaygearPaymentOptionId,
                                    'P_FirstName'=>$pP_FirstName,
                                    'P_LastName'=>$pP_LastName,
                                    'P_Email'=>$pP_Email,
                                    'P_Address1'=>$pP_Address1,
                                    'P_City'=>$pP_City,
                                    'P_State'=>$pP_State,
                                    'P_ZiporPostalCode'=>$pP_ZiporPostalCode,
                                    'P_Country'=>$pP_Country,
                                    'P_Phone'=>$pP_Phone,
                                    'P_SPAddress1'=>$pP_SPAddress1,
                                    'P_SPCity'=>$pP_SPCity,  
                                    'P_SPState'=>$pP_SPState,
                                    'P_SpZip'=>$pP_SpZip,
                                    'P_SPCountry'=>$pP_SPCountry,
                                    'P_SPPhone'=>$pP_SPPhone,
                                    'P_UserHostAddress'=>$pP_UserHostAddress);
                                    
    $WebServiceResponse = $this->moClient->call('AddManualOrderEntry',$lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }                      
         return $WebServiceResponse['AddManualOrderEntryResult'];
        
    } 
    
  
  
  function DeleteUpsellProduct($PaygearProductId,$level)
    {
        $lsPayGearParameteres = array('MainProductID'=>$PaygearProductId,
                                      'UpsellLevel'=>$level
                                     );
                                    
         $WebServiceResponse = $this->moClient->call('DeleteUpsellProductByUpsellLevel',$lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         return $WebServiceResponse['DeleteUpsellProductByUpsellLevelResult'];
        
    } 
   
     function updateFromPaygear_upsellProduct($PaygearProductId)
    {
        $lsPayGearParameteres = array('MainProductId'=>$PaygearProductId);
                                    
         $WebServiceResponse = $this->moClient->call('GetUpsellProductsByMainProductId',$lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         return $WebServiceResponse['GetUpsellProductsByMainProductIdResult'];
        
    }    
 function ManageUpsellProducts  ($MainProductId,$UpsellProduct1_ID,$UpsellProduct1,$UpsellProduct_Yes1,
                                   $UpsellProduct_No1,
                                   $UpsellProductLink1,$UpsellProduct2_ID,$UpsellProduct2,
                                   $UpsellProduct_Yes2,
                                   $UpsellProduct_No2,$UpsellProductLink2,$UpsellProduct3_ID,
                                   $UpsellProduct3,
                                   $UpsellProduct_Yes3,
                                   $UpsellProduct_No3,$UpsellProductLink3)
    {
        $lsPayGearParameteres = array('MainProductId'=>$MainProductId,
                                    'UpsellProduct1_ID'=>$UpsellProduct1_ID,
                                    'UpsellProduct1'=>$UpsellProduct1,
                                    'UpsellProduct_Yes1'=>$UpsellProduct_Yes1,
                                    'UpsellProduct_No1'=>$UpsellProduct_No1,
                                    'UpsellProductLink1'=>$UpsellProductLink1,
                                    'UpsellProduct2_ID'=>$UpsellProduct2_ID,
                                    'UpsellProduct2'=>$UpsellProduct2,
                                    'UpsellProduct_Yes2'=>$UpsellProduct_Yes2,
                                    'UpsellProduct_No2'=>$UpsellProduct_No2,
                                    'UpsellProductLink2'=>$UpsellProductLink2,
                                    'UpsellProduct3_ID'=>$UpsellProduct3_ID,
                                    'UpsellProduct3'=>$UpsellProduct3,
                                    'UpsellProduct_Yes3'=>$UpsellProduct_Yes3,
                                    'UpsellProduct_No3'=>$UpsellProduct_No3,
                                    'UpsellProductLink3'=>$UpsellProductLink3  
                               );
                                    
         $WebServiceResponse = $this->moClient->call('ManageUpsellProducts',$lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }                      
         return $WebServiceResponse['ManageUpsellProductsResult'];
        
    } 
    
    function UpdateOneTimeOfferProductThankPageUrl($pProductPaymentOptionId,$pThankYouPageUrl)
    {
        $lsPayGearParameteres = array('ProductPaymentOptionId'=>$pProductPaymentOptionId,
                                      'ThankYouPageUrl'=>$pThankYouPageUrl
                                     );
                                    
    $WebServiceResponse = $this->moClient->call('UpdateOneTimeOfferProductThankPageUrl',$lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         return $WebServiceResponse['UpdateOneTimeOfferProductThankPageUrlResult'];
        
    } 
    function UpdateOneTimeOfferProductThankPageUrls($ppProductPaymentOptionIds,$pprThankYouPageUrls)
    {
       $lsPayGearParameteres = array('pProductPaymentOptionIds'=>$ppProductPaymentOptionIds,
                                      'prThankYouPageUrls'=>$pprThankYouPageUrls
                                     );
                                    
     $WebServiceResponse = $this->moClient->call('UpdateOneTimeOfferProductThankPageUrls',$lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         return $WebServiceResponse['UpdateOneTimeOfferProductThankPageUrlsResult'];
    
    
    
    }    
    function AddProductPaymentOptionCommissions($pProductId,$pProductPaymentOptionID,$pCommissionType,$pCommissionLevel1,
    $pCommissionLevel2,$pCommissionLevel1_RestOf,$pCommissionLevel2_RestOf,$pCreatedBy,$pUserHostAddress)
    {
       
           $lamembershipproducpaymentoptioncommisiontinfo = array('ProductId'         =>$pProductId,
                                                         'ProductPaymentOptionID'     =>$pProductPaymentOptionID,
                                                         'CommissionType'             =>$pCommissionType,
                                                         'CommissionLevel1'           =>$pCommissionLevel1,
                                                         'CommissionLevel2'           =>$pCommissionLevel2,
                                                         'CommissionLevel1_RestOf'    =>$pCommissionLevel1_RestOf,
                                                         'CommissionLevel2_RestOf'    =>$pCommissionLevel2_RestOf,
                                                         'CreatedBy'                  =>$pCreatedBy,
                                                         'UserHostAddress'            =>$pUserHostAddress);
                                         
        $WebServiceResponse = $this->moClient->call('AddProductPaymentOptionCommissions', $lamembershipproducpaymentoptioncommisiontinfo); 
        
        if ($this->moClient->fault) 
            return false;
        else
        {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        }
        
       // $WebServiceResponse = $WebServiceResponse['AddPaygearProduct']['string'];
        //print_r($WebServiceResponse);
           
        $result=$WebServiceResponse['AddProductPaymentOptionCommissionsResult'];
        
        return $result;
        
    }
    function GetProductPaymentOptionCommissions($pProductPaymentOptionID)
    {
      
         $lsPayGearParameteres = array('ProductPaymentOptionID'=>$pProductPaymentOptionID);
         $WebServiceResponse = $this->moClient->call('GetProductPaymentOptionCommissions', $lsPayGearParameteres); 
         if ($this->moClient->fault) 
            return false;
          else
         {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        
         }
         $result=$WebServiceResponse['GetProductPaymentOptionCommissionsResult'];
        
         return $result['string'];
      }
      
     function UpdateProductPaymentOptionCommissions ($pCommissionID,$pProductId,$pProductPaymentOptionID,$pCommissionType
                                                    ,$pCommissionLevel1,$pCommissionLevel2,$pCommissionLevel1_RestOf,
                                                    $pCommissionLevel2_RestOf,$pCreatedBy,$pUserHostAddress)
                                             
    {
           $lamembershipproducpaymentoptioncommisionupdateinfo = array('CommissionID'          =>$pCommissionID,
                                                         'ProductId'                  =>$pProductId,
                                                         'ProductPaymentOptionID'   =>$pProductPaymentOptionID,
                                                         'CommissionType'             =>$pCommissionType,
                                                         'CommissionLevel1'           =>$pCommissionLevel1,
                                                         'CommissionLevel2'           =>$pCommissionLevel2,
                                                         'CommissionLevel1_RestOf'    =>$pCommissionLevel1_RestOf,
                                                         'CommissionLevel2_RestOf'    =>$pCommissionLevel2_RestOf,
                                                         'CreatedBy'                  =>$pCreatedBy,
                                                         'UserHostAddress'            =>$pUserHostAddress);
                                         

  
        $WebServiceResponse = $this->moClient->call('UpdateProductPaymentOptionCommissions', $lamembershipproducpaymentoptioncommisionupdateinfo); 
        
        if ($this->moClient->fault) 
            return false;
        else
        {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        }
        
       // $WebServiceResponse = $WebServiceResponse['AddPaygearProduct']['string'];
        //print_r($WebServiceResponse);
           
        $result=$WebServiceResponse['UpdateProductPaymentOptionCommissionsResult'];
        
        return $result;
        
    }  

        
    
         
     
    
}
   
//echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
//echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
//echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
?>
Return current item: MembersGear