Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PW-7259] Add Subscription and UnscheduledCardOnFile for Twint payments #1764

Merged
merged 4 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Helper/PaymentMethods/PaymentMethodFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public static function createAdyenPaymentMethod(string $txVariant): PaymentMetho
return new AmazonPayPaymentMethod($txVariantObject->getCard());
case GooglePayPaymentMethod::TX_VARIANT:
return new GooglePayPaymentMethod($txVariantObject->getCard());
case TwintPaymentMethod::TX_VARIANT:
return new TwintPaymentMethod();
default:
$message = sprintf('Unknown txVariant: %s', $txVariant);
self::$adyenLogger->debug($message);
Expand Down
58 changes: 58 additions & 0 deletions Helper/PaymentMethods/TwintPaymentMethod.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
/**
*
* Adyen Payment Module
*
* Copyright (c) 2022 Adyen N.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Helper\PaymentMethods;

class TwintPaymentMethod implements PaymentMethodInterface
{
const TX_VARIANT = 'twint';
const NAME = 'TWINT';

public function getTxVariant(): string
{
return self::TX_VARIANT;
}

public function getPaymentMethodName(): string
{
return self::NAME;
}

public function supportsRecurring(): bool
{
return true;
}

public function supportsManualCapture(): bool
{
return true;
}

public function supportsAutoCapture(): bool
{
return true;
}

public function supportsCardOnFile(): bool
{
return false;
}

public function supportsSubscription(): bool
{
return true;
}

public function supportsUnscheduledCardOnFile(): bool
{
return true;
}
}
4 changes: 4 additions & 0 deletions Model/Config/Source/TokenizedPaymentMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public function toOptionArray()
'value' => PaymentMethods\SepaPaymentMethod::TX_VARIANT,
'label' => PaymentMethods\SepaPaymentMethod::NAME
],
[
'value' => PaymentMethods\TwintPaymentMethod::TX_VARIANT,
'label' => PaymentMethods\TwintPaymentMethod::NAME
]
];
}
}