Skip to content

Commit

Permalink
[ECP-9277-v3] Add support for Billie Payment Method (#519)
Browse files Browse the repository at this point in the history
* [ECP-9277-v3] Billie basic structure - added payment method class, payment method handler, service injection, readme update etc.

* [ECP-9277-v3] Added empty lines at the end of files, moved billie installation to plugin version 3.16.0

* [ECP-9277-v3] Remove extra line

* [ECP-9277-v3] Update gateway code

---------

Co-authored-by: sushmita <[email protected]>
  • Loading branch information
SushmitaThakur and sushmita authored Jul 19, 2024
1 parent 00dd37b commit ca3b08f
Show file tree
Hide file tree
Showing 7 changed files with 154 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ The plugin integrates card component (Secured Fields) using Adyen Checkout for a
- Apple Pay
- Bancontact
- Blik
- Billie
- Clearpay
- Dotpay
- Electronic Payment Service (EPS)
Expand Down
20 changes: 20 additions & 0 deletions src/AdyenPaymentShopware6.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ public function update(UpdateContext $updateContext): void
if (\version_compare($currentVersion, '3.15.0', '<')) {
$this->updateTo3150($updateContext);
}

if (\version_compare($currentVersion, '3.16.0', '<')) {
$this->updateTo3160($updateContext);
}
}

private function addPaymentMethod(PaymentMethods\PaymentMethodInterface $paymentMethod, Context $context): void
Expand Down Expand Up @@ -501,6 +505,22 @@ private function updateTo3150(UpdateContext $updateContext): void
}
}

private function updateTo3160(UpdateContext $updateContext): void
{
/* Version 3.16.0 introduces following payment method.
* Billie
*/
$this->addPaymentMethod(
new PaymentMethods\BilliePaymentMethod(),
$updateContext->getContext()
);
$this->setPaymentMethodIsActive(
true,
$updateContext->getContext(),
new PaymentMethods\BilliePaymentMethod()
);
}

private function safeCopyAsset($source, $destination): bool
{
try {
Expand Down
37 changes: 37 additions & 0 deletions src/Handlers/BilliePaymentMethodHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php declare(strict_types=1);
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment Module
*
* Copyright (c) 2021 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*
* Author: Adyen <[email protected]>
*/

namespace Adyen\Shopware\Handlers;

class BilliePaymentMethodHandler extends AbstractPaymentMethodHandler
{
public static bool $isOpenInvoice = true;
public static bool $supportsManualCapture = true;
public static bool $supportsPartialCapture = true;

public static function getPaymentMethodCode()
{
return 'klarna_b2b';
}
}
87 changes: 87 additions & 0 deletions src/PaymentMethods/BilliePaymentMethod.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php declare(strict_types=1);
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment Module
*
* Copyright (c) 2021 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*
* Author: Adyen <[email protected]>
*/

namespace Adyen\Shopware\PaymentMethods;

use Adyen\Shopware\Handlers\BilliePaymentMethodHandler;

class BilliePaymentMethod implements PaymentMethodInterface
{

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

/**
* @inheritDoc
*/
public function getDescription(): string
{
return 'Buy Now Pay Later with Billie';
}

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

/**
* @inheritDoc
*/
public function getGatewayCode(): string
{
return 'ADYEN_KLARNA_B2B';
}

/**
* @inheritDoc
*/
public function getTemplate(): ?string
{
return null;
}

/**
* @inheritDoc
*/
public function getLogo(): string
{
return 'billie.png';
}

/**
* @inheritDoc
*/
public function getType(): string
{
return 'redirect';
}
}
3 changes: 2 additions & 1 deletion src/PaymentMethods/PaymentMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class PaymentMethods
MbwayPaymentMethod::class,
VippsPaymentMethod::class,
MobilePayPaymentMethod::class,
OpenBankingPaymentMethod::class
OpenBankingPaymentMethod::class,
BilliePaymentMethod::class
];
}
5 changes: 3 additions & 2 deletions src/Resources/app/storefront/src/configuration/adyen.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

export default {
updatablePaymentMethods: [
'scheme', 'ideal', 'sepadirectdebit', 'oneclick', 'dotpay', 'bcmc', 'bcmc_mobile', 'blik', 'eps', 'facilypay_3x',
'scheme', 'ideal', 'sepadirectdebit', 'oneclick', 'dotpay', 'bcmc', 'bcmc_mobile', 'blik', 'klarna_b2b', 'eps', 'facilypay_3x',
'facilypay_4x', 'facilypay_6x', 'facilypay_10x', 'facilypay_12x', 'afterpay_default', 'ratepay',
'ratepay_directdebit', 'giftcard', 'paybright', 'affirm', 'multibanco', 'mbway', 'vipps', 'mobilepay',
'wechatpayQR', 'wechatpayWeb', 'paybybank'
Expand Down Expand Up @@ -155,6 +155,7 @@ export default {
'vipps': 'handler_adyen_vippspaymentmethodhandler',
'affirm': 'handler_adyen_affirmpaymentmethodhandler',
'paybright': 'handler_adyen_paybrightpaymentmethodhandler',
'paybybank': 'handler_adyen_openbankingpaymentmethodhandler'
'paybybank': 'handler_adyen_openbankingpaymentmethodhandler',
'klarna_b2b': 'handler_adyen_billiepaymentmethodhandler'
}
}
4 changes: 4 additions & 0 deletions src/Resources/config/services/payment-handlers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@
parent="Adyen\Shopware\Handlers\AbstractPaymentMethodHandler">
<tag name="shopware.payment.method.async"/>
</service>
<service id="Adyen\Shopware\Handlers\BilliePaymentMethodHandler"
parent="Adyen\Shopware\Handlers\AbstractPaymentMethodHandler">
<tag name="shopware.payment.method.async"/>
</service>
<service id="Adyen\Shopware\Handlers\GivexGiftCardPaymentMethodHandler"
parent="Adyen\Shopware\Handlers\AbstractPaymentMethodHandler">
<tag name="shopware.payment.method.async"/>
Expand Down

0 comments on commit ca3b08f

Please sign in to comment.