* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @copyright PayPal */ namespace PaypalAddons\services\Core; use Configuration; class PaypalMerchantId { const SANDBOX = 'PAYPAL_MERCHANT_ID_SANDBOX'; const LIVE = 'PAYPAL_MERCHANT_ID_LIVE'; public function get($sandboxMode = null) { if ($sandboxMode instanceof SandboxMode == false) { $sandboxMode = $this->getSandboxMode(); } if ($sandboxMode->isSandbox()) { return Configuration::get(self::SANDBOX); } else { return Configuration::get(self::LIVE); } } public function set($id, $sandboxMode = null) { if ($sandboxMode instanceof SandboxMode == false) { $sandboxMode = $this->getSandboxMode(); } if ($sandboxMode->isSandbox()) { Configuration::updateValue(self::SANDBOX, $id); } else { Configuration::updateValue(self::LIVE, $id); } return $this; } protected function getSandboxMode() { return new SandboxMode(); } }