Skip to content

Commit

Permalink
version 107
Browse files Browse the repository at this point in the history
  • Loading branch information
C. Proske committed May 15, 2020
1 parent 27fe37c commit e169f42
Show file tree
Hide file tree
Showing 48 changed files with 3,434 additions and 115 deletions.
138 changes: 86 additions & 52 deletions composer.lock

Large diffs are not rendered by default.

87 changes: 72 additions & 15 deletions info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
<Version nr="106">
<CreateDate>2019-12-18</CreateDate>
</Version>
<Version nr="107">
<SQL>107.sql</SQL>
<CreateDate>2020-03-02</CreateDate>
</Version>
<Hooks>
<Hook id="131">131_globalinclude.php</Hook>
<Hook id="144">144_notify.php</Hook>
Expand Down Expand Up @@ -90,6 +94,15 @@
<Option value="A" sort="3"><![CDATA[Ja, alle]]></Option>
</SelectboxOptions>
</Setting>
<Setting type="selectbox" initialValue="N" sort="40" conf="Y">
<Name>Artikel mit rationalen Stückzahlen</Name>
<Description>Artikel mit rationalen Stückzahlen werden dann unterstützt, jedoch als ein Artikel behandelt. KEIN Teilversand hierfür möglich!</Description>
<ValueName>supportQ</ValueName>
<SelectboxOptions>
<Option value="Y" sort="1"><![CDATA[Ja, mollie hier anbieten]]></Option>
<Option value="N" sort="2"><![CDATA[Nein, mollie hier nicht anbieten]]></Option>
</SelectboxOptions>
</Setting>
<Setting type="selectbox" initialValue="ord_tr" sort="100" conf="Y">
<Name>TransaktionsID des Zahlungseingangs:</Name>
<Description>Welche ID soll an die WAWI übetragen werden?</Description>
Expand All @@ -113,83 +126,86 @@
<Description></Description>
<VariableLocalized iso="GER"><![CDATA[Zahlungsinformationen]]></VariableLocalized>
<VariableLocalized iso="ENG"><![CDATA[Enter your payment information]]></VariableLocalized>
<VariableLocalized iso="FRE"><![CDATA[Informations de paiement]]></VariableLocalized>
</Variable>
<Variable>
<Name>error_canceled</Name>
<Description></Description>
<VariableLocalized iso="GER"><![CDATA[Die Zahlung wurde von Ihnen abgebrochen. Wählen Sie ggf. eine andere
Zahlart aus.
]]></VariableLocalized>
<VariableLocalized iso="ENG"><![CDATA[You canceled the payment. Please select a different payment method if
necessary.
]]></VariableLocalized>
<VariableLocalized iso="ENG"><![CDATA[You canceled the payment. Please select a different payment method if necessary.]]></VariableLocalized>
<VariableLocalized iso="FRE"><![CDATA[Votre paiement a été annulé. Veuillez sélectionner un autre mode de paiement si nécessaire.]]></VariableLocalized>
</Variable>
<Variable>
<Name>error_expired</Name>
<Description></Description>
<VariableLocalized iso="GER"><![CDATA[Ihre Zahlungssession ist abgelaufen, bitte versuchen Sie es erneut.
]]></VariableLocalized>
<VariableLocalized iso="ENG"><![CDATA[Your payment session has expired, please try again.]]></VariableLocalized>
<VariableLocalized iso="FRE"><![CDATA[Votre session de paiement a expiré, s'il vous plaît essayer à nouveau.]]></VariableLocalized>
</Variable>
<Variable>
<Name>error_open</Name>
<Description></Description>
<VariableLocalized iso="GER"><![CDATA[Bei der Zahlung ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut,
oder whälen Sie eine andere Zahlungsart.
]]></VariableLocalized>
<VariableLocalized iso="ENG"><![CDATA[The payment process failed. Please try again or choose a different payment
method.
oder wählen Sie eine andere Zahlungsart.
]]></VariableLocalized>
<VariableLocalized iso="ENG"><![CDATA[The payment process failed. Please try again or choose a different payment method.]]></VariableLocalized>
<VariableLocalized iso="FRE"><![CDATA[Une erreur s'est produite lors du paiement. Veuillez réessayer ou choisir un autre mode de paiement.]]></VariableLocalized>
</Variable>
<Variable>
<Name>error_failed</Name>
<Description></Description>
<VariableLocalized iso="GER"><![CDATA[Bei der Zahlung ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut,
oder wählen Sie eine andere Zahlungsart.
]]></VariableLocalized>
<VariableLocalized iso="ENG"><![CDATA[The payment process failed. Please try again or choose a different payment
method.
]]></VariableLocalized>
<VariableLocalized iso="ENG"><![CDATA[The payment process failed. Please try again or choose a different paymentmethod.]]></VariableLocalized>
<VariableLocalized iso="FRE"><![CDATA[Une erreur s'est produite lors du paiement. Veuillez réessayer ou choisir un autre mode de paiement.]]></VariableLocalized>
</Variable>
<Variable>
<Name>lbl_cardHolder</Name>
<Description></Description>
<VariableLocalized iso="GER"><![CDATA[Karteninhaber:]]></VariableLocalized>
<VariableLocalized iso="ENG"><![CDATA[Card holder:]]></VariableLocalized>
<VariableLocalized iso="FRE"><![CDATA[Titulaire de la carte:]]></VariableLocalized>
</Variable>
<Variable>
<Name>lbl_cardNumber</Name>
<Description></Description>
<VariableLocalized iso="GER"><![CDATA[Kartennummer:]]></VariableLocalized>
<VariableLocalized iso="ENG"><![CDATA[Card number:]]></VariableLocalized>
<VariableLocalized iso="FRE"><![CDATA[Numéro de carte:]]></VariableLocalized>
</Variable>
<Variable>
<Name>lbl_expiryDate</Name>
<Description></Description>
<VariableLocalized iso="GER"><![CDATA[Ablaufdatum:]]></VariableLocalized>
<VariableLocalized iso="ENG"><![CDATA[Expiry date:]]></VariableLocalized>
<VariableLocalized iso="FRE"><![CDATA[Date d'expiration:]]></VariableLocalized>
</Variable>
<Variable>
<Name>lbl_varificationCode</Name>
<Description></Description>
<VariableLocalized iso="GER"><![CDATA[CVC:]]></VariableLocalized>
<VariableLocalized iso="ENG"><![CDATA[CVC:]]></VariableLocalized>
<VariableLocalized iso="GER"><![CDATA[CVC/CVV:]]></VariableLocalized>
<VariableLocalized iso="ENG"><![CDATA[CVC/CVV:]]></VariableLocalized>
<VariableLocalized iso="FRE"><![CDATA[CVC/CVV:]]></VariableLocalized>
</Variable>
<Variable>
<Name>cvchint_1</Name>
<Description></Description>
<VariableLocalized iso="GER"><![CDATA[So findet man die CVV/CVC Nummer]]></VariableLocalized>
<VariableLocalized iso="ENG"><![CDATA[How to find the CVV/CVC number]]></VariableLocalized>
<VariableLocalized iso="FRE"><![CDATA[Comment trouver le numéro CVC/CVV]]></VariableLocalized>
</Variable>
<Variable>
<Name>cvchint_2</Name>
<Description></Description>
<VariableLocalized iso="GER"><![CDATA[Die dreistellige CVV/CVC Nummer wird bei Visa und Mastercard auf der Rückseite,
bei American Express auf der Vorderseite der Karte abgebildet.
]]></VariableLocalized>
<VariableLocalized iso="ENG"><![CDATA[The three-digit CVV/CVC number is shown on the reverse for Visa and Mastercard,
and on the front of the card for American Express.
]]></VariableLocalized>
<VariableLocalized iso="ENG"><![CDATA[The three-digit CVV/CVC number is shown on the reverse for Visa and Mastercard, and on the front of the card for American Express.]]></VariableLocalized>
<VariableLocalized iso="FRE"><![CDATA[Le numéro CVC/CVV à trois chiffres est indiqué au dos de Visa et Mastercard et au recto de la carte American Express.]]></VariableLocalized>
</Variable>
</Locales>
<PaymentMethod>
Expand Down Expand Up @@ -226,6 +242,7 @@
<Sockets>0</Sockets>
<ClassFile>JTLMollieCreditCard.php</ClassFile>
<ClassName>JTLMollieCreditCard</ClassName>
<AdditionalTemplateFile>tpl/mollieComponents.tpl</AdditionalTemplateFile>
<TemplateFile>tpl/bestellabschluss.tpl</TemplateFile>
<MethodLanguage iso="GER">
<Name>Kreditkarte</Name>
Expand Down Expand Up @@ -553,6 +570,46 @@
<InfoText>Bezahlen Sie bequem mit Klarna Slice It.</InfoText>
</MethodLanguage>
</Method>
<Method>
<Name>mollie Przelewy24</Name>
<PictureURL></PictureURL>
<Sort>17</Sort>
<SendMail>0</SendMail>
<Provider>mollie.com</Provider>
<TSCode>OTHER</TSCode>
<PreOrder>1</PreOrder>
<Soap>0</Soap>
<Curl>1</Curl>
<Sockets>0</Sockets>
<ClassFile>JTLMolliePrzelewy24.php</ClassFile>
<ClassName>JTLMolliePrzelewy24</ClassName>
<TemplateFile>tpl/bestellabschluss.tpl</TemplateFile>
<MethodLanguage iso="GER">
<Name>Przelewy24</Name>
<ChargeName>mollie</ChargeName>
<InfoText>Bezahlen Sie bequem mit Przelewy24.</InfoText>
</MethodLanguage>
</Method>
<Method>
<Name>mollie MyBank</Name>
<PictureURL></PictureURL>
<Sort>17</Sort>
<SendMail>0</SendMail>
<Provider>mollie.com</Provider>
<TSCode>OTHER</TSCode>
<PreOrder>1</PreOrder>
<Soap>0</Soap>
<Curl>1</Curl>
<Sockets>0</Sockets>
<ClassFile>JTLMollieMyBank.php</ClassFile>
<ClassName>JTLMollieMyBank</ClassName>
<TemplateFile>tpl/bestellabschluss.tpl</TemplateFile>
<MethodLanguage iso="GER">
<Name>MyBank</Name>
<ChargeName>mollie</ChargeName>
<InfoText>Bezahlen Sie bequem mit MyBank.</InfoText>
</MethodLanguage>
</Method>
</PaymentMethod>
</Install>
</jtlshop3plugin>
2 changes: 1 addition & 1 deletion version/106/adminmenu/orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
}
}

$logs = Shop::DB()->executeQueryPrepared("SELECT * FROM tzahlungslog WHERE cLogData LIKE :kBestellung OR cLogData LIKE :cBestellNr OR cLogData LIKE :MollieID ORDER BY dDatum DESC, cLog DESC", [
$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 ?: '$$') . '%',
Expand Down
35 changes: 0 additions & 35 deletions version/106/frontend/131_globalinclude.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,48 +24,20 @@
$logData = '$' . $oZahlungSession->cNotifyID;

if (!(int)$oZahlungSession->kBestellung && $oZahlungSession->cNotifyID) {
Mollie::JTLMollie()->doLog("Hook 131: Bestellung noch nicht finalisiert ({$oZahlungSession->cNotifyID})", $logData, LOGLEVEL_DEBUG);
// Bestellung noch nicht finalisiert
$mOrder = JTLMollie::API()->orders->get($oZahlungSession->cNotifyID, ['embed' => 'payments']);
if ($mOrder && $mOrder->id === $oZahlungSession->cNotifyID) {

$lock = new \ws_mollie\ExclusiveLock('mollie_' . $mOrder->id, PFAD_ROOT . PFAD_COMPILEDIR);
$logged = false;
$maxWait = 300;
while (!$lock->lock() && $maxWait > 0) {
if (!$logged) {
Mollie::JTLMollie()->doLog("Hook 131: Order currently locked ({$oZahlungSession->cNotifyID})", $logData, LOGLEVEL_DEBUG);
$logged = microtime(true);
}
usleep(100000);
$maxWait--;
}

if ($logged) {
Mollie::JTLMollie()->doLog("Hook 131: Order unlocked (after " . round(microtime(true) - $logged, 2) . "s - maxWait left: {$maxWait})", $logData, LOGLEVEL_DEBUG);
} else {
Mollie::JTLMollie()->doLog("Hook 131: Order locked - maxWait left: {$maxWait})", $logData, LOGLEVEL_DEBUG);
}

$oZahlungSession = JTLMollie::getZahlungSession($_REQUEST['mollie']);
if ((int)$oZahlungSession->kBestellung) {
Mollie::JTLMollie()->doLog("Hook 131: Order finalized already ({$oZahlungSession->kBestellung}) => redirect", $logData, LOGLEVEL_DEBUG);
return Mollie::getOrderCompletedRedirect($oZahlungSession->kBestellung, true);
}

Mollie::JTLMollie()->doLog("Hook 131: Order {$mOrder->id} - {$mOrder->status} <br/><pre>" . print_r($mOrder, 1) . "</pre>", $logData, LOGLEVEL_DEBUG);
if (!in_array($mOrder->status, [OrderStatus::STATUS_EXPIRED, OrderStatus::STATUS_CANCELED])) {

$payment = Mollie::getLastPayment($mOrder);
if (in_array($payment->status, [PaymentStatus::STATUS_AUTHORIZED, PaymentStatus::STATUS_PAID, PaymentStatus::STATUS_PENDING])) {

if (session_id() !== $oZahlungSession->cSID) {
Mollie::JTLMollie()->doLog("Hook 131: Switch to PaymentSession <br/><pre>" . print_r([session_id(), $oZahlungSession], 1) . "</pre>", $logData, LOGLEVEL_DEBUG);
session_destroy();
session_id($oZahlungSession->cSID);
$session = Session::getInstance(true, true);
} else {
Mollie::JTLMollie()->doLog("Hook 131: Already in PaymentSession <br/><pre>" . print_r([session_id(), $oZahlungSession], 1) . "</pre>", $logData, LOGLEVEL_DEBUG);
$session = Session::getInstance(false, false);
}

Expand All @@ -75,20 +47,15 @@
$order = fakeBestellung();
$order = finalisiereBestellung();
$session->cleanUp();
$logData .= '#' . $order->kBestellung . '§' . $order->cBestellNr;
Mollie::JTLMollie()->doLog("Hook 131: Bestellung finalisiert <br/><pre>" . print_r([$order->kBestellung, $order->cBestellNr], 1) . "</pre>", $logData, LOGLEVEL_DEBUG);

if ($order->kBestellung > 0) {
Mollie::JTLMollie()->doLog("Hook 131: Finalisierung erfolgreich, kBestellung: {$order->kBestellung} / {$order->cBestellNr}", $logData, LOGLEVEL_DEBUG);
$oZahlungSession->nBezahlt = 1;
$oZahlungSession->dZeitBezahlt = 'now()';
$oZahlungSession->kBestellung = (int)$order->kBestellung;
$oZahlungSession->dNotify = strtotime($oZahlungSession->dNotify > 0) ? $oZahlungSession->dNotify : date("Y-m-d H:i:s");
Shop::DB()->update('tzahlungsession', 'cZahlungsID', $oZahlungSession->cZahlungsID, $oZahlungSession);
Mollie::handleOrder($mOrder, $order->kBestellung);
return Mollie::getOrderCompletedRedirect($order->kBestellung, true);
} else {
Mollie::JTLMollie()->doLog("Hook 131: Fionalisierung fehlgeschlagen <br/><pre>" . print_r($order, 1) . "</pre>", $logData, LOGLEVEL_ERROR);
}
} else {
Mollie::JTLMollie()->doLog("Hook 131: Invalid PaymentStatus: {$payment->status} for {$payment->id} ", $logData, LOGLEVEL_ERROR);
Expand All @@ -106,8 +73,6 @@
header('Location: ' . Shop::getURL() . '/bestellvorgang.php?editZahlungsart=1');
exit();
}
} else {
Mollie::JTLMollie()->doLog("Hook 131: already finalized => redirect / kBestellung:{$oZahlungSession->kBestellung} && cNotifyID:{$oZahlungSession->cNotifyID}", $logData, LOGLEVEL_NOTICE);
}
return Mollie::getOrderCompletedRedirect((int)$oZahlungSession->kBestellung, true);
}
Expand Down
14 changes: 2 additions & 12 deletions version/106/paymentmethod/JTLMollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function addIncomingPayment($order, $payment)
public function doLog($msg, $data = null, $level = LOGLEVEL_NOTICE)
{
//ZahlungsLog::add($this->moduleID, $msg, $data, $level);
ZahlungsLog::add($this->moduleID, "[" . microtime(true) . " - " . $_SERVER['PHP_SELF'] . "] " . $msg, $data, $level);
ZahlungsLog::add($this->moduleID, "[" . $_SERVER['PHP_SELF'] . "] " . $msg, $data, $level);

return $this;
}
Expand Down Expand Up @@ -505,22 +505,12 @@ public function handleNotification($order, $hash, $args)
*/
public function finalizeOrder($order, $hash, $args)
{

$result = false;
try {
if ($oZahlungSession = self::getZahlungSession(md5($hash))) {
if ((int)$oZahlungSession->kBestellung <= 0) {

$logData = '$' . $args['id'];
$GLOBALS['mollie_notify_lock'] = new \ws_mollie\ExclusiveLock('mollie_' . $args['id'], PFAD_ROOT . PFAD_COMPILEDIR);
if ($GLOBALS['mollie_notify_lock']->lock()) {
$this->doLog("JTLMollie::finalizeOrder::locked ({$args['id']})", $logData, LOGLEVEL_DEBUG);
} else {
$this->doLog("JTLMollie::finalizeOrder::locked failed ({$args['id']})", $logData, LOGLEVEL_ERROR);
}

$oOrder = self::API()->orders->get($args['id'], ['embed' => 'payments']);

$logData = '$' . $oOrder->id;
$result = in_array($oOrder->status, [OrderStatus::STATUS_PAID, OrderStatus::STATUS_AUTHORIZED, OrderStatus::STATUS_PENDING, OrderStatus::STATUS_COMPLETED]);
$this->doLog('JTLMollie::finalizeOrder (' . ($result ? 'true' : 'false') . ')<br/><pre>' . print_r([$hash, $args, $oOrder], 1) . '</pre>', $logData, LOGLEVEL_DEBUG);
//Payment::updateFromPayment($oMolliePayment, $order->kBestellung);
Expand Down
Loading

0 comments on commit e169f42

Please sign in to comment.