public function execute()
 {
     $result = array();
     try {
         $this->apiMessage = array('ManageRecurringPaymentsProfileStatusRequest' => array('Version' => API_VERSION, 'ManageRecurringPaymentsProfileStatusRequestDetails' => array('ProfileID' => $this->ProfileID, 'Action' => $this->Action)));
         $this->apiMessage = array($this->apiMessage);
         $response = PayPalBase::getSoapClient()->__soapCall('ManageRecurringPaymentsProfileStatus', $this->apiMessage, null, PayPalBase::getSoapHeader());
         parent::registerAPIResponse($response);
         PaypalBase::setOperationStatus(true);
         if (false) {
             $response = new stdClass();
             $response->Timestamp = '2011-01-28T15:28:24Z';
             $response->Ack = 'Success';
             $response->CorrelationID = '6f61538933b9';
             $response->Version = '65.1';
             $response->Build = '1704252';
             $r2 = new stdClass();
             $r2->ProfileID = 'I-XFD5FSRJAT6G';
             $response->ManageRecurringPaymentsProfileStatusResponseDetails = $r2;
         }
         $result = $response;
     } catch (SoapFault $Exception) {
         parent::registerAPIException($Exception);
         PaypalBase::setOperationStatus(false);
         return false;
     }
     return $result;
 }
Ejemplo n.º 2
0
 /**
  * Executes the DoCapture Operation
  *
  * Prepares the final message and the calls the Webservice operation. If it is successfull the response is registered
  * and the OperationStatus is set to true, otherwise the Operation status will be set to false and an Exception of the type
  * soapFault will be registered instead.
  * 
  * @throws SoapFault
  * @access public
  */
 public function execute()
 {
     try {
         $this->apiMessage['Version'] = API_VERSION;
         $this->apiMessage = array('DoVoidRequest' => $this->apiMessage);
         $this->apiMessage = array($this->apiMessage);
         parent::registerAPIResponse(PayPalBase::getSoapClient()->__soapCall('DoVoid', $this->apiMessage, null, PayPalBase::getSoapHeader()));
         PaypalBase::setOperationStatus(true);
     } catch (SoapFault $Exception) {
         parent::registerAPIException($Exception);
         PaypalBase::setOperationStatus(false);
     }
 }
Ejemplo n.º 3
0
 /**
  * Executes the Operation
  *
  * Prepares the final message and the calls the Webservice operation. If it is successfull the response is registered
  * and the OperationStatus is set to true, otherwise the Operation status will be set to false and an Exception of the type
  * soapFault will be registered instead.
  *
  * @access public
  */
 public function execute()
 {
     try {
         $this->apiMessage['Version'] = API_VERSION;
         $this->apiMessage['SetExpressCheckoutRequestDetails'] = $this->apiMessage;
         $this->apiMessage = array('SetExpressCheckoutRequest' => $this->apiMessage);
         if (count($this->recurringItems)) {
             $this->apiMessage['SetExpressCheckoutRequest']['SetExpressCheckoutRequestDetails']['BillingAgreementDetails'] = array();
             foreach ($this->recurringItems as $recurringItem) {
                 $this->apiMessage['SetExpressCheckoutRequest']['SetExpressCheckoutRequestDetails']['BillingAgreementDetails'][] = PayPalTypes::BillingAgreementDetailsType($recurringItem);
             }
         }
         $this->apiMessage = array($this->apiMessage);
         parent::registerAPIResponse(PayPalBase::getSoapClient()->__soapCall('SetExpressCheckout', $this->apiMessage, null, PayPalBase::getSoapHeader()));
         PaypalBase::setOperationStatus(true);
     } catch (SoapFault $Exception) {
         parent::registerAPIException($Exception);
         PaypalBase::setOperationStatus(false);
     }
 }
 public function execute()
 {
     $mapping = array(RecurringProductPeriod::TYPE_PERIOD_DAY => 'Day', RecurringProductPeriod::TYPE_PERIOD_WEEK => 'Week', RecurringProductPeriod::TYPE_PERIOD_MONTH => 'Month', RecurringProductPeriod::TYPE_PERIOD_YEAR => 'Year');
     $result = array();
     try {
         foreach ($this->recurringItems as $recurringItem) {
             $quantity = $recurringItem->orderedItem->get()->count->get();
             $RecurringPaymentsProfileDetails = array('BillingStartDate' => PayPalTypes::dateTimeType());
             $periodLength = $recurringItem->periodLength->get();
             $periodType = $recurringItem->periodType->get();
             $rebillCount = $recurringItem->rebillCount->get();
             $setupPrice = $recurringItem->setupPrice->get();
             $periodPrice = $recurringItem->periodPrice->get();
             $ScheduleDetails = array('Description' => PayPalTypes::RecurringItemDescription($recurringItem), 'PaymentPeriod' => array('BillingPeriod' => $mapping[$periodType], 'BillingFrequency' => $periodLength, 'TotalBillingCycles' => $rebillCount, 'Amount' => PayPalTypes::BasicAmountType($periodPrice * $quantity)), 'AutoBillOutstandingAmount' => 'NoAutoBill');
             if ($rebillCount > 0) {
                 $ScheduleDetails['PaymentPeriod']['TotalBillingCycles'] = $rebillCount;
             }
             if ($setupPrice > 0) {
                 $ScheduleDetails['ActivationDetails'] = array('InitialAmount' => PayPalTypes::BasicAmountType($setupPrice * $quantity), 'FailedInitialAmountAction' => 'ContinueOnFailure');
             }
             $this->apiMessage = array('CreateRecurringPaymentsProfileRequest' => array('Version' => API_VERSION, 'CreateRecurringPaymentsProfileRequestDetails' => array('Token' => $this->tokenValue, 'RecurringPaymentsProfileDetails' => $RecurringPaymentsProfileDetails, 'ScheduleDetails' => $ScheduleDetails)));
             $this->apiMessage = array($this->apiMessage);
             $response = PayPalBase::getSoapClient()->__soapCall('CreateRecurringPaymentsProfile', $this->apiMessage, null, PayPalBase::getSoapHeader());
             parent::registerAPIResponse($response);
             PaypalBase::setOperationStatus(true);
             if ($response->Ack == 'Success') {
                 $result[$recurringItem->getID()] = array('Timestamp' => $response->Timestamp, 'Ack' => $response->Ack, 'Version' => $response->Version, 'Build' => $response->Build, 'CreateRecurringPaymentsProfileResponseDetails' => array('ProfileID' => $response->CreateRecurringPaymentsProfileResponseDetails->ProfileID, 'ProfileStatus' => $response->CreateRecurringPaymentsProfileResponseDetails->ProfileStatus));
             }
         }
     } catch (SoapFault $Exception) {
         parent::registerAPIException($Exception);
         PaypalBase::setOperationStatus(false);
         return false;
     }
     return $result;
 }
Ejemplo n.º 5
0
 /**
  * Executes the DoDirectPayment Operation
  *
  * Prepares the final message and the calls the Webservice operation. If it is successfull the response is registered
  * and the OperationStatus is set to true, otherwise the Operation status will be set to false and an Exception of the type
  * soapFault will be registered instead.
  * 
  * @throws SoapFault
  * @access public
  */
 public function execute($call = 'DoDirectPayment')
 {
     try {
         $this->apiMessage['Version'] = API_VERSION;
         if ('DoDirectPayment' == $call) {
             $this->apiMessage['DoDirectPaymentRequestDetails'] = $this->apiMessage;
             $this->apiMessage = array('DoDirectPaymentRequest' => $this->apiMessage);
         } else {
             if ('DoAuthorization' == $call) {
                 $this->apiMessage['DoDirectPaymentRequestDetails'] = $this->apiMessage;
                 $this->apiMessage = array('DoAuthorizationRequest' => $this->apiMessage);
             }
         }
         $this->apiMessage = array($this->apiMessage);
         parent::registerAPIResponse(PayPalBase::getSoapClient()->__soapCall($call, $this->apiMessage, null, PayPalBase::getSoapHeader()));
         PaypalBase::setOperationStatus(true);
     } catch (SoapFault $Exception) {
         parent::registerAPIException($Exception);
         PaypalBase::setOperationStatus(false);
     }
 }
Ejemplo n.º 6
0
<?php 
require_once osc_themes_path() . 'nepcoders/includes/paypal-api.php';
if (isset($_POST['submit'])) {
    $username = Params::getParam("username");
    $password = Params::getParam("password");
    $signature = Params::getParam("signature");
    $url = Params::getParam("server");
    $status = Params::getParam("status");
    if ($status == "on") {
        $enable = TRUE;
    } else {
        $enable = FALSE;
    }
    $credentials = array('USER' => $username, 'PWD' => $password, 'SIGNATURE' => $signature);
    $method = array('METHOD' => 'GetBalance', 'VERSION' => '74.0');
    $data = PaypalAPI::execute_post($url, array(), $credentials, $method);
    if ($data['ACK'] == 'Failure') {
        echo returnErrorMsgWithHeader($data['L_SHORTMESSAGE0'], $data['L_LONGMESSAGE0']);
    } else {
        if ($data['ACK'] == 'Success') {
            echo returnSuccessMsgWithHeader("Your Available Balance", $data['L_CURRENCYCODE0'] . " " . $data['L_AMT0']);
            $_credentials = Paypal::newInstance()->selectPaypalData();
            if ($_credentials == null) {
                Paypal::newInstance()->insertPaypalData($username, $password, $signature, $url);
            } else {
                Paypal::newInstance()->updatePaypalData($username, $password, $signature, $url, $enable, $_credentials['pk_pp_username']);
            }
        }
    }
}
$_credentials = Paypal::newInstance()->selectPaypalData();
Ejemplo n.º 7
0
 /**
  * Executes the Operation
  *
  * Prepares the final message and the calls the Webservice operation. If it is successfull the response is registered
  * and the OperationStatus is set to true, otherwise the Operation status will be set to false and an Exception of the type
  * soapFault will be registered instead.
  * 
  * @throws SoapFault
  * @access public
  */
 public function execute()
 {
     try {
         $this->apiMessage['Version'] = API_VERSION;
         $this->apiMessage['Token'] = $this->tokenValue;
         $this->apiMessage = array('GetExpressCheckoutDetailsRequest' => $this->apiMessage);
         $this->apiMessage = array($this->apiMessage);
         $res = PayPalBase::getSoapClient()->__soapCall('GetExpressCheckoutDetails', $this->apiMessage, null, PayPalBase::getSoapHeader());
         /*
         $res = PayPalBase::postProcessResponse();
         
         var_dump($res);
         
         // sometimes the output doesn't get parsed for whatever reason...
         if (isset($res->GetExpressCheckoutDetailsResponseDetails) && !isset($res->GetExpressCheckoutDetailsResponseDetails->PayerInfo->Payer))
         {
             $dom = new DomDocument();
             $dom->loadXML(PayPalBase::getSoapClient()->__getLastResponse());
             $arr = self::xml2array($dom);
             $arr = self::array2stdclass($arr['SOAP-ENV:Envelope']['SOAP-ENV:Body']);
             $res = $arr->GetExpressCheckoutDetailsResponse;
         }
         */
         parent::registerAPIResponse($res);
         PaypalBase::setOperationStatus(true);
     } catch (SoapFault $Exception) {
         parent::registerAPIException($Exception);
         PaypalBase::setOperationStatus(false);
     }
 }