Skip to content

Commit

Permalink
Added craft 4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Roel van Hintum committed May 9, 2022
1 parent d2d1944 commit b68c366
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 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.0.0-beta.1 - 2022-05-09
### Changed
- Added craft 4 support

## 1.3.0 - 2022-03-10
### Change
- Update ideal issuers
Expand Down
12 changes: 6 additions & 6 deletions src/base/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use craft\commerce\omnipay\base\OffsiteGateway;

use Omnipay\Common\AbstractGateway;
use Omnipay\Buckaroo\Gateway as OmnipayGateway;
use Omnipay\Buckaroo\BuckarooGateway as OmnipayBuckarooGateway;

abstract class Gateway extends OffsiteGateway
{
Expand Down Expand Up @@ -37,15 +37,15 @@ abstract class Gateway extends OffsiteGateway
/**
* @inheritdoc
*/
public function getSettingsHtml()
public function getSettingsHtml(): ?string
{
return Craft::$app->getView()->renderTemplate('commerce-buckaroo/gatewaySettings', ['gateway' => $this]);
}

/**
* @inheritdoc
*/
public function populateRequest(array &$request, BasePaymentForm $paymentForm = null)
public function populateRequest(array &$request, BasePaymentForm $paymentForm = null): void
{
$request['culture'] = Craft::$app->language;
}
Expand All @@ -71,9 +71,9 @@ public function getPaymentTypeOptions(): array
/**
* @inheritdoc
*/
public function rules()
public function defineRules(): array
{
$rules = parent::rules();
$rules = parent::defineRules();
$rules[] = ['paymentType', 'compare', 'compareValue' => 'purchase'];

return $rules;
Expand All @@ -87,7 +87,7 @@ public function rules()
*/
protected function createGateway(): AbstractGateway
{
/** @var OmnipayGateway $gateway */
/** @var OmnipayBuckarooGateway $gateway */
$gateway = static::createOmnipayGateway($this->getGatewayClassName());

$settings = BuckarooPlugin::$plugin->getSettings();
Expand Down
8 changes: 4 additions & 4 deletions src/gateways/CreditCardGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function getPaymentFormModel(): BasePaymentForm
/**
* @inheritdoc
*/
public function getPaymentFormHtml(array $params)
public function getPaymentFormHtml(array $params): null|string
{
try {
$defaults = [
Expand Down Expand Up @@ -81,7 +81,7 @@ public function getPaymentFormHtml(array $params)
/**
* @inheritdoc
*/
public function populateRequest(array &$request, BasePaymentForm $paymentForm = null)
public function populateRequest(array &$request, BasePaymentForm $paymentForm = null): void
{
parent::populateRequest($request, $paymentForm);

Expand All @@ -96,7 +96,7 @@ public function populateRequest(array &$request, BasePaymentForm $paymentForm =
/**
* @return mixed
*/
public function fetchPaymentMethods()
public function fetchPaymentMethods(): array
{
// Source: https://dev.buckaroo.nl/PaymentMethods/Description/creditcards
return [
Expand All @@ -122,7 +122,7 @@ public function fetchPaymentMethods()
/**
* @inheritdoc
*/
protected function getGatewayClassName()
protected function getGatewayClassName(): null|string
{
return '\\' . OmniPayCreditCardGateway::class;
}
Expand Down
8 changes: 4 additions & 4 deletions src/gateways/IdealGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function getPaymentFormModel(): BasePaymentForm
/**
* @inheritdoc
*/
public function getPaymentFormHtml(array $params)
public function getPaymentFormHtml(array $params): null|string
{
try {
$defaults = [
Expand Down Expand Up @@ -81,7 +81,7 @@ public function getPaymentFormHtml(array $params)
/**
* @inheritdoc
*/
public function populateRequest(array &$request, BasePaymentForm $paymentForm = null)
public function populateRequest(array &$request, BasePaymentForm $paymentForm = null): void
{
parent::populateRequest($request, $paymentForm);

Expand All @@ -96,7 +96,7 @@ public function populateRequest(array &$request, BasePaymentForm $paymentForm =
/**
* @return mixed
*/
public function fetchIssuers()
public function fetchIssuers(): array
{
// Source: https://dev.buckaroo.nl/PaymentMethods/Description/ideal
return [
Expand All @@ -121,7 +121,7 @@ public function fetchIssuers()
/**
* @inheritdoc
*/
protected function getGatewayClassName()
protected function getGatewayClassName(): null|string
{
return '\\' . OmniPayIdealGateway::class;
}
Expand Down
2 changes: 1 addition & 1 deletion src/gateways/PayPalGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static function displayName(): string
/**
* @inheritdoc
*/
protected function getGatewayClassName()
protected function getGatewayClassName(): null|string
{
return '\\' . OmniPayPayPalGateway::class;
}
Expand Down
2 changes: 1 addition & 1 deletion src/gateways/SepaDirectDebitGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static function displayName(): string
/**
* @inheritdoc
*/
protected function getGatewayClassName()
protected function getGatewayClassName(): null|string
{
return '\\' . OmniPaySepaDirectDebitGateway::class;
}
Expand Down

0 comments on commit b68c366

Please sign in to comment.