public function actionIpn() { $aData =& $_POST; foreach ($aData as $sKey => $sValue) { $aData[$sKey] = bx_process_input(trim($sValue)); } if (!isset($aData['txn_type'])) { return; } bx_import('Paypal', $this->_aModule); $oPaypal = new BxSitesPaypal($this); $oPaypal->process($aData); bx_import('Account', $this->_aModule); $oAccount = new BxSitesAccount($this); if ($oPaypal->bProfileCreated) { $oAccount->onProfileConfirmed($aData); } else { if ($oPaypal->bProfileCanceled) { $oAccount->onProfileCanceled($aData); } else { if ($oPaypal->bPaymentDone) { $oAccount->onPaymentReceived($aData, $oPaypal->fPaymentAmout); } else { if ($oPaypal->bPaymentRefund) { $oAccount->onPaymentRefunded($aData); } } } } }
/** * @return delete data html */ public function deleteDataForm($aAccount, $sDisplay = 'bx_sites_site_delete') { $sMsg = $this->_oModule->isAllowedDelete($aAccount); if ($sMsg !== CHECK_ACTION_RESULT_ALLOWED) { return MsgBox($sMsg); } // check and display form $oForm = BxDolForm::getObjectInstance('bx_sites', $sDisplay); if (!$oForm) { return MsgBox(_t('_sys_txt_error_occured')); } $oForm->initChecker($aAccount); if (!$oForm->isSubmittedAndValid()) { return $oForm->getCode(); } if (!$oForm->delete($aAccount['id'], $aAccount)) { return MsgBox(_t('_bx_sites_txt_err_site_delete')); } //delete payment details and history if (!empty($aAccount['id'])) { $this->_oModule->_oDb->deletePaymentDetails(array('account_id' => $aAccount['id'])); $this->_oModule->_oDb->deletePaymentHistory(array('account_id' => $aAccount['id'])); } // cancel subscription if (!empty($aAccount['pd_profile_id'])) { bx_import('Paypal', $this->_oModule->_aModule); $oPaypal = new BxSitesPaypal($this->_oModule); $oPaypal->performAction($aAccount['pd_profile_id']); } // perform action $this->_oModule->isAllowedDelete($aAccount, true); // create an alert bx_alert($this->_oModule->getName(), 'deleted', $aAccount['id']); // redirect $this->_redirectAndExit('page.php?i=sites-home'); }