Skip to content

Commit

Permalink
Merge pull request #224 from buckaroo-it/BP-3629-Add-payment-method-B…
Browse files Browse the repository at this point in the history
…lik-Shopware-6

Blik payment
  • Loading branch information
gentiprenaj authored Jul 2, 2024
2 parents c4bd041 + 44625fa commit 5b607d9
Show file tree
Hide file tree
Showing 9 changed files with 172 additions and 16 deletions.
12 changes: 12 additions & 0 deletions src/Handlers/BlikPaymentHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Buckaroo\Shopware6\Handlers;

use Buckaroo\Shopware6\PaymentMethods\Blik;

class BlikPaymentHandler extends AsyncPaymentHandler
{
protected string $paymentClass = Blik::class;
}
2 changes: 2 additions & 0 deletions src/Helpers/GatewayHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Buckaroo\Shopware6\Helpers;

use Buckaroo\Shopware6\PaymentMethods\Blik;
use Buckaroo\Shopware6\PaymentMethods\Eps;
use Buckaroo\Shopware6\PaymentMethods\In3;
use Buckaroo\Shopware6\PaymentMethods\Kbc;
Expand Down Expand Up @@ -40,6 +41,7 @@ class GatewayHelper
{
public const GATEWAYS = [
Ideal::class,
Blik::class,
Bancontact::class,
Creditcard::class,
Creditcards::class,
Expand Down
77 changes: 77 additions & 0 deletions src/PaymentMethods/Blik.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

declare(strict_types=1);

namespace Buckaroo\Shopware6\PaymentMethods;

use Buckaroo\Shopware6\Handlers\BlikPaymentHandler;

class Blik extends AbstractPayment
{
/*
* @return string
*/
public function getBuckarooKey(): string
{
return 'blik';
}

/**
* {@inheritDoc}
*
* @return string
*/
public function getName(): string
{
return 'Buckaroo Blik';
}

/**
* {@inheritDoc}
*
* @return string
*/
public function getDescription(): string
{
return 'Pay with Blik';
}

/**
* {@inheritDoc}
*
* @return string
*/
public function getMedia(): string
{
return __DIR__ . '/../Resources/views/storefront/buckaroo/payments/blik.svg';
}

/**
* {@inheritDoc}
*
* @return string
*/
public function getPaymentHandler(): string
{
return BlikPaymentHandler::class;
}

/**
* {@inheritDoc}
*
* @return array<mixed>
*/
public function getTranslations(): array
{
return [
'de-DE' => [
'name' => $this->getName(),
'description' => 'Bezahlen mit PayPerEmail',
],
'en-GB' => [
'name' => $this->getName(),
'description' => $this->getDescription(),
],
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ Component.register("buckaroo-payment-list", {
code: "bancontactmrcash",
logo: "bancontact.svg"
},
{
code: "blik",
logo: "blik.svg"
},
{
code: "belfius",
logo: "belfius.svg"
Expand Down

Large diffs are not rendered by default.

76 changes: 66 additions & 10 deletions src/Resources/config/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@
<label lang="de-DE">Aktiviert</label>
<label lang="fr-FR">Activé</label>
</input-field>

<input-field type="single-select">
<name>bancontactmrcashEnvironment</name>
<label lang="en-GB">Test or Live:</label>
Expand All @@ -671,14 +671,14 @@

<input-field>
<name>bancontactmrcashLabel</name>
<label lang="en-GB">Frontend label</label>
<label lang="de-DE">Frontend-Label</label>
<label lang="nl-NL">Frontend label</label>
<label lang="fr-FR">Étiquette frontale</label>
<helpText lang="en-GB">This displays the payment method name entered in the checkout (Frontend label).</helpText>
<helpText lang="de-DE">Hier wird der im Checkout eingegebene Name der Zahlungsmethode (Frontend-Label) angezeigt.</helpText>
<helpText lang="nl-NL">Dit weergeeft de ingevoerde betaalmethode naam in de checkout (Frontend-label).</helpText>
<helpText lang="fr-FR">Cela affiche le nom du mode de paiement saisi lors du paiement (Étiquette frontale).</helpText>
<label lang="en-GB">Frontend label</label>
<label lang="de-DE">Frontend-Label</label>
<label lang="nl-NL">Frontend label</label>
<label lang="fr-FR">Étiquette frontale</label>
<helpText lang="en-GB">This displays the payment method name entered in the checkout (Frontend label).</helpText>
<helpText lang="de-DE">Hier wird der im Checkout eingegebene Name der Zahlungsmethode (Frontend-Label) angezeigt.</helpText>
<helpText lang="nl-NL">Dit weergeeft de ingevoerde betaalmethode naam in de checkout (Frontend-label).</helpText>
<helpText lang="fr-FR">Cela affiche le nom du mode de paiement saisi lors du paiement (Étiquette frontale).</helpText>
<defaultValue>Bancontact</defaultValue>
</input-field>

Expand All @@ -689,7 +689,7 @@
<label lang="en-GB">Buckaroo Fee</label>
<label lang="nl-NL">Buckaroo betaaltoeslag</label>
<label lang="de-DE">Buckaroo Gebühr</label>
<label lang="fr-FR">Frais de buckaroo</label>
<label lang="fr-FR">Frais de buckaroo</label>
</input-field>

<input-field type="single-select">
Expand Down Expand Up @@ -719,6 +719,62 @@

</card>

<card>
<title>Blik</title>
<name>blik</name>
<input-field type="bool">
<name>blikEnabled</name>
<label lang="en-GB">Enabled</label>
<label lang="nl-NL">Ingeschakeld</label>
<label lang="de-DE">Aktiviert</label>
<label lang="fr-FR">Activé</label>
</input-field>

<input-field type="single-select">
<name>blikEnvironment</name>
<label lang="en-GB">Test or Live:</label>
<label lang="de-DE">Test oder Live:</label>
<label lang="nl-NL">Test of Live:</label>
<label lang="fr-FR">Tester ou Vivre:</label>
<defaultValue>test</defaultValue>
<options>
<option>
<id>test</id>
<name>Test</name>
</option>
<option>
<id>live</id>
<name>Live</name>
</option>
</options>
</input-field>

<input-field>
<name>blikLabel</name>
<label lang="en-GB">Frontend label</label>
<label lang="de-DE">Frontend-Label</label>
<label lang="nl-NL">Frontend label</label>
<label lang="fr-FR">Étiquette frontale</label>
<helpText lang="en-GB">This displays the payment method name entered in the checkout (Frontend label).</helpText>
<helpText lang="de-DE">Hier wird der im Checkout eingegebene Name der Zahlungsmethode (Frontend-Label) angezeigt.</helpText>
<helpText lang="nl-NL">Dit weergeeft de ingevoerde betaalmethode naam in de checkout (Frontend-label).</helpText>
<helpText lang="fr-FR">Cela affiche le nom du mode de paiement saisi lors du paiement (Étiquette frontale).</helpText>
<defaultValue>Blik</defaultValue>
</input-field>

<input-field type="float">
<name>blikFee</name>
<min>0</min>
<max>1000</max>
<label lang="en-GB">Buckaroo Fee</label>
<label lang="nl-NL">Buckaroo betaaltoeslag</label>
<label lang="de-DE">Buckaroo Gebühr</label>
<label lang="fr-FR">Frais de buckaroo</label>
</input-field>


</card>

<card>
<title>Riverty | AfterPay</title>
<name>afterpay</name>
Expand Down
7 changes: 6 additions & 1 deletion src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,12 @@
<argument type="service" id="Buckaroo\Shopware6\Service\AsyncPaymentService"/>
<tag name="shopware.payment.method.async" />
</service>


<service id="Buckaroo\Shopware6\Handlers\BlikPaymentHandler">
<argument type="service" id="Buckaroo\Shopware6\Service\AsyncPaymentService"/>
<tag name="shopware.payment.method.async" />
</service>

<service id="Buckaroo\Shopware6\Handlers\CreditcardPaymentHandler">
<argument type="service" id="Buckaroo\Shopware6\Service\AsyncPaymentService"/>
<argument type="service" id="Buckaroo\Shopware6\Service\CustomerService"/>
Expand Down

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/Subscribers/CheckoutConfirmTemplateSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ public function addBuckarooExtension($event): void
'methodsWithFinancialWarning' => $this->getMethodsWithFinancialWarning($salesChannelId),
'validHouseNumbers' => $this->areValidHouseNumbers($event),
'afterpayOld' => $this->settingsService->getSetting('afterpayEnabledold', $salesChannelId) === true,
'redirectBancontact' => $this->settingsService->getSetting('redirectBancontact', $salesChannelId) === 'enabledRedirect'
]);
'redirectBancontact' =>
$this->settingsService->getSetting('redirectBancontact', $salesChannelId) === 'enabledRedirect']);

$event->getPage()->addExtension(
BuckarooStruct::EXTENSION_NAME,
Expand Down

0 comments on commit 5b607d9

Please sign in to comment.