Exemplo n.º 1
0
 function performAction($sProfileId, $sAction = BX_SITES_PP_RPA_CANCEL)
 {
     if (empty($sProfileId)) {
         return false;
     }
     $oRPPStatusReqestDetails = new ManageRecurringPaymentsProfileStatusRequestDetailsType();
     $oRPPStatusReqestDetails->Action = $sAction;
     $oRPPStatusReqestDetails->ProfileID = $sProfileId;
     $oRPPStatusReqest = new ManageRecurringPaymentsProfileStatusRequestType();
     $oRPPStatusReqest->ManageRecurringPaymentsProfileStatusRequestDetails = $oRPPStatusReqestDetails;
     $oRPPStatusReq = new ManageRecurringPaymentsProfileStatusReq();
     $oRPPStatusReq->ManageRecurringPaymentsProfileStatusRequest = $oRPPStatusReqest;
     $oPaypalService = new PayPalAPIInterfaceServiceService();
     try {
         $oRPPStatusResponse = $oPaypalService->ManageRecurringPaymentsProfileStatus($oRPPStatusReq);
     } catch (Exception $oException) {
         $this->_logException($oException);
         return false;
     }
     if (!isset($oRPPStatusResponse)) {
         $sLog = "---\n";
         $sLog .= "--- Perform Action: {date}\n";
         $sLog .= "--- Request: " . $oPaypalService->getLastRequest() . "\n";
         $sLog .= "--- Response: " . $oPaypalService->getLastResponse() . "\n";
         $sLog .= "---\n";
         $this->_logError($sLog);
         return false;
     }
     if ($oRPPStatusResponse->Ack == 'Success') {
         $oAccount = $this->_oModule->getObject('Account');
         $oAccount->onActionPerformed($sProfileId, $sAction);
     }
     return true;
 }