Skip to content

Commit

Permalink
RB - Added initial release of the Shopware 6 plugin for Mollie Payments
Browse files Browse the repository at this point in the history
  • Loading branch information
reinder committed Oct 8, 2019
1 parent 1817865 commit d350ddc
Show file tree
Hide file tree
Showing 38 changed files with 2,423 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.idea
/vendor
36 changes: 36 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "kiener/mollie-payments-plugin",
"description": "Mollie Payments",
"version": "v1.0.0",
"type": "shopware-platform-plugin",
"license": "MIT",
"authors": [
{
"name": "Kiener Digital Commerce"
}
],
"require": {
"shopware/core": "*",
"mollie/mollie-api-php": "^2.0"
},
"extra": {
"shopware-plugin-class": "Kiener\\MolliePayments\\MolliePayments",
"copyright": "(c) by Kiener Digital Commerce",
"label": {
"de-DE": "Mollie Zahlungen",
"en-GB": "Mollie Payments",
"nl-NL": "Mollie Betalingen"
},
"description": {
"de-DE": "Mit Mollie integrieren Sie alle wichtigen internationalen und lokalen Zahlungsmethoden in nur einem Schritt in Ihren Shopware-Webshop. Starten Sie noch heute!",
"en-GB": "With Mollie you integrate every major global and local payment method in your Shopware webshop in one go. Start growing your business with effortless payments today!",
"nl-NL": "Met Mollie integreer je alle belangrijke internationale en lokale betaalmethoden in één keer in je Shopware webshop. Start vandaag nog!"
}
},
"autoload": {
"psr-4": {
"Kiener\\MolliePayments\\": "src/",
"Mollie\\Api\\": "vendor/mollie/mollie-api-php/src/"
}
}
}
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

With Mollie you integrate every major global and local payment method in your Shopware webshop in one go. Start growing your business with effortless payments today!

## Expected release date
## Installation

Mollie Payments for Shopware 6 is actively being developed. The first release of Mollie Payments for Shopware 6 is expected in the first week of October 2019.
Clone this project into a folder named MolliePayments in custom/plugins. Afterwards run `composer install` in that MolliePayments folder. Now you are able to install and activate the plugin within Shopware 6.

## Contact

Expand Down
33 changes: 33 additions & 0 deletions src/Config/Config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php declare(strict_types=1);

namespace Kiener\MolliePayments\Config;

use Shopware\Core\System\SystemConfig\SystemConfigService;

class Config
{
public const SYSTEM_CONFIG_DOMAIN = 'MolliePayments.config.';

/** @var SystemConfigService $systemConfigService */
protected static $systemConfigService;

public function __construct(SystemConfigService $systemConfigService)
{
self::$systemConfigService = $systemConfigService;
}

public static function liveApiKey() : string
{
return (string) self::$systemConfigService->get(self::SYSTEM_CONFIG_DOMAIN . 'liveApiKey');
}

public static function testApiKey() : string
{
return (string) self::$systemConfigService->get(self::SYSTEM_CONFIG_DOMAIN . 'testApiKey');
}

public static function testMode() : bool
{
return (bool) self::$systemConfigService->get(self::SYSTEM_CONFIG_DOMAIN . 'testMode');
}
}
77 changes: 77 additions & 0 deletions src/Factory/MollieApiFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

namespace Kiener\MolliePayments\Factory;

use Exception;
use Kiener\MolliePayments\Config\Config;
use Mollie\Api\MollieApiClient;
use Psr\Log\LoggerInterface;
use Shopware\Core\Kernel;
use Symfony\Component\DependencyInjection\ContainerInterface;

class MollieApiFactory
{
/** @var ContainerInterface $container */
protected $container;

/** @var Config $config */
protected $config;

/** @var LoggerInterface */
protected $logger;

/** @var MollieApiClient $apiClient */
protected $apiClient;

/**
* Create a new instance of MollieApiFactory.
*
* @param ContainerInterface $container
* @param Config $config
* @param LoggerInterface $logger
*/
public function __construct(
ContainerInterface $container,
Config $config,
LoggerInterface $logger
)
{
$this->container = $container;
$this->config = $config;
$this->logger = $logger;
}

/**
* Create a new instance of the Mollie API client.
*
* @throws \Mollie\Api\Exceptions\IncompatiblePlatform
*/
public function createClient()
{
if ($this->apiClient === null) {
$this->apiClient = new MollieApiClient();

try {
// Set the API key
$this->apiClient->setApiKey(
$this->config::testMode() ? $this->config::testApiKey() : $this->config::liveApiKey()
);

// Add platform data
$this->apiClient->addVersionString(
'Shopware/' .
Kernel::SHOPWARE_FALLBACK_VERSION
);

// @todo Add plugin version variable
$this->apiClient->addVersionString(
'MollieShopware6/1.0'
);
} catch (Exception $e) {
$this->logger->error($e->getMessage(), [$e]);
}
}

return $this->apiClient;
}
}
11 changes: 11 additions & 0 deletions src/Handler/Method/ApplePayPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Kiener\MolliePayments\Handler\Method;

use Kiener\MolliePayments\Handler\PaymentHandler;
use Mollie\Api\Types\PaymentMethod;

class ApplePayPayment extends PaymentHandler
{
protected $paymentMethod = PaymentMethod::APPLEPAY;
}
11 changes: 11 additions & 0 deletions src/Handler/Method/BanContactPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Kiener\MolliePayments\Handler\Method;

use Kiener\MolliePayments\Handler\PaymentHandler;
use Mollie\Api\Types\PaymentMethod;

class BanContactPayment extends PaymentHandler
{
protected $paymentMethod = PaymentMethod::BANCONTACT;
}
11 changes: 11 additions & 0 deletions src/Handler/Method/BankTransferPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Kiener\MolliePayments\Handler\Method;

use Kiener\MolliePayments\Handler\PaymentHandler;
use Mollie\Api\Types\PaymentMethod;

class BankTransferPayment extends PaymentHandler
{
protected $paymentMethod = PaymentMethod::BANKTRANSFER;
}
11 changes: 11 additions & 0 deletions src/Handler/Method/BelfiusPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Kiener\MolliePayments\Handler\Method;

use Kiener\MolliePayments\Handler\PaymentHandler;
use Mollie\Api\Types\PaymentMethod;

class BelfiusPayment extends PaymentHandler
{
protected $paymentMethod = PaymentMethod::BELFIUS;
}
11 changes: 11 additions & 0 deletions src/Handler/Method/CreditCardPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Kiener\MolliePayments\Handler\Method;

use Kiener\MolliePayments\Handler\PaymentHandler;
use Mollie\Api\Types\PaymentMethod;

class CreditCardPayment extends PaymentHandler
{
protected $paymentMethod = PaymentMethod::CREDITCARD;
}
11 changes: 11 additions & 0 deletions src/Handler/Method/DirectDebitPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Kiener\MolliePayments\Handler\Method;

use Kiener\MolliePayments\Handler\PaymentHandler;
use Mollie\Api\Types\PaymentMethod;

class DirectDebitPayment extends PaymentHandler
{
protected $paymentMethod = PaymentMethod::DIRECTDEBIT;
}
11 changes: 11 additions & 0 deletions src/Handler/Method/EpsPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Kiener\MolliePayments\Handler\Method;

use Kiener\MolliePayments\Handler\PaymentHandler;
use Mollie\Api\Types\PaymentMethod;

class EpsPayment extends PaymentHandler
{
protected $paymentMethod = PaymentMethod::EPS;
}
11 changes: 11 additions & 0 deletions src/Handler/Method/GiftCardPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Kiener\MolliePayments\Handler\Method;

use Kiener\MolliePayments\Handler\PaymentHandler;
use Mollie\Api\Types\PaymentMethod;

class GiftCardPayment extends PaymentHandler
{
protected $paymentMethod = PaymentMethod::GIFTCARD;
}
11 changes: 11 additions & 0 deletions src/Handler/Method/GiroPayPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Kiener\MolliePayments\Handler\Method;

use Kiener\MolliePayments\Handler\PaymentHandler;
use Mollie\Api\Types\PaymentMethod;

class GiroPayPayment extends PaymentHandler
{
protected $paymentMethod = PaymentMethod::GIROPAY;
}
11 changes: 11 additions & 0 deletions src/Handler/Method/IngHomePayPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Kiener\MolliePayments\Handler\Method;

use Kiener\MolliePayments\Handler\PaymentHandler;
use Mollie\Api\Types\PaymentMethod;

class IngHomePayPayment extends PaymentHandler
{
protected $paymentMethod = PaymentMethod::INGHOMEPAY;
}
11 changes: 11 additions & 0 deletions src/Handler/Method/KbcPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Kiener\MolliePayments\Handler\Method;

use Kiener\MolliePayments\Handler\PaymentHandler;
use Mollie\Api\Types\PaymentMethod;

class KbcPayment extends PaymentHandler
{
protected $paymentMethod = PaymentMethod::KBC;
}
11 changes: 11 additions & 0 deletions src/Handler/Method/KlarnaPayLaterPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Kiener\MolliePayments\Handler\Method;

use Kiener\MolliePayments\Handler\PaymentHandler;
use Mollie\Api\Types\PaymentMethod;

class KlarnaPayLaterPayment extends PaymentHandler
{
protected $paymentMethod = PaymentMethod::KLARNA_PAY_LATER;
}
11 changes: 11 additions & 0 deletions src/Handler/Method/KlarnaSliceItPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Kiener\MolliePayments\Handler\Method;

use Kiener\MolliePayments\Handler\PaymentHandler;
use Mollie\Api\Types\PaymentMethod;

class KlarnaSliceItPayment extends PaymentHandler
{
protected $paymentMethod = PaymentMethod::KLARNA_SLICE_IT;
}
11 changes: 11 additions & 0 deletions src/Handler/Method/PayPalPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Kiener\MolliePayments\Handler\Method;

use Kiener\MolliePayments\Handler\PaymentHandler;
use Mollie\Api\Types\PaymentMethod;

class PayPalPayment extends PaymentHandler
{
protected $paymentMethod = PaymentMethod::PAYPAL;
}
11 changes: 11 additions & 0 deletions src/Handler/Method/PaySafeCardPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Kiener\MolliePayments\Handler\Method;

use Kiener\MolliePayments\Handler\PaymentHandler;
use Mollie\Api\Types\PaymentMethod;

class PaySafeCardPayment extends PaymentHandler
{
protected $paymentMethod = PaymentMethod::PAYSAFECARD;
}
11 changes: 11 additions & 0 deletions src/Handler/Method/Przelewy24Payment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Kiener\MolliePayments\Handler\Method;

use Kiener\MolliePayments\Handler\PaymentHandler;
use Mollie\Api\Types\PaymentMethod;

class Przelewy24Payment extends PaymentHandler
{
protected $paymentMethod = PaymentMethod::PRZELEWY24;
}
11 changes: 11 additions & 0 deletions src/Handler/Method/SofortPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Kiener\MolliePayments\Handler\Method;

use Kiener\MolliePayments\Handler\PaymentHandler;
use Mollie\Api\Types\PaymentMethod;

class SofortPayment extends PaymentHandler
{
protected $paymentMethod = PaymentMethod::SOFORT;
}
Loading

0 comments on commit d350ddc

Please sign in to comment.