diff --git a/Block/Widget/Button/Toolbar.php b/Block/Widget/Button/Toolbar.php
index ba4996afa..058ddb6f3 100644
--- a/Block/Widget/Button/Toolbar.php
+++ b/Block/Widget/Button/Toolbar.php
@@ -49,6 +49,7 @@ class Toolbar
'buckaroo_magento2_belfius',
'buckaroo_magento2_transfer',
'buckaroo_magento2_eps',
+ 'buckaroo_magento2_giropay',
'buckaroo_magento2_kbc',
'buckaroo_magento2_klarna',
'buckaroo_magento2_klarnakp',
diff --git a/Helper/Data.php b/Helper/Data.php
index 9683068b2..a620f52c0 100644
--- a/Helper/Data.php
+++ b/Helper/Data.php
@@ -433,6 +433,7 @@ public function getPaymentMethodsList()
['value' => 'emandate', 'label' => __('Digital Debit Authorization')],
['value' => 'eps', 'label' => __('EPS')],
['value' => 'giftcards', 'label' => __('Giftcards')],
+ ['value' => 'giropay', 'label' => __('Giropay')],
['value' => 'ideal', 'label' => __('iDEAL')],
['value' => 'idealprocessing', 'label' => __('iDEAL Processing')],
['value' => 'kbc', 'label' => __('KBC')],
diff --git a/Model/Config/Source/PaymentMethods/AfterExpiry.php b/Model/Config/Source/PaymentMethods/AfterExpiry.php
index ab15b983c..661e8016e 100644
--- a/Model/Config/Source/PaymentMethods/AfterExpiry.php
+++ b/Model/Config/Source/PaymentMethods/AfterExpiry.php
@@ -37,6 +37,7 @@ public function toOptionArray()
['value' => 'dankort', 'label' => __('Dankort')],
['value' => 'eps', 'label' => __('EPS')],
['value' => 'giftcard', 'label' => __('Giftcards')],
+ ['value' => 'giropay', 'label' => __('Giropay')],
['value' => 'ideal', 'label' => __('iDEAL')],
['value' => 'idealprocessing', 'label' => __('iDEAL Processing')],
['value' => 'maestro', 'label' => __('Maestro')],
diff --git a/Model/Config/Source/PaymentMethods/PayLink.php b/Model/Config/Source/PaymentMethods/PayLink.php
index 8c558c2be..7de64040d 100644
--- a/Model/Config/Source/PaymentMethods/PayLink.php
+++ b/Model/Config/Source/PaymentMethods/PayLink.php
@@ -38,6 +38,7 @@ public function toOptionArray()
['value' => 'dankort', 'label' => __('Dankort')],
['value' => 'eps', 'label' => __('EPS')],
['value' => 'giftcard', 'label' => __('Giftcards')],
+ ['value' => 'giropay', 'label' => __('Giropay')],
['value' => 'ideal', 'label' => __('iDEAL')],
['value' => 'idealprocessing', 'label' => __('iDEAL Processing')],
['value' => 'maestro', 'label' => __('Maestro')],
diff --git a/Model/Config/Source/PaymentMethods/PayPerEmail.php b/Model/Config/Source/PaymentMethods/PayPerEmail.php
index 8f65f5351..f191f7d0a 100644
--- a/Model/Config/Source/PaymentMethods/PayPerEmail.php
+++ b/Model/Config/Source/PaymentMethods/PayPerEmail.php
@@ -70,6 +70,11 @@ public function toOptionArray()
'label' => __('Giftcards'),
'code' => 'buckaroo_magento2_giftcards'
],
+ [
+ 'value' => 'giropay',
+ 'label' => __('Giropay'),
+ 'code' => 'buckaroo_magento2_giropay'
+ ],
[
'value' => 'ideal',
'label' => __('iDEAL'),
diff --git a/Model/ConfigProvider/Method/Giropay.php b/Model/ConfigProvider/Method/Giropay.php
new file mode 100644
index 000000000..7ebedd842
--- /dev/null
+++ b/Model/ConfigProvider/Method/Giropay.php
@@ -0,0 +1,81 @@
+getBuckarooPaymentFeeLabel(
+ \Buckaroo\Magento2\Model\Method\Giropay::PAYMENT_METHOD_CODE
+ );
+
+ return [
+ 'payment' => [
+ 'buckaroo' => [
+ 'giropay' => [
+ 'paymentFeeLabel' => $paymentFeeLabel,
+ 'subtext' => $this->getSubtext(),
+ 'subtext_style' => $this->getSubtextStyle(),
+ 'subtext_color' => $this->getSubtextColor(),
+ 'allowedCurrencies' => $this->getAllowedCurrencies(),
+ ],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * @param null|int $storeId
+ *
+ * @return float
+ */
+ public function getPaymentFee($storeId = null)
+ {
+ $paymentFee = $this->scopeConfig->getValue(
+ self::XPATH_GIROPAY_PAYMENT_FEE,
+ \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
+ $storeId
+ );
+
+ return $paymentFee ? $paymentFee : false;
+ }
+}
diff --git a/Model/ConfigProvider/Method/P24.php b/Model/ConfigProvider/Method/P24.php
index 483f2b092..c314be063 100644
--- a/Model/ConfigProvider/Method/P24.php
+++ b/Model/ConfigProvider/Method/P24.php
@@ -85,8 +85,7 @@ public function getPaymentFee($storeId = null)
public function getBaseAllowedCurrencies()
{
return [
- 'PLN',
- 'EUR'
+ 'PLN'
];
}
}
diff --git a/Model/Method/Giropay.php b/Model/Method/Giropay.php
new file mode 100644
index 000000000..69a7318ab
--- /dev/null
+++ b/Model/Method/Giropay.php
@@ -0,0 +1,109 @@
+transactionBuilderFactory->get('order');
+
+ $services = [
+ 'Name' => 'giropay',
+ 'Action' => 'Pay',
+ 'Version' => 2,
+ ];
+
+ /**
+ * @noinspection PhpUndefinedMethodInspection
+ */
+ $transactionBuilder->setOrder($payment->getOrder())
+ ->setServices($services)
+ ->setMethod('TransactionRequest');
+
+ return $transactionBuilder;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCaptureTransactionBuilder($payment)
+ {
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getAuthorizeTransactionBuilder($payment)
+ {
+ return false;
+ }
+
+ protected function getRefundTransactionBuilderVersion()
+ {
+ return 2;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getVoidTransactionBuilder($payment)
+ {
+ return true;
+ }
+
+ /**
+ * @param \Magento\Sales\Api\Data\OrderPaymentInterface|\Magento\Payment\Model\InfoInterface $payment
+ *
+ * @return bool|string
+ */
+ public function getPaymentMethodName($payment)
+ {
+ return $this->buckarooPaymentMethodCode;
+ }
+
+ protected function getRefundTransactionBuilderChannel()
+ {
+ return 'Web';
+ }
+}
diff --git a/Model/Service/Order.php b/Model/Service/Order.php
index 26912dc69..889dde04d 100644
--- a/Model/Service/Order.php
+++ b/Model/Service/Order.php
@@ -29,7 +29,6 @@
use Magento\Sales\Model\ResourceModel\Order\CollectionFactory;
use Buckaroo\Magento2\Helper\Data;
use Magento\Framework\App\ResourceConnection;
-use Laminas\Db\Sql\Expression;
class Order
{
@@ -44,17 +43,16 @@ class Order
private Factory $configProviderFactory;
public function __construct(
- Account $accountConfig,
- MethodFactory $configProviderMethodFactory,
- Factory $configProviderFactory,
+ Account $accountConfig,
+ MethodFactory $configProviderMethodFactory,
+ Factory $configProviderFactory,
StoreRepositoryInterface $storeRepository,
- CollectionFactory $orderFactory,
- OrderStatusFactory $orderStatusFactory,
- Data $helper,
- Log $logging,
- ResourceConnection $resourceConnection
- )
- {
+ CollectionFactory $orderFactory,
+ OrderStatusFactory $orderStatusFactory,
+ Data $helper,
+ Log $logging,
+ ResourceConnection $resourceConnection
+ ) {
$this->accountConfig = $accountConfig;
$this->configProviderMethodFactory = $configProviderMethodFactory;
$this->configProviderFactory = $configProviderFactory;
@@ -96,11 +94,11 @@ protected function cancelExpiredTransferOrdersPerStore($store)
)
->addFieldToFilter(
'created_at',
- ['lt' => new Expression('NOW() - INTERVAL ' . $dueDays . ' DAY')]
+ ['lt' => new \Zend_Db_Expr('NOW() - INTERVAL ' . $dueDays . ' DAY')]
)
->addFieldToFilter(
'created_at',
- ['gt' => new Expression('NOW() - INTERVAL ' . ($dueDays + 7) . ' DAY')]
+ ['gt' => new \Zend_Db_Expr('NOW() - INTERVAL ' . ($dueDays + 7) . ' DAY')]
);
$orderCollection->getSelect()
@@ -156,11 +154,11 @@ protected function cancelExpiredPPEOrdersPerStore($store)
)
->addFieldToFilter(
'created_at',
- ['lt' => new Expression('NOW() - INTERVAL ' . $dueDays . ' DAY')]
+ ['lt' => new \Zend_Db_Expr('NOW() - INTERVAL ' . $dueDays . ' DAY')]
)
->addFieldToFilter(
'created_at',
- ['gt' => new Expression('NOW() - INTERVAL ' . ($dueDays + 7) . ' DAY')]
+ ['gt' => new \Zend_Db_Expr('NOW() - INTERVAL ' . ($dueDays + 7) . ' DAY')]
);
$orderCollection->getSelect()
@@ -218,7 +216,7 @@ public function cancel($order, $statusCode)
$this->logging->addDebug(__METHOD__ . '|20|');
if (in_array($order->getPayment()->getMethodInstance()->buckarooPaymentMethodCode, ['klarnakp'])) {
- $methodInstanceClass = get_class($order->getPayment()->getMethodInstance());
+ $methodInstanceClass = get_class($order->getPayment()->getMethodInstance());
$methodInstanceClass::$requestOnVoid = false;
}
diff --git a/Test/Unit/Model/Config/Source/PaymentMethods/AfterExpiryTest.php b/Test/Unit/Model/Config/Source/PaymentMethods/AfterExpiryTest.php
index 5fb49443f..33bde4377 100644
--- a/Test/Unit/Model/Config/Source/PaymentMethods/AfterExpiryTest.php
+++ b/Test/Unit/Model/Config/Source/PaymentMethods/AfterExpiryTest.php
@@ -41,6 +41,9 @@ public function toOptionArrayProvider()
[
['value' => 'giftcard', 'label' => 'Giftcards']
],
+ [
+ ['value' => 'giropay', 'label' => 'Giropay']
+ ],
[
['value' => 'ideal', 'label' => 'iDEAL']
],
diff --git a/Test/Unit/Model/Config/Source/PaymentMethods/PayPerEmailTest.php b/Test/Unit/Model/Config/Source/PaymentMethods/PayPerEmailTest.php
index 2d3dd894f..b9964fd5a 100644
--- a/Test/Unit/Model/Config/Source/PaymentMethods/PayPerEmailTest.php
+++ b/Test/Unit/Model/Config/Source/PaymentMethods/PayPerEmailTest.php
@@ -44,6 +44,9 @@ public function toOptionArrayProvider()
[
['value' => 'giftcard', 'label' => 'Giftcards']
],
+ [
+ ['value' => 'giropay', 'label' => 'Giropay']
+ ],
[
['value' => 'ideal', 'label' => 'iDEAL']
],
diff --git a/Test/Unit/Model/ConfigProvider/Method/GiropayTest.php b/Test/Unit/Model/ConfigProvider/Method/GiropayTest.php
new file mode 100644
index 000000000..0e3325832
--- /dev/null
+++ b/Test/Unit/Model/ConfigProvider/Method/GiropayTest.php
@@ -0,0 +1,137 @@
+ [
+ [
+ 'payment' => [
+ 'buckaroo' => [
+ 'giropay' => [
+ 'paymentFeeLabel' => 'Fee',
+ 'allowedCurrencies' => ['EUR']
+ ]
+ ]
+ ]
+ ]
+ ]
+ ];
+ }
+
+ /**
+ * @param $expected
+ *
+ * @dataProvider getConfigProvider
+ */
+ public function testGetConfig($expected)
+ {
+ $scopeConfigMock = $this->getFakeMock(ScopeConfigInterface::class)
+ ->setMethods(['getValue'])
+ ->getMockForAbstractClass();
+ $scopeConfigMock->expects($this->atLeastOnce())
+ ->method('getValue')
+ ->withConsecutive(
+ [Giropay::XPATH_ALLOWED_CURRENCIES, ScopeInterface::SCOPE_STORE, null]
+ )
+ ->willReturnOnConsecutiveCalls('EUR');
+
+ $paymentFeeMock = $this->getFakeMock(PaymentFee::class)->setMethods(['getBuckarooPaymentFeeLabel'])->getMock();
+ $paymentFeeMock->method('getBuckarooPaymentFeeLabel')->with(GiropayMethod::PAYMENT_METHOD_CODE)->willReturn('Fee');
+
+ $instance = $this->getInstance(['scopeConfig' => $scopeConfigMock, 'paymentFeeHelper' => $paymentFeeMock]);
+ $result = $instance->getConfig();
+
+ $this->assertEquals($expected, $result);
+ }
+
+ public function getPaymentFeeProvider()
+ {
+ return [
+ 'null value' => [
+ null,
+ false
+ ],
+ 'false value' => [
+ false,
+ false
+ ],
+ 'empty int value' => [
+ 0,
+ false
+ ],
+ 'empty float value' => [
+ 0.00,
+ false
+ ],
+ 'empty string value' => [
+ '',
+ false
+ ],
+ 'int value' => [
+ 1,
+ 1
+ ],
+ 'float value' => [
+ 2.34,
+ 2.34
+ ],
+ 'string value' => [
+ '5.67',
+ 5.67
+ ],
+ ];
+ }
+
+ /**
+ * @param $value
+ * @param $expected
+ *
+ * @dataProvider getPaymentFeeProvider
+ */
+ public function testGetPaymentFee($value, $expected)
+ {
+ $scopeConfigMock = $this->getFakeMock(ScopeConfigInterface::class)
+ ->setMethods(['getValue'])
+ ->getMockForAbstractClass();
+ $scopeConfigMock->expects($this->once())
+ ->method('getValue')
+ ->with(Giropay::XPATH_GIROPAY_PAYMENT_FEE, ScopeInterface::SCOPE_STORE)
+ ->willReturn($value);
+
+ $instance = $this->getInstance(['scopeConfig' => $scopeConfigMock]);
+ $result = $instance->getPaymentFee();
+
+ $this->assertEquals($expected, $result);
+ }
+}
diff --git a/Test/Unit/Model/Method/GiropayTest.php b/Test/Unit/Model/Method/GiropayTest.php
new file mode 100644
index 000000000..34e5b533a
--- /dev/null
+++ b/Test/Unit/Model/Method/GiropayTest.php
@@ -0,0 +1,241 @@
+getObject(DataObject::class);
+ $data->setBuckarooSkipValidation(0);
+ $data->setAdditionalData([
+ 'customer_bic' => 'NL32INGB'
+ ]);
+
+ $infoInstanceMock = $this->getFakeMock(InfoInterface::class)
+ ->setMethods(['setAdditionalInformation'])
+ ->getMockForAbstractClass();
+ $infoInstanceMock->expects($this->exactly(2))->method('setAdditionalInformation')->withConsecutive(
+ ['buckaroo_skip_validation', 0],
+ ['customer_bic', 'NL32INGB']
+ );
+
+ $instance = $this->getInstance();
+ $instance->setData('info_instance', $infoInstanceMock);
+
+ $result = $instance->assignData($data);
+ $this->assertInstanceOf(Giropay::class, $result);
+ }
+
+ /**
+ * Test the getOrderTransactionBuilder method.
+ */
+ public function testGetOrderTransactionBuilder()
+ {
+ $fixture = [
+ 'customer_bic' => 'biccib',
+ 'order' => 'orderrr!',
+ ];
+
+ $paymentMock = $this->getFakeMock(Payment::class)
+ ->setMethods(['getOrder', 'getAdditionalInformation'])
+ ->getMock();
+ $paymentMock->expects($this->once())->method('getOrder')->willReturn($fixture['order']);
+ $paymentMock->expects($this->once())
+ ->method('getAdditionalInformation')
+ ->with('customer_bic')
+ ->willReturn($fixture['customer_bic']);
+
+ $orderMock =$this->getFakeMock(Order::class)->setMethods(['setOrder', 'setMethod', 'setServices'])->getMock();
+ $orderMock->expects($this->once())->method('setOrder')->with($fixture['order'])->willReturnSelf();
+ $orderMock->expects($this->once())->method('setMethod')->with('TransactionRequest')->willReturnSelf();
+ $orderMock->expects($this->once())->method('setServices')->willReturnCallback(
+ function ($services) use ($fixture, $orderMock) {
+ $this->assertEquals('giropay', $services['Name']);
+ $this->assertEquals($fixture['customer_bic'], $services['RequestParameter'][0]['_']);
+
+ return $orderMock;
+ }
+ );
+
+ $trxFactoryMock = $this->getFakeMock(TransactionBuilderFactory::class)->setMethods(['get'])->getMock();
+ $trxFactoryMock->expects($this->once())->method('get')->with('order')->willReturn($orderMock);
+
+ $infoInterface = $this->getFakeMock(InfoInterface::class)->getMockForAbstractClass();
+
+ $instance = $this->getInstance(['transactionBuilderFactory' => $trxFactoryMock]);
+ $instance->setData('info_instance', $infoInterface);
+
+ $this->assertEquals($orderMock, $instance->getOrderTransactionBuilder($paymentMock));
+ }
+
+ /**
+ * Test the getCaptureTransactionBuilder method.
+ */
+ public function testGetCaptureTransactionBuilder()
+ {
+ $instance = $this->getInstance();
+ $this->assertFalse($instance->getCaptureTransactionBuilder(''));
+ }
+
+ /**
+ * Test the getAuthorizeTransactionBuild method.
+ */
+ public function testGetAuthorizeTransactionBuilder()
+ {
+ $instance = $this->getInstance();
+ $this->assertFalse($instance->getAuthorizeTransactionBuilder(''));
+ }
+
+ /**
+ * Test the getRefundTransactionBuilder method.
+ */
+ public function testGetRefundTransactionBuilder()
+ {
+ $paymentMock = $this->getFakeMock(Payment::class)
+ ->setMethods(['getOrder', 'getAdditionalInformation'])
+ ->getMock();
+ $paymentMock->expects($this->once())->method('getOrder')->willReturn('orderr');
+ $paymentMock->expects($this->once())
+ ->method('getAdditionalInformation')
+ ->with(Giropay::BUCKAROO_ORIGINAL_TRANSACTION_KEY_KEY)
+ ->willReturn('getAdditionalInformation');
+
+ $trxFactoryMock = $this->getFakeMock(TransactionBuilderFactory::class)
+ ->setMethods(['get', 'setOrder', 'setMethod', 'setChannel', 'setOriginalTransactionKey', 'setServices'])
+ ->getMock();
+ $trxFactoryMock->expects($this->once())->method('get')->with('refund')->willReturnSelf();
+ $trxFactoryMock->expects($this->once())->method('setOrder')->with('orderr')->willReturnSelf();
+ $trxFactoryMock->expects($this->once())->method('setMethod')->with('TransactionRequest')->willReturnSelf();
+ $trxFactoryMock->expects($this->once())->method('setChannel')->with('CallCenter')->willReturnSelf();
+ $trxFactoryMock->expects($this->once())
+ ->method('setOriginalTransactionKey')
+ ->with('getAdditionalInformation')
+ ->willReturnSelf();
+ $trxFactoryMock->expects($this->once())->method('setServices')->willReturnCallback(
+ function ($services) use ($trxFactoryMock) {
+ $services['Name'] = 'giropay';
+ $services['Action'] = 'Refund';
+
+ return $trxFactoryMock;
+ }
+ );
+
+ $instance = $this->getInstance(['transactionBuilderFactory' => $trxFactoryMock]);
+
+ $this->assertEquals($trxFactoryMock, $instance->getRefundTransactionBuilder($paymentMock));
+ }
+
+ /**
+ * Test the getVoidTransactionBuild method.
+ */
+ public function testGetVoidTransactionBuilder()
+ {
+ $instance = $this->getInstance();
+ $this->assertTrue($instance->getVoidTransactionBuilder(''));
+ }
+
+ /**
+ * Test the validation method happy path.
+ */
+ public function testValidate()
+ {
+ $paymentInfoMock = $this->getFakeMock(InfoInterface::class)
+ ->setMethods(['getQuote', 'getBillingAddress', 'getCountryId', 'getAdditionalInformation'])
+ ->getMockForAbstractClass();
+ $paymentInfoMock->expects($this->once())->method('getQuote')->willReturnSelf();
+ $paymentInfoMock->expects($this->once())->method('getBillingAddress')->willReturnSelf();
+ $paymentInfoMock->expects($this->once())->method('getCountryId')->willReturn(4);
+ $paymentInfoMock->expects($this->exactly(2))
+ ->method('getAdditionalInformation')
+ ->withConsecutive(['buckaroo_skip_validation'], ['customer_bic'])
+ ->willReturnOnConsecutiveCalls(false, 'ABCDEF1E');
+
+ $instance = $this->getInstance();
+ $instance->setData('info_instance', $paymentInfoMock);
+ $result = $instance->validate();
+
+ $this->assertInstanceOf(Giropay::class, $result);
+ }
+
+ /**
+ * Test the validation method happy path.
+ */
+ public function testValidateInvalidBic()
+ {
+ $paymentInfoMock = $this->getFakeMock(InfoInterface::class)
+ ->setMethods(['getQuote', 'getBillingAddress', 'getCountryId', 'getAdditionalInformation'])
+ ->getMockForAbstractClass();
+ $paymentInfoMock->expects($this->once())->method('getQuote')->willReturnSelf();
+ $paymentInfoMock->expects($this->once())->method('getBillingAddress')->willReturnSelf();
+ $paymentInfoMock->expects($this->once())->method('getCountryId')->willReturn(4);
+ $paymentInfoMock->expects($this->exactly(2))
+ ->method('getAdditionalInformation')
+ ->withConsecutive(['buckaroo_skip_validation'], ['customer_bic'])
+ ->willReturnOnConsecutiveCalls(false, 'wrong');
+
+ $instance = $this->getInstance();
+ $instance->setData('info_instance', $paymentInfoMock);
+
+ try {
+ $instance->validate();
+ } catch (LocalizedException $e) {
+ $this->assertEquals('Please enter a valid BIC number', $e->getMessage());
+ }
+ }
+
+ /**
+ * Test the validation method happy path.
+ */
+ public function testValidateSkipValidation()
+ {
+ $paymentInfoMock = $this->getFakeMock(InfoInterface::class)
+ ->setMethods(['getQuote', 'getBillingAddress', 'getCountryId', 'getAdditionalInformation'])
+ ->getMockForAbstractClass();
+ $paymentInfoMock->expects($this->once())->method('getQuote')->willReturnSelf();
+ $paymentInfoMock->expects($this->once())->method('getBillingAddress')->willReturnSelf();
+ $paymentInfoMock->expects($this->once())->method('getCountryId')->willReturn(4);
+ $paymentInfoMock->expects($this->once())
+ ->method('getAdditionalInformation')
+ ->with('buckaroo_skip_validation')
+ ->willReturn(true);
+
+ $instance = $this->getInstance();
+ $instance->setData('info_instance', $paymentInfoMock);
+
+ $result = $instance->validate();
+
+ $this->assertInstanceOf(Giropay::class, $result);
+ }
+}
diff --git a/etc/adminhtml/system/payment_methods.xml b/etc/adminhtml/system/payment_methods.xml
index 3a80f1638..2aa07251a 100644
--- a/etc/adminhtml/system/payment_methods.xml
+++ b/etc/adminhtml/system/payment_methods.xml
@@ -66,6 +66,8 @@
+
+
diff --git a/etc/adminhtml/system/payment_methods/giropay.xml b/etc/adminhtml/system/payment_methods/giropay.xml
new file mode 100644
index 000000000..6ba00f4cb
--- /dev/null
+++ b/etc/adminhtml/system/payment_methods/giropay.xml
@@ -0,0 +1,177 @@
+
+
+
+
+
+
+ Buckaroo\Magento2\Block\Config\Form\Field\Fieldset
+
+
+
+
+ Buckaroo\Magento2\Model\Config\Source\Enablemode
+ payment/buckaroo_magento2_giropay/active
+
+
+
+
+
+ payment/buckaroo_magento2_giropay/title
+
+
+
+
+
+ payment/buckaroo_magento2_giropay/subtext
+
+
+
+
+
+ Buckaroo\Magento2\Model\Config\Source\SubtextStyle
+ payment/buckaroo_magento2_giropay/subtext_style
+
+
+
+
+
+ payment/buckaroo_magento2_giropay/subtext_color
+ Buckaroo\Magento2\Block\Config\Form\Field\ColorPicker
+
+
+
+
+
+
+ payment/buckaroo_magento2_giropay/sort_order
+
+
+
+
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ payment/buckaroo_magento2_giropay/order_email
+
+
+
+
+ Configuration > Sales > Tax.]]>
+ payment/buckaroo_magento2_giropay/payment_fee
+ Buckaroo\Magento2\Model\Config\Backend\PaymentFee
+
+
+
+
+
+ payment/buckaroo_magento2_giropay/payment_fee_label
+
+
+
+
+
+ The payment method shows only for orders with an order amount greater than the minimum amount.
+ payment/buckaroo_magento2_giropay/min_amount
+ Buckaroo\Magento2\Model\Config\Backend\Price
+
+
+
+
+
+ The payment method shows only for orders with an order amount smaller than the maximum amount.
+ payment/buckaroo_magento2_giropay/max_amount
+ Buckaroo\Magento2\Model\Config\Backend\Price
+
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ payment/buckaroo_magento2_giropay/active_status
+
+
+
+
+
+ To make a new status available it needs to be assigned to the correct state. See Magento documentation about state and status.
+ Buckaroo\Magento2\Model\Config\Source\StatusesSuccess
+ payment/buckaroo_magento2_giropay/order_status_success
+
+ 1
+
+
+
+
+
+
+ To make a new status available it needs to be assigned to the correct state. See Magento documentation about state and status.
+ Buckaroo\Magento2\Model\Config\Source\StatusesFailed
+ payment/buckaroo_magento2_giropay/order_status_failed
+
+ 1
+
+
+
+
+
+
+ Your contract with Buckaroo must allow for the selected currencies to be used with this payment method.
+ payment/buckaroo_magento2_giropay/allowed_currencies
+ Buckaroo\Magento2\Model\Config\Source\AllowedCurrencies::giropay
+ Buckaroo\Magento2\Model\Config\Backend\AllowedCurrencies
+
+
+
+
+ Buckaroo\Magento2\Model\Config\Source\AllOrSpecificCountries
+ payment/buckaroo_magento2_giropay/allowspecific
+
+
+
+
+
+ Magento\Config\Model\Config\Source\Locale\Country
+ payment/buckaroo_magento2_giropay/specificcountry
+
+ 1
+
+
+
+
+
+
+ Magento developer client restrictions.
+ Magento\Config\Model\Config\Source\Yesno
+ payment/buckaroo_magento2_giropay/limit_by_ip
+
+
+
+
+ Buckaroo\Magento2\Model\Config\Source\SpecificCustomerGroups
+ 1
+ payment/buckaroo_magento2_giropay/specificcustomergroup
+
+
+
+
diff --git a/etc/config.xml b/etc/config.xml
index d95dba683..320d22a16 100644
--- a/etc/config.xml
+++ b/etc/config.xml
@@ -95,7 +95,7 @@
buckaroo_magento2
order
0
- amex,bancontactmrcash,cartebancaire,cartebleuevisa,nexi,postepay,dankort,eps,giftcard,ideal,mastercard,paypal,sofortueberweisung,transfer,visa,maestro,visaelectron,vpay,alipay,wechatpay,p24,trustly,belfius,blik
+ amex,bancontactmrcash,cartebancaire,cartebleuevisa,nexi,postepay,dankort,eps,giftcard,giropay,ideal,mastercard,paypal,sofortueberweisung,transfer,visa,maestro,visaelectron,vpay,alipay,wechatpay,p24,trustly,belfius,blik
@@ -182,9 +182,23 @@
buckaroo_magento2
order
1
- amex,bancontactmrcash,cartebancaire,cartebleuevisa,nexi,postepay,dankort,eps,giftcard,ideal,mastercard,paypal,sofortueberweisung,transfer,visa,maestro,visaelectron,vpay,alipay,wechatpay,p24,trustly,belfius,blik
+ amex,bancontactmrcash,cartebancaire,cartebleuevisa,nexi,postepay,dankort,eps,giftcard,giropay,ideal,mastercard,paypal,sofortueberweisung,transfer,visa,maestro,visaelectron,vpay,alipay,wechatpay,p24,trustly,belfius,blik
+
+ 0
+ Buckaroo\Magento2\Model\Method\Giropay
+ pending
+ Giropay
+ 0
+ 160
+ 1
+ Fee
+ buckaroo_magento2
+ order
+ 0
+
+
0
Buckaroo\Magento2\Model\Method\Mrcash
@@ -276,8 +290,8 @@
1
1
1
- amex,bancontactmrcash,cartebancaire,cartebleuevisa,nexi,postepay,dankort,eps,sepadirectdebit,giftcard,ideal,mastercard,paypal,sofortueberweisung,transfer,visa,maestro,visaelectron,vpay,alipay,wechatpay,p24,trustly,belfius,blik
- amex,bancontactmrcash,cartebancaire,cartebleuevisa,nexi,postepay,dankort,eps,giftcard,ideal,mastercard,paypal,sofortueberweisung,transfer,visa,maestro,visaelectron,vpay,alipay,wechatpay,p24,trustly,belfius,blik
+ amex,bancontactmrcash,cartebancaire,cartebleuevisa,nexi,postepay,dankort,eps,sepadirectdebit,giftcard,giropay,ideal,mastercard,paypal,sofortueberweisung,transfer,visa,maestro,visaelectron,vpay,alipay,wechatpay,p24,trustly,belfius,blik
+ amex,bancontactmrcash,cartebancaire,cartebleuevisa,nexi,postepay,dankort,eps,giftcard,giropay,ideal,mastercard,paypal,sofortueberweisung,transfer,visa,maestro,visaelectron,vpay,alipay,wechatpay,p24,trustly,belfius,blik
7
1
diff --git a/etc/di.xml b/etc/di.xml
index 75c61345c..89cf99a36 100644
--- a/etc/di.xml
+++ b/etc/di.xml
@@ -249,6 +249,10 @@
- creditcards
- Buckaroo\Magento2\Model\ConfigProvider\Method\Creditcards
+ -
+
- giropay
+ - Buckaroo\Magento2\Model\ConfigProvider\Method\Giropay
+
-
- mrcash
- Buckaroo\Magento2\Model\ConfigProvider\Method\Mrcash
diff --git a/etc/frontend/di.xml b/etc/frontend/di.xml
index d217359d4..6bd197d3b 100644
--- a/etc/frontend/di.xml
+++ b/etc/frontend/di.xml
@@ -36,6 +36,7 @@
- Buckaroo\Magento2\Model\ConfigProvider\Method\Mrcash
- Buckaroo\Magento2\Model\ConfigProvider\Method\Sofortbanking
- Buckaroo\Magento2\Model\ConfigProvider\Method\Belfius
+ - Buckaroo\Magento2\Model\ConfigProvider\Method\Giropay
- Buckaroo\Magento2\Model\ConfigProvider\Method\Afterpay
- Buckaroo\Magento2\Model\ConfigProvider\Method\Afterpay2
- Buckaroo\Magento2\Model\ConfigProvider\Method\PayPerEmail
diff --git a/etc/payment.xml b/etc/payment.xml
index 93dffa21d..80e06896c 100644
--- a/etc/payment.xml
+++ b/etc/payment.xml
@@ -51,6 +51,9 @@
0
+
+ 0
+
0
diff --git a/i18n/de_DE.csv b/i18n/de_DE.csv
index 42f141d39..e13182196 100644
--- a/i18n/de_DE.csv
+++ b/i18n/de_DE.csv
@@ -97,6 +97,8 @@
"Enable Przelewy24","Przelewy24 activieren"
"Trustly","Trustly"
"Enable Trustly","Trustly activieren"
+"Giropay","Giropay"
+"Enable Giropay","Giropay activieren"
"Refunding","Erstattung"
"Enable or disable refunding.","Gutschrift/Rückerstattung aktivieren oder deaktivieren."
"Set to 'No' refunds must be done manualy in Payment Plaza.","Mit der Auswahl 'Nein' werden Gutschriften in Magento bei Payment Plaza nicht angeboten."
diff --git a/i18n/es_ES.csv b/i18n/es_ES.csv
index 25943735f..37a3d4c79 100644
--- a/i18n/es_ES.csv
+++ b/i18n/es_ES.csv
@@ -99,6 +99,8 @@
"Enable Trustly","Activar Trustly"
"Request To Pay","Request To Pay"
"Enable Request To Pay","Activar Request To Pay"
+"Giropay","Giropay"
+"Enable Giropay","Activar Giropay"
"Refunding","Reembolso"
"Enable or disable refunding.","Activar o desactivar el reembolso."
"Set to 'No' refunds must be done manualy in Payment Plaza.","Elegir 'No' para 'los reembolsos se deben realizar manualmente en Payment Plaza'."
diff --git a/i18n/fr_FR.csv b/i18n/fr_FR.csv
index 76b72f06a..08d54046d 100644
--- a/i18n/fr_FR.csv
+++ b/i18n/fr_FR.csv
@@ -97,6 +97,8 @@
"Enable Przelewy24","Activer Przelewy24"
"Trustly","Trustly"
"Enable Trustly","Activer Trustly"
+"Giropay","Giropay"
+"Enable Giropay","Activer Giropay"
"Refunding","Remboursement"
"Enable or disable refunding.","Activer ou désactiver le remboursement"
"Set to 'No' refunds must be done manualy in Payment Plaza.","Défini sur "Non", les remboursements doivent être effectués manuellement dans Payment Plaza."
diff --git a/i18n/nl_BE.csv b/i18n/nl_BE.csv
index bd82c60ab..598df015d 100644
--- a/i18n/nl_BE.csv
+++ b/i18n/nl_BE.csv
@@ -97,6 +97,8 @@
"Enable Przelewy24","Przelewy24 inschakelen"
"Trustly","Trustly"
"Enable Trustly","Trustly inschakelen"
+"Giropay","Giropay"
+"Enable Giropay","Giropay inschakelen"
"Refunding","Terugbetaling"
"Enable or disable refunding.","Schakel de creditering/terugstorten in of uit."
"Set to 'No' refunds must be done manualy in Payment Plaza.","Bij de selectie 'Nee' worden credit memo's in Magento niet aangeboden bij Payment Plaza."
diff --git a/i18n/nl_NL.csv b/i18n/nl_NL.csv
index 65b8ee68f..0eba9f0e5 100644
--- a/i18n/nl_NL.csv
+++ b/i18n/nl_NL.csv
@@ -99,6 +99,8 @@
"Enable Przelewy24","Przelewy24 inschakelen"
"Trustly","Trustly"
"Enable Trustly","Trustly inschakelen"
+"Giropay","Giropay"
+"Enable Giropay","Giropay inschakelen"
"Blik","Blik"
"Enable Blik","Blik inschakelen"
"Refunding","Terugbetaling"
diff --git a/view/frontend/layout/checkout_index_index.xml b/view/frontend/layout/checkout_index_index.xml
index 65c9c43d4..cb37f60ee 100644
--- a/view/frontend/layout/checkout_index_index.xml
+++ b/view/frontend/layout/checkout_index_index.xml
@@ -122,6 +122,9 @@
-
- true
+ -
+
- true
+
-
- true
diff --git a/view/frontend/web/css/styles.css b/view/frontend/web/css/styles.css
index e3c2cd600..7afb0da75 100644
--- a/view/frontend/web/css/styles.css
+++ b/view/frontend/web/css/styles.css
@@ -133,15 +133,15 @@
margin-top: 20px;
}
-.payment-method-second-col input::placeholder {
+.payment-method-second-col input::placeholder {
color: #c0c0c0;
- opacity: 1;
+ opacity: 1;
}
-
+
.payment-method-second-col input:-ms-input-placeholder {
color: #c0c0c0;
}
-
+
.payment-method-second-col input::-ms-input-placeholder {
color: #c0c0c0;
}
@@ -173,6 +173,7 @@
.buckaroo_magento2_afterpay20 .payment-method-second-col,
.buckaroo_magento2_billink .payment-method-second-col,
.buckaroo_magento2_sepadirectdebit .payment-method-second-col,
+ .buckaroo_magento2_giropay .payment-method-second-col,
.buckaroo_magento2_payperemail .payment-method-second-col,
.buckaroo_magento2_klarna .payment-method-second-col,
.buckaroo_magento2_klarnakp .payment-method-second-col,
@@ -204,6 +205,7 @@
.buckaroo_magento2_afterpay20 .payment-method-billing-address,
.buckaroo_magento2_billink .payment-method-billing-address,
.buckaroo_magento2_sepadirectdebit .payment-method-billing-address,
+ .buckaroo_magento2_giropay .payment-method-billing-address,
.buckaroo_magento2_payperemail .payment-method-billing-address,
.buckaroo_magento2_klarna .payment-method-billing-address,
.buckaroo_magento2_klarnakp .payment-method-billing-address,
@@ -239,6 +241,7 @@
.magento-blank .buckaroo_magento2_afterpay20 .fieldset > .field:not(.choice) > .label,
.magento-blank .buckaroo_magento2_billink .fieldset > .field:not(.choice) > .label,
.magento-blank .buckaroo_magento2_sepadirectdebit .fieldset > .field:not(.choice) > .label,
+ .magento-blank .buckaroo_magento2_giropay .fieldset > .field:not(.choice) > .label,
.magento-blank .buckaroo_magento2_payperemail .fieldset > .field:not(.choice) > .label,
.magento-blank .buckaroo_magento2_klarna .fieldset > .field:not(.choice) > .label,
.magento-blank .buckaroo_magento2_klarnakp .fieldset > .field:not(.choice) > .label,
@@ -265,6 +268,7 @@
.magento-blank .buckaroo_magento2_afterpay20 .fieldset > .field:not(.choice) > .control,
.magento-blank .buckaroo_magento2_billink .fieldset > .field:not(.choice) > .control,
.magento-blank .buckaroo_magento2_sepadirectdebit .fieldset > .field:not(.choice) > .control,
+ .magento-blank .buckaroo_magento2_giropay .fieldset > .field:not(.choice) > .control,
.magento-blank .buckaroo_magento2_payperemail .fieldset > .field:not(.choice) > .control,
.magento-blank .buckaroo_magento2_klarna .fieldset > .field:not(.choice) > .control,
.magento-blank .buckaroo_magento2_klarnakp .fieldset > .field:not(.choice) > .control,
@@ -289,6 +293,7 @@
.magento-blank .buckaroo_magento2_afterpay20 .fieldset > .field.choice:before,
.magento-blank .buckaroo_magento2_billink .fieldset > .field.choice:before,
.magento-blank .buckaroo_magento2_sepadirectdebit .fieldset > .field.choice:before,
+ .magento-blank .buckaroo_magento2_giropay .fieldset > .field.choice:before,
.magento-blank .buckaroo_magento2_payperemail .fieldset > .field.choice:before,
.magento-blank .buckaroo_magento2_klarna .fieldset > .field.choice:before,
.magento-blank .buckaroo_magento2_klarnakp .fieldset > .field.choice:before,
@@ -638,4 +643,4 @@
.fieldset > .field .addon .bk-paybybank-selector .bank-method-input {
display:none;
}
-}
+}
\ No newline at end of file
diff --git a/view/frontend/web/js/view/payment/buckaroo-payments.js b/view/frontend/web/js/view/payment/buckaroo-payments.js
index b574b68b1..efa1abc6a 100644
--- a/view/frontend/web/js/view/payment/buckaroo-payments.js
+++ b/view/frontend/web/js/view/payment/buckaroo-payments.js
@@ -93,6 +93,10 @@ define(
type: 'buckaroo_magento2_transfer',
component: 'Buckaroo_Magento2/js/view/payment/method-renderer/transfer'
},
+ {
+ type: 'buckaroo_magento2_giropay',
+ component: 'Buckaroo_Magento2/js/view/payment/method-renderer/giropay'
+ },
{
type: 'buckaroo_magento2_mrcash',
component: 'Buckaroo_Magento2/js/view/payment/method-renderer/mrcash'
diff --git a/view/frontend/web/js/view/payment/method-renderer/giftcards.js b/view/frontend/web/js/view/payment/method-renderer/giftcards.js
index ced797fd1..fe87d5dcf 100644
--- a/view/frontend/web/js/view/payment/method-renderer/giftcards.js
+++ b/view/frontend/web/js/view/payment/method-renderer/giftcards.js
@@ -66,7 +66,7 @@ define(
}
function checkPayments(){
- var p = ["billink","klarnakp","capayableinstallments","sofortbanking","transfer","sepadirectdebit","capayablein3","creditcard","mrcash","payperemail","emandate"];
+ var p = ["billink","klarnakp","capayableinstallments","sofortbanking","giropay","transfer","sepadirectdebit","capayablein3","creditcard","mrcash","payperemail","emandate"];
p.forEach(function(item) {
$('.buckaroo_magento2_'+item).remove();
});
diff --git a/view/frontend/web/js/view/payment/method-renderer/giropay.js b/view/frontend/web/js/view/payment/method-renderer/giropay.js
new file mode 100644
index 000000000..cb2804922
--- /dev/null
+++ b/view/frontend/web/js/view/payment/method-renderer/giropay.js
@@ -0,0 +1,121 @@
+/**
+ * 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 support@buckaroo.nl 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 support@buckaroo.nl for more information.
+ *
+ * @copyright Copyright (c) Buckaroo B.V.
+ * @license https://tldrlegal.com/license/mit-license
+ */
+/*browser:true*/
+/*global define*/
+define(
+ [
+ 'jquery',
+ 'Magento_Checkout/js/view/payment/default',
+ 'Magento_Checkout/js/model/payment/additional-validators',
+ 'Buckaroo_Magento2/js/action/place-order',
+ 'ko',
+ 'Magento_Checkout/js/checkout-data',
+ 'Magento_Checkout/js/action/select-payment-method',
+ 'buckaroo/checkout/common'
+ ],
+ function (
+ $,
+ Component,
+ additionalValidators,
+ placeOrderAction,
+ ko,
+ checkoutData,
+ selectPaymentMethodAction,
+ checkoutCommon
+ ) {
+ 'use strict';
+
+ return Component.extend(
+ {
+ defaults: {
+ template: 'Buckaroo_Magento2/payment/buckaroo_magento2_giropay'
+ },
+ paymentFeeLabel : window.checkoutConfig.payment.buckaroo.giropay.paymentFeeLabel,
+ subtext : window.checkoutConfig.payment.buckaroo.giropay.subtext,
+ subTextStyle : checkoutCommon.getSubtextStyle('giropay'),
+ currencyCode : window.checkoutConfig.quoteData.quote_currency_code,
+ baseCurrencyCode : window.checkoutConfig.quoteData.base_currency_code,
+
+ /**
+ * @override
+ */
+ initialize : function (options) {
+ if (checkoutData.getSelectedPaymentMethod() == options.index) {
+ window.checkoutConfig.buckarooFee.title(this.paymentFeeLabel);
+ }
+
+ return this._super(options);
+ },
+
+ /**
+ * Place order.
+ *
+ * placeOrderAction has been changed from Magento_Checkout/js/action/place-order to our own version
+ * (Buckaroo_Magento2/js/action/place-order) to prevent redirect and handle the response.
+ */
+ placeOrder: function (data, event) {
+ var self = this,
+ placeOrder;
+
+ if (event) {
+ event.preventDefault();
+ }
+
+ if (this.validate() && additionalValidators.validate()) {
+ this.isPlaceOrderActionAllowed(false);
+ placeOrder = placeOrderAction(this.getData(), this.redirectAfterPlaceOrder, this.messageContainer);
+
+ $.when(placeOrder).fail(
+ function () {
+ self.isPlaceOrderActionAllowed(true);
+ }
+ ).done(this.afterPlaceOrder.bind(this));
+ return true;
+ }
+ return false;
+ },
+
+ afterPlaceOrder: function () {
+ var response = window.checkoutConfig.payment.buckaroo.response;
+ checkoutCommon.redirectHandle(response);
+ },
+
+ selectPaymentMethod: function () {
+ window.checkoutConfig.buckarooFee.title(this.paymentFeeLabel);
+
+ selectPaymentMethodAction(this.getData());
+ checkoutData.setSelectedPaymentMethod(this.item.method);
+ return true;
+ },
+
+ payWithBaseCurrency: function () {
+ var allowedCurrencies = window.checkoutConfig.payment.buckaroo.giropay.allowedCurrencies;
+
+ return allowedCurrencies.indexOf(this.currencyCode) < 0;
+ },
+
+ getPayWithBaseCurrencyText: function () {
+ var text = $.mage.__('The transaction will be processed using %s.');
+
+ return text.replace('%s', this.baseCurrencyCode);
+ }
+ }
+ );
+ }
+);
diff --git a/view/frontend/web/template/payment/buckaroo_magento2_giropay.html b/view/frontend/web/template/payment/buckaroo_magento2_giropay.html
new file mode 100644
index 000000000..8b71e76b2
--- /dev/null
+++ b/view/frontend/web/template/payment/buckaroo_magento2_giropay.html
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+