<?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/config.php";
require_once(INCLUDE_DIR_INSTALLATION.'/nusoapwebservice/nusoap.php');
class PaygearWebserviceClientInstallation
{
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)
{
$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 AddPaygearProduct($pVendorID,$pPrice,$pName,$pLogo,$pKeyword,$pDescription,$pCCEmail1,$pCCEmail2,
$pProductStatusid,$pIsAllAffiliateApprovedByDefault,$pIsRequiredShippingInformation,
$pIsRequiredPersonalInformation,$pIPNUrl,$pIPNSecretCode,$pIsEmailNotificationOnEachSales,
$pDisplayLogoOnCheckoutPage,$pIsApproved,$pIsProhibited,$pCreatedBy,$pIpAddress,
$pIsDeleted,$pIsLinkedWithMemberSite,$pCategories)
{
$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);
$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)
{
$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);
$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)
{
$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);
$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 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 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 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 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 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'];
}
}
//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>';
?>