Skip to content

Commit

Permalink
Merge pull request #132 from paynl/feature/PLUG-381
Browse files Browse the repository at this point in the history
Added Trustly
  • Loading branch information
woutse authored Apr 1, 2021
2 parents 2a7c420 + 4d9344d commit 616252f
Show file tree
Hide file tree
Showing 10 changed files with 205 additions and 1 deletion.
12 changes: 12 additions & 0 deletions Model/Config/Source/Available/Trustly.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
/**
* Copyright © 2020 PAY. All rights reserved.
*/

namespace Paynl\Payment\Model\Config\Source\Available;


class Trustly extends Available
{
protected $_class = \Paynl\Payment\Model\Paymentmethod\Trustly::class;
}
1 change: 1 addition & 0 deletions Model/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class ConfigProvider implements ConfigProviderInterface
'paynl_payment_spraypay',
'paynl_payment_telefonischbetalen',
'paynl_payment_tikkie',
'paynl_payment_trustly',
'paynl_payment_visamastercard',
'paynl_payment_vvvgiftcard',
'paynl_payment_webshopgiftcard',
Expand Down
20 changes: 20 additions & 0 deletions Model/Paymentmethod/Trustly.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* Copyright © 2020 PAY. All rights reserved.
*/

namespace Paynl\Payment\Model\Paymentmethod;

/**
* Class Trustly
* @package Paynl\Payment\Model\Paymentmethod
*/
class Trustly extends PaymentMethod
{
protected $_code = 'paynl_payment_trustly';

protected function getDefaultPaymentOptionId()
{
return 2718;
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ MyBank | Carte Bancaire | Podium Cadeaukaart | Capayable Achteraf Betalen | Cash
SOFORT | PostePay | Gezondheidsbon | in3 keer betalen, 0% rente | Pay Fixed Price (phone) |
Maestro | Dankort | Fashion Giftcard | Klarna | Instore Payments (POS) |
Bank Transfer | Cartasi | GivaCard | SprayPay | Przelewy24 |
| Tikkie | De Cadeaukaart | YourGift | Creditclick | Apple Pay |
Trustly | Tikkie | De Cadeaukaart | YourGift | Creditclick | Apple Pay |
| Multibanco | | Paysafecard | | Payconiq
| | | Huis en Tuin Cadeau
| | | Good4Fun
Expand Down
1 change: 1 addition & 0 deletions etc/adminhtml/paymentmethods.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<include path="Paynl_Payment::paymentmethods/spraypay.xml" />
<include path="Paynl_Payment::paymentmethods/telefonischbetalen.xml" />
<include path="Paynl_Payment::paymentmethods/tikkie.xml" />
<include path="Paynl_Payment::paymentmethods/trustly.xml" />
<include path="Paynl_Payment::paymentmethods/visamastercard.xml" />
<include path="Paynl_Payment::paymentmethods/vvvgiftcard.xml" />
<include path="Paynl_Payment::paymentmethods/webshopgiftcard.xml" />
Expand Down
151 changes: 151 additions & 0 deletions etc/adminhtml/paymentmethods/trustly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8"?>
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
<group id="paynl_payment_trustly" sortOrder="2051" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Trustly</label>
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Enabled</label>
<source_model>Paynl\Payment\Model\Config\Source\Available\Trustly</source_model>
<config_path>payment/paynl_payment_trustly/active</config_path>
</field>
<field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Title</label>
<config_path>payment/paynl_payment_trustly/title</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="order_status" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>New Order Status</label>
<source_model>Paynl\Payment\Model\Config\Source\Order\Status\PendingPayment</source_model>
<depends>
<field id="active">1</field>
</depends>
<config_path>payment/paynl_payment_trustly/order_status</config_path>
</field>
<field id="order_status_authorized" translate="label" type="select" sortOrder="32" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Authorized Order Status</label>
<source_model>Paynl\Payment\Model\Config\Source\Order\Status\Processing</source_model>
<depends>
<field id="active">1</field>
</depends>
<config_path>payment/paynl_payment_trustly/order_status_authorized</config_path>
</field>
<field id="order_status_processing" translate="label" type="select" sortOrder="35" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Paid Order Status</label>
<source_model>Paynl\Payment\Model\Config\Source\Order\Status\Processing</source_model>
<depends>
<field id="active">1</field>
</depends>
<config_path>payment/paynl_payment_trustly/order_status_processing</config_path>
</field>
<field id="holded" translate="label" type="select" sortOrder="35" showInDefault="1"
showInWebsite="1"
showInStore="1">
<label>Set order on-hold</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/paynl_payment_trustly/holded</config_path>
<depends>
<field id="active">1</field>
</depends>
<comment><![CDATA[Set the orderstatus to on-hold when payment begins (to hold stock).]]></comment>
</field>
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="40" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Payment from Applicable Countries</label>
<source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model>
<config_path>payment/paynl_payment_trustly/allowspecific</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="specificcountry" translate="label" type="multiselect" sortOrder="50" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Payment from Specific Countries</label>
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
<can_be_empty>1</can_be_empty>
<config_path>payment/paynl_payment_trustly/specificcountry</config_path>
<depends>
<field id="allowspecific">1</field>
<field id="active">1</field>
</depends>
</field>
<field id="instructions" translate="label" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Instructions</label>
<depends>
<field id="active">1</field>
</depends>
<config_path>payment/paynl_payment_trustly/instructions</config_path>
</field>
<field id="min_order_total" translate="label" type="text" sortOrder="70" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Minimum Order Total</label>
<config_path>payment/paynl_payment_trustly/min_order_total</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="max_order_total" translate="label" type="text" sortOrder="80" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Maximum Order Total</label>
<config_path>payment/paynl_payment_trustly/max_order_total</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="sort_order" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Sort Order</label>
<frontend_class>validate-number</frontend_class>
<config_path>payment/paynl_payment_trustly/sort_order</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="send_new_order_email" translate="label" type="select" sortOrder="100" showInDefault="1"
showInWebsite="1"
showInStore="1">
<label>Send new order email</label>
<source_model>Paynl\Payment\Model\Config\Source\SendNewOrderEmail</source_model>
<config_path>payment/paynl_payment_trustly/send_new_order_email</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="disallowedshipping" translate="label" type="multiselect" sortOrder="110" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Disallowed Shipping Methods</label>
<source_model>Magento\Shipping\Model\Config\Source\Allmethods</source_model>
<can_be_empty>1</can_be_empty>
<depends>
<field id="active">1</field>
</depends>
<config_path>payment/paynl_payment_trustly/disallowedshipping</config_path>
<comment><![CDATA[Hold CTRL button to select/deselect multiple]]></comment>
</field>
<field id="showforcompany" translate="label" type="select" sortOrder="150" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Show for companies</label>
<source_model>Paynl\Payment\Model\Config\Source\showCompanyOptions</source_model>
<depends>
<field id="active">1</field>
</depends>
<config_path>payment/paynl_payment_trustly/showforcompany</config_path>
<comment><![CDATA[Allow payment method to be used for companies, private, or both.]]></comment>
</field>
<group id="advanced" translate="label" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Advanced</label>
<field id="payment_option_id" translate="label comment" type="text" sortOrder="10" showInDefault="1"
showInWebsite="1"
showInStore="1">
<label>Payment option id</label>
<comment>The id of the payment method, only change this if you are told to do so</comment>
<config_path>payment/paynl_payment_trustly/payment_option_id</config_path>
</field>
</group>
</group>
</include>

12 changes: 12 additions & 0 deletions etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,18 @@ In order to pay for your order click the link below
<group>paynl_payment</group>
<send_new_order_email>after_payment</send_new_order_email>
</paynl_payment_tikkie>
<paynl_payment_trustly>
<active>0</active>
<title>Trustly</title>
<payment_option_id>2718</payment_option_id>
<order_status>pending_payment</order_status>
<order_status_authorized>processing</order_status_authorized>
<order_status_processing>processing</order_status_processing>
<payment_action>order</payment_action>
<model>Paynl\Payment\Model\Paymentmethod\Trustly</model>
<group>paynl_payment</group>
<send_new_order_email>after_payment</send_new_order_email>
</paynl_payment_trustly>
<paynl_payment_visamastercard>
<active>0</active>
<title>Visa / Mastercard</title>
Expand Down
3 changes: 3 additions & 0 deletions etc/payment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@
<method name="paynl_payment_tikkie">
<allow_multiple_address>0</allow_multiple_address>
</method>
<method name="paynl_payment_trustly">
<allow_multiple_address>0</allow_multiple_address>
</method>
<method name="paynl_payment_visamastercard">
<allow_multiple_address>0</allow_multiple_address>
</method>
Expand Down
3 changes: 3 additions & 0 deletions view/frontend/layout/checkout_index_index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@
<item name="paynl_payment_tikkie" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
<item name="paynl_payment_trustly" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
<item name="paynl_payment_visamastercard" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
Expand Down
1 change: 1 addition & 0 deletions view/frontend/web/js/view/payment/method-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ define(
{type: 'paynl_payment_spraypay', component: defaultComponent},
{type: 'paynl_payment_telefonischbetalen', component: defaultComponent},
{type: 'paynl_payment_tikkie', component: defaultComponent},
{type: 'paynl_payment_trustly', component: defaultComponent},
{type: 'paynl_payment_visamastercard', component: defaultComponent},
{type: 'paynl_payment_vvvgiftcard', component: defaultComponent},
{type: 'paynl_payment_webshopgiftcard', component: defaultComponent},
Expand Down

0 comments on commit 616252f

Please sign in to comment.