Skip to content

Commit

Permalink
Match Craft's php standards as much as possible
Browse files Browse the repository at this point in the history
  • Loading branch information
Roel van Hintum committed Jul 13, 2023
1 parent 84dcf3c commit 44fc687
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 38 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release notes for Buckaroo Gateway for Craft Commerce

## 2.1.1 - 2023-07-13
### Changed
- Match Craft's php standards as much as possible

## 2.1.0 - 2023-07-07
### Changed
- Ideal issuer select doesn't have a bank selected by default anymore
Expand Down
17 changes: 9 additions & 8 deletions src/base/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Craft;
use craft\commerce\models\payments\BasePaymentForm;
use craft\commerce\omnipay\base\OffsiteGateway;
use craft\helpers\App;

use Omnipay\Common\AbstractGateway;
use Omnipay\Buckaroo\BuckarooGateway as OmnipayBuckarooGateway;
Expand All @@ -17,19 +18,19 @@ abstract class Gateway extends OffsiteGateway
// =========================================================================

/**
* @var string
* @var string|null
*/
public $websiteKey;
public ?string $websiteKey;

/**
* @var string
* @var string|null
*/
public $secretKey;
public ?string $secretKey;

/**
* @var bool
* @var bool|null
*/
public $testMode = false;
public ?bool $testMode = false;

// Public Methods
// =========================================================================
Expand Down Expand Up @@ -93,8 +94,8 @@ protected function createGateway(): AbstractGateway
$settings = BuckarooPlugin::$plugin->getSettings();
$testMode = $settings->testMode !== null ? $settings->testMode : $this->testMode;

$gateway->setWebsiteKey(Craft::parseEnv($this->websiteKey));
$gateway->setSecretKey(Craft::parseEnv($this->secretKey));
$gateway->setWebsiteKey(App::parseEnv($this->websiteKey));
$gateway->setSecretKey(App::parseEnv($this->secretKey));
$gateway->setTestMode($testMode);

return $gateway;
Expand Down
14 changes: 7 additions & 7 deletions src/gateways/CreditCardGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ class CreditCardGateway extends Gateway
// =========================================================================

/**
* @var string
* @var string|null
*/
public $websiteKey;
public ?string $websiteKey;

/**
* @var string
* @var string|null
*/
public $secretKey;
public ?string $secretKey;

/**
* @var bool
* @var bool|null
*/
public $testMode = false;
public ?bool $testMode = false;

// Public Methods
// =========================================================================
Expand Down Expand Up @@ -122,7 +122,7 @@ public function fetchPaymentMethods(): array
/**
* @inheritdoc
*/
protected function getGatewayClassName(): null|string
protected function getGatewayClassName(): ?string
{
return '\\' . OmniPayCreditCardGateway::class;
}
Expand Down
14 changes: 7 additions & 7 deletions src/gateways/IdealGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ class IdealGateway extends Gateway
// =========================================================================

/**
* @var string
* @var string|null
*/
public $websiteKey;
public ?string $websiteKey;

/**
* @var string
* @var string|null
*/
public $secretKey;
public ?string $secretKey;

/**
* @var bool
* @var bool|null
*/
public $testMode = false;
public ?bool $testMode = false;

// Public Methods
// =========================================================================
Expand Down Expand Up @@ -121,7 +121,7 @@ public function fetchIssuers(): array
/**
* @inheritdoc
*/
protected function getGatewayClassName(): null|string
protected function getGatewayClassName(): ?string
{
return '\\' . OmniPayIdealGateway::class;
}
Expand Down
14 changes: 7 additions & 7 deletions src/gateways/PayPalGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ class PayPalGateway extends Gateway
// =========================================================================

/**
* @var string
* @var string|null
*/
public $websiteKey;
public ?string $websiteKey;

/**
* @var string
* @var string|null
*/
public $secretKey;
public ?string $secretKey;

/**
* @var bool
* @var bool|null
*/
public $testMode = false;
public ?bool $testMode = false;

// Public Methods
// =========================================================================
Expand All @@ -44,7 +44,7 @@ public static function displayName(): string
/**
* @inheritdoc
*/
protected function getGatewayClassName(): null|string
protected function getGatewayClassName(): ?string
{
return '\\' . OmniPayPayPalGateway::class;
}
Expand Down
14 changes: 7 additions & 7 deletions src/gateways/SepaDirectDebitGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ class SepaDirectDebitGateway extends Gateway
// =========================================================================

/**
* @var string
* @var string|null
*/
public $websiteKey;
public ?string $websiteKey;

/**
* @var string
* @var string|null
*/
public $secretKey;
public ?string $secretKey;

/**
* @var bool
* @var bool|null
*/
public $testMode = false;
public ?bool $testMode = false;

// Public Methods
// =========================================================================
Expand All @@ -44,7 +44,7 @@ public static function displayName(): string
/**
* @inheritdoc
*/
protected function getGatewayClassName(): null|string
protected function getGatewayClassName(): ?string
{
return '\\' . OmniPaySepaDirectDebitGateway::class;
}
Expand Down
5 changes: 4 additions & 1 deletion src/models/forms/CreditCardPaymentForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@

class CreditCardPaymentForm extends OffsitePaymentForm
{
public $paymentMethod;
/**
* @var string|null
*/
public ?string $paymentMethod = null;
}
5 changes: 4 additions & 1 deletion src/models/forms/IdealPaymentForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@

class IdealPaymentForm extends OffsitePaymentForm
{
public $issuer;
/**
* @var string|null
*/
public ?string $issuer = null;
}

0 comments on commit 44fc687

Please sign in to comment.