Commit ab568828 authored by Marcel's avatar Marcel
Browse files

Aktuelle Version 1.0

parent 7b232a11
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Known issues]
- SecureFields do not initialize when opening the checkout additional step a second time
## [Unreleased]
- Fixed a typo which lead to bill payments not working properly
- Fixed texts that sometimes used CrefoPayment and sometimes CrefoPay
- Fixed typo in the provider of the payment methods
- Added the installer SQL script
- Added english defaults for the translatable strings
- Credit cards can not be registered, therefore a checkout with credit cards is not possible
## [1.0.0] - 2019-05-10
- Initial release
\ No newline at end of file
......@@ -3,4 +3,7 @@
Bindet die Zahlungsarten von CrefoPay in den Checkout des JTL-Shop ein
### Freigegebene JTL-Shop-Versionen
- JTL-Shop 4: ab 4.05
\ No newline at end of file
- JTL-Shop 4: ab 4.05
### Änderungen
Alle Änderungen am Plugin werden im CHANGELOG.md festgehalten.
\ No newline at end of file
......@@ -17,6 +17,7 @@
<Hook id="8">lfs_crefopayment_hooks.php</Hook>
<Hook id="10">lfs_crefopayment_hooks.php</Hook>
<Hook id="132">lfs_crefopayment_hooks.php</Hook>
<Hook id="140">lfs_crefopayment_hooks.php</Hook>
<Hook id="207">lfs_crefopayment_hooks.php</Hook>
</Hooks>
<Locales>
......@@ -128,6 +129,30 @@
<VariableLocalized iso="GER">Ihre Zahlungsart wird registriert, sie werden in Krze weitergeleitet.</VariableLocalized>
<VariableLocalized iso="ENG">We're registering your payment, you'll be redirected shortly.</VariableLocalized>
</Variable>
<Variable>
<Name>cfp_payment_payment_error_header</Name>
<Description>Hinweis auf Fehler bei Zahlung</Description>
<VariableLocalized iso="GER">Achtung!</VariableLocalized>
<VariableLocalized iso="ENG">Attention!</VariableLocalized>
</Variable>
<Variable>
<Name>cfp_payment_payment_error</Name>
<Description>Hinweis auf Fehler bei Zahlung</Description>
<VariableLocalized iso="GER">Ihre Zahlung konnte nicht durchgefhrt werden! Bitte nehmen Sie Kontakt mit unserem Kundenservice auf!</VariableLocalized>
<VariableLocalized iso="ENG">Your payment could not be made! Please contact our customer service!</VariableLocalized>
</Variable>
<Variable>
<Name>cfp_payment_paymentmethod_not_available</Name>
<Description>Hinweis das Zahlungsart nicht verfgbar ist</Description>
<VariableLocalized iso="GER">Die gewnschte Zahlungsart steht leider nicht zur Verfgung. Bitte whlen Sie eine andere Zahlungsart.</VariableLocalized>
<VariableLocalized iso="ENG">The desired payment method is unfortunately not available. Please choose another payment method.</VariableLocalized>
</Variable>
<Variable>
<Name>cfp_payment_button_paymentselection</Name>
<Description>Beschriftung fr Button der zur Zahlungsartauswahl fhrt</Description>
<VariableLocalized iso="GER">Bitte whlen Sie eine andere Zahlungsart aus.</VariableLocalized>
<VariableLocalized iso="ENG">Please select another payment method.</VariableLocalized>
</Variable>
</Locales>
<PaymentMethod>
<Method>
......@@ -361,5 +386,12 @@
<priority>5</priority>
</file>
</CSS>
<JS>
<file>
<name>lfs_crefopay.js</name>
<priority>5</priority>
<position>body</position>
</file>
</JS>
</Install>
</jtlshop3plugin>
\ No newline at end of file
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
......@@ -3,17 +3,23 @@ global $cHinweis, $cFehler;
Shop::Smarty()->assign('cfp_update_url', Shop::getURL()."/cfp_update");
$capture_workflow_params = "Action=capture";
$capture_workflow_params .= "&merchantid=".$oPlugin->oPluginEinstellungAssoc_arr["crefopayment_merchant_id"];
$capture_workflow_params .= "&storeid=".$oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"];
$capture_workflow_params .= "&Rechnungsnummer={{ Vorgang.Auftrag.Rechnung.Rechnungsnummer }}&orderid={{ Vorgang.Auftrag.Rechnung.Zahlungen.ErstesObjekt.ExterneTransaktionsID }}&amount={{ Vorgang.Auftrag.Rechnung.Gesamtbetrag }}";
$capture_workflow_params = "{% capture query -%}
SELECT cValue FROM tBestellungAttribute
JOIN tBestellung ON tBestellung.kBestellung = tBestellungAttribute.kBestellung
WHERE tBestellung.cBestellNr = '{{ Vorgang.Auftrag.Auftragsnummer }}'
AND tBestellungAttribute.cName = 'crefopay_orderid'
{% endcapture -%}
{% assign crefopay_orderid = query | DirectQueryScalar %}{% if crefopay_orderid != null %}Action=capture&merchantid=".$oPlugin->oPluginEinstellungAssoc_arr["crefopayment_merchant_id"]."&storeid=".$oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"]."&Rechnungsnummer={{ Vorgang.Auftrag.Rechnung.Rechnungsnummer }}&orderid={{ crefopay_orderid }}&amount={{ Vorgang.Auftrag.Gesamtbruttopreis }}{% endif %}";
Shop::Smarty()->assign('capture_workflow_params', $capture_workflow_params);
$cancel_workflow_params = "Action=cancel";
$cancel_workflow_params .= "&merchantid=".$oPlugin->oPluginEinstellungAssoc_arr["crefopayment_merchant_id"];
$cancel_workflow_params .= "&storeid=".$oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"];
$cancel_workflow_params .= "&bestellnr={{ Vorgang.Stammdaten.ExterneAuftragsnummer }}";
$cancel_workflow_params = "{% capture query -%}
SELECT cValue FROM tBestellungAttribute
JOIN tBestellung ON tBestellung.kBestellung = tBestellungAttribute.kBestellung
WHERE tBestellung.cBestellNr = '{{ Vorgang.Stammdaten.Auftragsnummer }}'
AND tBestellungAttribute.cName = 'crefopay_orderid'
{% endcapture -%}
{% assign crefopay_orderid = query | DirectQueryScalar %}{% if crefopay_orderid != null %}Action=cancel&merchantid=" . $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_merchant_id"] . "&storeid=".$oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"]."&bestellnr={{crefopay_orderid}}{% endif %}";
Shop::Smarty()->assign('cancel_workflow_params', $cancel_workflow_params);
......
......@@ -148,7 +148,7 @@ class cfpHelper
// Initiate cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ($this->mode==='live')?$this->getLiveSystemUrl():$this->getSandBoxUrl().$endpoint);
curl_setopt($ch, CURLOPT_URL, ($this->mode==='live')?$this->getLiveSystemUrl().$endpoint:$this->getSandBoxUrl().$endpoint);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Disable the SSL Verification if you're testing locally
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
......@@ -189,8 +189,10 @@ class cfpHelper
unset($_SESSION['cfp_reserved']);
$orderId = uniqid($this->oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"]."_");
$tmpAmount = 0;
$tmpBasketItems = [];
foreach ($_SESSION['Warenkorb']->PositionenArr as $pos) {
$tmpAmount += round((($pos->fPreisEinzelNetto/100)*(100+$_SESSION['Steuersatz'][$pos->kSteuerklasse])*$pos->nAnzahl)*100,2);
$item = [];
$item['basketItemText'] = utf8_encode($pos->cName[$_SESSION['cISOSprache']]);
$item['basketItemCount'] = $pos->nAnzahl;
......@@ -226,7 +228,7 @@ class cfpHelper
'name' => utf8_encode($_SESSION['Kunde']->cVorname),
'surname' => utf8_encode($_SESSION['Kunde']->cNachname),
'email' => utf8_encode($_SESSION['Kunde']->cMail),
'salutation' => strtoupper($_SESSION['Kunde']->cAnrede)
'salutation' => (strtoupper($_SESSION['Kunde']->cAnrede)=="M")?"M":"F"
];
if ($_SESSION['Kunde']->dGeburtstag != "0000-00-00" && $_SESSION['Kunde']->dGeburtstag != "00.00.0000" && $_SESSION['Kunde']->dGeburtstag != "" && !is_null($_SESSION['Kunde']->dGeburtstag)) {
......@@ -234,7 +236,8 @@ class cfpHelper
}
if ($_SESSION['Kunde']->cTel != "" && !is_null($_SESSION['Kunde']->cTel)) {
$userData['phoneNumber'] = preg_replace('/[^0-9]/', '', $_SESSION['Kunde']->cTel);
$tmpPhone = preg_replace('/[^0-9]/', '', $_SESSION['Kunde']->cTel);
$userData['phoneNumber'] = ($tmpPhone[0] != "0")?"00".$tmpPhone:$tmpPhone;
}
$param = array(
......@@ -278,18 +281,24 @@ class cfpHelper
'userType' => 'PRIVATE'
);
$result = $this->callCfpApi("createTransaction", $param);
if ($tmpAmount > 0) {
$result = $this->callCfpApi("createTransaction", $param);
if ($result->resultCode === 0) {
$_SESSION['cfp_orderId'] = $orderId;
$_SESSION['cfp_paymentmethods'] = $result->allowedPaymentMethods;
$_SESSION['cfp_paymentinstruments'] = $result->allowedPaymentInstruments;
$_SESSION['cfp_additionalInformation'] = $result->additionalInformation;
$_SESSION['cfp_result'] = $result;
return true;
if ($result->resultCode === 0) {
$_SESSION['cfp_orderId'] = $orderId;
$_SESSION['cfp_paymentmethods'] = $result->allowedPaymentMethods;
$_SESSION['cfp_paymentinstruments'] = $result->allowedPaymentInstruments;
$_SESSION['cfp_additionalInformation'] = $result->additionalInformation;
$_SESSION['cfp_result'] = $result;
return true;
}
else {
Jtllog::writeLog($this->oPlugin->cPluginID . ": " . $this->mapErrorCode($result->resultCode), JTLLOG_LEVEL_ERROR);
return false;
}
}
else {
Jtllog::writeLog($this->oPlugin->cPluginID . ": " . $this->mapErrorCode($result->resultCode), JTLLOG_LEVEL_ERROR);
Jtllog::writeLog($this->oPlugin->cPluginID . ": Amount less than 0 - no transaction created", JTLLOG_LEVEL_ERROR);
return false;
}
}
......@@ -330,6 +339,13 @@ class cfpHelper
if ($result->resultCode <= 1 && $result !== false) {
$_SESSION['cfp_reserved'] = true;
$_SESSION['payment_reserved'] = $aPost_arr['orderId'];
$oReserveInsert = new stdClass();
$oReserveInsert->cfp_orderid = $aPost_arr['orderId'];
$oReserveInsert->created_at = date('Y-m-d H:i:s', time());
Shop::DB()->insertRow("xplugin_lfs_crefopayment_paymentreservelog", $oReserveInsert);
return $result;
}
else {
......@@ -438,6 +454,54 @@ class cfpHelper
Shop::DB()->insert('tzahlungseingang', $model);
}
public function cancelOrder($cfp_orderid = null)
{
// Cancel single order
if (!is_null($cfp_orderid)) {
$param = array(
'merchantID' => $this->oPlugin->oPluginEinstellungAssoc_arr["crefopayment_merchant_id"],
'storeID' => $this->oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"],
'orderID' => $cfp_orderid
);
$result = $this->callCfpApi("cancel", $param);
if ($result->resultCode == 0 && $result !== false) {
// Order canceled -- Delete reservelog-db-entry if exists
Shop::DB()->delete("xplugin_lfs_crefopayment_paymentreservelog", "cfp_orderid", $cfp_orderid);
}
else {
Jtllog::writeLog("Crefopay: Cancel - " . $this->oPlugin->cPluginID . ": " . $this->mapErrorCode($result->resultCode) . " - " . print_r($param,1) . " - " . print_r($_POST,1), JTLLOG_LEVEL_DEBUG);
}
}
else {
$oPaymentreserve_arr = Shop::DB()->executeQuery("SELECT cfp_orderid
FROM xplugin_lfs_crefopayment_paymentreservelog
WHERE created_at > DATE_SUB(NOW(), INTERVAL 10 MINUTE)
ORDER BY created_at DESC",2);
if (is_array($oPaymentreserve_arr) && count($oPaymentreserve_arr)>0) {
foreach ($oPaymentreserve_arr as $reserve) {
$param = array(
'merchantID' => $this->oPlugin->oPluginEinstellungAssoc_arr["crefopayment_merchant_id"],
'storeID' => $this->oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"],
'orderID' => $reserve->cfp_orderid
);
$result = $this->callCfpApi("cancel", $param);
if ($result->resultCode == 0 && $result !== false) {
// Order canceled -- Delete reservelog-db-entry if exists
Shop::DB()->delete("xplugin_lfs_crefopayment_paymentreservelog", "cfp_orderid", $reserve->cfp_orderid);
}
else {
Jtllog::writeLog("Crefopay: Cancel - " . $this->oPlugin->cPluginID . ": " . $this->mapErrorCode($result->resultCode) . " - " . print_r($param,1) . " - " . print_r($_POST,1), JTLLOG_LEVEL_DEBUG);
}
}
}
}
}
private function checkProductRisk($artikel)
{
if (!is_null($artikel) && (isset($artikel->FunktionsAttribute) && is_array($artikel->FunktionsAttribute))) {
......
File mode changed from 100755 to 100644
......@@ -4,7 +4,7 @@ require_once $oPlugin->cFrontendPfad."/classes/cfpHelper.php";
$cfpHelper = new cfpHelper($oPlugin);
if (strpos($_SESSION['Zahlungsart']->cModulId, "crefopay") !== false) {
if (!isset($_SESSION['cfp_reserved'])) {
if (!isset($_SESSION['cfp_paymentinfo_set'])) {
header("Location: " . Shop::getURL()."/bestellvorgang.php?editZahlungsart=1");
}
}
\ No newline at end of file
<?php
require_once $oPlugin->cFrontendPfad."/classes/cfpHelper.php";
$cfpHelper = new cfpHelper($oPlugin);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$settings = Shopsetting::getInstance();
require_once(PFAD_ROOT . PFAD_INCLUDES . "mailTools.php");
require_once $oPlugin->cFrontendPfad."/classes/cfpHelper.php";
$cfpHelper = new cfpHelper($oPlugin);
if (isset($_POST['action']) && $_POST['action'] == "cfp_reserve" && isset($_SESSION['reserveData'])) {
$_SESSION['cfp_reservecall'] = time();
$oReturn = [];
$aPost_arr = (array)json_decode($_SESSION['reserveData']);
$result = $cfpHelper->reservePayment($aPost_arr);
if ($result !== null) {
$_SESSION['cfp_paymentreserved'] = true;
$oReturn['success'] = true;
$oInsert = new stdClass();
$oInsert->cfp_orderid = $aPost_arr['orderId'];
$oInsert->kBestellung = 0;
$oInsert->transaction_state = "NEW";
$oInsert->order_state = "PAYPENDING";
$oInsert->created_at = date('Y-m-d H:i:s', time());
$oInsert->updated_at = date('Y-m-d H:i:s', time());
Shop::DB()->insertRow("xplugin_lfs_crefopayment_orders", $oInsert);
if ($result->resultCode == 0) {
// Keine Weiterleitung zur Besttigung erforderlich
$oReturn['cfp_redirectUrl'] = "";
}
else {
// Weiterleitung zur Besttigung erforderlich
$oReturn['cfp_redirectUrl'] = $result->redirectUrl;
}
}
else {
$oReturn['success'] = false;
$oInsert = new stdClass();
$oInsert->cfp_orderid = $aPost_arr['orderId'];
$oInsert->kBestellung = 0;
$oInsert->transaction_state = "NEW";
$oInsert->order_state = "PAYMENTFAILED";
$oInsert->created_at = date('Y-m-d H:i:s', time());
$oInsert->updated_at = date('Y-m-d H:i:s', time());
Shop::DB()->insert('xplugin_lfs_crefopayment_orders', $oInsert);
}
header('Content-type: application/json');
print json_encode($oReturn);
die();
}
// Handle notifications by Crefopay-MNS
if (isset($_POST['merchantID']) && $_POST['merchantID'] === $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_merchant_id"]
&& isset($_POST['storeID']) && $_POST['storeID'] === $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"])
{
Jtllog::writeLog("Crefopay: Notification-Call " . print_r($_POST,1), JTLLOG_LEVEL_DEBUG);
$tmpCfpOrderData = Shop::DB()->selectSingleRow("xplugin_lfs_crefopayment_orders", "cfp_orderid", $_POST['orderID']);
if (is_object($tmpCfpOrderData)) {
Jtllog::writeLog("Crefopay: Notification-Call - Order found", JTLLOG_LEVEL_DEBUG);
if ($_POST['orderStatus'] != "")
$tmpCfpOrderData->order_state = $_POST['orderStatus'];
......@@ -32,19 +77,23 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$oInsert->updated_at = date('Y-m-d H:i:s', time());
Shop::DB()->insertRow("xplugin_lfs_crefopayment_log", $oInsert);
Jtllog::writeLog("Crefopay: Notification-Call - Bestellung " . print_r($tmpCfpOrderData, 1), JTLLOG_LEVEL_DEBUG);
if ($tmpCfpOrderData->kBestellung > 0) {
Jtllog::writeLog("Crefopay: Notification-Call - Bestellung found", JTLLOG_LEVEL_DEBUG);
$tmpOrder = new Bestellung($tmpCfpOrderData->kBestellung);
if ($tmpOrder->cStatus != 3 && $tmpOrder->dBezahltDatum == '0000-00-00') {
if ($tmpCfpOrderData->transaction_state == "MERCHANTPENDING") {
$tmpKunde = new Kunde($tmpOrder->kKunde);
$tmpOrder->dBezahltDatum = date('Y-m-d', time());
if ($tmpOrder->cStatus < 3)
$tmpOrder->cStatus = 3;
$tmpOrder->updateInDB();
$cfpHelper->savePayment($tmpCfpOrderData, $tmpOrder, $tmpKunde);
if (strstr($tmpOrder->cZahlungsartName, "PayPal") || strstr($tmpOrder->cZahlungsartName, "Kreditkarte") || strstr($tmpOrder->cZahlungsartName, "Sofort")) {
Jtllog::writeLog("Crefopay: Notification-Call - Set payment", JTLLOG_LEVEL_DEBUG);
if ($tmpOrder->cStatus != 3 && $tmpOrder->dBezahltDatum == '0000-00-00') {
if ($tmpCfpOrderData->transaction_state == "MERCHANTPENDING") {
$tmpKunde = new Kunde($tmpOrder->kKunde);
$tmpOrder->dBezahltDatum = date('Y-m-d', time());
if ($tmpOrder->cStatus < 3)
$tmpOrder->cStatus = 3;
$tmpOrder->updateInDB();
$cfpHelper->savePayment($tmpCfpOrderData, $tmpOrder, $tmpKunde);
}
}
}
}
......@@ -90,22 +139,10 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
}
if ($_POST['Action'] == "cancel" && $cfpHelper->checkMerchantAndStoreId($_POST['merchantid'], $_POST['storeid'])) {
$tmpBestellung = Shop::DB()->selectSingleRow("tbestellung", "cBestellNr", $_POST['bestellnr']);
$tmpCfpOrderData = Shop::DB()->selectSingleRow("xplugin_lfs_crefopayment_orders", "kBestellung", $tmpBestellung->kBestellung);
$tmpCfpOrderData = Shop::DB()->selectSingleRow("xplugin_lfs_crefopayment_orders", "cfp_orderid", $_POST['bestellnr']);
if (!is_null($tmpCfpOrderData)) {
$param = array(
'merchantID' => $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_merchant_id"],
'storeID' => $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"],
'orderID' => $tmpCfpOrderData->orderId,
'captureID' => $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"]."-".$_POST['Rechnungsnummer']
);
$result = $cfpHelper->callCfpApi("cancel", $param);
if ($result->resultCode > 0 && $result !== false) {
Jtllog::writeLog($oPlugin->cPluginID . ": " . $cfpHelper->mapErrorCode($result->resultCode) . " - " . print_r($param,1) . " - " . print_r($_POST,1), JTLLOG_LEVEL_ERROR);
}
$cfpHelper->cancelOrder($tmpCfpOrderData->cfp_orderid);
}
http_response_code(200);
......
<?php
if (Shop::getPageType() == PAGE_BESTELLVORGANG) {
require_once $oPlugin->cFrontendPfad."/classes/cfpHelper.php";
$cfpHelper = new cfpHelper($oPlugin);
Shop::Smarty()->assign('cfp_oPlugin', $oPlugin);
if (file_exists($oPlugin->cFrontendPfad."/template/crefopay_overlay_custom.tpl")) {
$overlayTpl = Shop::Smarty()->fetch($oPlugin->cFrontendPfad."/template/crefopay_overlay_custom.tpl");
}
else {
$overlayTpl = Shop::Smarty()->fetch($oPlugin->cFrontendPfad."/template/crefopay_overlay.tpl");
}
pq("body")->append($overlayTpl);
if (isset($_SESSION['cfp_reservecall']) && isset($_SESSION['cfp_paymentreserved'])) {
if (file_exists($oPlugin->cFrontendPfad."/template/crefopay_checkout_js_custom.tpl")) {
$adviceTpl = Shop::Smarty()->fetch($oPlugin->cFrontendPfad."/template/crefopay_checkout_js_custom.tpl");
}
else {
$adviceTpl = Shop::Smarty()->fetch($oPlugin->cFrontendPfad."/template/crefopay_checkout_js.tpl");
}
pq("#checkout > div")->prepend($adviceTpl);
}
if (isset($_SESSION['Zahlungsart']) && is_object($_SESSION['Zahlungsart'])) {
$cfp_marker = '<input type="hidden" id="is_cfp_payment" value="';
if (strpos($_SESSION['Zahlungsart']->cModulId, "crefopay") !== false) {
$cfp_marker .= '1">';
}
else {
$cfp_marker .= '0">';
}
pq("body")->append($cfp_marker);
}
}
\ No newline at end of file
......@@ -15,6 +15,16 @@ if ( (strstr($tmpOrder->cZahlungsartName, "Crefopay") || strstr($tmpOrder->cZahl
Shop::DB()->updateRow("xplugin_lfs_crefopayment_orders", "cfp_orderid", $_SESSION['cfp_orderId'], $oUpdate);
$bestellAttribut = new stdClass();
$bestellAttribut->kBestellung = $tmpOrder->kBestellung;
$bestellAttribut->cName = 'crefopay_orderid';
$bestellAttribut->cValue = $_SESSION['cfp_orderId'];
Shop::DB()->insert('tbestellattribut', $bestellAttribut);
// unset payment reserve marker and delete db entry
Shop::DB()->delete("xplugin_lfs_crefopayment_paymentreservelog", "cfp_orderid", $_SESSION['payment_reserved']);
unset($_SESSION['payment_reserved']);
$param = array(
'merchantID' => $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_merchant_id"],
'storeID' => $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"],
......@@ -24,6 +34,7 @@ if ( (strstr($tmpOrder->cZahlungsartName, "Crefopay") || strstr($tmpOrder->cZahl
$cfpStatus = $cfpHelper->callCfpApi('getTransactionStatus', $param);
if ($cfpStatus !== false) {
Jtllog::writeLog("Crefopay: Status erhalten - " . print_r($cfpStatus,1), JTLLOG_LEVEL_DEBUG);
if ($cfpStatus->transactionStatus == "MERCHANTPENDING") {
// Wenn der Status passt --> Bestellung als bezahlt markieren
if ($cfpStatus->transactionStatus != "")
......@@ -32,21 +43,27 @@ if ( (strstr($tmpOrder->cZahlungsartName, "Crefopay") || strstr($tmpOrder->cZahl
if ($cfpStatus->transactionStatus != "")
Shop::DB()->updateRow("xplugin_lfs_crefopayment_orders", "cfp_orderid", $tmpCfpOrderData->orderId, $tmpCfpOrderData);
if ($tmpOrder->cStatus != 3 && $tmpOrder->dBezahltDatum == '0000-00-00') {
if ($tmpCfpOrderData->transaction_state == "MERCHANTPENDING") {
$tmpKunde = new Kunde($tmpOrder->kKunde);
$tmpOrder->dBezahltDatum = date('Y-m-d', time());
if ($tmpOrder->cStatus < 3)
$tmpOrder->cStatus = 3;
$tmpOrder->updateInDB();
if (strstr($tmpOrder->cZahlungsartName, "PayPal") || strstr($tmpOrder->cZahlungsartName, "Kreditkarte") || strstr($tmpOrder->cZahlungsartName, "Sofort")) {
Jtllog::writeLog("Crefopay: Zahlungsart ist PayPal, Kreditkarte oder Sofort", JTLLOG_LEVEL_DEBUG);
if ($tmpOrder->cStatus != 3 && $tmpOrder->dBezahltDatum == '0000-00-00') {
if ($tmpCfpOrderData->transaction_state == "MERCHANTPENDING") {
$tmpKunde = new Kunde($tmpOrder->kKunde);
$tmpOrder->dBezahltDatum = date('Y-m-d', time());
if ($tmpOrder->cStatus < 3)
$tmpOrder->cStatus = 3;
$tmpOrder->updateInDB();
$cfpHelper->savePayment($tmpCfpOrderData, $tmpOrder, $tmpKunde);
$cfpHelper->savePayment($tmpCfpOrderData, $tmpOrder, $tmpKunde);
}
}
}
}
}
}
}
unset($_SESSION['cfp_orderId']);
unset($_SESSION['cfp_result']);
\ No newline at end of file
unset($_SESSION['cfp_orderId']);
unset($_SESSION['cfp_result']);
unset($_SESSION['cfp_kBestellung']);
unset($_SESSION['cfp_reservecall']);
unset($_SESSION['cfp_paymentreserved']);
}
}
\ No newline at end of file
......@@ -2,7 +2,9 @@
require_once $oPlugin->cFrontendPfad."/classes/cfpHelper.php";
$cfpHelper = new cfpHelper($oPlugin);
unset($_SESSION['cfp_paymentinfo_set']);
unset($_SESSION['cfp_reservecall']);
unset($_SESSION['cfp_paymentreserved']);
$_SESSION['cfp_userIdUnreg'] = rand(50,500) . '_' . $_SESSION['Kunde']->cMail;
if ($cfpHelper->createTransaction()) {
Shop::Smarty()->assign('orderId', $_SESSION['cfp_orderId']);
......
<?php
if (version_compare(Shop::getShopVersion(), 405, "<=")) {
unset($_SESSION['cfp_paymentinfo_set']);
unset($_SESSION['cfp_reservecall']);
unset($_SESSION['cfp_paymentreserved']);
require_once $oPlugin->cFrontendPfad . "/classes/cfpHelper.php";
$cfpHelper = new cfpHelper($oPlugin);
......
$('#complete-order-button').on("click", function (e) {
e.preventDefault();
if ($('#is_cfp_payment').val() === "1") {
$(this).attr("disabled", "disabled");
$.ajax({
type: 'POST',
url: '/',
data: {action: 'cfp_reserve'},
success: function (data) {
if (data.success === true) {
if (data.cfp_redirectUrl === "") {
// No redirect needed
cfp_placeorder();
}
else {
window.location = data.cfp_redirectUrl;
}
} else {
$('#modalCrefopayInfo').modal();
}
},
error: function (data) {
$('#modalCrefopayInfo').modal();
},
dataType: 'json'
});
}
else {
$('#complete_order').submit();
}
});
function cfp_placeorder() {
$('#complete-order-button').hide();
$('#complete_order').submit();
}
\ No newline at end of file
File mode changed from 100755 to 100644
<p class="bg-danger">{$cfp_oPlugin->oPluginSprachvariableAssoc_arr.cfp_payment_paymentmethod_not_available}</p>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment