Skip to content

Commit

Permalink
Merge pull request #85 from paynl/feature/PLUG-1539
Browse files Browse the repository at this point in the history
feature/PLUG-1539 - Add sodexo, monizze and pronto wonen
  • Loading branch information
woutse authored Nov 28, 2022
2 parents 9b6b23a + 6e429df commit 751db9d
Show file tree
Hide file tree
Showing 17 changed files with 545 additions and 11 deletions.
31 changes: 20 additions & 11 deletions Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
*/
class Config
{
const FINISH_PAY = 'paynl/order/finish';
const PENDING_PAY = 'paynl/order/pending';
const CANCEL_PAY = 'paynl/order/cancel';
const FINISH_STANDARD = 'checkout/onepage/success';
const ORDERSTATUS_PAID = 100;
const ORDERSTATUS_PENDING = 50;
const ORDERSTATUS_DENIED = -63;
const ORDERSTATUS_CANCELED = -90;
public const FINISH_PAY = 'paynl/order/finish';
public const PENDING_PAY = 'paynl/order/pending';
public const CANCEL_PAY = 'paynl/order/cancel';
public const FINISH_STANDARD = 'checkout/onepage/success';
public const ORDERSTATUS_PAID = 100;
public const ORDERSTATUS_PENDING = 50;
public const ORDERSTATUS_DENIED = -63;
public const ORDERSTATUS_CANCELED = -90;

/** @var Store */
private $store;
Expand Down Expand Up @@ -66,6 +66,7 @@ class Config
"paynl_payment_klarnakp" => "15",
"paynl_payment_maestro" => "33",
"paynl_payment_mistercash" => "2",
"paynl_payment_monizze" => "183",
"paynl_payment_multibanco" => "141",
"paynl_payment_mybank" => "5",
"paynl_payment_nexi" => "76",
Expand All @@ -77,7 +78,9 @@ class Config
"paynl_payment_podiumcadeaukaart" => "29",
"paynl_payment_postepay" => "10",
"paynl_payment_przelewy24" => "93",
"paynl_payment_prontowonen" => "270",
"paynl_payment_shoesandsneakers" => "2937",
"paynl_payment_sodexo" => "186",
"paynl_payment_sofortbanking" => "4",
"paynl_payment_sofortbanking_hr" => "4",
"paynl_payment_sofortbanking_ds" => "4",
Expand Down Expand Up @@ -157,9 +160,14 @@ public function isTestMode()

$ipconfig = $this->store->getConfig('payment/paynl/testipaddress');

if(!empty($ipconfig)) {
if (!empty($ipconfig)) {
$allowed_ips = explode(',', $ipconfig);
if (in_array($ip, $allowed_ips) && filter_var($ip, FILTER_VALIDATE_IP) && strlen($ip) > 0 && count($allowed_ips) > 0) {
if (
in_array($ip, $allowed_ips) &&
filter_var($ip, FILTER_VALIDATE_IP) &&
strlen($ip) > 0 &&
count($allowed_ips) > 0
) {
return true;
}
}
Expand Down Expand Up @@ -228,7 +236,8 @@ public function ignoreB2BInvoice($methodCode)
*/
public function ignoreManualCapture()
{
return $this->store->getConfig('payment/paynl/auto_capture') != 0 && $this->store->getConfig('payment/paynl/auto_capture') != 1;
return $this->store->getConfig('payment/paynl/auto_capture') != 0
&& $this->store->getConfig('payment/paynl/auto_capture') != 1;
}

public function autoCaptureEnabled()
Expand Down
8 changes: 8 additions & 0 deletions Model/Config/Source/Available/Monizze.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

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

class Monizze extends Available
{
protected $_class = \Paynl\Payment\Model\Paymentmethod\Monizze::class;
}
8 changes: 8 additions & 0 deletions Model/Config/Source/Available/Prontowonen.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

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

class Prontowonen extends Available
{
protected $_class = \Paynl\Payment\Model\Paymentmethod\Prontowonen::class;
}
8 changes: 8 additions & 0 deletions Model/Config/Source/Available/Sodexo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

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

class Sodexo extends Available
{
protected $_class = \Paynl\Payment\Model\Paymentmethod\Sodexo::class;
}
3 changes: 3 additions & 0 deletions Model/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class ConfigProvider implements ConfigProviderInterface
'paynl_payment_klarnakp',
'paynl_payment_maestro',
'paynl_payment_mistercash',
'paynl_payment_monizze',
'paynl_payment_multibanco',
'paynl_payment_mybank',
'paynl_payment_nexi',
Expand All @@ -59,7 +60,9 @@ class ConfigProvider implements ConfigProviderInterface
'paynl_payment_podiumcadeaukaart',
'paynl_payment_postepay',
'paynl_payment_przelewy24',
'paynl_payment_prontowonen',
'paynl_payment_shoesandsneakers',
'paynl_payment_sodexo',
'paynl_payment_sofortbanking',
'paynl_payment_sofortbanking_hr',
'paynl_payment_sofortbanking_ds',
Expand Down
13 changes: 13 additions & 0 deletions Model/Paymentmethod/Monizze.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Paynl\Payment\Model\Paymentmethod;

class Monizze extends PaymentMethod
{
protected $_code = 'paynl_payment_monizze';

protected function getDefaultPaymentOptionId()
{
return 3027;
}
}
13 changes: 13 additions & 0 deletions Model/Paymentmethod/Prontowonen.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Paynl\Payment\Model\Paymentmethod;

class Prontowonen extends PaymentMethod
{
protected $_code = 'paynl_payment_prontowonen';

protected function getDefaultPaymentOptionId()
{
return 3039;
}
}
13 changes: 13 additions & 0 deletions Model/Paymentmethod/Sodexo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Paynl\Payment\Model\Paymentmethod;

class Sodexo extends PaymentMethod
{
protected $_code = 'paynl_payment_sodexo';

protected function getDefaultPaymentOptionId()
{
return 3030;
}
}
3 changes: 3 additions & 0 deletions etc/adminhtml/paymentmethods.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<include path="Paynl_Payment::paymentmethods/klarnakp.xml" />
<include path="Paynl_Payment::paymentmethods/maestro.xml" />
<include path="Paynl_Payment::paymentmethods/mistercash.xml" />
<include path="Paynl_Payment::paymentmethods/monizze.xml" />
<include path="Paynl_Payment::paymentmethods/multibanco.xml" />
<include path="Paynl_Payment::paymentmethods/mybank.xml" />
<include path="Paynl_Payment::paymentmethods/nexi.xml" />
Expand All @@ -50,7 +51,9 @@
<include path="Paynl_Payment::paymentmethods/podiumcadeaukaart.xml" />
<include path="Paynl_Payment::paymentmethods/postepay.xml" />
<include path="Paynl_Payment::paymentmethods/przelewy24.xml" />
<include path="Paynl_Payment::paymentmethods/prontowonen.xml" />
<include path="Paynl_Payment::paymentmethods/shoesandsneakers.xml" />
<include path="Paynl_Payment::paymentmethods/sodexo.xml" />
<include path="Paynl_Payment::paymentmethods/sofortbanking.xml" />
<include path="Paynl_Payment::paymentmethods/sofortbanking_hr.xml" />
<include path="Paynl_Payment::paymentmethods/sofortbanking_ds.xml" />
Expand Down
133 changes: 133 additions & 0 deletions etc/adminhtml/paymentmethods/monizze.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<?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_monizze" sortOrder="1110" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Monizze</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\Monizze</source_model>
<config_path>payment/paynl_payment_monizze/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_monizze/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_monizze/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_monizze/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_monizze/order_status_processing</config_path>
</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_monizze/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_monizze/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_monizze/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_monizze/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_monizze/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_monizze/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_monizze/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_monizze/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_monizze/showforcompany</config_path>
<comment><![CDATA[Allow payment method to be used for companies, private, or both.]]></comment>
</field>
<field id="showforgroup" translate="label" type="select" sortOrder="160" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Customer Group</label>
<source_model>Paynl\Payment\Model\Config\Source\UserGroups</source_model>
<depends>
<field id="active">1</field>
</depends>
<config_path>payment/paynl_payment_monizze/showforgroup</config_path>
<comment><![CDATA[Show payment method only to specific customer groups.]]></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_monizze/payment_option_id</config_path>
</field>
</group>
</group>
</include>
Loading

0 comments on commit 751db9d

Please sign in to comment.