-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RB - Added initial release of the Shopware 6 plugin for Mollie Payments
- Loading branch information
reinder
committed
Oct 8, 2019
1 parent
1817865
commit d350ddc
Showing
38 changed files
with
2,423 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/.idea | ||
/vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
Oops, something went wrong.