Skip to content

Commit

Permalink
Merge pull request #63 from presteamshop/presteamshop
Browse files Browse the repository at this point in the history
Revision: 57 - The module prevents errors if the account is not confi…
  • Loading branch information
jimmyn authored Oct 23, 2024
2 parents 0507037 + 214e78a commit 3da0d62
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions monei.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,20 @@ public function __construct()
$this->description = $this->l('Accept Card, Apple Pay, Google Pay, Bizum, PayPal and many more payment methods in your store.');

$apiKey = Configuration::get('MONEI_API_KEY');
$accountId = Configuration::get('MONEI_ACCOUNT_ID');
if (!$apiKey || !$accountId) {
$this->moneiAccountId = Configuration::get('MONEI_ACCOUNT_ID');
if (!$apiKey || !$this->moneiAccountId) {
$this->warning = $this->l('Api Key or Account ID is not set.');
} else {
$this->moneiClient = new MoneiClient(
$apiKey,
$accountId
$this->moneiAccountId
);
$this->moneiAccount = $this->moneiClient->paymentMethods->getAccountInformation();
$this->moneiAccountId = $accountId;

try {
$this->moneiAccount = $this->moneiClient->paymentMethods->getAccountInformation();
} catch (ApiException $e) {
$this->warning = $e->getMessage();
}
}
}

Expand Down Expand Up @@ -1459,6 +1463,9 @@ public function isMoneiAvailable($cart)
if (!$this->moneiClient) {
return false;
}
if (!$this->moneiAccount) {
return false;
}

return true;
}
Expand Down

0 comments on commit 3da0d62

Please sign in to comment.