Skip to content

Commit

Permalink
Merge pull request #26 from jornPay/master
Browse files Browse the repository at this point in the history
Added paymentMethods Cashly, SpayPay and Wechat Pay
  • Loading branch information
Andy Pieters authored Jun 25, 2018
2 parents 1b6ab6d + 5b265de commit d856b17
Show file tree
Hide file tree
Showing 19 changed files with 491 additions and 5 deletions.
14 changes: 12 additions & 2 deletions Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ public function configureSDK()
{
$apiToken = $this->getApiToken();
$serviceId = $this->getServiceId();
$tokencode = $this->getTokencode();

if(! empty($tokencode)) {
\Paynl\Config::setTokenCode($tokencode);
}

if ( ! empty($apiToken) && ! empty($serviceId)) {
\Paynl\Config::setApiToken($apiToken);
Expand All @@ -97,11 +102,16 @@ public function configureSDK()

public function getApiToken()
{
return $this->store->getConfig('payment/paynl/apitoken');
return trim($this->store->getConfig('payment/paynl/apitoken'));
}

public function getTokencode()
{
return trim($this->store->getConfig('payment/paynl/tokencode'));
}

public function getServiceId()
{
return $this->store->getConfig('payment/paynl/serviceid');
return trim($this->store->getConfig('payment/paynl/serviceid'));
}
}
10 changes: 8 additions & 2 deletions Model/Config/Source/Available/Available.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,14 @@ public function toArray()

protected function configureSDK()
{
$apiToken = $this->getConfigValue('payment/paynl/apitoken');
$serviceId = $this->getConfigValue('payment/paynl/serviceid');
$apiToken = trim($this->getConfigValue('payment/paynl/apitoken'));
$serviceId = trim($this->getConfigValue('payment/paynl/serviceid'));
$tokencode = trim($this->getConfigValue('payment/paynl/tokencode'));

if(! empty($tokencode)) {
\Paynl\Config::setTokenCode($tokencode);
}

if (!empty($apiToken) && !empty($serviceId)) {
\Paynl\Config::setApiToken($apiToken);
\Paynl\Config::setServiceId($serviceId);
Expand Down
12 changes: 12 additions & 0 deletions Model/Config/Source/Available/Cashly.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
/**
* Copyright © 2015 Pay.nl All rights reserved.
*/

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


class Cashly extends Available
{
protected $_code = 'paynl_payment_cashly';
}
12 changes: 12 additions & 0 deletions Model/Config/Source/Available/Spraypay.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
/**
* Copyright © 2015 Pay.nl All rights reserved.
*/

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


class Spraypay extends Available
{
protected $_code = 'paynl_payment_spraypay';
}
12 changes: 12 additions & 0 deletions Model/Config/Source/Available/Wechatpay.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
/**
* Copyright © 2015 Pay.nl All rights reserved.
*/

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


class Wechatpay extends Available
{
protected $_code = 'paynl_payment_wechatpay';
}
3 changes: 3 additions & 0 deletions Model/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ConfigProvider implements ConfigProviderInterface
'paynl_payment_capayable_gespreid',
'paynl_payment_cartasi',
'paynl_payment_cartebleue',
'paynl_payment_cashly',
'paynl_payment_clickandbuy',
'paynl_payment_dankort',
'paynl_payment_fashioncheque',
Expand All @@ -43,10 +44,12 @@ class ConfigProvider implements ConfigProviderInterface
'paynl_payment_podiumcadeaukaart',
'paynl_payment_postepay',
'paynl_payment_sofortbanking',
'paynl_payment_spraypay',
'paynl_payment_telefonischbetalen',
'paynl_payment_visamastercard',
'paynl_payment_vvvgiftcard',
'paynl_payment_webshopgiftcard',
'paynl_payment_wechatpay',
'paynl_payment_wijncadeau',
'paynl_payment_yehhpay',
'paynl_payment_yourgift'
Expand Down
12 changes: 12 additions & 0 deletions Model/Paymentmethod/Cashly.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
/**
* Copyright © 2015 Pay.nl All rights reserved.
*/

namespace Paynl\Payment\Model\Paymentmethod;

class Cashly extends PaymentMethod
{
protected $_code = 'paynl_payment_cashly';

}
17 changes: 17 additions & 0 deletions Model/Paymentmethod/Spraypay.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
/**
* Copyright © 2015 Pay.nl All rights reserved.
*/

namespace Paynl\Payment\Model\Paymentmethod;

/**
* Description of Ideal
*
* @author Andy Pieters <[email protected]>
*/
class Spraypay extends PaymentMethod
{
protected $_code = 'paynl_payment_spraypay';

}
17 changes: 17 additions & 0 deletions Model/Paymentmethod/Wechatpay.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
/**
* Copyright © 2015 Pay.nl All rights reserved.
*/

namespace Paynl\Payment\Model\Paymentmethod;

/**
* Description of Ideal
*
* @author Andy Pieters <[email protected]>
*/
class Wechatpay extends PaymentMethod
{
protected $_code = 'paynl_payment_wechatpay';

}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "paynl/magento2-plugin",
"description": "Pay.nl Magento2 Payment methods",
"type": "magento2-module",
"version": "1.3.9",
"version": "1.4.0",
"require": {
"php": "~5.5.22|~5.6.0|7.0.2|7.0.4|~7.0.6|~7.1.0",
"magento/module-sales": "100 - 101",
Expand Down
3 changes: 3 additions & 0 deletions etc/adminhtml/paymentmethods.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<include path="Paynl_Payment::paymentmethods/capayable_gespreid.xml" />
<include path="Paynl_Payment::paymentmethods/cartasi.xml" />
<include path="Paynl_Payment::paymentmethods/cartebleue.xml" />
<include path="Paynl_Payment::paymentmethods/cashly.xml" />
<include path="Paynl_Payment::paymentmethods/clickandbuy.xml" />
<include path="Paynl_Payment::paymentmethods/dankort.xml" />
<include path="Paynl_Payment::paymentmethods/fashioncheque.xml" />
Expand All @@ -33,10 +34,12 @@
<include path="Paynl_Payment::paymentmethods/podiumcadeaukaart.xml" />
<include path="Paynl_Payment::paymentmethods/postepay.xml" />
<include path="Paynl_Payment::paymentmethods/sofortbanking.xml" />
<include path="Paynl_Payment::paymentmethods/spraypay.xml" />
<include path="Paynl_Payment::paymentmethods/telefonischbetalen.xml" />
<include path="Paynl_Payment::paymentmethods/visamastercard.xml" />
<include path="Paynl_Payment::paymentmethods/vvvgiftcard.xml" />
<include path="Paynl_Payment::paymentmethods/webshopgiftcard.xml" />
<include path="Paynl_Payment::paymentmethods/wechatpay.xml" />
<include path="Paynl_Payment::paymentmethods/wijncadeau.xml" />
<include path="Paynl_Payment::paymentmethods/yehhpay.xml" />
<include path="Paynl_Payment::paymentmethods/yourgift.xml" />
Expand Down
108 changes: 108 additions & 0 deletions etc/adminhtml/paymentmethods/cashly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © 2015 Pay.nl All rights reserved.
*/
-->
<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_cashly" sortOrder="320" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Cashly</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\Cashly</source_model>
<config_path>payment/paynl_payment_cashly/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_cashly/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_cashly/order_status</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_cashly/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_cashly/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_cashly/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_cashly/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_cashly/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_cashly/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_cashly/send_new_order_email</config_path>
<depends>
<field id="active">1</field>
</depends>
</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_cashly/payment_option_id</config_path>
</field>
</group>
</group>
</include>

Loading

0 comments on commit d856b17

Please sign in to comment.