/** * Gets instance of user parameters for $user_id of type $type * * @param int $userId * @param string $type * @param string $prefix * @return cbpaidUserParams */ public static function getUserParamsInstance( $userId, $type = 'params', /** @noinspection PhpUnusedParameterInspection */ $prefix = '' ) { static $cache = array(); if ( ! isset( $cache[(string) $userId][$type] ) ) { $userParams = new cbpaidUserParams(); if ( ! $userParams->loadUserParams( $userId, $type ) ) { $userParams->user_id = $userId; $userParams->type = $type; } $cache[(string) $userId][$type] = $userParams; } return $cache[(string) $userId][$type]; }
/** * Sets Financial alias information of the user (crypted) * * @param int $userId * @param mixed $aliasInfo * @return void */ private function setFinancialCoordinatesAlias($userId, $aliasInfo) { $userPaymentParams = cbpaidUserParams::getUserParamsInstance($userId, 'params'); $prefix = $this->getGgatewayNameIdUserParamsPrefix(); $userPaymentParams->setUserParam($prefix . 'alias', $userPaymentParams->encryptAliasInfo($aliasInfo, 'sf7Qsj-k,p.7/2sp0+2&a%YK85LrC3*fkI1?LfJ(25%).!$NWfE', 'CbS3unlkaDhnDonmDu3847fn*9)Lk)nus(2%$%km')); $userPaymentParams->storeParams(); $userPaymentParams->store(); }