Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Commit

Permalink
Merge pull request #11 from heidelpay/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
bnoobbnoob committed Aug 29, 2018
2 parents 6d8ccf1 + b6401be commit b3532b7
Show file tree
Hide file tree
Showing 29 changed files with 180 additions and 173 deletions.
22 changes: 18 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,35 @@

##114

###18.06.26
### 18.08.29
#### Fixed
- spaces in front or after payment credentials, caused the transaction to fail.
- Secured invoice was not disabled after customer was denied by insurance provider.
- Error mail was sent when automatic finalize failed because Reservation was already
finalized.
- function getCurrentVersion used to set the SHOPMODULE.VERSION can
cause an exception

#### Changed
- iFrame language can now be different from "EN" and "DE" and therefore also allows
other languages for the iFrame.
- allow installation in directory name other than "heidelpay_standard"

### 18.06.26

###Added
#### Added
- basket for secured invoice and secured direct debit to increase the acceptance rate of the insurance provider.
- info about the used shop and plugin version are in the payment request.
- support for asynchronously incoming payments via push notification.
- send uniqueId to WAWI for an easier way to map the payment transactions.

###Changed
#### Changed
- secured invoice is no longer available for the time of the actual session after user was denied by insurance provider.
That behaviour should avoid repetitive payment requests which will fail.
- "sofortueberweisung" was renamed "Sofort". (Reconfiguration necessary)
- Heidelberger Payment GmbH was renamed heidelpay GmbH.

###Fixed
####Fixed
- added Switch for secured direct debit to choose between booking modes authorize and debit(default).

## v113
Expand Down
172 changes: 72 additions & 100 deletions version/113/frontend/heidelpay.hook181.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
*/



require_once PFAD_ROOT . PFAD_PLUGIN . 'heidelpay_standard/vendor/autoload.php';
require_once __DIR__.'/xmlQuery.php';
require_once __DIR__ . '/xmlQuery.php';

use Heidelpay\XmlQuery;

Expand All @@ -19,138 +18,111 @@


$oBestellung = Shop::DB()->query(
"SELECT tbestellung.kBestellung, tzahlungsart.cModulId
"SELECT tbestellung.kBestellung, tzahlungsart.cModulId
FROM tbestellung
LEFT JOIN tzahlungsart ON tbestellung.kZahlungsart = tzahlungsart.kZahlungsart
WHERE tbestellung.kBestellung = '" . (int)$args_arr['oBestellung']->kBestellung . "'
LIMIT 1", 1
);

$_query_live_url = 'https://heidelpay.hpcgw.net/TransactionCore/xml';
$_query_sandbox_url = 'https://test-heidelpay.hpcgw.net/TransactionCore/xml';

if ($oPlugin->oPluginEinstellungAssoc_arr [$oBestellung->cModulId. '_transmode'] == 'LIVE'){

$url = $_query_live_url;

}else{

$url = $_query_sandbox_url;
};



// if Versand oder Teilversand - Status s. defines_inc.php
);

$payMethod = explode("_", $oBestellung->cModulId);
$_query_live_url = 'https://heidelpay.hpcgw.net/TransactionCore/xml';
$_query_sandbox_url = 'https://test-heidelpay.hpcgw.net/TransactionCore/xml';

if(($args_arr['status'] === 4 OR $args_arr['status'] === 5 ) AND $payMethod['2'] === 'heidelpaygesicherterechnungplugin' ){
if ($oPlugin->oPluginEinstellungAssoc_arr [$oBestellung->cModulId . '_transmode'] == 'LIVE') {
$url = $_query_live_url;
} else {

preg_match('/[0-9]{4}\.[0-9]{4}\.[0-9]{4}/', $args_arr['oBestellung']->cKommentar, $result);
$url = $_query_sandbox_url;
};


if(!empty($result[0])){
// if Versand oder Teilversand - Status s. defines_inc.php


$xml_params = array(
"type" => "STANDARD",
"methods" => array("IV"),
"types" => array("PA"),
"identification" => $result,
"procRes" => "ACK",
"transType" => "PAYMENT"
$payMethod = explode("_", $oBestellung->cModulId);

);
if (($args_arr['status'] === 4 OR $args_arr['status'] === 5) AND $payMethod['2'] === 'heidelpaygesicherterechnungplugin') {

preg_match('/[0-9]{4}\.[0-9]{4}\.[0-9]{4}/', $args_arr['oBestellung']->cKommentar, $result);


$xml_params_fin = array(
"type" => "LINKED_TRANSACTIONS",
"methods" => array("IV"),
"types" => array("FI"),
"identification" => $result,
"procRes" => "ACK",
"transType" => "PAYMENT"
if (!empty($result[0])) {

);
$xml_params = array(
"type" => "STANDARD",
"methods" => array("IV"),
"types" => array("PA"),
"identification" => $result,
"procRes" => "ACK",
"transType" => "PAYMENT"

);


$xml_params_fin = array(
"type" => "LINKED_TRANSACTIONS",
"methods" => array("IV"),
"types" => array("FI"),
"identification" => $result,
"procRes" => "ACK",
"transType" => "PAYMENT"



$sandboxMode = 1;

$xmlQueryClass = new XmlQuery();
);
$sandboxMode = 1;

$config = array(
"sandbox" => $sandboxMode,
"security_sender" => $oPlugin->oPluginEinstellungAssoc_arr ['sender'],
"user_login" => $oPlugin->oPluginEinstellungAssoc_arr ['user'],
"user_password" => $oPlugin->oPluginEinstellungAssoc_arr ['pass']
);
$xmlQueryClass = new XmlQuery();

$resLinkedTxn = $xmlQueryClass->doRequest(array('load' => urlencode($xmlQueryClass->getXMLRequest($config, $xml_params_fin))), $url);

$config = array(
"sandbox" => $sandboxMode,
"security_sender" => $oPlugin->oPluginEinstellungAssoc_arr ['sender'],
"user_login" => $oPlugin->oPluginEinstellungAssoc_arr ['user'],
"user_password" => $oPlugin->oPluginEinstellungAssoc_arr ['pass']
);

$resLinkedTxn = $xmlQueryClass->doRequest(array('load' => urlencode($xmlQueryClass->getXMLRequest($config, $xml_params_fin))), $url);

$resLinkedTxnXMLObject = new SimpleXMLElement($resLinkedTxn);

$resLinkedTxnXMLObject = new SimpleXMLElement($resLinkedTxn);
$resLinkedTxnCount = (string)$resLinkedTxnXMLObject->Result['count'];

//check if FI already exists, if so stop executing
foreach ($resLinkedTxnXMLObject->Result->Transaction as $key => $val) {


$resLinkedTxnCount = (string)$resLinkedTxnXMLObject->Result['count'];

//check if FI already exists, if so stop executing
foreach ($resLinkedTxnXMLObject->Result->Transaction as $key => $val) {

if((string)$val->Payment['code'] == 'IV.FI'){
return;
}
};


//if PA and other transactions (not FI) exist, do finalize
if($resLinkedTxnCount >= 1){
if ((string)$val->Payment['code'] == 'IV.FI') {
return;
}
}

//if PA and other transactions (not FI) exist, do finalize
if ($resLinkedTxnCount >= 1) {
$res = $xmlQueryClass->doRequest(array('load' => urlencode($xmlQueryClass->getXMLRequest($config, $xml_params))), $url);

$resXMLObject = new SimpleXMLElement($res);

$res = $xmlQueryClass->doRequest(array('load' => urlencode($xmlQueryClass->getXMLRequest($config, $xml_params))),$url);
$resUniquieId = (string)$resXMLObject->Result->Transaction->Identification->UniqueID;

$resXMLObject = new SimpleXMLElement($res);
$paymentObject = new Heidelpay\PhpPaymentApi\PaymentMethods\InvoiceB2CSecuredPaymentMethod();

$resUniquieId = (string)$resXMLObject->Result->Transaction->Identification->UniqueID;
$paymentObject->getRequest()->authentification(
$oPlugin->oPluginEinstellungAssoc_arr ['sender'],
$oPlugin->oPluginEinstellungAssoc_arr ['user'],
$oPlugin->oPluginEinstellungAssoc_arr ['pass'],
(string)$resXMLObject->Result->Transaction['channel'],
$sandboxMode);

$paymentObject = new Heidelpay\PhpPaymentApi\PaymentMethods\InvoiceB2CSecuredPaymentMethod();
$paymentObject->getRequest()->basketData(
$args_arr['oBestellung']->kBestellung,
$args_arr['oBestellung']->fGesamtsumme,
(string)$resXMLObject->Result->Transaction->Payment->Presentation->Currency,
$args_arr['oBestellung']->cSession);
$paymentObject->finalize($resUniquieId);

$paymentObject->getRequest()->authentification(
$oPlugin->oPluginEinstellungAssoc_arr ['sender'],
$oPlugin->oPluginEinstellungAssoc_arr ['user'],
$oPlugin->oPluginEinstellungAssoc_arr ['pass'],
(string)$resXMLObject->Result->Transaction['channel'],
$sandboxMode);
if ($paymentObject->getResponse()->isError()) {
$errorCode = $paymentObject->getResponse()->getError();
mail($oPlugin->oPluginEinstellungAssoc_arr ['reportErrorMail'], 'heidelpay: Order ID ' . $args_arr['oBestellung']->kBestellung . ' report shipment failed',

$paymentObject->getRequest()->basketData(
$args_arr['oBestellung']->kBestellung,
$args_arr['oBestellung']->fGesamtsumme,
(string)$resXMLObject->Result->Transaction->Payment->Presentation->Currency,
$args_arr['oBestellung']->cSession);
$paymentObject->finalize($resUniquieId);

if ($paymentObject->getResponse()->isError()) {
$errorCode = $paymentObject->getResponse()->getError();
mail($oPlugin->oPluginEinstellungAssoc_arr ['reportErrorMail'],'heidelpay: Order ID '.$args_arr['oBestellung']->kBestellung.' report shipment failed',

'Report shipment for order'.$args_arr['oBestellung']->kBestellung.' in Shop '.Shop::getURL().' failed.
Error messsage: '.print_r($errorCode['message'],1));
'Report shipment for order' . $args_arr['oBestellung']->kBestellung . ' in Shop ' . Shop::getURL() . ' failed.
Error messsage: ' . print_r($errorCode['message'], 1));
}
}




}

}

}
2 changes: 1 addition & 1 deletion version/114/frontend/heidelpay.hook140.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
*
*/
require_once PFAD_ROOT . PFAD_PLUGIN . 'heidelpay_standard/vendor/autoload.php';
require_once PFAD_ROOT . PFAD_PLUGIN . $oPlugin->cVerzeichnis . '/vendor/autoload.php';

use \Heidelpay\MessageCodeMapper\MessageCodeMapper;

Expand Down
46 changes: 25 additions & 21 deletions version/114/frontend/heidelpay.hook181.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@
* @category JTL
*/


require_once PFAD_ROOT . PFAD_PLUGIN . 'heidelpay_standard/vendor/autoload.php';
require_once PFAD_ROOT . PFAD_PLUGIN . $oPlugin->cVerzeichnis . '/vendor/autoload.php';
require_once __DIR__ . '/xmlQuery.php';

use Heidelpay\XmlQuery;

#ini_set('display_errors', 1);
#ini_set('display_startup_errors', 1);
#error_reporting(E_ALL);

$bestellNr = (int)$args_arr['oBestellung']->kBestellung;
$query = "SELECT tbestellung.kBestellung, tzahlungsart.cModulId
FROM tbestellung
Expand All @@ -32,8 +30,10 @@
$_query_sandbox_url = 'https://test-heidelpay.hpcgw.net/TransactionCore/xml';

$url = $_query_sandbox_url;
$sandboxMode = 1;
if ($oPlugin->oPluginEinstellungAssoc_arr [$oBestellung->cModulId . '_transmode'] == 'LIVE') {
$url = $_query_live_url;
$sandboxMode = 0;
}

// if Versand oder Teilversand - Status s. defines_inc.php
Expand All @@ -54,19 +54,16 @@
'transType' => 'PAYMENT'
);

$sandboxMode = 1;

$xmlQueryClass = new XmlQuery();

$config = array(
'sandbox' => $sandboxMode,
'security_sender' => $oPlugin->oPluginEinstellungAssoc_arr ['sender'],
'user_login' => $oPlugin->oPluginEinstellungAssoc_arr ['user'],
'user_password' => $oPlugin->oPluginEinstellungAssoc_arr ['pass']
'security_sender' => trim($oPlugin->oPluginEinstellungAssoc_arr ['sender']),
'user_login' => trim($oPlugin->oPluginEinstellungAssoc_arr ['user']),
'user_password' => trim($oPlugin->oPluginEinstellungAssoc_arr ['pass'])
);

$finalizedOrder = Shop::DB()->select('xplugin_heidelpay_standard_finalize', 'cshort_id', $result[0]);

//if finalize wasn't found in the database, do finalize
if ($finalizedOrder === null) {
$res = $xmlQueryClass->doRequest(
Expand All @@ -81,10 +78,10 @@
$paymentObject = new Heidelpay\PhpPaymentApi\PaymentMethods\InvoiceB2CSecuredPaymentMethod();

$paymentObject->getRequest()->authentification(
$oPlugin->oPluginEinstellungAssoc_arr ['sender'],
$oPlugin->oPluginEinstellungAssoc_arr ['user'],
$oPlugin->oPluginEinstellungAssoc_arr ['pass'],
(string)$resXMLObject->Result->Transaction['channel'],
trim($oPlugin->oPluginEinstellungAssoc_arr ['sender']),
trim($oPlugin->oPluginEinstellungAssoc_arr ['user']),
trim($oPlugin->oPluginEinstellungAssoc_arr ['pass']),
trim((string)$resXMLObject->Result->Transaction['channel']),
$sandboxMode
);

Expand All @@ -96,21 +93,28 @@
);
$paymentObject->finalize($resUniquieId);

if ($paymentObject->getResponse()->isError()) {
$errorCode = $paymentObject->getResponse()->getError();
if ($paymentObject->getResponse()->isError()
&& $paymentObject->getResponse()->getError()['code'] !== '700.400.800'
) {
$error = $paymentObject->getResponse()->getError();
mail(
$oPlugin->oPluginEinstellungAssoc_arr ['reportErrorMail'],
'heidelpay: Order ID ' . $args_arr['oBestellung']->kBestellung . ' report shipment failed',
'Report shipment for order' . $args_arr['oBestellung']->kBestellung . ' in Shop ' .
'Report shipment for order ' . $args_arr['oBestellung']->kBestellung . ' in Shop ' .
Shop::getURL() . ' failed.
Error messsage: ' . print_r($errorCode['message'], 1)
Error messsage: ' . print_r($error['message'], 1)
);
} else {
Shop::DB()->insert('xplugin_heidelpay_standard_finalize', (object)[
'cshort_id' => $result[0],
'kBestellung' => $bestellNr
]);
saveFinalize($result[0], $bestellNr);
}
}
}
}

function saveFinalize($shortId, $bestellNr)
{
Shop::DB()->insert('xplugin_heidelpay_standard_finalize', (object)[
'cshort_id' => $shortId,
'kBestellung' => $bestellNr
]);
}
2 changes: 1 addition & 1 deletion version/114/frontend/pushgw.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @author David Owusu
* @category JTL
*/
require_once PFAD_ROOT . PFAD_PLUGIN . 'heidelpay_standard/version/' . $oPlugin->nVersion . '/paymentmethod/helper/PushNotificationHandler.php';
require_once PFAD_ROOT . PFAD_PLUGIN . $oPlugin->cVerzeichnis . '/version/' . $oPlugin->nVersion . '/paymentmethod/helper/PushNotificationHandler.php';

$xml = file_get_contents("php://input");
$pushHandler = new PushNotificationHandler($xml);
Expand Down
3 changes: 1 addition & 2 deletions version/114/frontend/xmlQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Heidelpay;

require_once PFAD_ROOT . PFAD_PLUGIN . 'heidelpay_standard/vendor/autoload.php';
require_once PFAD_ROOT . PFAD_PLUGIN . $oPlugin->cVerzeichnis . '/vendor/autoload.php';
require_once __DIR__.'/arrayFilter.php';

use \SimpleXMLElement;
Expand All @@ -15,7 +15,6 @@ class XmlQuery{

public function getXMLRequest($config, $xml_params)
{

$arrFilClass = new ArrayFilter();
// filter empty key/value pairs to prevent problems while creating the XML
$xml_params = $arrFilClass->array_filter_recursive($xml_params);
Expand Down
Loading

0 comments on commit b3532b7

Please sign in to comment.