-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Christian Proske
committed
Jul 12, 2019
1 parent
cb463fc
commit f28b718
Showing
39 changed files
with
3,060 additions
and
482 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,8 @@ | |
"name": "C. Proske", | ||
"email": "[email protected]" | ||
} | ||
] | ||
], | ||
"config": { | ||
"optimize-autoloader": true | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
require_once __DIR__ . '/JTLMollie.php'; | ||
|
||
class JTLMollieApplePay extends JTLMollie | ||
{ | ||
const MOLLIE_METHOD = \Mollie\Api\Types\PaymentMethod::APPLEPAY; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
use ws_mollie\Helper; | ||
|
||
require_once __DIR__ . '/../class/Helper.php'; | ||
try { | ||
Helper::init(); | ||
|
||
if (array_key_exists("action", $_REQUEST) && $_REQUEST['action'] === 'update-plugin') { | ||
Shop::Smarty()->assign('defaultTabbertab', Helper::getAdminmenu('Info')); | ||
Helper::selfupdate(); | ||
} | ||
|
||
$svgQuery = http_build_query([ | ||
'p' => Helper::oPlugin()->cPluginID, | ||
'v' => Helper::oPlugin()->nVersion, | ||
's' => defined('APPLICATION_VERSION') ? APPLICATION_VERSION : JTL_VERSION, | ||
'd' => Helper::getDomain(), | ||
'm' => base64_encode(Helper::getMasterMail(true)), | ||
'php' => PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION, | ||
]); | ||
|
||
echo "<script type='application/javascript' src='//cdn.webstollen.com/plugin/js/ws.js?p=" . Helper::oPlugin()->cPluginID . '&v=' . Helper::oPlugin()->nVersion . "'></script>"; | ||
echo "<div id='ws-head-bar' class='row'>" . | ||
" <div class='col-md-4 text-center'>" . | ||
" <object data='//lic.dash.bar/info/licence?{$svgQuery}' type='image/svg+xml'>" . | ||
" <img src='//lic.dash.bar/info/licence.png?{$svgQuery}' width='370' height='20' alt='Lizenz Informationen'>" . | ||
' </object>' . | ||
' </div>' . | ||
" <div class='col-md-4 text-center'>" . | ||
" <object data='//lic.dash.bar/info/version?{$svgQuery}' type='image/svg+xml'>" . | ||
" <img src='//lic.dash.bar/info/version.png?{$svgQuery}' width='370' height='20' alt='Update Informationen'>" . | ||
' </object>' . | ||
' </div>' . | ||
" <div class='col-md-4 text-center'>" . | ||
" <object data='//lic.dash.bar/info/help?{$svgQuery}' type='image/svg+xml'>" . | ||
" <img src='//lic.dash.bar/info/help.png?{$svgQuery}' width='370' height='20' alt='Plugin informationen'>" . | ||
' </object>' . | ||
' </div>' . | ||
'</div>'; | ||
|
||
try { | ||
$latestRelease = Helper::getLatestRelease(array_key_exists('update', $_REQUEST)); | ||
if ((int)Helper::oPlugin()->nVersion < (int)$latestRelease->version) { | ||
Shop::Smarty()->assign('update', $latestRelease); | ||
} | ||
} catch (\Exception $e) { | ||
} | ||
|
||
Shop::Smarty()->display(Helper::oPlugin()->cAdminmenuPfad . '/tpl/info.tpl'); | ||
} catch (Exception $e) { | ||
echo "<div class='alert alert-danger'>Fehler: {$e->getMessage()}</div>"; | ||
Helper::logExc($e); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
<?php | ||
|
||
use Mollie\Api\Types\OrderStatus; | ||
use ws_mollie\Helper; | ||
use ws_mollie\Model\Payment; | ||
use ws_mollie\Mollie; | ||
|
||
require_once __DIR__ . '/../class/Helper.php'; | ||
try { | ||
if (!Helper::init()) { | ||
echo "Kein gültige Lizenz?"; | ||
return; | ||
} | ||
require_once __DIR__ . '/../paymentmethod/JTLMollie.php'; | ||
global $oPlugin; | ||
$ordersMsgs = []; | ||
if (array_key_exists('action', $_REQUEST)) { | ||
switch ($_REQUEST['action']) { | ||
case 'refund': | ||
if (!array_key_exists('id', $_REQUEST)) { | ||
$ordersMsgs[] = (object)['type' => 'danger', 'text' => 'Keine ID angeben!']; | ||
break; | ||
} | ||
$payment = Payment::getPaymentMollie($_REQUEST['id']); | ||
if (!$payment) { | ||
$ordersMsgs[] = (object)['type' => 'danger', 'text' => 'Order nicht gefunden!']; | ||
break; | ||
} | ||
|
||
$order = JTLMollie::API()->orders->get($_REQUEST['id']); | ||
if ($order->status == OrderStatus::STATUS_CANCELED) { | ||
$ordersMsgs[] = (object)['type' => 'danger', 'text' => 'Bestellung bereits storniert']; | ||
break; | ||
} | ||
$refund = JTLMollie::API()->orderRefunds->createFor($order, ['lines' => []]); | ||
Mollie::JTLMollie()->doLog("Order refunded: <br/><pre>" . print_r($refund, 1) . "</pre>", '$' . $payment->kID . '#' . $payment->kBestellung . '§' . $payment->cOrderNumber, LOGLEVEL_NOTICE); | ||
|
||
goto order; | ||
break; | ||
|
||
case 'cancel': | ||
if (!array_key_exists('id', $_REQUEST)) { | ||
$ordersMsgs[] = (object)['type' => 'danger', 'text' => 'Keine ID angeben!']; | ||
break; | ||
} | ||
$payment = Payment::getPaymentMollie($_REQUEST['id']); | ||
if (!$payment) { | ||
$ordersMsgs[] = (object)['type' => 'danger', 'text' => 'Order nicht gefunden!']; | ||
break; | ||
} | ||
$order = JTLMollie::API()->orders->get($_REQUEST['id']); | ||
if ($order->status == OrderStatus::STATUS_CANCELED) { | ||
$ordersMsgs[] = (object)['type' => 'danger', 'text' => 'Bestellung bereits storniert']; | ||
break; | ||
} | ||
$cancel = JTLMollie::API()->orders->cancel($order->id); | ||
Mollie::JTLMollie()->doLog("Order canceled: <br/><pre>" . print_r($cancel, 1) . "</pre>", '$' . $payment->kID . '#' . $payment->kBestellung . '§' . $payment->cOrderNumber, LOGLEVEL_NOTICE); | ||
goto order; | ||
break; | ||
|
||
case 'capture': | ||
if (!array_key_exists('id', $_REQUEST)) { | ||
$ordersMsgs[] = (object)['type' => 'danger', 'text' => 'Keine ID angeben!']; | ||
break; | ||
} | ||
$payment = Payment::getPaymentMollie($_REQUEST['id']); | ||
if (!$payment) { | ||
$ordersMsgs[] = (object)['type' => 'danger', 'text' => 'Order nicht gefunden!']; | ||
break; | ||
} | ||
$order = JTLMollie::API()->orders->get($_REQUEST['id']); | ||
if ($order->status !== OrderStatus::STATUS_AUTHORIZED && $order->status !== OrderStatus::STATUS_SHIPPING) { | ||
$ordersMsgs[] = (object)['type' => 'danger', 'text' => 'Nur autorisierte Zahlungen können erfasst werden!']; | ||
break; | ||
} | ||
|
||
$oBestellung = new Bestellung($payment->kBestellung, true); | ||
if (!$oBestellung->kBestellung) { | ||
$ordersMsgs[] = (object)['type' => 'danger', 'text' => 'Bestellung konnte nicht geladen werden!']; | ||
break; | ||
} | ||
|
||
$logData = '#' . $payment->kBestellung . '$' . $payment->kID . "§" . $oBestellung->cBestellNr; | ||
|
||
$options = ['lines' => []]; | ||
if ($oBestellung->cTracking) { | ||
$tracking = new stdClass(); | ||
$tracking->carrier = $oBestellung->cVersandartName; | ||
$tracking->url = $oBestellung->cTrackingURL; | ||
$tracking->code = $oBestellung->cTracking; | ||
$options['tracking'] = $tracking; | ||
} | ||
|
||
// CAPTURE ALL | ||
$shipment = JTLMollie::API()->shipments->createFor($order, $options); | ||
$ordersMsgs[] = (object)['type' => 'success', 'text' => 'Zahlung wurde erfolgreich erfasst!']; | ||
Mollie::JTLMollie()->doLog('Shipment created<br/><pre>' . print_r(['options' => $options, 'shipment' => $shipment], 1) . '</pre>', $logData); | ||
goto order; | ||
|
||
case 'order': | ||
order: | ||
if (!array_key_exists('id', $_REQUEST)) { | ||
$ordersMsgs[] = (object)['type' => 'danger', 'text' => 'Keine ID angeben!']; | ||
break; | ||
} | ||
|
||
$order = JTLMollie::API()->orders->get($_REQUEST['id'], ['embed' => 'payments,refunds']); | ||
$payment = Payment::getPaymentMollie($_REQUEST['id']); | ||
if ($payment) { | ||
$oBestellung = new Bestellung($payment->kBestellung, false); | ||
//\ws_mollie\Model\Payment::updateFromPayment($order, $oBestellung->kBestellung); | ||
if ($oBestellung->kBestellung && $oBestellung->cBestellNr !== $payment->cOrderNumber) { | ||
Shop::DB()->executeQueryPrepared("UPDATE xplugin_ws_mollie_payments SET cOrderNumber = :cBestellNr WHERE kID = :kID", [ | ||
':cBestellNr' => $oBestellung->cBestellNr, | ||
':kID' => $payment->kID, | ||
], 3); | ||
} | ||
} | ||
|
||
$logs = Shop::DB()->executeQueryPrepared("SELECT * FROM tzahlungslog WHERE cLogData LIKE :kBestellung OR cLogData LIKE :cBestellNr OR cLogData LIKE :MollieID ORDER BY dDatum DESC", [ | ||
':kBestellung' => '%#' . ($payment->kBestellung ?: '##') . '%', | ||
':cBestellNr' => '%§' . ($payment->cOrderNumber ?: '§§') . '%', | ||
':MollieID' => '%$' . ($payment->kID ?: '$$') . '%', | ||
], 2); | ||
|
||
Shop::Smarty()->assign('payment', $payment) | ||
->assign('oBestellung', $oBestellung) | ||
->assign('order', $order) | ||
->assign('logs', $logs) | ||
->assign('ordersMsgs', $ordersMsgs); | ||
Shop::Smarty()->display($oPlugin->cAdminmenuPfad . '/tpl/order.tpl'); | ||
return; | ||
} | ||
} | ||
|
||
|
||
$payments = Shop::DB()->executeQueryPrepared("SELECT * FROM xplugin_ws_mollie_payments WHERE kBestellung IS NOT NULL AND cStatus != 'created'", [], 2); | ||
foreach ($payments as $i => $payment) { | ||
$payments[$i]->oBestellung = new Bestellung($payment->kBestellung, false); | ||
} | ||
|
||
Shop::Smarty()->assign('payments', $payments) | ||
->assign('ordersMsgs', $ordersMsgs) | ||
->assign('admRoot', str_replace('http:', '', $oPlugin->cAdminmenuPfadURL)) | ||
->assign('hasAPIKey', trim(Helper::getSetting("api_key")) !== ''); | ||
|
||
Shop::Smarty()->display($oPlugin->cAdminmenuPfad . '/tpl/orders.tpl'); | ||
} catch (Exception $e) { | ||
echo "<div class='alert alert-danger'>" . | ||
"{$e->getMessage()}<br/>" . | ||
"<blockquote>{$e->getFile()}:{$e->getLine()}<br/><pre>{$e->getTraceAsString()}</pre></blockquote>" . | ||
"</div>"; | ||
Helper::logExc($e); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
use Mollie\Api\MollieApiClient; | ||
use ws_mollie\Helper; | ||
use ws_mollie\Mollie; | ||
|
||
require_once __DIR__ . '/../class/Helper.php'; | ||
try { | ||
if (!Helper::init()) { | ||
echo "Kein gültige Lizenz?"; | ||
return; | ||
} | ||
|
||
global $oPlugin; | ||
|
||
|
||
$mollie = new MollieApiClient(); | ||
$mollie->setApiKey(Helper::getSetting("api_key")); | ||
|
||
$profile = $mollie->profiles->get('me'); | ||
/* $methods = $mollie->methods->all([ | ||
//'locale' => 'de_DE', | ||
'include' => 'pricing', | ||
]);*/ | ||
|
||
$za = filter_input(INPUT_GET, 'za', FILTER_VALIDATE_BOOLEAN); | ||
$active = filter_input(INPUT_GET, 'active', FILTER_VALIDATE_BOOLEAN); | ||
$amount = filter_input(INPUT_GET, 'amount', FILTER_VALIDATE_FLOAT) ?: null; | ||
$locale = filter_input(INPUT_GET, 'locale', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^[a-zA-Z]{2}_[a-zA-Z]{2}$/']]) ?: null; | ||
$currency = filter_input(INPUT_GET, 'currency', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^[a-zA-Z]{3}$/']]) ?: 'EUR'; | ||
|
||
if ($za) { | ||
Shop::Smarty()->assign('defaultTabbertab', Helper::getAdminmenu("Zahlungsarten")); | ||
} | ||
|
||
$params = ['include' => 'pricing,issuers', 'resource' => 'orders']; | ||
if ($amount && $currency && $locale) { | ||
$params['amount'] = ['value' => number_format($amount, 2, '.', ''), 'currency' => $currency]; | ||
$params['locale'] = $locale; | ||
if ($active) { | ||
$params['includeWallets'] = 'applepay'; | ||
} | ||
} | ||
|
||
if ($active) { | ||
$allMethods = $mollie->methods->allActive($params); | ||
} else { | ||
$allMethods = $mollie->methods->allAvailable($params); | ||
} | ||
|
||
Shop::Smarty()->assign('profile', $profile) | ||
->assign('currencies', Mollie::getCurrencies()) | ||
->assign('locales', Mollie::getLocales()) | ||
->assign('allMethods', $allMethods); | ||
Shop::Smarty()->display($oPlugin->cAdminmenuPfad . '/tpl/paymentmethods.tpl'); | ||
} catch (Exception $e) { | ||
echo "<div class='alert alert-danger'>{$e->getMessage()}</div>"; | ||
Helper::logExc($e); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<div style="max-width: 1500px; margin: 0 auto" id="info"> | ||
<div class="row"> | ||
<div class="col-xs-6 col-sm-4"> | ||
<a target="_blank" href="https://ws-url.de/r11"> | ||
<img class="img-responsive" src="https://static.dash.bar/info/r11.png"/> | ||
</a> | ||
</div> | ||
<div class="col-xs-6 col-sm-4"> | ||
<a target="_blank" href="https://ws-url.de/r12"> | ||
<img class="img-responsive" src="https://static.dash.bar/info/r12.png"/> | ||
</a> | ||
</div> | ||
|
||
{if isset($update)} | ||
<div class="col-xs-12 col-sm-4"> | ||
<script>$(function () { | ||
$('.nav-tabs .tab-link-info').addClass('update').html("Update verfügbar!"); | ||
});</script> | ||
<div class="alert alert-success"> | ||
<h4>Update auf Version {$update->version} verfügbar!</h4> | ||
</div> | ||
<div> | ||
<div> | ||
<div class="col-xs-5">Version:</div> | ||
<div class="col-xs-7"><strong>{$update->version}</strong></div> | ||
</div> | ||
<div> | ||
<div class="col-xs-5">Erschienen:</div> | ||
<div class="col-xs-7"><strong>{$update->create_date}</strong></div> | ||
</div> | ||
<div> | ||
<div class="col-xs-5">Changelog:</div> | ||
<div class="col-xs-7"> | ||
<textarea readonly | ||
rows="{if ($update->changelog|substr_count:"\n") > 6}6{else}{($update->changelog|substr_count:"\n")+1}{/if}" | ||
style="width: 100%">{$update->changelog|utf8_decode|htmlentities}</textarea> | ||
</div> | ||
</div> | ||
|
||
<div> | ||
<div class="col-xs-5"></div> | ||
<div class="col-xs-7 text-center"> | ||
<a class="btn btn-info" target="_blank" | ||
href="{if $update->short_url != ''}{$update->short_url}{else}{$update->full_url}{/if}">Download</a> | ||
<a class="btn btn-success" | ||
href="plugin.php?kPlugin={$oPlugin->kPlugin}&action=update-plugin">Install</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{else} | ||
<div class="col-xs-12 col-sm-4"> | ||
<a target="_blank" href="https://ws-url.de/r13"> | ||
<img class="img-responsive" src="https://static.dash.bar/info/r13.png"/> | ||
</a> | ||
</div> | ||
{/if} | ||
|
||
</div> | ||
<div class="row"> | ||
<div class="col-xs-6 col-sm-4"> | ||
<a target="_blank" href="https://ws-url.de/r21"> | ||
<img class="img-responsive" src="https://static.dash.bar/info/r21.png"/> | ||
</a> | ||
</div> | ||
<div class="col-xs-6 col-sm-4"> | ||
<a target="_blank" href="https://ws-url.de/r22"> | ||
<img class="img-responsive" src="https://static.dash.bar/info/r22.png"/> | ||
</a> | ||
</div> | ||
<div class="col-xs-12 col-sm-4"> | ||
<a target="_blank" href="https://ws-url.de/r23"> | ||
<img class="img-responsive" src="https://static.dash.bar/info/r23.png"/> | ||
</a></div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-xs-6 col-sm-4"> | ||
<a target="_blank" href="https://ws-url.de/r31"> | ||
<img class="img-responsive" src="https://static.dash.bar/info/r31.png"/> | ||
</a> | ||
</div> | ||
<div class="col-xs-6 col-sm-4"> | ||
<a target="_blank" href="https://ws-url.de/r32"> | ||
<img class="img-responsive" src="https://static.dash.bar/info/r32.png"/> | ||
</a> | ||
</div> | ||
<div class="col-xs-12 col-sm-4"> | ||
<a target="_blank" href="https://ws-url.de/r33"> | ||
<img class="img-responsive" src="https://static.dash.bar/info/r33.png"/> | ||
</a> | ||
</div> | ||
</div> | ||
</div> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.