Skip to content

Commit

Permalink
Move OpenSSL message to exception in the main class
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviocopes committed Feb 26, 2016
1 parent aa4bccb commit 2e5f385
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 0 additions & 6 deletions gateways/paypal_express/gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ protected function setupGateway($gateway)
$signature = $gatewayConfig['signature'];
$test_mode = $pluginConfig['test_mode'];

//OpenSSL 1.0.1 Required for Sandbox
if($test_mode && OPENSSL_VERSION_NUMBER < 0x1000100f) {
echo "OpenSSL Version Out-of-Date. PayPal Sandbox needs 1.0.1 for TLS 1.2";
exit();
}

$gateway = Omnipay::create('PayPal_Express');
$gateway->setUsername($username);
$gateway->setPassword($password);
Expand Down
6 changes: 6 additions & 0 deletions shoppingcart-paypal.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public function onPluginsInitialized()
$this->config->set('plugins.shoppingcart', array_replace_recursive($this->config->get('plugins.shoppingcart'), $this->config->get('plugins.shoppingcart-paypal')));

if (!$this->isAdmin()) {

//OpenSSL >= 1.0.1 Required
if(OPENSSL_VERSION_NUMBER < 0x1000100f) {
throw new \RuntimeException("PayPal Plugin Error. Your OpenSSL Version is too old. PayPal Sandbox needs at least OpenSSL 1.0.1 because of recent changes on their side. Please update your OpenSSL version, or ask your hosting provider to update it.");
}

// Site
$this->enable([
'onTwigSiteVariables' => ['onTwigSiteVariables', 0],
Expand Down

0 comments on commit 2e5f385

Please sign in to comment.