クラス
MemberMeta
AmazonPay member meta data
ソース ソース
ファイル: src/Models/MemberMeta.php
class MemberMeta { const INITIAL_REGISTRATION_EMAIL = 'initialRegistrationEmail'; const ALLOW_AMAZON_TO_WELCART_LOGIN = 'allowAmazonToWelcartLogin'; /** * Welcart member ID * * @var int */ private $memberId; /** * `initialRegistrationEmail` meta value * * @var string|null */ private $initialRegistrationEmail = null; /** * `allowAmazonToWelcartLogin` meta value * * @var bool */ private $allowAmazonToWelcartLogin = false; /** * Constructs a member meta model object for a given member ID * * @author Evan D Shaw <evandanielshaw@gmail.com> * @global \usc_e_shop $usces * @param int $memberId * @return void */ public function __construct($memberId) { global $usces; $this->memberId = (int)$memberId; $initialRegistrationEmail = $usces->get_member_meta_value(self::INITIAL_REGISTRATION_EMAIL, $this->memberId); $allowAmazonToWelcartLogin = $usces->get_member_meta_value(self::ALLOW_AMAZON_TO_WELCART_LOGIN, $this->memberId); if (!empty($initialRegistrationEmail)) { $this->initialRegistrationEmail = $initialRegistrationEmail; } if (!empty($allowAmazonToWelcartLogin)) { $this->allowAmazonToWelcartLogin = (bool)(int)$allowAmazonToWelcartLogin; } } /** * Saves member meta data * * @author Evan D Shaw <evandanielshaw@gmail.com> * @global \usc_e_shop $usces * @param string $email * @param int $memberId * @return void */ public static function saveMemberMetaData($email, $memberId) { global $usces; $usces->set_member_meta_value(self::INITIAL_REGISTRATION_EMAIL, $email, $memberId); $usces->set_member_meta_value(self::ALLOW_AMAZON_TO_WELCART_LOGIN, true, $memberId); } /** * Saves member meta data * * @author Kubo Tatsuya <k.tatsuya0419@gmail.com> * @global \usc_e_shop $usces * @param bool $bool * @return void */ public static function addAmazonLoginPermissionToMemberMetaData($bool) { global $usces; $usces->set_member_meta_value(self::ALLOW_AMAZON_TO_WELCART_LOGIN, $bool); } /** * Updates `allowAmazonToWelcartLogin` meta value * * @author Evan D Shaw <evandanielshaw@gmail.com> * @param bool $bool * @return void */ public function updateAllowAmazonToWelcartLogin($bool) { global $usces; $this->allowAmazonToWelcartLogin = $bool; $usces->set_member_meta_value(self::ALLOW_AMAZON_TO_WELCART_LOGIN, $bool, $this->memberId); } /** * Getter for `memberId` * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return int */ public function getMemberId() { return $this->memberId; } /** * Getter for `initialRegistrationEmail` * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return string */ public function getInitialRegistrationEmail() { return $this->initialRegistrationEmail; } /** * Getter for `allowAmazonToWelcartLogin` * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return string */ public function getAllowAmazonToWelcartLogin() { return $this->allowAmazonToWelcartLogin; } }
- __construct — Constructs a member meta model object for a given member ID
- addAmazonLoginPermissionToMemberMetaData — Saves member meta data
- getAllowAmazonToWelcartLogin — Getter for allowAmazonToWelcartLogin
- getInitialRegistrationEmail — Getter for initialRegistrationEmail
- getMemberId — Getter for memberId
- saveMemberMetaData — Saves member meta data
- updateAllowAmazonToWelcartLogin — Updates allowAmazonToWelcartLogin meta value