BxPaymentResponse.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup Payment Payment
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxPaymentResponse extends BxDolAlertsResponse
  12. {
  13. protected $_sModule;
  14. protected $_oModule;
  15. public function __construct()
  16. {
  17. parent::__construct();
  18. $this->_sModule = 'bx_payment';
  19. $this->_oModule = BxDolModule::getInstance($this->_sModule);
  20. }
  21. /**
  22. * Overwtire the method of parent class.
  23. *
  24. * @param BxDolAlerts $oAlert an instance of alert.
  25. */
  26. public function response($oAlert)
  27. {
  28. $sMethod = '_process' . bx_gen_method_name($oAlert->sUnit . '_' . $oAlert->sAction);
  29. if(method_exists($this, $sMethod))
  30. return $this->$sMethod($oAlert);
  31. if($oAlert->sUnit != 'profile' || !in_array($oAlert->sAction, ['join', 'delete']))
  32. return;
  33. switch($oAlert->sAction) {
  34. case 'join':
  35. $this->_oModule->onProfileJoin($oAlert->iObject);
  36. break;
  37. case 'delete':
  38. $this->_oModule->onProfileDelete($oAlert->iObject);
  39. break;
  40. }
  41. }
  42. protected function _processSystemSaveSetting($oAlert)
  43. {
  44. $CNF = &$this->_oModule->_oConfig->CNF;
  45. if($oAlert->aExtras['option'] != $CNF['PARAM_CURRENCY_CODE'])
  46. return;
  47. if(strcmp($oAlert->aExtras['value'], $oAlert->aExtras['value_prior']) == 0)
  48. return;
  49. $this->_oModule->updateCurrencyExchangeRates();
  50. }
  51. }
  52. /** @} */