Skip to content

Commit

Permalink
Blik payment method added
Browse files Browse the repository at this point in the history
  • Loading branch information
gentiprenaj committed Jul 5, 2024
1 parent 5f8512d commit 49f0529
Show file tree
Hide file tree
Showing 14 changed files with 283 additions and 0 deletions.
29 changes: 29 additions & 0 deletions api/paymentmethods/blik/blik.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* It is available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this file
*
* @author Buckaroo.nl <[email protected]>
* @copyright Copyright (c) Buckaroo B.V.
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}

require_once dirname(__FILE__) . '/../paymentmethod.php';
class Blik extends PaymentMethod
{
public function __construct()
{
$this->type = 'blik';
$this->version = 1;
}
}
25 changes: 25 additions & 0 deletions api/paymentmethods/blik/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/**
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* It is available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this file
*
* @author Buckaroo.nl <[email protected]>
* @copyright Copyright (c) Buckaroo B.V.
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');

header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');

header('Location: ../');
exit;
2 changes: 2 additions & 0 deletions api/paymentmethods/paymentrequestfactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class PaymentRequestFactory
public const REQUEST_TYPE_KBCPAYMENTBUTTON = 'kbcpaymentbutton';
public const REQUEST_TYPE_SEPADIRECTDEBIT = 'sepadirectdebit';
public const REQUEST_TYPE_BANCONTACTMRCASH = 'bancontactmrcash';
public const REQUEST_TYPE_BLIK = 'blik';
public const REQUEST_TYPE_SOFORTBANKING = 'sofortueberweisung';
public const REQUEST_TYPE_GIFTCARD = 'giftcard';
public const REQUEST_TYPE_CREDITCARD = 'creditcard';
Expand Down Expand Up @@ -60,6 +61,7 @@ class PaymentRequestFactory
PaymentRequestFactory::REQUEST_TYPE_GIROPAY => 'Giropay',
PaymentRequestFactory::REQUEST_TYPE_KBCPAYMENTBUTTON => 'Kbcpaymentbutton',
PaymentRequestFactory::REQUEST_TYPE_BANCONTACTMRCASH => 'Bancontactmrcash',
PaymentRequestFactory::REQUEST_TYPE_BLIK => 'Blik',
PaymentRequestFactory::REQUEST_TYPE_SOFORTBANKING => 'Sofortbanking',
PaymentRequestFactory::REQUEST_TYPE_GIFTCARD => 'GiftCard',
PaymentRequestFactory::REQUEST_TYPE_CREDITCARD => 'CreditCard',
Expand Down
1 change: 1 addition & 0 deletions dev/lang/php_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
"payment_methods.bancontactmrcash": "Bancontact",
"payment_methods.belfius": "Belfius",
"payment_methods.billink": "Billink",
"payment_methods.blik": "Blik",
"payment_methods.creditcard": "Karten",
"payment_methods.eps": "EPS",
"payment_methods.giftcard": "Geschenkkarte",
Expand Down
1 change: 1 addition & 0 deletions dev/lang/php_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"payment_methods.bancontactmrcash": "Bancontact",
"payment_methods.belfius": "Belfius",
"payment_methods.billink": "Billink",
"payment_methods.blik": "Blik",
"payment_methods.creditcard": "Cards",
"payment_methods.eps": "EPS",
"payment_methods.giftcard": "Giftcard",
Expand Down
1 change: 1 addition & 0 deletions dev/lang/php_fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
"payment_methods.bancontactmrcash": "Bancontact",
"payment_methods.belfius": "Belfius",
"payment_methods.billink": "Lien de facturation",
"payment_methods.blik": "Blik",
"payment_methods.creditcard": "Cartes",
"payment_methods.eps": "PSE",
"payment_methods.giftcard": "Carte cadeau",
Expand Down
1 change: 1 addition & 0 deletions dev/lang/php_nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
"payment_methods.bancontactmrcash": "Bancontact",
"payment_methods.belfius": "Belfius",
"payment_methods.billink": "Billink",
"payment_methods.blik": "Blik",
"payment_methods.creditcard": "Cards",
"payment_methods.eps": "EPS",
"payment_methods.giftcard": "Giftcard",
Expand Down
51 changes: 51 additions & 0 deletions library/checkout/BlikCheckout.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
/**
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* It is available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this file
*
* @author Buckaroo.nl <[email protected]>
* @copyright Copyright (c) Buckaroo B.V.
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
include_once _PS_MODULE_DIR_ . 'buckaroo3/library/checkout/checkout.php';

if (!defined('_PS_VERSION_')) {
exit;
}

class BlikCheckout extends Checkout
{
protected $customVars = [];

final public function setCheckout()
{
parent::setCheckout();
}

public function startPayment()
{
$this->payment_response = $this->payment_request->pay($this->customVars);
}

public function isRedirectRequired()
{
return true;
}

public function isVerifyRequired()
{
return false;
}

protected function initialize()
{
$this->payment_request = PaymentRequestFactory::create(PaymentRequestFactory::REQUEST_TYPE_BLIK);
}
}
1 change: 1 addition & 0 deletions src/Repository/RawPaymentMethodRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ private function getPaymentMethodsData()
['name' => 'giropay', 'label' => 'GiroPay', 'icon' => 'Giropay.svg', 'template' => '', 'is_payment_method' => '1'],
['name' => 'kbcpaymentbutton', 'label' => 'KBC', 'icon' => 'KBC.svg', 'template' => '', 'is_payment_method' => '1'],
['name' => 'bancontactmrcash', 'label' => 'Bancontact', 'icon' => 'Bancontact.svg', 'template' => '', 'is_payment_method' => '1'],
['name' => 'blik', 'label' => 'Blik', 'icon' => 'Blik.svg', 'template' => '', 'is_payment_method' => '1'],
['name' => 'giftcard', 'label' => 'Giftcards', 'icon' => 'Giftcards.svg', 'template' => 'payment_giftcards.tpl', 'is_payment_method' => '1'],
['name' => 'creditcard', 'label' => 'Cards', 'icon' => 'Creditcards.svg', 'template' => 'payment_creditcard.tpl', 'is_payment_method' => '1'],
['name' => 'sofortueberweisung', 'label' => 'Sofortbanking', 'icon' => 'Sofort.svg', 'template' => '', 'is_payment_method' => '1'],
Expand Down
48 changes: 48 additions & 0 deletions vendor/buckaroo/sdk/src/PaymentMethods/Blik/Blik.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

declare(strict_types=1);

namespace Buckaroo\PaymentMethods\Blik;

use Buckaroo\Models\Model;
use Buckaroo\PaymentMethods\Blik\Models\Refund;
use Buckaroo\PaymentMethods\Blik\Models\Pay;
use Buckaroo\PaymentMethods\Interfaces\Combinable;
use Buckaroo\PaymentMethods\PayablePaymentMethod;
use Buckaroo\Transaction\Response\TransactionResponse;

/**
*
*/
class Blik extends PayablePaymentMethod implements Combinable
{
/**
* @var string
*/
protected string $paymentName = 'blik';
/**
* @var int
*/
protected int $serviceVersion = 0;

/**
* @param Model|null $model
* @return TransactionResponse
*/
public function pay(?Model $model = null): TransactionResponse
{
return parent::pay($model ?? new Pay($this->payload));
}

// /**
// * @param Model|null $model
// * @return TransactionResponse
// */
// public function refund(?Model $model = null): TransactionResponse
// {
// return parent::refund($model ?? new Refund($this->payload));
// }
//


}
28 changes: 28 additions & 0 deletions vendor/buckaroo/sdk/src/PaymentMethods/Blik/Models/Pay.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/*
* NOTICE OF LICENSE
*
* This source file is subject to the MIT License
* It is available through the world-wide-web at this URL:
* https://tldrlegal.com/license/mit-license
* If you are unable to obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please contact [email protected] for more information.
*
* @copyright Copyright (c) Buckaroo B.V.
* @license https://tldrlegal.com/license/mit-license
*/

namespace Buckaroo\PaymentMethods\Blik\Models;

use Buckaroo\Models\ServiceParameter;

class Pay extends ServiceParameter
{
protected bool $saveToken;
}
58 changes: 58 additions & 0 deletions vendor/buckaroo/sdk/src/PaymentMethods/Blik/Models/Refund.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace Buckaroo\PaymentMethods\Blik\Models;

use Buckaroo\Models\ServiceParameter;
use Buckaroo\PaymentMethods\Afterpay\Service\ParameterKeys\ArticleAdapter;
use Buckaroo\PaymentMethods\Traits\CountableGroupKey;

class Refund extends ServiceParameter
{
use CountableGroupKey;

/**
* @var array|string[]
*/
private array $countableProperties = ['articles'];

/**
* @var string
*/
protected string $merchantImageUrl;

/**
* @var string
*/
protected string $summaryImageUrl;

/**
* @var array
*/
protected array $articles = [];

/**
* @var array|\string[][]
*/
protected array $groupData = [
'articles' => [
'groupType' => 'Article',
],
];

/**
* @param array|null $articles
* @return array
*/
public function articles(?array $articles = null)
{
if (is_array($articles))
{
foreach ($articles as $article)
{
$this->articles[] = new ArticleAdapter(new Article($article));
}
}

return $this->articles;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
use Buckaroo\PaymentMethods\KlarnaPay\KlarnaPay;
use Buckaroo\PaymentMethods\WeChatPay\WeChatPay;
use Buckaroo\PaymentMethods\Bancontact\Bancontact;
use Buckaroo\PaymentMethods\Blik\Blik;
use Buckaroo\PaymentMethods\CreditCard\CreditCard;
use Buckaroo\PaymentMethods\Multibanco\Multibanco;
use Buckaroo\PaymentMethods\Przelewy24\Przelewy24;
Expand Down Expand Up @@ -82,6 +83,7 @@ class PaymentMethodFactory
Billink::class => ['billink'],
Belfius::class => ['belfius'],
BuckarooWallet::class => ['buckaroo_wallet'],
Blik::class => ['blik'],
CreditCard::class =>
[
'creditcard', 'mastercard', 'visa',
Expand Down
35 changes: 35 additions & 0 deletions views/img/buckaroo/Payment methods/SVG/Blik.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 49f0529

Please sign in to comment.