addVersionString() public method

public addVersionString ( string $version_string )
$version_string string
示例#1
0
 /**
  * Get the Mollie client. Needs the Config array for multishop to retrieve the API key.
  *
  * @param array $config
  *
  * @return Mollie_API_Client
  */
 public static function getAPIClientAdmin($config)
 {
     require_once realpath(DIR_SYSTEM . "/..") . "/catalog/controller/extension/payment/mollie-api-client/src/Mollie/API/Autoloader.php";
     $mollie = new Mollie_API_Client();
     $mollie->setApiKey(isset($config['mollie_api_key']) ? $config['mollie_api_key'] : null);
     $mollie->addVersionString("OpenCart/" . VERSION);
     $mollie->addVersionString("MollieOpenCart/" . self::PLUGIN_VERSION);
     return $mollie;
 }
示例#2
0
 /**
  * Get the Mollie client. Needs the Config object to retrieve the API key.
  *
  * @param Config $config
  *
  * @return Mollie_API_Client
  */
 public static function getAPIClient($config)
 {
     if (!self::$api_client && self::apiClientFound()) {
         require_once realpath(DIR_SYSTEM . "/..") . "/catalog/controller/payment/mollie-api-client/src/Mollie/API/Autoloader.php";
         $mollie = new Mollie_API_Client();
         $mollie->setApiKey($config->get('mollie_api_key'));
         $mollie->addVersionString("OpenCart/" . VERSION);
         $mollie->addVersionString("MollieOpenCart/" . self::PLUGIN_VERSION);
         self::$api_client = $mollie;
     }
     return self::$api_client;
 }
示例#3
0
 public function __construct()
 {
     parent::__construct();
     $this->displayName = $this->l('Mollie Payment Module');
     $this->description = $this->l('Mollie Payments');
     $this->confirmUninstall = $this->l('Are you sure you want to uninstall the Mollie Payment Module?');
     require_once dirname(__FILE__) . '/lib/src/Mollie/API/Autoloader.php';
     try {
         $this->api = new Mollie_API_Client();
         $this->api->setApiKey($this->getConfigValue('MOLLIE_API_KEY'));
         $this->api->addVersionString('Prestashop/' . (defined('_PS_VERSION_') ? _PS_VERSION_ : 'Unknown'));
         $this->api->addVersionString('MolliePrestashop/' . (isset($this->version) ? $this->version : 'Unknown'));
     } catch (Mollie_API_Exception_IncompatiblePlatform $e) {
         Logger::addLog(__METHOD__ . ' - System incompatible: ' . $e->getMessage(), Mollie::CRASH);
     } catch (Mollie_API_Exception $e) {
         $this->warning = $this->l('Payment error:') . $e->getMessage();
         Logger::addLog(__METHOD__ . ' said: ' . $this->warning, Mollie::CRASH);
     }
     $this->statuses = array(Mollie_API_Object_Payment::STATUS_PAID => $this->getConfigValue('MOLLIE_STATUS_PAID'), Mollie_API_Object_Payment::STATUS_CANCELLED => $this->getConfigValue('MOLLIE_STATUS_CANCELLED'), Mollie_API_Object_Payment::STATUS_EXPIRED => $this->getConfigValue('MOLLIE_STATUS_EXPIRED'), Mollie_API_Object_Payment::STATUS_REFUNDED => $this->getConfigValue('MOLLIE_STATUS_REFUNDED'), Mollie_API_Object_Payment::STATUS_OPEN => $this->getConfigValue('MOLLIE_STATUS_OPEN'));
     // Load all translatable text here so we have a single translation point
     $this->lang = array(Mollie_API_Object_Payment::STATUS_PAID => $this->l('paid'), Mollie_API_Object_Payment::STATUS_CANCELLED => $this->l('cancelled'), Mollie_API_Object_Payment::STATUS_EXPIRED => $this->l('expired'), Mollie_API_Object_Payment::STATUS_REFUNDED => $this->l('refunded'), Mollie_API_Object_Payment::STATUS_OPEN => $this->l('bankwire pending'), 'This payment method is not available.' => $this->l('This payment method is not available.'), 'Click here to continue' => $this->l('Click here to continue'), 'This payment method is only available for Euros.' => $this->l('This payment method is only available for Euros.'), 'There was an error while processing your request: ' => $this->l('There was an error while processing your request: '), 'The order with this id does not exist.' => $this->l('The order with this id does not exist.'), 'We have not received a definite payment status. You will be notified as soon as we receive a confirmation of the bank/merchant.' => $this->l('We have not received a definite payment status. You will be notified as soon as we receive a confirmation of the bank/merchant.'), 'You have cancelled your payment.' => $this->l('You have cancelled your payment.'), 'Unfortunately your payment was expired.' => $this->l('Unfortunately your payment was expired.'), 'Thank you. Your payment has been received.' => $this->l('Thank you. Your payment has been received.'), 'The transaction has an unexpected status.' => $this->l('The transaction has an unexpected status.'), 'You are not authorised to see this page.' => $this->l('You are not authorised to see this page.'), 'Continue shopping' => $this->l('Continue shopping'), 'Welcome back' => $this->l('Welcome back'), 'Select your bank:' => $this->l('Select your bank:'), 'OK' => $this->l('OK'), 'Return to the homepage' => $this->l('Return to the homepage'), 'Pay with %s' => $this->l('Pay with %s'), 'Refund this order' => $this->l('Refund this order'), 'Mollie refund' => $this->l('Mollie refund'), 'Refund order #%d through the Mollie API.' => $this->l('Refund order #%d through the Mollie API.'), 'iDEAL' => $this->l('iDEAL'), 'Creditcard' => $this->l('Creditcard'), 'Mister Cash' => $this->l('Mister Cash'), 'Bank transfer' => $this->l('Bank transfer'), 'PayPal' => $this->l('PayPal'), 'paysafecard' => $this->l('paysafecard'), 'MiniTix' => $this->l('MiniTix'), 'Micropayments' => $this->l('Micropayments'));
     // If an update includes a new hook, it normally takes a manual reinstall for it to take effect
     // This would cause all config values to reset and the Mollie table to be cleared.
     // $this->reinstall() fixes the hook registration without those sad side effects.
     $version = $this->getConfigValue('MOLLIE_VERSION');
     if ($version === FALSE || version_compare($version, $this->version, '<')) {
         $this->reinstall();
         $this->updateConfigValue('MOLLIE_VERSION', $this->version);
     }
 }
示例#4
0
 /**
  * @param bool $test_mode
  * @return Mollie_API_Client
  * @throws Mollie_WC_Exception_InvalidApiKey
  */
 public function getApiClient($test_mode = false)
 {
     global $wp_version;
     $api_key = $this->settings_helper->getApiKey($test_mode);
     if (empty($api_key)) {
         throw new Mollie_WC_Exception_InvalidApiKey(__('No API key provided.', 'mollie-payments-for-woocommerce'));
     } elseif (!preg_match('/^(live|test)_\\w+$/', $api_key)) {
         throw new Mollie_WC_Exception_InvalidApiKey(__('Invalid API key. The API key must start with \'live_\' or \'test_\' and can\'t further contain any special characters.', 'mollie-payments-for-woocommerce'));
     }
     if (empty(self::$api_client)) {
         $client = new Mollie_API_Client();
         $client->setApiKey($api_key);
         $client->setApiEndpoint(self::getApiEndpoint());
         $client->addVersionString('WordPress/' . (isset($wp_version) ? $wp_version : 'Unknown'));
         $client->addVersionString('WooCommerce/' . get_option('woocommerce_version', 'Unknown'));
         $client->addVersionString('MollieWoo/' . Mollie_WC_Plugin::PLUGIN_VERSION);
         self::$api_client = $client;
     }
     return self::$api_client;
 }
示例#5
0
文件: Api.php 项目: mollie/magento
 /**
  * @param NULL|string $key
  *
  * @return Mollie_API_Client
  * @throws Mollie_API_Exception
  */
 public function _getMollieAPI($key = NULL)
 {
     $this->_setAutoLoader();
     $key = $key === NULL ? $this->getApiKey() : $key;
     $api = new Mollie_API_Client();
     $api->setApiKey($key);
     $api->addVersionString('Magento/' . Mage::getVersion());
     $api->addVersionString('MollieMagento/' . $this->getExtensionVersion());
     return $api;
 }
示例#6
0
 /**
  * @param null|string $key
  * @return Mollie_API_Client
  * @throws Mollie_API_Exception
  */
 public function _getMollieAPI($key = null)
 {
     $this->_setAutoLoader();
     $key = $key === null ? $this->getApiKey() : $key;
     $api = new Mollie_API_Client();
     $api->setApiKey($key);
     $api->addVersionString('Magento/' . Mage::getVersion());
     $api->addVersionString('MollieMagento/' . self::PLUGIN_VERSION);
     return $api;
 }