From e9f0d1ae06e60f35b6d0fc33efcb62c46cbf9149 Mon Sep 17 00:00:00 2001 From: Florian Evertz Date: Thu, 8 Feb 2018 16:03:09 +0100 Subject: [PATCH 01/62] Init --- info.xml | 4 + version/114/frontend/arrayFilter.php | 23 + version/114/frontend/heidelpay.hook008.php | 17 + version/114/frontend/heidelpay.hook140.php | 75 ++ version/114/frontend/heidelpay.hook153.php | 14 + version/114/frontend/heidelpay.hook181.php | 142 +++ version/114/frontend/heidelpay_style.css | 179 ++++ version/114/frontend/xmlQuery.php | 115 +++ .../heidelpay_standard.class.php | 858 ++++++++++++++++++ version/114/paymentmethod/returnHPMailStr.php | 167 ++++ .../template/css/hppaymentframe.css | 17 + .../114/paymentmethod/template/heidelpay.png | Bin 0 -> 779 bytes .../template/heidelpay_3dsecure.tpl | 29 + .../template/heidelpay_CreditDebitCard.tpl | 19 + .../template/heidelpay_DirectDebit.tpl | 44 + .../template/heidelpay_InvoiceSec.tpl | 34 + .../template/heidelpay_Santander.tpl | 45 + .../template/heidelpay_ddMail_de.tpl | 36 + .../template/heidelpay_ddMail_en.tpl | 35 + .../template/heidelpay_iDealEPS_Bank.tpl | 28 + .../template/heidelpay_ppMail_de.tpl | 35 + .../template/heidelpay_ppMail_en.tpl | 35 + .../template/js/birthDateAction.js | 27 + .../template/js/creditCardFrame.js | 102 +++ .../template/new_bestellabschluss.tpl | 36 + .../template/old_bestellabschluss.tpl | 25 + 26 files changed, 2141 insertions(+) create mode 100644 version/114/frontend/arrayFilter.php create mode 100644 version/114/frontend/heidelpay.hook008.php create mode 100644 version/114/frontend/heidelpay.hook140.php create mode 100644 version/114/frontend/heidelpay.hook153.php create mode 100644 version/114/frontend/heidelpay.hook181.php create mode 100644 version/114/frontend/heidelpay_style.css create mode 100644 version/114/frontend/xmlQuery.php create mode 100644 version/114/paymentmethod/heidelpay_standard.class.php create mode 100644 version/114/paymentmethod/returnHPMailStr.php create mode 100644 version/114/paymentmethod/template/css/hppaymentframe.css create mode 100644 version/114/paymentmethod/template/heidelpay.png create mode 100644 version/114/paymentmethod/template/heidelpay_3dsecure.tpl create mode 100644 version/114/paymentmethod/template/heidelpay_CreditDebitCard.tpl create mode 100644 version/114/paymentmethod/template/heidelpay_DirectDebit.tpl create mode 100644 version/114/paymentmethod/template/heidelpay_InvoiceSec.tpl create mode 100644 version/114/paymentmethod/template/heidelpay_Santander.tpl create mode 100644 version/114/paymentmethod/template/heidelpay_ddMail_de.tpl create mode 100644 version/114/paymentmethod/template/heidelpay_ddMail_en.tpl create mode 100644 version/114/paymentmethod/template/heidelpay_iDealEPS_Bank.tpl create mode 100644 version/114/paymentmethod/template/heidelpay_ppMail_de.tpl create mode 100644 version/114/paymentmethod/template/heidelpay_ppMail_en.tpl create mode 100644 version/114/paymentmethod/template/js/birthDateAction.js create mode 100644 version/114/paymentmethod/template/js/creditCardFrame.js create mode 100644 version/114/paymentmethod/template/new_bestellabschluss.tpl create mode 100644 version/114/paymentmethod/template/old_bestellabschluss.tpl diff --git a/info.xml b/info.xml index 594dd35..4341ac6 100644 --- a/info.xml +++ b/info.xml @@ -51,7 +51,11 @@ 2017-11-08 + + 2018-02-02 + + heidelpay.hook008.php heidelpay.hook140.php heidelpay.hook153.php heidelpay.hook181.php diff --git a/version/114/frontend/arrayFilter.php b/version/114/frontend/arrayFilter.php new file mode 100644 index 0000000..97bfdaa --- /dev/null +++ b/version/114/frontend/arrayFilter.php @@ -0,0 +1,23 @@ +array_filter_recursive($value); + } + } + return array_filter($input); + } +} \ No newline at end of file diff --git a/version/114/frontend/heidelpay.hook008.php b/version/114/frontend/heidelpay.hook008.php new file mode 100644 index 0000000..58aa7ed --- /dev/null +++ b/version/114/frontend/heidelpay.hook008.php @@ -0,0 +1,17 @@ +Error:
'; + $divEnd = ''; + + + $hpErrorMsg = htmlspecialchars_decode($customerErrorMessage->getMessage($heidelpayError)); + + + $errorSnip = $divStart . ' ' . $hpErrorMsg . ' ' . $divEnd; + pq("#content")->prepend($errorSnip); + + } +} + +if (isset($_GET ['hperrorcom'])) { + + $divStart = '
Error:
'; + $divEnd = '
'; + + + if ($_SESSION ['cISOSprache'] == 'ger') { + $hpErrorMsg = utf8_decode('Dieses Zahlverfahren steht nicht für Firmenkunden zur Verfügung'); + } else { + $hpErrorMsg = utf8_decode('This paymentmethod is not available for corporate clients'); + } + + + $errorSnip = $divStart . ' ' . $hpErrorMsg . ' ' . $divEnd; + pq("#content")->prepend($errorSnip); + +} + +if (isset($_GET ['hperroradd'])) { + + $divStart = '
Error:
'; + $divEnd = '
'; + + + if ($_SESSION ['cISOSprache'] == 'ger') { + $hpErrorMsg = utf8_decode('Rechnungs- und Lieferadresse müssen identisch sein'); + } else { + $hpErrorMsg = utf8_decode('Billing- and shipping adress have to be equal'); + } + + + $errorSnip = $divStart . ' ' . $hpErrorMsg . ' ' . $divEnd; + pq("#content")->prepend($errorSnip); + +} diff --git a/version/114/frontend/heidelpay.hook153.php b/version/114/frontend/heidelpay.hook153.php new file mode 100644 index 0000000..31988e9 --- /dev/null +++ b/version/114/frontend/heidelpay.hook153.php @@ -0,0 +1,14 @@ +query( + "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); + +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); + + + 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(); + + $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); + + + $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) { + + + $res = $xmlQueryClass->doRequest(array('load' => urlencode($xmlQueryClass->getXMLRequest($config, $xml_params))), $url); + + $resXMLObject = new SimpleXMLElement($res); + + $resUniquieId = (string)$resXMLObject->Result->Transaction->Identification->UniqueID; + + $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'], + $sandboxMode); + + $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)); + } + + + } + + } + +} diff --git a/version/114/frontend/heidelpay_style.css b/version/114/frontend/heidelpay_style.css new file mode 100644 index 0000000..6298c64 --- /dev/null +++ b/version/114/frontend/heidelpay_style.css @@ -0,0 +1,179 @@ +/* SUMMARY +* +* DESC +* +* @license Use of this software requires acceptance of the License Agreement. See LICENSE file. +* @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. +* @link https://dev.heidelpay.de/JTL +* @author Ronja Wann +* @category JTL +*/ +#defaultData { + +} + +#frontendForm { + width: 400px; + margin-left: auto; + margin-right: auto; +} + +tr[id=notMandatoryRow] { + display: none; +} + +tr[id=spacer1] { + display: none; +} + +tr[id=spacer2] { + display: none; +} + +tr[id=spacer3] { + display: none; +} + +tr[id=spacer4] { + display: none; +} + +tr[id=contactBlock] { + display: none; +} + +tr[id=userInfoBlock] { + display: none; +} + +tr[id=addressBlock] { + display: none; +} + +tr#notMandatoryRow, tr#addressBlock, tr#userInfoBlock, tr#contactBlock, + tr#spacer1, tr#spacer2, tr#spacer3, tr#spacer4 { + display: none; +} + +td { + color: #000000; +} + +input, select { + color: #000000; + background-color: #ffffff; +} + +a:link { + color: #000000; +} + +a:visited { + color: #000000; +} + +a:hover { + color: #000000; +} + +a:active { + color: #000000; +} + +a:focus { + color: #000000; +} + +.bar { + display: none; +} + +select#paymentMethod { + display: none; +} + +#paymentSelection { + display: none; +} + +#send { + margin-left: 130px; + background: #ffee66; + background-image: -webkit-linear-gradient(top, #ffee66, #ffc43c); + background-image: -moz-linear-gradient(top, #ffee66, #ffc43c); + background-image: -ms-linear-gradient(top, #ffee66, #ffc43c); + background-image: -o-linear-gradient(top, #ffee66, #ffc43c); + background-image: linear-gradient(to bottom, #ffee66, #ffc43c); + border: 1px solid #FA2; + -webkit-border-radius: 5; + -moz-border-radius: 5; + border-radius: 5px; + font-family: Arial; + color: #333; + font: 1.1em "Trebuchet MS", sans-serif; + text-align: center; + text-decoration: none; + text-shadow: 0px 1px 0px #FE6; + padding: 2px 20px 2px 20px; +} + +#send:hover { + text-decoration: none; +} + +#cancel { + background: #ffee66; + background-image: -webkit-linear-gradient(top, #ffee66, #ffc43c); + background-image: -moz-linear-gradient(top, #ffee66, #ffc43c); + background-image: -ms-linear-gradient(top, #ffee66, #ffc43c); + background-image: -o-linear-gradient(top, #ffee66, #ffc43c); + background-image: linear-gradient(to bottom, #ffee66, #ffc43c); + border: 1px solid #FA2; + -webkit-border-radius: 5; + -moz-border-radius: 5; + border-radius: 5px; + font-family: Arial; + color: #333; + font: 1.1em "Trebuchet MS", sans-serif; + text-align: center; + text-decoration: none; + text-shadow: 0px 1px 0px #FE6; + padding: 2px 20px 2px 20px; +} + +#cancel:hover { + text-decoration: none; +} + +html, body, .bar { + background: transparent; + font-family: Verdana, sans-serif; + color: #000 !important; + overflow: visible; +} + +table { + border: 0; + margin: 0; + padding: 0; + background: transparent; +} + +table td { + padding: 3px 0; +} + +.frm_box { + background: transparent; + border: none; +} + +#header_bar, #notMandatoryRow, #contactBlock, #userInfoBlock, + #addressBlock, .bar { + display: none; +} + +form, tr, td { + border: none; + background: transparent; +} \ No newline at end of file diff --git a/version/114/frontend/xmlQuery.php b/version/114/frontend/xmlQuery.php new file mode 100644 index 0000000..d2474f2 --- /dev/null +++ b/version/114/frontend/xmlQuery.php @@ -0,0 +1,115 @@ +array_filter_recursive($xml_params); + $xml = '' . + ' +
+ +
+ + + +
'; + $xmlObject = new \SimpleXMLElement($xml); + $xmlObject->Header->Security->addAttribute('sender', trim(strtoupper($config['security_sender']))); + $xmlObject->Query->addAttribute('mode', trim(($config['sandbox'] == 0) ? 'LIVE' : 'CONNECTOR_TEST')); + + $xmlObject->Query->addAttribute('level', 'MERCHANT'); + $xmlObject->Query->addAttribute('entity', trim($config['security_sender'])); + + if (isset($xml_params['type']) && !empty($xml_params['type'])) { + $xmlObject->Query->addAttribute('type', trim(strtoupper($xml_params['type']))); + } + $xmlObject->Query->User->addAttribute('login', trim($config['user_login'])); + $xmlObject->Query->User->addAttribute('pwd', trim($config['user_password'])); + + $period = $xmlObject->Query->addChild('Period'); + $period->addAttribute('from', date('Y-m-d', strtotime('-30 day', time()))); + $period->addAttribute('to', date('Y-m-d')); + + + if (isset($xml_params['methods']) && !empty($xml_params['methods'])) { + $methods = $xmlObject->Query->addChild('Methods'); + foreach ($xml_params['methods'] as $key => $method) { + if ($method != '') { + $newMeth = $methods->addChild('Method'); + $newMeth->addAttribute('code', strtoupper($method)); + } + } + } + if (isset($xml_params['types']) && !empty($xml_params['types'])) { + $types = $xmlObject->Query->addChild('Types'); + foreach ($xml_params['types'] as $key => $type) { + if ($type != '') { + $newType = $types->addChild('Type'); + $newType->addAttribute('code', strtoupper($type)); + } + } + } + if (isset($xml_params['identification']) && !empty($xml_params['identification'])) { + $identification = $xmlObject->Query->addChild('Identification'); + foreach ($xml_params['identification'] as $key => $ident) { + $identification->addChild('ShortID', $ident); + + } + } + + if (isset($xml_params['procRes']) && !empty($xml_params['procRes'])) { + $xmlObject->Query->addChild('ProcessingResult', trim(strtoupper($xml_params['procRes']))); + } + if (isset($xml_params['transType']) && !empty($xml_params['transType'])) { + $xmlObject->Query->addChild('TransactionType', trim(strtoupper($xml_params['transType']))); + } + + return $xmlObject->asXML(); + } + + public function doRequest($params = array(), $url) + { + + try { + $client = new Client('', + array( + 'sslverifypeer' => false, + 'ssltransport' => 'tls' + ) + ); + + $client->setUri($url); + $client->setMethod('POST'); + $client->setParameterPost($params); + $client->setAdapter('Zend\Http\Client\Adapter\Curl'); + + $response = $client->send(); + if ($response->getStatusCode() == '200') { + return $response->getBody(); + } + } catch (Exception $e) { + $data = array( + 'type' => 0, + 'category' => 0, + 'errorMessage' => htmlspecialchars('Curl Error: ' . $e->getMessage()) + ); + + exit(); + } + } +} \ No newline at end of file diff --git a/version/114/paymentmethod/heidelpay_standard.class.php b/version/114/paymentmethod/heidelpay_standard.class.php new file mode 100644 index 0000000..4f8cdd7 --- /dev/null +++ b/version/114/paymentmethod/heidelpay_standard.class.php @@ -0,0 +1,858 @@ +executeQueryPrepared($sql, array($shortId, $orderId), 3); + } + + /** + * generates hash for criterion secret with secretPhrase and orderID + * + * @param $secret secret phrase from backend + * @param $orderId + * @return string hashed secret string + */ + public function getHash($secret, $orderId) + { + return hash('sha256', $secret . $orderId); + } + + /** + * Prepares process for payment + * + * @param $order + */ + public function preparePaymentProcess($order) + { + global $bestellung; + + $currentPaymentMethod = $_SESSION ['Zahlungsart']->cModulId; + if (empty($currentPaymentMethod)) { + $currentPaymentMethod = $bestellung->Zahlungsart->cModulId; + } + + $this->getPlugin($currentPaymentMethod); + + $hash = $this->generateHash($order); + if (property_exists($order, 'cId')) { + $hash = $order->cId; + } + $this->moduleID = $currentPaymentMethod; + $this->init(0); + + $notifyURL = $this->getNotificationURL($hash); + $oPlugin = $this->getPlugin($currentPaymentMethod); + $paymentMethodPrefix = $this->getCurrentPaymentMethodPrefix($oPlugin, $currentPaymentMethod); + + $this->setPaymentObject($paymentMethodPrefix); + + $this->paymentObject->getRequest()->authentification( + $oPlugin->oPluginEinstellungAssoc_arr ['sender'], + $oPlugin->oPluginEinstellungAssoc_arr ['user'], + $oPlugin->oPluginEinstellungAssoc_arr ['pass'], + $oPlugin->oPluginEinstellungAssoc_arr [$currentPaymentMethod . '_channel'], + $this->isSandboxMode($oPlugin, $currentPaymentMethod)); + $this->paymentObject->getRequest()->getContact()->set('ip', $this->getIp()); + $this->paymentObject->getRequest()->customerAddress(...$this->getCustomerData($oPlugin, $currentPaymentMethod)); + $this->paymentObject->getRequest()->basketData(...$this->getBasketData($order, $oPlugin)); + $this->paymentObject->getRequest()->async($this->getLanguageCode(), $notifyURL); + $this->paymentObject->getRequest()->getCriterion()->set('PAYMETHOD', $currentPaymentMethod); + + if (($paymentMethodPrefix == 'HPDDPG' OR $paymentMethodPrefix == 'HPIVPG' OR $paymentMethodPrefix == 'HPSA') AND $this->isEqualAddress($order) == false) { + $this->redirect('warenkorb.php?hperroradd=1'); + } + + if (($paymentMethodPrefix == 'HPDDPG' OR $paymentMethodPrefix == 'HPIVPG') AND $_SESSION['Kunde']->cFirma != null) { + $this->redirect('warenkorb.php?hperrorcom=1'); + } + + switch ($paymentMethodPrefix) { + case 'HPCC': + case 'HPDC': + if ($this->getBookingMode($oPlugin, $currentPaymentMethod) == 'DB') { + $this->paymentObject->debit($this->getPaymentFrameOrigin(), 'FALSE'); + } else { + $this->paymentObject->authorize($this->getPaymentFrameOrigin(), 'FALSE'); + } + break; + case 'HPDD': + $this->paymentObject->debit(); + break; + case 'HPVA': + if ($this->getBookingMode($oPlugin, $currentPaymentMethod) == 'DB') { + $this->paymentObject->debit(); + break; + } + default: + $this->paymentObject->authorize(); + break; + } + + if ($this->paymentObject->getResponse()->isError()) { + mail('florian.evertz@heidelpay.de', 'Debug - Error', print_r($this->paymentObject->getResponse(), 1)); + $errorCode = $this->paymentObject->getResponse()->getError(); + $this->redirect('bestellvorgang.php?heidelpayErrorCode=' . $errorCode['code']); + return; + } + + $this->setPaymentTemplate($paymentMethodPrefix); + } + + /** + * returns plugin depending on current payment method + * + * @param $moduleID + * @return bool|Plugin + */ + public function getPlugin($moduleID) + { + $kPlugin = gibkPluginAuscModulId($moduleID); + if ($kPlugin > 0) { + $oPlugin = new Plugin($kPlugin); + } else { + return false; + } + + return $oPlugin; + } + + /** + * Initial function + * + * @param int $nAgainCheckout + */ + public function init($nAgainCheckout = 0) + { + parent::init($nAgainCheckout); + + $this->name = 'Heidelpay'; + $this->caption = 'Heidelpay'; + + $sql = "SELECT * FROM `tzahlungsart` WHERE `cModulId` = '{$this->moduleID}'"; + $this->info = $GLOBALS ["DB"]->executeQuery($sql, 1); + } + + /** + * Gets prefix of current payment method + * + * @param $oPlugin + * @param $currentPaymentMethod + * @return string current payment method prefix + */ + public function getCurrentPaymentMethodPrefix($oPlugin, $currentPaymentMethod) + { + $payCode = strtolower($oPlugin->oPluginEinstellungAssoc_arr [$currentPaymentMethod . '_paycode']); + return strtoupper('HP' . $payCode); + } + + /** + * Sets payment object depending on chosen payment method + * + * @param $paymentMethodPrefix + */ + public function setPaymentObject($paymentMethodPrefix) + { + switch ($paymentMethodPrefix) { + case 'HPCC': + $this->paymentObject = new Heidelpay\PhpPaymentApi\PaymentMethods\CreditCardPaymentMethod(); + break; + case 'HPDC': + $this->paymentObject = new Heidelpay\PhpPaymentApi\PaymentMethods\DebitCardPaymentMethod(); + break; + case 'HPDD': + $this->paymentObject = new Heidelpay\PhpPaymentApi\PaymentMethods\DirectDebitPaymentMethod(); + break; + case 'HPSU': + $this->paymentObject = new Heidelpay\PhpPaymentApi\PaymentMethods\SofortPaymentMethod(); + break; + case 'HPGP': + $this->paymentObject = new Heidelpay\PhpPaymentApi\PaymentMethods\GiropayPaymentMethod(); + break; + case 'HPIDL': + $this->paymentObject = new Heidelpay\PhpPaymentApi\PaymentMethods\IDealPaymentMethod(); + break; + case 'HPEPS': + $this->paymentObject = new Heidelpay\PhpPaymentApi\PaymentMethods\EPSPaymentMethod(); + break; + case 'HPVA': + $this->paymentObject = new Heidelpay\PhpPaymentApi\PaymentMethods\PayPalPaymentMethod(); + break; + case 'HPP24': + $this->paymentObject = new Heidelpay\PhpPaymentApi\PaymentMethods\Przelewy24PaymentMethod(); + break; + case 'HPPFC': + $this->paymentObject = new Heidelpay\PhpPaymentApi\PaymentMethods\PostFinanceCardPaymentMethod(); + break; + case 'HPPFE': + $this->paymentObject = new Heidelpay\PhpPaymentApi\PaymentMethods\PostFinanceEFinancePaymentMethod(); + break; + case 'HPPP': + $this->paymentObject = new Heidelpay\PhpPaymentApi\PaymentMethods\PrepaymentPaymentMethod(); + break; + case 'HPIV': + $this->paymentObject = new Heidelpay\PhpPaymentApi\PaymentMethods\InvoicePaymentMethod(); + break; + case 'HPSA': + $this->paymentObject = new Heidelpay\PhpPaymentApi\PaymentMethods\SantanderInvoicePaymentMethod(); + break; + case 'HPDDPG': + $this->paymentObject = new Heidelpay\PhpPaymentApi\PaymentMethods\DirectDebitB2CSecuredPaymentMethod(); + break; + case 'HPIVPG': + $this->paymentObject = new Heidelpay\PhpPaymentApi\PaymentMethods\InvoiceB2CSecuredPaymentMethod(); + break; + } + } + + /** + * Checks if Sandbox-Mode active or not + * + * @param $oPlugin + * @return bool true = sandbox mode active, false = live mode active (productive system) + */ + public function isSandboxMode($oPlugin, $currentPaymentMethod) + { + if ($oPlugin->oPluginEinstellungAssoc_arr [$currentPaymentMethod . '_transmode'] == 'LIVE') { + return false; + } + return true; + } + + /** + * gets IP from client + * + * @return ip address + */ + public function getIp() + { + $ip = '127.0.0.1'; + + if (!empty($_SERVER['HTTP_CLIENT_IP'])) { + if (filter_var($_SERVER['HTTP_CLIENT_IP'], FILTER_VALIDATE_IP) !== FALSE) { + $ip = $_SERVER['HTTP_CLIENT_IP']; + } + } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { + if (filter_var($_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP) !== FALSE) { + $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; + } + } elseif (!empty($_SERVER['REMOTE_ADDR'])) { + if (filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP) !== FALSE) { + $ip = $_SERVER['REMOTE_ADDR']; + } + } + return $ip; + } + + /** + * Gets customer data from current session + * sets customer address on shipping address in case of PayPal for PayPal buyer protection + * + * @param $oPlugin + * @return array with user data (name, address and mail) + */ + public function getCustomerData($oPlugin, $currentPaymentMethod) + { + $payCode = $this->getCurrentPaymentMethodPrefix($oPlugin, $currentPaymentMethod); + //PayPal Case + if ($payCode == 'HPVA') { + $user = $_SESSION ['Lieferadresse']; + $mail = $_SESSION ['Kunde']; + $userStreet = $user->cStrasse . ' ' . $user->cHausnummer; + $userData = array((empty($user->cVorname)) ? null : $user->cVorname, (empty($user->cNachname)) ? null : $user->cNachname, (empty($user->cFirma)) ? null : $user->cFirma, (empty($user->kKunde)) ? null : $user->kKunde, (empty($userStreet)) ? null : $userStreet, (empty($user->cBundesland)) ? null : $user->cBundesland, (empty($user->cPLZ)) ? null : $user->cPLZ, (empty($user->cOrt)) ? null : $user->cOrt, (empty($user->cLand)) ? null : $user->cLand, (empty($mail->cMail)) ? null : $mail->cMail); + } else { + $user = $_SESSION ['Kunde']; + $userStreet = $user->cStrasse . ' ' . $user->cHausnummer; + $userData = array((empty($user->cVorname)) ? null : $user->cVorname, (empty($user->cNachname)) ? null : $user->cNachname, (empty($user->cFirma)) ? null : $user->cFirma, (empty($user->kKunde)) ? null : $user->kKunde, (empty($userStreet)) ? null : $userStreet, (empty($user->cBundesland)) ? null : $user->cBundesland, (empty($user->cPLZ)) ? null : $user->cPLZ, (empty($user->cOrt)) ? null : $user->cOrt, (empty($user->cLand)) ? null : $user->cLand, (empty($user->cMail)) ? null : $user->cMail); + } + return $this->encodeData($userData); + } + + /** + * Encodes data to UTF8 + * + * @param $data + * @return insert $data in UTF8 + */ + public function encodeData($data) + { + foreach ($data as $k => $v) { + if (!$this->isUTF8($v)) { + $data [$k] = utf8_encode($v); + } + } + return $data; + } + + /** + * Checks if string is UTF8 + * + * @param $string + * @return bool + */ + public function isUTF8($string) + { + return (utf8_encode(utf8_decode($string)) == $string); + } + + /** + * Gets order information of current session + * + * @return array order information + */ + public function getBasketData($order, $oPlugin) + { + $orderId = $order->cBestellNr; + if (empty($orderId)) { + $orderId = baueBestellnummer(); + } + + $amount = $order->fGesamtsummeKundenwaehrung; // In Kunden Währung + if (empty($amount)) { + $amount = $_SESSION ["Warenkorb"]->gibGesamtsummeWaren(1); + } + + $amount = sprintf('%1.2f', $amount); + $basketData = array( + $orderId, $amount, $_SESSION ['Waehrung']->cISO, $oPlugin->oPluginEinstellungAssoc_arr['secret'] + ); + return $basketData; + } + + /** + * Gets language code depending on language in session + * + * @return string language code + */ + public function getLanguageCode() + { + $language = $_SESSION ['cISOSprache'] == 'ger' ? 'DE' : 'EN'; + return $language; + } + + /** + * billing and shipping address has to be equal + * + * @param $order + * @return bool + */ + public function isEqualAddress($order) + { + $keyList = array( + 'cVorname', + 'cNachname', + 'cAnrede', + 'cFirma', + 'cStrasse', + 'cHausnummer', + 'cOrt', + 'cPLZ', + 'cLand' + ); + foreach ($keyList as $key) { + // key exists only in billing address + if (array_key_exists($key, (array)$order->oRechnungsadresse) and !array_key_exists($key, (array)$order->Lieferadresse)) { + return false; + } + // key exists only in delivery address + if (array_key_exists($key, (array)$order->Lieferadresse) and !array_key_exists($key, (array)$order->oRechnungsadresse)) { + return false; + } + // merge keys + if (array_key_exists($key, (array)$order->Lieferadresse) and array_key_exists($key, (array)$order->oRechnungsadresse)) { + // return false on unmatched + if ($order->Lieferadresse->$key != $order->oRechnungsadresse->$key) { + return false; + } + } + } + // if everything is equal return true + return true; + } + + /** + * Redirects customer + */ + public function redirect($url) + { + header('Location: ' . $url); + } + + /** + * Get booking mode + * + * @param $oPlugin + * @param $currentPaymentMethod + * @return mixed returns booking mode + */ + public function getBookingMode($oPlugin, $currentPaymentMethod) + { + $bookingMode = $oPlugin->oPluginEinstellungAssoc_arr [$currentPaymentMethod . '_bookingmode']; + return $bookingMode; + } + + /** + * Gets payment frame origin + * + * @return string url with the origin of the payment frame + */ + public function getPaymentFrameOrigin() + { + $parse_url = parse_url(Shop::getURL()); + $paymentFrameOrigin = $parse_url['scheme'] . '://' . $parse_url['host']; + return $paymentFrameOrigin; + } + + /** + * Sets payment template depending on chosen payment method + * + * @param $paymentMethodPrefix + * + */ + public function setPaymentTemplate($paymentMethodPrefix) + { + global $smarty; + + $smarty->assign('pay_button_label', $this->getPayButtonLabel()); + $smarty->assign('paytext', utf8_decode($this->getPayText())); + + #setlocale(LC_TIME, $this->getLanguageCode()); + + switch ($paymentMethodPrefix) { + case 'HPCC': + case 'HPDC': + case 'HPDD': + $smarty->assign('holder_label', $this->getHolderLabel()); + $smarty->assign('holder', $_SESSION['Kunde']->cVorname . ' ' . $_SESSION['Kunde']->cNachname); + $smarty->assign('action_url', $this->paymentObject->getResponse()->getPaymentFormUrl()); + break; + case 'HPDDPG': + case 'HPIVPG': + $smarty->assign('holder_label', $this->getHolderLabel()); + $smarty->assign('birthdate_label', $this->getBirthdateLabel()); + $smarty->assign('salutation', $this->getSalutationArray()); + $smarty->assign('salutation_pre', $this->getSalutation()); + $smarty->assign('holder', $_SESSION['Kunde']->cVorname . ' ' . $_SESSION['Kunde']->cNachname); + $smarty->assign('is_PG', true); + $smarty->assign('birthdate', str_replace('.', '-', $_SESSION['Kunde']->dGeburtstag)); + $smarty->assign('action_url', $this->paymentObject->getResponse()->getPaymentFormUrl()); + break; + case 'HPIDL': + case 'HPEPS': + $smarty->assign('action_url', $this->paymentObject->getResponse()->getPaymentFormUrl()); + $smarty->assign('account_country', $this->paymentObject->getResponse()->getConfig()->getBankCountry()); + $smarty->assign('account_bankname', $this->paymentObject->getResponse()->getConfig()->getBrands()); + break; + case 'HPSA': + $smarty->assign('birthdate_label', $this->getBirthdateLabel()); + $smarty->assign('privatepolicy_label', $this->getPrivatePolicyLabel()); + $smarty->assign('action_url', $this->paymentObject->getResponse()->getPaymentFormUrl()); + $smarty->assign('salutation', $this->getSalutationArray()); + $smarty->assign('salutation_pre', $this->getSalutation()); + $smarty->assign('holder', $_SESSION['Kunde']->cVorname . ' ' . $_SESSION['Kunde']->cNachname); + $smarty->assign('birthdate', str_replace('.', '-', $_SESSION['Kunde']->dGeburtstag)); + $optinText = $this->paymentObject->getResponse()->getConfig()->getOptinText(); + $smarty->assign('optin', utf8_decode($optinText['optin'])); + $smarty->assign('privacy_policy', utf8_decode($optinText['privacy_policy'])); + break; + default: + $this->redirect($this->paymentObject->getResponse()->getPaymentFormUrl()); + } + } + + /** + * Gets label on pay button depending on selected language + * + * @return string with text for pay button + */ + public function getPayButtonLabel() + { + if ($_SESSION ['cISOSprache'] == 'ger') { + $payButtonLabel = 'Jetzt zahlen'; + } else { + $payButtonLabel = 'Pay now'; + } + return $payButtonLabel; + } + + /** + * Gets payment text depending on selected language + * + * @return string with payment text + */ + public function getPayText() + { + if ($_SESSION ['cISOSprache'] == 'ger') { + $payText = 'Bitte vervollständigen Sie die unten aufgeführten Daten und schließen Sie den Bestellprozess ab.'; + } else { + $payText = 'Please complete the following data and complete the order process.'; + } + return $payText; + } + + /** + * Gets label for holder depending on selected language + * + * @return string with text for holder label + */ + public function getHolderLabel() + { + if ($_SESSION ['cISOSprache'] == 'ger') { + $holderLabel = 'Kontoinhaber'; + } else { + $holderLabel = 'Holder'; + } + return $holderLabel; + } + + /** + * Gets label for birthdate depending on selected language + * + * @return string with text for birthdate label + */ + public function getBirthdateLabel() + { + if ($_SESSION ['cISOSprache'] == 'ger') { + $birthdateLabel = 'Geburtsdatum'; + } else { + $birthdateLabel = 'Birthdate'; + } + return $birthdateLabel; + } + + /** + * Creates salutation array for template depending on session language + * + * @return array with salutation options + */ + public function getSalutationArray() + { + if ($_SESSION ['cISOSprache'] == 'ger') { + $salutationArray = array('MR' => 'Herr', 'MRS' => 'Frau'); + } else { + $salutationArray = array('MR' => 'Mr', 'MRS' => 'Mrs'); + } + return $salutationArray; + } + + /** + * Gets salutation from session for payment + * + * @return string 'MR' or 'MRS' depending on the salutation in session + */ + public function getSalutation() + { + if ($_SESSION['Kunde']->cAnrede == 'm') { + $salutation = 'MR'; + } else { + $salutation = 'MRS'; + } + return $salutation; + } + + /** + * Gets private policy depending on language + * + * @param $oPlugin + * @return mixed text with private policy + */ + public function getPrivatePolicyLabel($oPlugin) + { + if ($_SESSION ['cISOSprache'] == 'ger') { + $privatePolicyLabel = $oPlugin->oPluginSprachvariable_arr['0']->oPluginSprachvariableSprache_arr['GER']; + } else { + $privatePolicyLabel = $oPlugin->oPluginSprachvariable_arr['0']->oPluginSprachvariableSprache_arr['ENG']; + } + return $privatePolicyLabel; + } + + /** + * Handles notification and redirects customer + * + * @param $order + * @param $paymentHash + * @param $args + */ + public function handleNotification($order, $paymentHash, $args) + { + $this->init(); + + mail('florian.evertz@heidelpay.de', 'debug - handle1', print_r($args, 1)); + + $HeidelpayResponse = new Heidelpay\PhpPaymentApi\Response($args); + + if (array_key_exists('CRITERION_PAYMETHOD', $args)) { + $oPlugin = $this->getPlugin($args['CRITERION_PAYMETHOD']); + $secretPass = $oPlugin->oPluginEinstellungAssoc_arr ['secret']; + $identificationTransactionId = $HeidelpayResponse->getIdentification()->getTransactionId(); + try { + $HeidelpayResponse->verifySecurityHash($secretPass, $identificationTransactionId); + } catch (\Exception $e) { + /* If the verification does not match this can mean some kind of manipulation or + * miss configuration. So you can log $e->getMessage() for debugging.*/ + $callers = debug_backtrace(); + Jtllog::write("Heidelpay - " . $callers [0] ['function'] . ": Invalid response hash from " . $_SERVER ['REMOTE_ADDR'] . ", suspecting manipulation", 2, false, 'Notify'); + exit(); + } + } else { + $this->redirect('bestellvorgang.php'); + } + if ($HeidelpayResponse->isSuccess()) { + /* save order and transaction result to your database */ + if ($this->verifyNotification($order, $args)) { + $payCode = explode('.', $args ['PAYMENT_CODE']); + if ((strtoupper($payCode [0]) == 'DD') && (!isset($args ['TRANSACTION_SOURCE']))) { + $language = $_SESSION ['cISOSprache'] == 'ger' ? 'DE' : 'EN'; + if ($language == 'DE') { + include_once(PFAD_ROOT . PFAD_PLUGIN . 'heidelpay_standard/version/112/paymentmethod/template/heidelpay_ddMail_de.tpl'); + } else { + include_once(PFAD_ROOT . PFAD_PLUGIN . 'heidelpay_standard/version/112/paymentmethod/template/heidelpay_ddMail_en.tpl'); + } + $repl = array( + '{ACC_IBAN}' => $args ['ACCOUNT_IBAN'], + '{ACC_BIC}' => $args ['ACCOUNT_BIC'], + '{ACC_IDENT}' => $args ['ACCOUNT_IDENTIFICATION'], + '{AMOUNT}' => $args ['PRESENTATION_AMOUNT'], + '{CURRENCY}' => $args ['PRESENTATION_CURRENCY'], + '{HOLDER}' => $args ['ACCOUNT_HOLDER'] + ); + if ((isset($args ['IDENTIFICATION_CREDITOR_ID']) && ($args ['IDENTIFICATION_CREDITOR_ID'] != ''))) { + $repl ['{IDENT_CREDITOR}'] = $args ['IDENTIFICATION_CREDITOR_ID']; + } else { + $repl ['{IDENT_CREDITOR}'] = '-'; + } + mail($order->oRechnungsadresse->cMail, constant('DD_MAIL_SUBJECT'), strtr(constant('DD_MAIL_TEXT'), $repl), constant('DD_MAIL_HEADERS')); + } elseif ((strtoupper($payCode [0]) == 'PP') && (!isset($args ['TRANSACTION_SOURCE']))) { + $language = $_SESSION ['cISOSprache'] == 'ger' ? 'DE' : 'EN'; + if ($language == 'DE') { + include_once(PFAD_ROOT . PFAD_PLUGIN . 'heidelpay_standard/version/112/paymentmethod/template/heidelpay_ppMail_de.tpl'); + } else { + include_once(PFAD_ROOT . PFAD_PLUGIN . 'heidelpay_standard/version/112/paymentmethod/template/heidelpay_ppMail_en.tpl'); + } + $repl = array( + '{ACC_IBAN}' => $args ['CONNECTOR_ACCOUNT_IBAN'], + '{ACC_BIC}' => $args ['CONNECTOR_ACCOUNT_BIC'], + '{ACC_OWNER}' => $args ['CONNECTOR_ACCOUNT_HOLDER'], + '{AMOUNT}' => $args ['PRESENTATION_AMOUNT'], + '{CURRENCY}' => $args ['PRESENTATION_CURRENCY'], + '{USAGE}' => $args ['IDENTIFICATION_SHORTID'] + ); + mail($order->oRechnungsadresse->cMail, constant('PP_MAIL_SUBJECT'), strtr(constant('PP_MAIL_TEXT'), $repl), constant('PP_MAIL_HEADERS')); + } elseif ((strtoupper($payCode [0]) == 'IV') && (!isset($args ['TRANSACTION_SOURCE']))) { + $this->setPayInfo($args, $order->cBestellNr); + } + if (strtoupper($payCode [0]) != 'PP' AND strtoupper($payCode [0]) != 'IV') { // Nur wenn nicht Vorkasse od. Rechnung + try { + $this->setOrderStatusToPaid($order); + } catch (Exception $e) { + $e = 'Update order status failed on order: ' . $order . ' in file: ' . $e->getFile() . ' on line: ' . $e->getLine() . ' with message: ' . $e->getMessage(); + $logData = array( + 'module' => 'Heidelpay Standard', + 'order' => $order, + 'error_msg' => $e + ); + Jtllog::write($logData, 1, false); + } + try { + $this->sendConfirmationMail($order); + } catch (Exception $e) { + $e = 'Update order status failed on order: ' . $order . ' in file: ' . $e->getFile() . ' on line: ' . $e->getLine() . ' with message: ' . $e->getMessage(); + $logData = array( + 'module' => 'Heidelpay Standard', + 'order' => $order, + 'error_msg' => $e + ); + Jtllog::write($logData, 1, false); + } + } + + if (strtoupper($payCode [1]) != 'PA' AND strtoupper($payCode [1]) != 'RG') { + $incomingPayment = new stdClass(); + $incomingPayment->fBetrag = number_format($order->fGesamtsummeKundenwaehrung, 2, '.', ''); + $incomingPayment->cISO = $order->Waehrung->cISO; + $this->addIncomingPayment($order, $incomingPayment); + } + $this->updateNotificationID($order->kBestellung, $args['IDENTIFICATION_UNIQUEID']); + } + /* redirect customer to success page */ + echo $this->getReturnURL($order); + + /*save order */ + } elseif ($HeidelpayResponse->isError()) { + $error = $HeidelpayResponse->getError(); + echo $this->getErrorReturnURL($order) . '&hperror=' . $error['code']; + } elseif ($HeidelpayResponse->isPending()) { + echo $this->getReturnURL($order); + } + } + + /** + * Verifies notification + * + * @return boolean + * @param Bestellung $order + * @param array $post + */ + public function verifyNotification($order, $post) + { + if ($post['CLEARING_AMOUNT'] != number_format($order->fGesamtsummeKundenwaehrung, 2, '.', '')) { + return false; + } + + if ($post['CLEARING_CURRENCY'] != $order->Waehrung->cISO) { + return false; + } + return true; + } + + /** + * Sets payment information as comment in database + * + * @param $post response form payment + * @param $orderId + */ + public function setPayInfo($post, $orderId) + { + $bookingtext = 'Bitte überweisen Sie uns den Betrag von ' . $post['PRESENTATION_AMOUNT'] . ' ' . $post['PRESENTATION_CURRENCY'] . ' nach Erhalt der Ware auf folgendes Konto: + + Kontoinhaber: ' . $post['CONNECTOR_ACCOUNT_HOLDER'] . ' + IBAN: ' . $post['CONNECTOR_ACCOUNT_IBAN'] . ' + BIC: ' . $post['CONNECTOR_ACCOUNT_BIC'] . ' + + Geben Sie als Verwendungszweck bitte ausschließlich folgende Identifikationsnummer an: + ' . $post['IDENTIFICATION_SHORTID']; + + + $sql = 'UPDATE `tbestellung` SET + `cKommentar` ="' . htmlspecialchars(utf8_decode($bookingtext)) . '" + WHERE `cBestellNr` ="' . htmlspecialchars($orderId) . '";'; + $GLOBALS ["DB"]->executeQuery($sql, 1); + } + + /** + * Error return url clone from PaymentMethod.class because of bestellabschluss case + * @param Bestellung $order + * @return string + */ + public function getErrorReturnURL($order) + { + if (!isset($_SESSION['Zahlungsart']->nWaehrendBestellung) || $_SESSION['Zahlungsart']->nWaehrendBestellung == 0) { + + return $order->BestellstatusURL; + } + + return Shop::getURL() . '/bestellvorgang.php'; + } + + public function finalizeOrder($order, $hash, $args) + { + global $cEditZahlungHinweis; + + if ($args['PROCESSING_RESULT'] == "ACK") { + return true; + } else { + mail('florian.evertz@heidelpay.de', 'debug - handle', print_r($args, 1)); + + $cEditZahlungHinweis = rawurlencode($args['PROCESSING_RETURN']) . '&hperror=' . $args['PROCESSING_RETURN_CODE'] . '2354'; + return false; + } + } + + + /** + * prepares payment text + * + * @param $res + * @param string $lang + * @return string + */ + public function prepaymentText($res, $lang = 'EN') + { + if ($lang == 'DE') { + define('PREPAYMENT_TEXT', + 'Bitte überweisen Sie uns den Betrag von {CURRENCY} {AMOUNT} auf folgendes Konto:

+ Land : {ACC_COUNTRY}
+ Kontoinhaber : {ACC_OWNER}
+ Konto-Nr. : {ACC_NUMBER}
+ Bankleitzahl: {ACC_BANKCODE}
+ IBAN: {ACC_IBAN}
+ BIC: {ACC_BIC}
+

Geben sie bitte im Verwendungszweck UNBEDINGT die Identifikationsnummer
+ {SHORTID}
+ und NICHTS ANDERES an.
'); + } else { + define('PREPAYMENT_TEXT', + 'Please transfer the amount of {CURRENCY} {AMOUNT} to the following account:

+ Country : {ACC_COUNTRY}
+ Account holder : {ACC_OWNER}
+ Account No. : {ACC_NUMBER}
+ Bank Code: {ACC_BANKCODE}
+ IBAN: {ACC_IBAN}
+ BIC: {ACC_BIC}
+

Please use the identification number
+ {SHORTID}
+ as the descriptor and nothing else. Otherwise we cannot match your transaction!
'); + } + + $repl = array( + '{CURRENCY}' => $res ['all'] ['PRESENTATION_CURRENCY'], + '{AMOUNT}' => $res ['all'] ['PRESENTATION_AMOUNT'], + '{ACC_COUNTRY}' => $res ['all'] ['CONNECTOR_ACCOUNT_COUNTRY'], + '{ACC_OWNER}' => $res ['all'] ['CONNECTOR_ACCOUNT_HOLDER'], + '{ACC_NUMBER}' => $res ['all'] ['CONNECTOR_ACCOUNT_NUMBER'], + '{ACC_BANKCODE}' => $res ['all'] ['CONNECTOR_ACCOUNT_BANK'], + '{ACC_IBAN}' => $res ['all'] ['CONNECTOR_ACCOUNT_IBAN'], + '{ACC_BIC}' => $res ['all'] ['CONNECTOR_ACCOUNT_BIC'], + '{SHORTID}' => $res ['all'] ['IDENTIFICATION_SHORTID'] + ); + + return strtr(constant('PREPAYMENT_TEXT'), $repl); + } +} diff --git a/version/114/paymentmethod/returnHPMailStr.php b/version/114/paymentmethod/returnHPMailStr.php new file mode 100644 index 0000000..f539886 --- /dev/null +++ b/version/114/paymentmethod/returnHPMailStr.php @@ -0,0 +1,167 @@ +assign('billsafeinfo', 'Test'); + +if (class_exists('FB')) { + FB::log($args_arr ['mailsmarty']); +} + +if (! empty($_POST ['PROCESSING_RESULT'])) { + if ($oPlugin->cPluginID == 'heidelpay_standard' && strpos($_SESSION ['Zahlungsart']->cModulId, 'heidelpaybillsafeplugin') !== false) { + $bankName = $_POST ['CRITERION_BILLSAFE_BANKNAME']; + $kontoInhaber = $_POST ['CRITERION_BILLSAFE_RECIPIENT']; + $iban = $_POST ['CRITERION_BILLSAFE_IBAN']; + $bic = $_POST ['CRITERION_BILLSAFE_BIC']; + $betrag = str_replace(".", ",", sprintf("%01.2f", $_POST ['CRITERION_BILLSAFE_AMOUNT'])); + $waehrung = $_POST ['CRITERION_BILLSAFE_CURRENCY']; + $billsafeLegalnote = $_POST ['CRITERION_BILLSAFE_LEGALNOTE']; // Wird noch nicht benutzt + $billsafeNote = htmlentities($_POST ['CRITERION_BILLSAFE_NOTE'], ENT_NOQUOTES, 'UTF-8'); + $billsafePdfUrl = $_POST ['CRITERION_BILLSAFE_PDF_URL']; // Wird noch nicht benutzt + $billsafeReference = $_POST ['CRITERION_BILLSAFE_REFERENCE']; + + $stringDe = " + Bitte überweisen Sie uns den Betrag von $betrag $waehrung auf folgendes Konto:

+ Bankname: $bankName
+ Kontoinhaber: $kontoInhaber
+ IBAN: $iban
+ BIC: $bic

+ Geben Sie als Verwendungszweck bitte ausschließlich diese Identifikationsnummer an:
+ $billsafeReference

+ $billsafeNote
"; + + $stringEn = " + Please transfer the amount of $betrag $waehrung to the following account

+ Bankname: $bankName
+ Holder: $kontoInhaber
+ IBAN: $iban
+ BIC: $bic

+ Please use only this identification number as the descriptor :
+ $billsafeReference
+ $billsafeNote
"; + + $ausgabeInEmail = ''; + if (strtolower($_POST ['FRONTEND_LANGUAGE']) == 'de') { + $ausgabeInEmail = $stringDe; + } else { + $ausgabeInEmail = $stringEn; + } + + $args_arr ['mail']->bodyText = preg_replace('/#billsafeinfo#/', $ausgabeInEmail, $args_arr ['mail']->bodyText); + $args_arr ['mail']->bodyHtml = preg_replace('/#billsafeinfo#/', $ausgabeInEmail, $args_arr ['mail']->bodyHtml); + } elseif ($oPlugin->cPluginID == 'heidelpay_standard' && strpos($_SESSION ['Zahlungsart']->cModulId, 'heidelpayrechnungplugin') !== false) { + // Case Rechnungskauf / Invoice + $datenArray ['betrag'] = str_replace(".", ",", sprintf("%01.2f", $_POST ['PRESENTATION_AMOUNT'])); + $datenArray ['waehrung'] = $_POST ['PRESENTATION_CURRENCY']; + ; + $datenArray ['kontoInhaber'] = $_POST ['CONNECTOR_ACCOUNT_HOLDER']; + $datenArray ['iban'] = $_POST ['CONNECTOR_ACCOUNT_IBAN']; + $datenArray ['bic'] = $_POST ['CONNECTOR_ACCOUNT_BIC']; + $datenArray ['vZweck'] = $_POST ['IDENTIFICATION_SHORTID']; + $datenArray ['lang'] = $_POST ['FRONTEND_LANGUAGE']; + + $args_arr ['mail']->bodyText = preg_replace('/#billsafeinfo#/', returnEmailStr($datenArray), $args_arr ['mail']->bodyText); + $args_arr ['mail']->bodyHtml = preg_replace('/#billsafeinfo#/', returnEmailStr($datenArray), $args_arr ['mail']->bodyHtml); + } elseif ($oPlugin->cPluginID == 'heidelpay_standard' && strpos($_SESSION ['Zahlungsart']->cModulId, 'heidelpayvorkasseplugin') !== false) { + // case Vorkasse / Prepayment + $datenArray ['betrag'] = str_replace(".", ",", sprintf("%01.2f", $_POST ['PRESENTATION_AMOUNT'])); + $datenArray ['waehrung'] = $_POST ['PRESENTATION_CURRENCY']; + ; + $datenArray ['kontoInhaber'] = $_POST ['CONNECTOR_ACCOUNT_HOLDER']; + $datenArray ['iban'] = $_POST ['CONNECTOR_ACCOUNT_IBAN']; + $datenArray ['bic'] = $_POST ['CONNECTOR_ACCOUNT_BIC']; + $datenArray ['vZweck'] = $_POST ['IDENTIFICATION_SHORTID']; + $datenArray ['lang'] = $_POST ['FRONTEND_LANGUAGE']; + + $args_arr ['mail']->bodyText = preg_replace('/#billsafeinfo#/', returnEmailStr($datenArray), $args_arr ['mail']->bodyText); + $args_arr ['mail']->bodyHtml = preg_replace('/#billsafeinfo#/', returnEmailStr($datenArray), $args_arr ['mail']->bodyHtml); + } elseif ($oPlugin->cPluginID == 'heidelpay_standard' && strpos($_SESSION ['Zahlungsart']->cModulId, 'heidelpaygesicherterechnungplugin') !== false) { + // case Vorkasse / Prepayment + $datenArray ['betrag'] = str_replace(".", ",", sprintf("%01.2f", $_POST ['PRESENTATION_AMOUNT'])); + $datenArray ['waehrung'] = $_POST ['PRESENTATION_CURRENCY']; + ; + $datenArray ['kontoInhaber'] = $_POST ['CONNECTOR_ACCOUNT_HOLDER']; + $datenArray ['iban'] = $_POST ['CONNECTOR_ACCOUNT_IBAN']; + $datenArray ['bic'] = $_POST ['CONNECTOR_ACCOUNT_BIC']; + $datenArray ['vZweck'] = $_POST ['IDENTIFICATION_SHORTID']; + $datenArray ['lang'] = $_POST ['FRONTEND_LANGUAGE']; + + $args_arr ['mail']->bodyText = preg_replace('/#billsafeinfo#/', returnEmailStr($datenArray), $args_arr ['mail']->bodyText); + $args_arr ['mail']->bodyHtml = preg_replace('/#billsafeinfo#/', returnEmailStr($datenArray), $args_arr ['mail']->bodyHtml); + } elseif ($oPlugin->cPluginID == 'heidelpay_standard' && strpos($_SESSION ['Zahlungsart']->cModulId, 'heidelpaysantanderplugin') !== false) { + // case Vorkasse / Prepayment + $datenArray ['betrag'] = str_replace(".", ",", sprintf("%01.2f", $_POST ['PRESENTATION_AMOUNT'])); + $datenArray ['waehrung'] = $_POST ['PRESENTATION_CURRENCY']; + ; + $datenArray ['kontoInhaber'] = $_POST ['CONNECTOR_ACCOUNT_HOLDER']; + $datenArray ['iban'] = $_POST ['CONNECTOR_ACCOUNT_IBAN']; + $datenArray ['bic'] = $_POST ['CONNECTOR_ACCOUNT_BIC']; + $datenArray ['vZweck'] = $_POST ['IDENTIFICATION_SHORTID']; + $datenArray ['lang'] = $_POST ['FRONTEND_LANGUAGE']; + + $args_arr ['mail']->bodyText = preg_replace('/#billsafeinfo#/', returnEmailStr($datenArray), $args_arr ['mail']->bodyText); + $args_arr ['mail']->bodyHtml = preg_replace('/#billsafeinfo#/', returnEmailStr($datenArray), $args_arr ['mail']->bodyHtml); + } else { + $args_arr ['mail']->bodyText = preg_replace('/#billsafeinfo#/', '', $args_arr ['mail']->bodyText); + $args_arr ['mail']->bodyHtml = preg_replace('/#billsafeinfo#/', '', $args_arr ['mail']->bodyHtml); + } +} else { + $args_arr ['mail']->bodyText = preg_replace('/#billsafeinfo#/', '', $args_arr ['mail']->bodyText); + $args_arr ['mail']->bodyHtml = preg_replace('/#billsafeinfo#/', '', $args_arr ['mail']->bodyHtml); +} + +/** + * returnEmailStr() + * + * gibt den String zurück, der in der Bestellbestätigung an den Kunden geht + * bei Sprache de wird deustcher Text ausgegeben, bei anderen Sprachen en Text + * + * @param array $datenArray + * $datenArray['betrag'] => Betrag formatiert, + * $datenArray['waehrung'] => ISO-Konform, + * $datenArray['kontoInhaber'] => Kontoinhaber laut Payment, + * $datenArray['iban'] => IBAN laut Payment, + * $datenArray['bic'] => BIC laut Payment, + * $datenArray['vZweck'] => Short-ID laut Payment, + * $datenArray['lang'] => FRONTEND_LANGUAGE + */ +function returnEmailStr($datenArray) +{ + $stringDe = " + Bitte überweisen Sie uns den Betrag von " . $datenArray ['betrag'] . " " . $datenArray ['waehrung'] . " auf folgendes Konto:

+ Kontoinhaber: " . $datenArray ['kontoInhaber'] . "
+ IBAN: " . $datenArray ['iban'] . "
+ BIC: " . $datenArray ['bic'] . "

+ Geben Sie als Verwendungszweck bitte ausschließlich diese Identifikationsnummer an:
+ " . $datenArray ['vZweck'] . "

"; + + $stringEn = " + Please transfer the amount of " . $datenArray ['betrag'] . " " . $datenArray ['waehrung'] . " to the following account

+ Holder: " . $datenArray ['kontoInhaber'] . "
+ IBAN: " . $datenArray ['iban'] . "
+ BIC: " . $datenArray ['bic'] . "

+ Please use only this identification number as the descriptor :
+ " . $datenArray ['vZweck'] . ""; + + $ausgabeInEmail = ''; + if (strtolower($datenArray ['lang']) == 'de') { + $ausgabeInEmail = $stringDe; + } else { + $ausgabeInEmail = $stringEn; + } + + return $ausgabeInEmail; +} diff --git a/version/114/paymentmethod/template/css/hppaymentframe.css b/version/114/paymentmethod/template/css/hppaymentframe.css new file mode 100644 index 0000000..b9bc69b --- /dev/null +++ b/version/114/paymentmethod/template/css/hppaymentframe.css @@ -0,0 +1,17 @@ +/* SUMMARY +* +* DESC +* +* @license Use of this software requires acceptance of the License Agreement. See LICENSE file. +* @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. +* @link https://dev.heidelpay.de/JTL +* @author Ronja Wann +* @category JTL +*/ + +#paymentFrameForm +{ + + frameborder:"0"; + +} \ No newline at end of file diff --git a/version/114/paymentmethod/template/heidelpay.png b/version/114/paymentmethod/template/heidelpay.png new file mode 100644 index 0000000000000000000000000000000000000000..e8b88c6f11b0da4bd20c36935a2f4a708c6beb49 GIT binary patch literal 779 zcmV+m1N8ifP)Px#7*I@9MLj(|ySuyp|NoPdlMfFMYin!S+1c*y?i(N4e*gdg32;bRa{vGf6951U z69E94oEQKA00(qQO+^RU3Kj?>8jJrZ1^@s8c}YY;R7l6|)w`FXFcb&iIHI=WyET_X z()zXy%VS$bTw7&EZJo@j|Nh`Xx`ROEeeBC94%y((d>r>Yi^Y$ZWU6(8d3&Wk=a~is&v>=$u6lbB=QpvGy6mFav zUJGx>w@tSw6RyrYEM5jk!@`AAqZlRW=eZZf)%n%AP6uz)Px$aI{VcK}T9mgAL> zXMXUayYwKU3s?Q!9jl7s+(@Uxa>C7rJz+#5-#ZU`BxKBowTDewy&w-C(?;dY*+VzD zP!6+cCZ*1qcY@3_(Ae7V*)&`$-iR^{R=E&n)87Tfi;U2ZGh1InGLyt z+zm9mp-qR1N1BGcThpZPic3v{C3I;Axu?nTxzVN8GfwrL#E+PU>(l&vtZU%Ev}us5 zMygNQC>_L?to)2m(?NVm?Jqf-f{ulIH?{>`z!VOgY$3Gg`hyP9thl zn`6}+;O4R-?E~%Kjh*^dSc-f^Q2pU4K-wHe)U=68f^*!Zs(fG%|n zA&}$!%{snQb?CtcQoVNy)#@(hQ|eT!+Y~>@UYeuhH5`nu27`s9l?>)X4F=41kmk(W zttvQGvfBt4PClK>RA)F +
+
+
+

{$title}

+
+

+ {$heidelpay_iframe} +
+
+
+
+ +{include file='tpl_inc/leftContainer.tpl'} +{include file='tpl_inc/rightContainer.tpl'} +{include file='tpl_inc/footer.tpl'} \ No newline at end of file diff --git a/version/114/paymentmethod/template/heidelpay_CreditDebitCard.tpl b/version/114/paymentmethod/template/heidelpay_CreditDebitCard.tpl new file mode 100644 index 0000000..cb09b8d --- /dev/null +++ b/version/114/paymentmethod/template/heidelpay_CreditDebitCard.tpl @@ -0,0 +1,19 @@ +{* SUMMARY +* +* DESC +* +* @license Use of this software requires acceptance of the License Agreement. See LICENSE file. +* @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. +* @link https://dev.heidelpay.de/JTL +* @author Andreas Nemet/Jens Richter/Marijo Prskalo/Ronja Wann +* @category JTL +*} +
+
{$paytext}
+
+
+ +
+ + +
\ No newline at end of file diff --git a/version/114/paymentmethod/template/heidelpay_DirectDebit.tpl b/version/114/paymentmethod/template/heidelpay_DirectDebit.tpl new file mode 100644 index 0000000..4c70343 --- /dev/null +++ b/version/114/paymentmethod/template/heidelpay_DirectDebit.tpl @@ -0,0 +1,44 @@ +{* SUMMARY +* +* DESC +* +* @license Use of this software requires acceptance of the License Agreement. See LICENSE file. +* @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. +* @link https://dev.heidelpay.de/JTL +* @author Ronja Wann +* @category JTL +*} + + +
+ +
{$paytext}
+
+ +
+ {if $is_PG == TRUE}{html_options name='NAME.SALUTATION' options=$salutation selected=$salutation_pre}{/if} + +
+
+ +
+
+
+ {if $is_PG == TRUE} + + {if isset($birthdate)} +
+ {assign var=payment_data value=$birthdate} + {html_select_date|utf8_encode day_id='Date_Day' month_id='Date_Month' year_id='Date_Year' time=$payment_data start_year='-18' end_year='-100' reverse_years='true' day_value_format='%02d' month_format='%m' field_order='DMY'} + {else} + {html_select_date|utf8_encode day_id='Date_Day' month_id='Date_Month' year_id='Date_Year' start_year='-18' end_year='-100' reverse_years='true' day_value_format='%02d' month_format='%m' field_order='DMY'} + {/if} + + {/if} +
+ +
+ +
+ +
\ No newline at end of file diff --git a/version/114/paymentmethod/template/heidelpay_InvoiceSec.tpl b/version/114/paymentmethod/template/heidelpay_InvoiceSec.tpl new file mode 100644 index 0000000..ae88ef4 --- /dev/null +++ b/version/114/paymentmethod/template/heidelpay_InvoiceSec.tpl @@ -0,0 +1,34 @@ +{* SUMMARY +* +* DESC +* +* @license Use of this software requires acceptance of the License Agreement. See LICENSE file. +* @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. +* @link https://dev.heidelpay.de/JTL +* @author Andreas Nemet/Jens Richter/Marijo Prskalo/Ronja Wann +* @category JTL +*} + + +
+
{$paytext}
+
+ + {html_options name='NAME.SALUTATION' options=$salutation selected=$salutation_pre}
+ +
+ {if isset($birthdate)} +
+ {assign var=payment_data value=$birthdate} + {html_select_date|utf8_encode day_id='Date_Day' month_id='Date_Month' year_id='Date_Year' time=$payment_data start_year='-18' end_year='-100' reverse_years='true' day_value_format='%02d' month_format='%m' field_order='DMY'} + {else} + {html_select_date|utf8_encode day_id='Date_Day' month_id='Date_Month' year_id='Date_Year' start_year='-18' end_year='-100' reverse_years='true' day_value_format='%02d' month_format='%m' field_order='DMY'} + {/if} + +
+
+
+ +
+ +
\ No newline at end of file diff --git a/version/114/paymentmethod/template/heidelpay_Santander.tpl b/version/114/paymentmethod/template/heidelpay_Santander.tpl new file mode 100644 index 0000000..4baa272 --- /dev/null +++ b/version/114/paymentmethod/template/heidelpay_Santander.tpl @@ -0,0 +1,45 @@ +{* SUMMARY +* +* DESC +* +* @license Use of this software requires acceptance of the License Agreement. See LICENSE file. +* @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. +* @link https://dev.heidelpay.de/JTL +* @author Andreas Nemet/Jens Richter/Marijo Prskalo/Ronja Wann +* @category JTL +*} + + +
+
{$paytext}
+
+ + {html_options name='NAME.SALUTATION' options=$salutation selected=$salutation_pre}
+
+ {if isset($birthdate)} +
+ {assign var=payment_data value=$birthdate} + {html_select_date|utf8_encode day_id='Date_Day' month_id='Date_Month' year_id='Date_Year' time=$payment_data start_year='-18' end_year='-100' reverse_years='true' day_value_format='%02d' month_format='%m' field_order='DMY'} + {else} + {html_select_date|utf8_encode day_id='Date_Day' month_id='Date_Month' year_id='Date_Year' start_year='-18' end_year='-100' reverse_years='true' day_value_format='%02d' month_format='%m' field_order='DMY'} + {/if} + +
+ + +
+

+ + {$optin} +

+
+
+
+
+ + +
+ +
+ +
\ No newline at end of file diff --git a/version/114/paymentmethod/template/heidelpay_ddMail_de.tpl b/version/114/paymentmethod/template/heidelpay_ddMail_de.tpl new file mode 100644 index 0000000..2c0ccaf --- /dev/null +++ b/version/114/paymentmethod/template/heidelpay_ddMail_de.tpl @@ -0,0 +1,36 @@ +'. "\r\n"; +$headers .= 'Reply-To: '.$einstellungen['emails']['email_master_absender']. "\r\n"; +$headers .= 'MIME-Version: 1.0' . "\r\n"; +$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; + +define('DD_MAIL_HEADERS', $headers); +define('DD_MAIL_SUBJECT','Zahlungsinformation zu Ihrer Bestellung bei '.$firma->cName); +define('DD_MAIL_TEXT',' + + Der Betrag von {AMOUNT} {CURRENCY} wird in den nächsten Tagen von folgendem Konto abgebucht:

+ Kontoinhaber: {HOLDER}
+ IBAN: {ACC_IBAN}
+ BIC: {ACC_BIC}
+
+ Die Abbuchung enthält die Mandatsreferenz-ID: {ACC_IDENT}
+ und die Gläubiger ID: {IDENT_CREDITOR}
+
Bitte sorgen Sie für ausreichende Deckung auf dem entsprechenden Konto. +

+ Mit freundlichem Gruß
+ Ihr Team von '.$firma->cName.' +
+'); +?> \ No newline at end of file diff --git a/version/114/paymentmethod/template/heidelpay_ddMail_en.tpl b/version/114/paymentmethod/template/heidelpay_ddMail_en.tpl new file mode 100644 index 0000000..e22841f --- /dev/null +++ b/version/114/paymentmethod/template/heidelpay_ddMail_en.tpl @@ -0,0 +1,35 @@ +'. "\r\n"; +$headers .= 'Reply-To: '.$einstellungen['emails']['email_master_absender']. "\r\n"; +$headers .= 'MIME-Version: 1.0' . "\r\n"; +$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; + +define('DD_MAIL_HEADERS', $headers); +define('DD_MAIL_SUBJECT','Additional info about your order at '.$firma->cName); +define('DD_MAIL_TEXT',' + + The amount of {AMOUNT} {CURRENCY} will be debited from this account within the next days:

+ Holder: {HOLDER}
+ IBAN: {ACC_IBAN}
+ BIC: {ACC_BIC}
+ The booking contains the mandate reference ID: {ACC_IDENT}
+ and the creditor identifier: {IDENT_CREDITOR}
+
Please ensure that there will be sufficient funds on the corresponding account. +

+ Kind regards,
+ your team from '.$firma->cName.' +
+'); +?> \ No newline at end of file diff --git a/version/114/paymentmethod/template/heidelpay_iDealEPS_Bank.tpl b/version/114/paymentmethod/template/heidelpay_iDealEPS_Bank.tpl new file mode 100644 index 0000000..75aa066 --- /dev/null +++ b/version/114/paymentmethod/template/heidelpay_iDealEPS_Bank.tpl @@ -0,0 +1,28 @@ +{* SUMMARY +* +* DESC +* +* @license Use of this software requires acceptance of the License Agreement. See LICENSE file. +* @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. +* @link https://dev.heidelpay.de/JTL +* @author Andreas Nemet/Jens Richter/Marijo Prskalo/Ronja Wann +* @category JTL +*} + +
+
+ Bankland:
+ Bankname
+ + +
+ +
\ No newline at end of file diff --git a/version/114/paymentmethod/template/heidelpay_ppMail_de.tpl b/version/114/paymentmethod/template/heidelpay_ppMail_de.tpl new file mode 100644 index 0000000..f65a50f --- /dev/null +++ b/version/114/paymentmethod/template/heidelpay_ppMail_de.tpl @@ -0,0 +1,35 @@ +'. "\r\n"; +$headers .= 'Reply-To: '.$einstellungen['emails']['email_master_absender']. "\r\n"; +$headers .= 'MIME-Version: 1.0' . "\r\n"; +$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; + +define('PP_MAIL_HEADERS', $headers); +define('PP_MAIL_SUBJECT','Zahlungsinformation zu Ihrer Bestellung bei '.$firma->cName); +define('PP_MAIL_TEXT',' + + Bitte überweisen Sie uns den Betrag von {AMOUNT} {CURRENCY} auf folgendes Konto:

+ + Kontoinhaber: {ACC_OWNER}
+ IBAN: {ACC_IBAN}
+ BIC: {ACC_BIC}

+ Geben Sie als Verwendungszweck bitte ausschließlich diese Identifikationsnummer an:
+ {USAGE}

+

+ Mit freundlichen Grüßen,
+ Ihr Team von '.$firma->cName.' +
+'); +?> \ No newline at end of file diff --git a/version/114/paymentmethod/template/heidelpay_ppMail_en.tpl b/version/114/paymentmethod/template/heidelpay_ppMail_en.tpl new file mode 100644 index 0000000..bc1692c --- /dev/null +++ b/version/114/paymentmethod/template/heidelpay_ppMail_en.tpl @@ -0,0 +1,35 @@ +'. "\r\n"; +$headers .= 'Reply-To: '.$einstellungen['emails']['email_master_absender']. "\r\n"; +$headers .= 'MIME-Version: 1.0' . "\r\n"; +$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; + +define('PP_MAIL_HEADERS', $headers); +define('PP_MAIL_SUBJECT','Payment information for your order at '.$firma->cName); +define('PP_MAIL_TEXT',' + + Please transfer the amount of {AMOUNT} {CURRENCY} to the following account:

+ + Holder: {ACC_OWNER}
+ IBAN: {ACC_IBAN}
+ BIC: {ACC_BIC}

+ Please use only the following identification number as descriptor:
+ {USAGE}

+

+ With kind regards,
+ your team from '.$firma->cName.' +
+'); +?> \ No newline at end of file diff --git a/version/114/paymentmethod/template/js/birthDateAction.js b/version/114/paymentmethod/template/js/birthDateAction.js new file mode 100644 index 0000000..c2fddea --- /dev/null +++ b/version/114/paymentmethod/template/js/birthDateAction.js @@ -0,0 +1,27 @@ +/** + * SUMMARY + * + * DESC + * + * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. + * @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. + * @link https://dev.heidelpay.de/JTL + * @author Ronja Wann + * @category JTL + */ + + +paymentFrameForm = document.getElementById('paymentFrameForm'); + +function formatDate(e){ + +$("#birthdate_papg").val((document.getElementById('Date_Year').value) + "-" + (document.getElementById('Date_Month').value) + "-" + (document.getElementById('Date_Day').value)); + +} + + +if (paymentFrameForm.addEventListener) {// W3C DOM + paymentFrameForm.addEventListener('submit', formatDate); } +else if (paymentFrameForm.attachEvent) { // IE DOM + paymentFrameForm.attachEvent('onsubmit', formatDate); +} diff --git a/version/114/paymentmethod/template/js/creditCardFrame.js b/version/114/paymentmethod/template/js/creditCardFrame.js new file mode 100644 index 0000000..3a866bc --- /dev/null +++ b/version/114/paymentmethod/template/js/creditCardFrame.js @@ -0,0 +1,102 @@ +/** + * SUMMARY + * + * DESC + * + * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. + * @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. + * @link https://dev.heidelpay.de/JTL + * @author Ronja Wann + * @category JTL + */ + + +var paymentFrameIframe = document.getElementById('paymentIframe'); + +/** + * Get hostname and protocol from paymentIframe + */ +var targetOrigin = getDomainFromUrl($('#paymentIframe').attr('src')); + +/** + * Get the form element + */ + +paymentFrameForm = document.getElementById('paymentFrameForm'); + + +/** + * Add an event listener to from submit, which will execute the sendMessage function + */ +if (paymentFrameForm.addEventListener) {// W3C DOM + paymentFrameForm.addEventListener('submit', sendMessage); } +else if (paymentFrameForm.attachEvent) { // IE DOM + paymentFrameForm.attachEvent('onsubmit', sendMessage); + } + +/** + * Define send Message function + * This function will collect each inpunt inside the form and then submit + * the iframe to the payment server. Please note that it is not allowed to submit + * credit or debit card information form your webpage. + */ + +function sendMessage(e) { + + if(e.preventDefault) { e.preventDefault(); } + else { e.returnValue = false; } + + var data = {}; + + /** + * Collection form input fields + */ + + + + + /** + * Send html postmessage to payment frame + */ + paymentFrameIframe.contentWindow.postMessage(JSON.stringify(data), targetOrigin); +} + + +/** + * Function to get the domain from a given url + */ +function getDomainFromUrl(url) { + var arr = url.split("/"); + return arr[0] + "//" + arr[2]; + } + + +/** + * Add an listener to your webpage, which will recieve the response message + * from payment server. + */ +if (window.addEventListener) { // W3C DOM + window.addEventListener('message', receiveMessage); + + } +else if (window.attachEvent) { // IE DOM + window.attachEvent('onmessage', receiveMessage); + } + +/** + * Define receiveMessage function + * + * This function will recieve the response message form the payment server. + */ +function receiveMessage(e) { + + if (e.origin !== targetOrigin) { + return; + } + + var antwort = JSON.parse(e.data); + console.log(antwort); +} + + + diff --git a/version/114/paymentmethod/template/new_bestellabschluss.tpl b/version/114/paymentmethod/template/new_bestellabschluss.tpl new file mode 100644 index 0000000..8603758 --- /dev/null +++ b/version/114/paymentmethod/template/new_bestellabschluss.tpl @@ -0,0 +1,36 @@ +{* SUMMARY +* +* DESC +* +* @license Use of this software requires acceptance of the License Agreement. See LICENSE file. +* @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. +* @link https://dev.heidelpay.de/JTL +* @author Andreas Nemet/Jens Richter/Marijo Prskalo/Ronja Wann +* @category JTL +*} + +
+ getResponse()->isError()) { + echo '
'. print_r($iDeal->getResponse()->getError(),1).'
'; + } + ?> + Bankland:
+ Bankname
+ Holder:
+ +
\ No newline at end of file diff --git a/version/114/paymentmethod/template/old_bestellabschluss.tpl b/version/114/paymentmethod/template/old_bestellabschluss.tpl new file mode 100644 index 0000000..76329ba --- /dev/null +++ b/version/114/paymentmethod/template/old_bestellabschluss.tpl @@ -0,0 +1,25 @@ +{* SUMMARY +* +* DESC +* +* @license Use of this software requires acceptance of the License Agreement. See LICENSE file. +* @copyright Copyright 2016-present Heidelberger Payment GmbH. All rights reserved. +* @link https://dev.heidelpay.de/JTL +* @author Andreas Nemet/Jens Richter/Marijo Prskalo/Ronja Wann +* @category JTL +*} + +
+ {if $status == 'error'} + {$error} + {else} + {lang key="heidelpayDesc" section=""} + {strip} +
+ + HeidelPay Logo + +
+ {/strip} + {/if} +
\ No newline at end of file From c7baad96622caa66dfd2ef34e0d58d628e991726 Mon Sep 17 00:00:00 2001 From: Florian Evertz Date: Thu, 8 Feb 2018 17:59:35 +0100 Subject: [PATCH 02/62] Formatting --- version/114/paymentmethod/heidelpay_standard.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/version/114/paymentmethod/heidelpay_standard.class.php b/version/114/paymentmethod/heidelpay_standard.class.php index 4f8cdd7..e5d5dfa 100644 --- a/version/114/paymentmethod/heidelpay_standard.class.php +++ b/version/114/paymentmethod/heidelpay_standard.class.php @@ -769,7 +769,6 @@ public function setPayInfo($post, $orderId) Geben Sie als Verwendungszweck bitte ausschließlich folgende Identifikationsnummer an: ' . $post['IDENTIFICATION_SHORTID']; - $sql = 'UPDATE `tbestellung` SET `cKommentar` ="' . htmlspecialchars(utf8_decode($bookingtext)) . '" WHERE `cBestellNr` ="' . htmlspecialchars($orderId) . '";'; @@ -805,7 +804,6 @@ public function finalizeOrder($order, $hash, $args) } } - /** * prepares payment text * From 148c246bd4aa520711637d986e868a464df9a4b2 Mon Sep 17 00:00:00 2001 From: Florian Evertz Date: Tue, 13 Feb 2018 17:53:59 +0100 Subject: [PATCH 03/62] =?UTF-8?q?Methode=20f=C3=BCr=20die=20Fehlermeldung?= =?UTF-8?q?=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Methode disableInvoiceSecured hinzugefügt. --- .../heidelpay_standard.class.php | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/version/114/paymentmethod/heidelpay_standard.class.php b/version/114/paymentmethod/heidelpay_standard.class.php index e5d5dfa..bc362bf 100644 --- a/version/114/paymentmethod/heidelpay_standard.class.php +++ b/version/114/paymentmethod/heidelpay_standard.class.php @@ -74,6 +74,8 @@ public function preparePaymentProcess($order) { global $bestellung; + mail('florian.evertz@heidelpay.de', 'Debugmail - preparement', 'es wird prepared'); + $currentPaymentMethod = $_SESSION ['Zahlungsart']->cModulId; if (empty($currentPaymentMethod)) { $currentPaymentMethod = $bestellung->Zahlungsart->cModulId; @@ -624,7 +626,7 @@ public function handleNotification($order, $paymentHash, $args) { $this->init(); - mail('florian.evertz@heidelpay.de', 'debug - handle1', print_r($args, 1)); + mail('florian.evertz@heidelpay.de', 'debug - handle Notification', print_r($args, 1)); $HeidelpayResponse = new Heidelpay\PhpPaymentApi\Response($args); @@ -727,7 +729,10 @@ public function handleNotification($order, $paymentHash, $args) /*save order */ } elseif ($HeidelpayResponse->isError()) { $error = $HeidelpayResponse->getError(); - echo $this->getErrorReturnURL($order) . '&hperror=' . $error['code']; + //TODO: an dieser Stelle auf INSURANCE-Dingens prüfen und Funktion ausführen + + echo $this->getErrorReturnURL($order) . '&hperror=' . $error['code']. + $this->disableInvoiceSecured($args); } elseif ($HeidelpayResponse->isPending()) { echo $this->getReturnURL($order); } @@ -797,13 +802,30 @@ public function finalizeOrder($order, $hash, $args) if ($args['PROCESSING_RESULT'] == "ACK") { return true; } else { - mail('florian.evertz@heidelpay.de', 'debug - handle', print_r($args, 1)); + mail('florian.evertz@heidelpay.de', 'debug - finalizeOrder', print_r($args, 1)); + + //TODO: Response auf INSURER-DINGENS prüfen und funtkion ausführen? - $cEditZahlungHinweis = rawurlencode($args['PROCESSING_RETURN']) . '&hperror=' . $args['PROCESSING_RETURN_CODE'] . '2354'; + $cEditZahlungHinweis = rawurlencode($args['PROCESSING_RETURN']) . + '&hperror=' . $args['PROCESSING_RETURN_CODE']; + + if (isset($args['CRITERION_INSURANCE-RESERVATION']) && + $args['CRITERION_INSURANCE-RESERVATION'] === 'DENIED') { + $cEditZahlungHinweis .= $this->disableInvoiceSecured($args); + } return false; } } + public function disableInvoiceSecured($response) + { + if (isset($response['CRITERION_INSURANCE-RESERVATION'])&& + $response['CRITERION_INSURANCE-RESERVATION'] === 'DENIED') { + return '&disableInvoice=true'; + } + return ''; + } + /** * prepares payment text * From 2db007d0bc006cc4999dd99cc260ca853fd6dbcd Mon Sep 17 00:00:00 2001 From: Florian Evertz Date: Thu, 15 Feb 2018 10:40:19 +0100 Subject: [PATCH 04/62] [feature](-)Secured Invoice: Add hook to disable Payment method --- info.xml | 2 +- version/114/frontend/heidelpay.hook008.php | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/info.xml b/info.xml index 4341ac6..d560057 100644 --- a/info.xml +++ b/info.xml @@ -55,7 +55,7 @@ 2018-02-02 - heidelpay.hook008.php + heidelpay.hook008.php heidelpay.hook140.php heidelpay.hook153.php heidelpay.hook181.php diff --git a/version/114/frontend/heidelpay.hook008.php b/version/114/frontend/heidelpay.hook008.php index 58aa7ed..4f99c11 100644 --- a/version/114/frontend/heidelpay.hook008.php +++ b/version/114/frontend/heidelpay.hook008.php @@ -6,12 +6,18 @@ * Time: 12:09 */ -mail('florian.evertz@heidelpay.de', 'Hook Check', 'Hook is activated and executed'); +if (isset($_GET['disableInvoice']) && $_GET['disableInvoice']) { + $_SESSION['InvoiceDisabled'] = true; +} -/* -if (isset($_SESSION['secureFailed'])) { - //disable Invoice Secure - echo 'Session ist gesetzt'; -} else { - echo 'Keine Sessionsetzung!!!!!!!!!!!!!!!'; -}*/ +if ($_SESSION['InvoiceDisabled']) { + $zahlungsArray = Shop::Smarty()->getTemplateVars('Zahlungsarten', null, false); + + //Search for heidelpay Secured Invoice in smarty Object and remove it + foreach ($zahlungsArray as $key => $class) { + if ($class->cModulId == 'kPlugin_10_heidelpaygesicherterechnungplugin') { + unset($zahlungsArray[$key]); + Shop::Smarty()->assign('Zahlungsarten', $zahlungsArray); + } + } +} From 7d08d35e1fa74b1b08d6846766616399add68ddd Mon Sep 17 00:00:00 2001 From: Florian Evertz Date: Fri, 16 Feb 2018 08:55:00 +0100 Subject: [PATCH 05/62] [refactor](-) removing debug mail function --- version/114/paymentmethod/heidelpay_standard.class.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/version/114/paymentmethod/heidelpay_standard.class.php b/version/114/paymentmethod/heidelpay_standard.class.php index bc362bf..428d1e8 100644 --- a/version/114/paymentmethod/heidelpay_standard.class.php +++ b/version/114/paymentmethod/heidelpay_standard.class.php @@ -74,8 +74,6 @@ public function preparePaymentProcess($order) { global $bestellung; - mail('florian.evertz@heidelpay.de', 'Debugmail - preparement', 'es wird prepared'); - $currentPaymentMethod = $_SESSION ['Zahlungsart']->cModulId; if (empty($currentPaymentMethod)) { $currentPaymentMethod = $bestellung->Zahlungsart->cModulId; @@ -139,7 +137,6 @@ public function preparePaymentProcess($order) } if ($this->paymentObject->getResponse()->isError()) { - mail('florian.evertz@heidelpay.de', 'Debug - Error', print_r($this->paymentObject->getResponse(), 1)); $errorCode = $this->paymentObject->getResponse()->getError(); $this->redirect('bestellvorgang.php?heidelpayErrorCode=' . $errorCode['code']); return; @@ -626,8 +623,6 @@ public function handleNotification($order, $paymentHash, $args) { $this->init(); - mail('florian.evertz@heidelpay.de', 'debug - handle Notification', print_r($args, 1)); - $HeidelpayResponse = new Heidelpay\PhpPaymentApi\Response($args); if (array_key_exists('CRITERION_PAYMETHOD', $args)) { @@ -802,10 +797,6 @@ public function finalizeOrder($order, $hash, $args) if ($args['PROCESSING_RESULT'] == "ACK") { return true; } else { - mail('florian.evertz@heidelpay.de', 'debug - finalizeOrder', print_r($args, 1)); - - //TODO: Response auf INSURER-DINGENS prüfen und funtkion ausführen? - $cEditZahlungHinweis = rawurlencode($args['PROCESSING_RETURN']) . '&hperror=' . $args['PROCESSING_RETURN_CODE']; From 03a072c227fca7492e8b29313a6ebb1efa341a43 Mon Sep 17 00:00:00 2001 From: Jens Richter Date: Fri, 16 Feb 2018 09:40:27 +0100 Subject: [PATCH 06/62] [add] add author to composer.json and git ignore file --- .gitignore | 5 +++-- composer.json | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index fe32b8a..c430163 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea -/.php_cs.cache -/composer.lock +.php_cs.cache +composer.lock +composer.phar diff --git a/composer.json b/composer.json index 2a182e4..8b5a6d5 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,9 @@ }, "authors" : [{ "name" : "Ronja Wann" + }, + { + "name" : "Florian Evertz" } ], "support" : { From f4e2b0537b02012121f181e3c44c56a354d80dba Mon Sep 17 00:00:00 2001 From: Florian Evertz Date: Fri, 16 Feb 2018 14:33:03 +0100 Subject: [PATCH 07/62] [refactor] Format: solve PSR2 hints --- composer.json | 2 +- version/114/frontend/heidelpay.hook140.php | 19 +--- version/114/frontend/heidelpay.hook153.php | 3 +- version/114/frontend/heidelpay.hook181.php | 101 ++++++++---------- .../heidelpay_standard.class.php | 39 +++++-- 5 files changed, 84 insertions(+), 80 deletions(-) diff --git a/composer.json b/composer.json index 2a182e4..b6b800e 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "require" : { "php" : "~5.6.0|~7.0.0|~7.1.0", "zendframework/zend-http" : "2.*", - "heidelpay/php-payment-api" : "v1.2.0", + "heidelpay/php-payment-api" : "v1.4.0", "heidelpay/php-message-code-mapper": "v1.0.0" }, "require-dev": { diff --git a/version/114/frontend/heidelpay.hook140.php b/version/114/frontend/heidelpay.hook140.php index c26bd7e..a820c41 100644 --- a/version/114/frontend/heidelpay.hook140.php +++ b/version/114/frontend/heidelpay.hook140.php @@ -16,60 +16,49 @@ if (isset($_GET ['hperror'])) { if (preg_match('/[0-9]{3}\.[0-9]{3}\.[0-9]{3}/', $_GET ['hperror'])) { - include_once(PFAD_ROOT . PFAD_INCLUDES . 'plugins/heidelpay_standard/version/114/paymentmethod/heidelpay_standard.class.php'); + include_once PFAD_ROOT . PFAD_PLUGIN . $oPlugin->cVerzeichnis . '/version/' . + $oPlugin->nVersion . '/paymentmethod/heidelpay_standard.class.php'; $heidelpayError = $_GET['hperror']; $local = ($_SESSION ['cISOSprache'] == 'ger') ? 'de_DE' : 'en_US'; - $customerErrorMessage = new \Heidelpay\MessageCodeMapper\MessageCodeMapper($local); $divStart = '
Error:
'; $divEnd = '
'; - $hpErrorMsg = htmlspecialchars_decode($customerErrorMessage->getMessage($heidelpayError)); - $errorSnip = $divStart . ' ' . $hpErrorMsg . ' ' . $divEnd; pq("#content")->prepend($errorSnip); - } } if (isset($_GET ['hperrorcom'])) { - $divStart = '
Error:
'; $divEnd = '
'; - if ($_SESSION ['cISOSprache'] == 'ger') { $hpErrorMsg = utf8_decode('Dieses Zahlverfahren steht nicht für Firmenkunden zur Verfügung'); } else { $hpErrorMsg = utf8_decode('This paymentmethod is not available for corporate clients'); } - $errorSnip = $divStart . ' ' . $hpErrorMsg . ' ' . $divEnd; - pq("#content")->prepend($errorSnip); - + pq('#content')->prepend($errorSnip); } if (isset($_GET ['hperroradd'])) { - $divStart = '
Error:
'; $divEnd = '
'; - if ($_SESSION ['cISOSprache'] == 'ger') { $hpErrorMsg = utf8_decode('Rechnungs- und Lieferadresse müssen identisch sein'); } else { $hpErrorMsg = utf8_decode('Billing- and shipping adress have to be equal'); } - $errorSnip = $divStart . ' ' . $hpErrorMsg . ' ' . $divEnd; - pq("#content")->prepend($errorSnip); - + pq('#content')->prepend($errorSnip); } diff --git a/version/114/frontend/heidelpay.hook153.php b/version/114/frontend/heidelpay.hook153.php index 31988e9..7f0b39b 100644 --- a/version/114/frontend/heidelpay.hook153.php +++ b/version/114/frontend/heidelpay.hook153.php @@ -11,4 +11,5 @@ * @category JTL */ -require_once PFAD_ROOT . PFAD_PLUGIN .'heidelpay_standard/version/114/paymentmethod/returnHPMailStr.php'; +require_once PFAD_ROOT . PFAD_PLUGIN . $oPlugin->cVerzeichnis . '/version/' . + $oPlugin->nVersion . '/paymentmethod/heidelpay_standard.class.php'; diff --git a/version/114/frontend/heidelpay.hook181.php b/version/114/frontend/heidelpay.hook181.php index ac64138..aa3a4ba 100644 --- a/version/114/frontend/heidelpay.hook181.php +++ b/version/114/frontend/heidelpay.hook181.php @@ -16,95 +16,87 @@ #ini_set('display_startup_errors', 1); #error_reporting(E_ALL); - $oBestellung = Shop::DB()->query( "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 + LIMIT 1", + 1 ); $_query_live_url = 'https://heidelpay.hpcgw.net/TransactionCore/xml'; $_query_sandbox_url = 'https://test-heidelpay.hpcgw.net/TransactionCore/xml'; +$url = $_query_sandbox_url; 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); - -if (($args_arr['status'] === 4 OR $args_arr['status'] === 5) AND $payMethod['2'] === 'heidelpaygesicherterechnungplugin') { +$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); - if (!empty($result[0])) { - - $xml_params = array( - "type" => "STANDARD", - "methods" => array("IV"), - "types" => array("PA"), - "identification" => $result, - "procRes" => "ACK", - "transType" => "PAYMENT" - + '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" - + 'type' => 'LINKED_TRANSACTIONS', + 'methods' => array('IV'), + 'types' => array('FI'), + 'identification' => $result, + 'procRes' => 'ACK', + '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'] + '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); - + $resLinkedTxn = $xmlQueryClass->doRequest( + array( + 'load' => urlencode($xmlQueryClass->getXMLRequest($config, $xml_params_fin)) + ), + $url + ); $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) { - 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); + $res = $xmlQueryClass->doRequest( + array( + 'load' => urlencode($xmlQueryClass->getXMLRequest($config, $xml_params)) + ), + $url + ); $resXMLObject = new SimpleXMLElement($res); @@ -117,26 +109,27 @@ $oPlugin->oPluginEinstellungAssoc_arr ['user'], $oPlugin->oPluginEinstellungAssoc_arr ['pass'], (string)$resXMLObject->Result->Transaction['channel'], - $sandboxMode); + $sandboxMode + ); $paymentObject->getRequest()->basketData( $args_arr['oBestellung']->kBestellung, $args_arr['oBestellung']->fGesamtsumme, (string)$resXMLObject->Result->Transaction->Payment->Presentation->Currency, - $args_arr['oBestellung']->cSession); + $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)); + 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) + ); } - - } - } - } diff --git a/version/114/paymentmethod/heidelpay_standard.class.php b/version/114/paymentmethod/heidelpay_standard.class.php index e5d5dfa..97567b6 100644 --- a/version/114/paymentmethod/heidelpay_standard.class.php +++ b/version/114/paymentmethod/heidelpay_standard.class.php @@ -7,12 +7,12 @@ * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL - * @author Ronja Wann + * @author Ronja Wann, Florian Evertz * @category JTL */ -include_once(PFAD_ROOT . PFAD_INCLUDES_MODULES . 'ServerPaymentMethod.class.php'); +include_once PFAD_ROOT . PFAD_INCLUDES_MODULES . 'ServerPaymentMethod.class.php'; require_once PFAD_ROOT . PFAD_PLUGIN . 'heidelpay_standard/vendor/autoload.php'; -require_once(PFAD_ROOT . PFAD_CLASSES . "class.JTL-Shop.Jtllog.php"); +require_once PFAD_ROOT . PFAD_CLASSES . "class.JTL-Shop.Jtllog.php"; /* * Heidelpay @@ -41,7 +41,7 @@ public function setLocal() */ public function setShortId($shortId, $orderId) { - (preg_match('/\d{4}[.]\d{4}[.]\d{4}/', $shortId)) ? $shortId : false; + preg_match('/\d{4}[.]\d{4}[.]\d{4}/', $shortId) ? $shortId : false; if (!is_numeric($orderId)) { return false; @@ -99,18 +99,21 @@ public function preparePaymentProcess($order) $oPlugin->oPluginEinstellungAssoc_arr ['user'], $oPlugin->oPluginEinstellungAssoc_arr ['pass'], $oPlugin->oPluginEinstellungAssoc_arr [$currentPaymentMethod . '_channel'], - $this->isSandboxMode($oPlugin, $currentPaymentMethod)); + $this->isSandboxMode($oPlugin, $currentPaymentMethod) + ); $this->paymentObject->getRequest()->getContact()->set('ip', $this->getIp()); $this->paymentObject->getRequest()->customerAddress(...$this->getCustomerData($oPlugin, $currentPaymentMethod)); $this->paymentObject->getRequest()->basketData(...$this->getBasketData($order, $oPlugin)); $this->paymentObject->getRequest()->async($this->getLanguageCode(), $notifyURL); $this->paymentObject->getRequest()->getCriterion()->set('PAYMETHOD', $currentPaymentMethod); - if (($paymentMethodPrefix == 'HPDDPG' OR $paymentMethodPrefix == 'HPIVPG' OR $paymentMethodPrefix == 'HPSA') AND $this->isEqualAddress($order) == false) { + if (($paymentMethodPrefix == 'HPDDPG' OR $paymentMethodPrefix == 'HPIVPG' OR $paymentMethodPrefix == 'HPSA') AND + $this->isEqualAddress($order) == false) { $this->redirect('warenkorb.php?hperroradd=1'); } - if (($paymentMethodPrefix == 'HPDDPG' OR $paymentMethodPrefix == 'HPIVPG') AND $_SESSION['Kunde']->cFirma != null) { + if (($paymentMethodPrefix == 'HPDDPG' OR $paymentMethodPrefix == 'HPIVPG') AND + $_SESSION['Kunde']->cFirma != null) { $this->redirect('warenkorb.php?hperrorcom=1'); } @@ -306,11 +309,29 @@ public function getCustomerData($oPlugin, $currentPaymentMethod) $user = $_SESSION ['Lieferadresse']; $mail = $_SESSION ['Kunde']; $userStreet = $user->cStrasse . ' ' . $user->cHausnummer; - $userData = array((empty($user->cVorname)) ? null : $user->cVorname, (empty($user->cNachname)) ? null : $user->cNachname, (empty($user->cFirma)) ? null : $user->cFirma, (empty($user->kKunde)) ? null : $user->kKunde, (empty($userStreet)) ? null : $userStreet, (empty($user->cBundesland)) ? null : $user->cBundesland, (empty($user->cPLZ)) ? null : $user->cPLZ, (empty($user->cOrt)) ? null : $user->cOrt, (empty($user->cLand)) ? null : $user->cLand, (empty($mail->cMail)) ? null : $mail->cMail); + $userData = array(empty($user->cVorname) ? null : $user->cVorname, + empty($user->cNachname) ? null : $user->cNachname, + empty($user->cFirma) ? null : $user->cFirma, + empty($user->kKunde) ? null : $user->kKunde, + empty($userStreet) ? null : $userStreet, + empty($user->cBundesland) ? null : $user->cBundesland, + empty($user->cPLZ) ? null : $user->cPLZ, + empty($user->cOrt) ? null : $user->cOrt, + empty($user->cLand) ? null : $user->cLand, + empty($mail->cMail) ? null : $mail->cMail); } else { $user = $_SESSION ['Kunde']; $userStreet = $user->cStrasse . ' ' . $user->cHausnummer; - $userData = array((empty($user->cVorname)) ? null : $user->cVorname, (empty($user->cNachname)) ? null : $user->cNachname, (empty($user->cFirma)) ? null : $user->cFirma, (empty($user->kKunde)) ? null : $user->kKunde, (empty($userStreet)) ? null : $userStreet, (empty($user->cBundesland)) ? null : $user->cBundesland, (empty($user->cPLZ)) ? null : $user->cPLZ, (empty($user->cOrt)) ? null : $user->cOrt, (empty($user->cLand)) ? null : $user->cLand, (empty($user->cMail)) ? null : $user->cMail); + $userData = array(empty($user->cVorname) ? null : $user->cVorname, + empty($user->cNachname) ? null : $user->cNachname, + empty($user->cFirma) ? null : $user->cFirma, + empty($user->kKunde) ? null : $user->kKunde, + empty($userStreet) ? null : $userStreet, + empty($user->cBundesland) ? null : $user->cBundesland, + empty($user->cPLZ) ? null : $user->cPLZ, + empty($user->cOrt) ? null : $user->cOrt, + empty($user->cLand) ? null : $user->cLand, + empty($user->cMail) ? null : $user->cMail); } return $this->encodeData($userData); } From adabf1a217650e55756a2ac78a779657e39d6129 Mon Sep 17 00:00:00 2001 From: Florian Evertz Date: Fri, 16 Feb 2018 14:37:25 +0100 Subject: [PATCH 08/62] [refactor](-) Update composer dependencies --- vendor/composer/ClassLoader.php | 4 +- vendor/composer/installed.json | 30 +-- vendor/heidelpay/php-payment-api/.codacy.yml | 11 +- vendor/heidelpay/php-payment-api/.travis.yml | 40 ++-- vendor/heidelpay/php-payment-api/CHANGELOG.md | 49 ++++- vendor/heidelpay/php-payment-api/README.md | 18 +- .../heidelpay/php-payment-api/composer.json | 2 +- .../php-payment-api/lib/AbstractMethod.php | 157 +++++++++++++-- .../lib/Constants/ApiConfig.php | 25 +++ .../php-payment-api/lib/Constants/Brand.php | 79 ++++++++ .../lib/Constants/PaymentMethod.php | 32 +++ .../lib/Constants/ProcessingResult.php | 23 +++ .../lib/Constants/ReasonCode.php | 31 +++ .../lib/Constants/StatusCode.php | 29 +++ .../lib/Constants/TransactionMode.php | 24 +++ .../lib/Constants/TransactionType.php | 47 +++++ .../Exceptions/HashVerificationException.php | 4 +- .../lib/Exceptions/JsonParserException.php | 21 ++ .../Exceptions/PaymentFormUrlException.php | 4 +- .../Exceptions/UndefinedPropertyException.php | 4 +- .../UndefinedTransactionModeException.php | 4 +- .../UndefinedXmlResponseException.php | 4 +- .../Exceptions/XmlResponseParserException.php | 4 +- .../php-payment-api/lib/MethodInterface.php | 41 +++- .../AbstractParameterGroup.php | 6 +- .../ParameterGroups/AccountParameterGroup.php | 51 ++++- .../ParameterGroups/AddressParameterGroup.php | 4 +- .../ParameterGroups/BasketParameterGroup.php | 4 +- .../ParameterGroups/ConfigParameterGroup.php | 6 +- .../ConnectorParameterGroup.php | 4 +- .../ParameterGroups/ContactParameterGroup.php | 4 +- .../CriterionParameterGroup.php | 12 +- .../FrontendParameterGroup.php | 36 ++-- .../IdentificationParameterGroup.php | 14 +- .../ParameterGroups/NameParameterGroup.php | 14 +- .../ParameterGroupInterface.php | 2 +- .../ParameterGroups/PaymentParameterGroup.php | 4 +- .../PresentationParameterGroup.php | 10 +- .../ProcessingParameterGroup.php | 4 +- .../ParameterGroups/RequestParameterGroup.php | 4 +- .../RiskInformationParameterGroup.php | 4 +- .../SecurityParameterGroup.php | 6 +- .../TransactionParameterGroup.php | 12 +- .../ParameterGroups/UserParameterGroup.php | 8 +- .../PaymentMethods/AbstractPaymentMethod.php | 43 ---- .../BasicPaymentMethodTrait.php | 134 +++++++------ .../CreditCardPaymentMethod.php | 108 +++++----- .../PaymentMethods/DebitCardPaymentMethod.php | 113 ++++++----- .../DirectDebitB2CSecuredPaymentMethod.php | 26 +-- .../DirectDebitPaymentMethod.php | 22 +-- .../lib/PaymentMethods/EPSPaymentMethod.php | 39 ++-- .../EasyCreditPaymentMethod.php | 16 +- .../PaymentMethods/GiropayPaymentMethod.php | 39 ++-- .../lib/PaymentMethods/IDealPaymentMethod.php | 32 ++- .../InvoiceB2CSecuredPaymentMethod.php | 24 +-- .../PaymentMethods/InvoicePaymentMethod.php | 20 +- .../PaymentMethods/PayPalPaymentMethod.php | 22 +-- .../PaymentMethods/PaymentMethodInterface.php | 61 +++++- .../PayolutionInvoicePaymentMethod.php | 12 +- .../PostFinanceCardPaymentMethod.php | 39 ++-- .../PostFinanceEFinancePaymentMethod.php | 39 ++-- .../PrepaymentPaymentMethod.php | 20 +- .../Przelewy24PaymentMethod.php | 39 ++-- .../SantanderInvoicePaymentMethod.php | 20 +- .../PaymentMethods/SofortPaymentMethod.php | 20 +- vendor/heidelpay/php-payment-api/lib/Push.php | 10 +- .../lib/PushMapping/AbstractPushMapper.php | 6 +- .../lib/PushMapping/Account.php | 26 ++- .../lib/PushMapping/Address.php | 16 +- .../lib/PushMapping/Connector.php | 14 +- .../lib/PushMapping/Contact.php | 16 +- .../lib/PushMapping/Frontend.php | 14 +- .../lib/PushMapping/Identification.php | 14 +- .../php-payment-api/lib/PushMapping/Name.php | 14 +- .../lib/PushMapping/Payment.php | 14 +- .../lib/PushMapping/Presentation.php | 14 +- .../lib/PushMapping/Processing.php | 36 +++- .../lib/PushMapping/PushMappingInterface.php | 4 +- .../lib/PushMapping/Transaction.php | 12 +- .../heidelpay/php-payment-api/lib/Request.php | 77 +++----- .../php-payment-api/lib/Response.php | 116 +++-------- ...AuthorizeOnRegistrationTransactionType.php | 21 +- .../AuthorizeTransactionType.php | 12 +- .../CaptureTransactionType.php | 20 +- .../DebitOnRegistrationTransactionType.php | 18 +- .../TransactionTypes/DebitTransactionType.php | 12 +- .../FinalizeTransactionType.php | 20 +- .../InitializeTransactionType.php | 11 +- .../RebillTransactionType.php | 20 +- .../RefundTransactionType.php | 20 +- .../RegistrationTransactionType.php | 12 +- .../ReregistrationTransactionType.php | 44 +++++ .../ReversalTransactionType.php | 20 +- .../heidelpay/php-payment-api/phpdoc.dist.xml | 3 + .../tests/Helper/BasePaymentMethodTest.php | 15 ++ .../CreditCardPaymentMethodTest.php | 187 +++++++++++++----- .../DebitCardPaymentMethodTest.php | 183 +++++++++++++---- ...DirectDebitB2CSecuredPaymentMethodTest.php | 174 ++++++++++++---- .../DirectDebitPaymentMethodTest.php | 126 +++++++++--- .../PaymentMethods/EPSPaymentMethodTest.php | 15 +- .../EasyCreditPaymentMethodTest.php | 9 +- .../GiropayPaymentMethodTest.php | 15 +- .../PaymentMethods/IdealPaymentMethodTest.php | 15 +- .../InvoiceB2CSecuredPaymentMethodTest.php | 30 ++- .../InvoicePaymentMethodTest.php | 24 ++- .../PayPalPaymentMethodTest.php | 101 ++++++++-- .../PayolutionInvoicePaymentMethodTest.php | 24 ++- .../PostFinanceCardPaymentMethodTest.php | 19 +- .../PostFinanceEFinancePaymentMethodTest.php | 15 +- .../PrepaymentPaymentMethodTest.php | 24 ++- .../Przelewy24PaymentMethodTest.php | 15 +- .../SantanderInvoicePaymentMethodTest.php | 24 ++- .../SofortPaymentMethodTest.php | 24 ++- .../tests/script/travis_before_install.sh | 15 ++ .../tests/script/travis_install.sh | 16 ++ .../tests/script/travis_script.sh | 20 ++ .../tests/unit/Adapter/CurlAdapterTest.php | 2 +- .../AccountParameterGroupTest.php | 10 +- .../AddressParameterGroupTest.php | 2 +- .../BasketParameterGroupTest.php | 2 +- .../ConfigParameterGroupTest.php | 2 +- .../ConnectorParameterGroupTest.php | 2 +- .../ContactParameterGroupTest.php | 2 +- .../CriterionParameterGroupTest.php | 2 +- .../FrontendParameterGroupTest.php | 4 +- .../IdentificationParameterGroupTest.php | 2 +- .../NameParameterGroupTest.php | 2 +- .../PaymentParameterGroupTest.php | 2 +- .../PresentationParameterGroupTest.php | 2 +- .../RequestParameterGroupTest.php | 2 +- .../RiskInformationParameterGroupTest.php | 2 +- .../SecurityParameterGroupTest.php | 2 +- .../TransactionParameterGroupTest.php | 2 +- .../UserParameterGroupTest.php | 2 +- .../AbstractPaymentMethodTest.php | 29 ++- .../CreditCardPaymentMethodTest.php | 127 +++++++++--- .../DebitCardPaymentMethodTest.php | 135 ++++++++++--- .../EasyCreditPaymentMethodTest.php | 12 +- .../GenericPaymentMethodTest.php | 6 +- .../PaymentMethodTransactionTest.php | 48 +++-- .../php-payment-api/tests/unit/PushTest.php | 33 ++-- .../tests/unit/RequestTest.php | 86 +++++++- .../tests/unit/ResponseTest.php | 89 +++++++-- .../zendframework/zend-validator/CHANGELOG.md | 41 ++++ .../zend-validator/composer.json | 7 +- .../zend-validator/composer.lock | 2 +- .../doc/book/validators/credit-card.md | 1 + .../doc/book/validators/explode.md | 48 +++++ .../zendframework/zend-validator/mkdocs.yml | 1 + .../zend-validator/src/CreditCard.php | 19 +- .../zendframework/zend-validator/src/Csrf.php | 6 +- .../zend-validator/src/Hostname.php | 10 +- .../zendframework/zend-validator/src/Iban.php | 3 +- .../zend-validator/src/Regex.php | 2 +- .../src/ValidatorPluginManager.php | 5 + 155 files changed, 2891 insertions(+), 1375 deletions(-) create mode 100644 vendor/heidelpay/php-payment-api/lib/Constants/ApiConfig.php create mode 100644 vendor/heidelpay/php-payment-api/lib/Constants/Brand.php create mode 100644 vendor/heidelpay/php-payment-api/lib/Constants/PaymentMethod.php create mode 100644 vendor/heidelpay/php-payment-api/lib/Constants/ProcessingResult.php create mode 100644 vendor/heidelpay/php-payment-api/lib/Constants/ReasonCode.php create mode 100644 vendor/heidelpay/php-payment-api/lib/Constants/StatusCode.php create mode 100644 vendor/heidelpay/php-payment-api/lib/Constants/TransactionMode.php create mode 100644 vendor/heidelpay/php-payment-api/lib/Constants/TransactionType.php create mode 100644 vendor/heidelpay/php-payment-api/lib/Exceptions/JsonParserException.php delete mode 100644 vendor/heidelpay/php-payment-api/lib/PaymentMethods/AbstractPaymentMethod.php create mode 100644 vendor/heidelpay/php-payment-api/lib/TransactionTypes/ReregistrationTransactionType.php create mode 100644 vendor/heidelpay/php-payment-api/tests/script/travis_before_install.sh create mode 100644 vendor/heidelpay/php-payment-api/tests/script/travis_install.sh create mode 100644 vendor/heidelpay/php-payment-api/tests/script/travis_script.sh create mode 100644 vendor/zendframework/zend-validator/doc/book/validators/explode.md diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index 6e8d09f..dc02dfb 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -379,9 +379,9 @@ private function findFileWithExtension($class, $ext) $subPath = substr($subPath, 0, $lastPos); $search = $subPath.'\\'; if (isset($this->prefixDirsPsr4[$search])) { - $length = $this->prefixLengthsPsr4[$first][$search]; + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); foreach ($this->prefixDirsPsr4[$search] as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { + if (file_exists($file = $dir . $pathEnd)) { return $file; } } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 542e0cc..0cff93e 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -87,17 +87,17 @@ }, { "name": "heidelpay/php-payment-api", - "version": "v1.2.0", - "version_normalized": "1.2.0.0", + "version": "v1.4.0", + "version_normalized": "1.4.0.0", "source": { "type": "git", "url": "https://github.com/heidelpay/php-payment-api.git", - "reference": "6fa02ca075a22e3221082ae65c0d99e6a4485402" + "reference": "de2f457f26523a06c67c8a6e225da8b65f4b4bac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/heidelpay/php-payment-api/zipball/6fa02ca075a22e3221082ae65c0d99e6a4485402", - "reference": "6fa02ca075a22e3221082ae65c0d99e6a4485402", + "url": "https://api.github.com/repos/heidelpay/php-payment-api/zipball/de2f457f26523a06c67c8a6e225da8b65f4b4bac", + "reference": "de2f457f26523a06c67c8a6e225da8b65f4b4bac", "shasum": "" }, "require": { @@ -124,7 +124,7 @@ "heidelpay/php-basket-api": "Use this package to transmit basket information.", "heidelpay/php-message-code-mapper": "You can use this package to provide user-friendly messages instead of error codes." }, - "time": "2017-12-14T12:36:17+00:00", + "time": "2018-02-05T13:50:04+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -134,7 +134,7 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file." + "proprietary" ], "authors": [ { @@ -532,17 +532,17 @@ }, { "name": "zendframework/zend-validator", - "version": "2.10.1", - "version_normalized": "2.10.1.0", + "version": "2.10.2", + "version_normalized": "2.10.2.0", "source": { "type": "git", "url": "https://github.com/zendframework/zend-validator.git", - "reference": "010084ddbd33299bf51ea6f0e07f8f4e8bd832a8" + "reference": "38109ed7d8e46cfa71bccbe7e6ca80cdd035f8c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-validator/zipball/010084ddbd33299bf51ea6f0e07f8f4e8bd832a8", - "reference": "010084ddbd33299bf51ea6f0e07f8f4e8bd832a8", + "url": "https://api.github.com/repos/zendframework/zend-validator/zipball/38109ed7d8e46cfa71bccbe7e6ca80cdd035f8c9", + "reference": "38109ed7d8e46cfa71bccbe7e6ca80cdd035f8c9", "shasum": "" }, "require": { @@ -574,12 +574,12 @@ "zendframework/zend-session": "Zend\\Session component, ^2.8; required by the Csrf validator", "zendframework/zend-uri": "Zend\\Uri component, required by the Uri and Sitemap\\Loc validators" }, - "time": "2017-08-22T14:19:23+00:00", + "time": "2018-02-01T17:05:33+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.10-dev", - "dev-develop": "2.11-dev" + "dev-master": "2.10.x-dev", + "dev-develop": "2.11.x-dev" }, "zf": { "component": "Zend\\Validator", diff --git a/vendor/heidelpay/php-payment-api/.codacy.yml b/vendor/heidelpay/php-payment-api/.codacy.yml index e74e0cc..ffae063 100644 --- a/vendor/heidelpay/php-payment-api/.codacy.yml +++ b/vendor/heidelpay/php-payment-api/.codacy.yml @@ -1,8 +1,9 @@ +exclude_paths: + - **/tests/** + - example/** + - **/vendor/** + - build/** + engines: coverage: enabled: true - exclude_paths: - - **/tests/** - - example/** - - **/vendor/** - - build/** \ No newline at end of file diff --git a/vendor/heidelpay/php-payment-api/.travis.yml b/vendor/heidelpay/php-payment-api/.travis.yml index 09191e4..35d5f72 100644 --- a/vendor/heidelpay/php-payment-api/.travis.yml +++ b/vendor/heidelpay/php-payment-api/.travis.yml @@ -1,50 +1,32 @@ language: php dist: trusty - matrix: fast_finish: true include: - php: 5.6 env: deps=no - - php: 7 + - php: 7.0 env: deps=no - - php: 7 + - php: 7.0 env: deps=high - php: 7.1 env: deps=no - php: 7.1 env: deps=high - - + - php: 7.2 + env: deps=no + - php: 7.2 + env: deps=high cache: directories: - $HOME/.composer/cache - $HOME/.php-cs-fixer - $HOME/.local - -before_script: - ## backup and disable xdebug - - cp ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ~/.phpenv/versions/$(phpenv version-name)/xdebug.ini.bak - - echo > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini - - phpenv rehash - - mkdir -p "$HOME/.php-cs-fixer" - - mkdir -p build/logs - - composer self-update - - if [ "$deps" = "no" ]; then composer --prefer-dist install; fi; - - if [ "$deps" = "high" ]; then composer --prefer-source update; fi; - +before_install: + - ./tests/script/travis_before_install.sh +install: + - if [ "$(phpenv version-name)" == "5.6" ]; then travis_wait ./tests/script/travis_install.sh; else ./tests/script/travis_install.sh; fi script: - - ./vendor/bin/php-cs-fixer fix --dry-run --diff --verbose - ## enable xdebug - - mv ~/.phpenv/versions/$(phpenv version-name)/xdebug.ini.bak ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini - - ./vendor/bin/codecept build - - ./vendor/bin/codecept run unit --coverage --coverage-xml - ## perform this task only for php 7 with deps=0 - - | - if [[ ($(phpenv version-name) == "7") && ("$deps" == "no") ]]; then - echo "Perform integration tests as well"; - ./vendor/bin/codecept run integration - fi - + - ./tests/script/travis_script.sh after_success: - php vendor/bin/codacycoverage clover tests/_output/coverage.xml diff --git a/vendor/heidelpay/php-payment-api/CHANGELOG.md b/vendor/heidelpay/php-payment-api/CHANGELOG.md index 9aeca86..47f6ee3 100644 --- a/vendor/heidelpay/php-payment-api/CHANGELOG.md +++ b/vendor/heidelpay/php-payment-api/CHANGELOG.md @@ -3,15 +3,48 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [v1.4.0][v1.4.0] +## Added +- Transaction type reregistration. +- Unit and integration tests for reregistration transaction. +- `toArray()` method to the AbstractMethod class for Request/Response +- Added important methods to the PaymentMethodInterface. + +## Changed +- Added debug output to integration tests. Append `--debug` to see them (`codecept run integration --debug`). +- Replaced magic setters. + +## [v1.3.0][v1.3.0] +## Added +- `fromJson()` and `fromPost()` static methods to instantiate `Response` and `Request` objects with a static call. +- Several constants for Api Config, Paymentmethod codes, status/reason codes, ... see the following classes in the `Heidelpay\PhpPaymentApi\Constants` namespace: + - `ApiConfig` includes this sdk's version, live and test api urls + - `Brand` includes codes for brands (e.g. Visa, giropay, PayPal) + - `PaymentMethod` includes codes for all payment methods (e.g. CC for Credit Card, OT for Online Transfer, ...) + - `ProcessingResult` includes transaction result codes (ACK and NOK for now) + - `ReasonCode` includes reason codes (indicators for errors) of transactions + - `StatusCode` includes transaction status codes + - `TransactionMode` includes transaction modes, which are important for the running environment + - `TransactionType` includes codes for transaction types (e.g. Capture, Debit, Reversal, ...) + +## Changed +- Clearified the exception message in `verifySecurityHash()` (Response script/page should only be called by heidelpay) + +## Removed +- `AbstractPaymentMethod` class in favor of the `BasicPaymentMethodTrait` + +## Deprecated +- Declared `Response::splitArray()` as deprecated in favor of `fromPost()` and replaced it's code with a `fromPost` call + ## [v1.2.0][v1.2.0] ## Added -- HttpAdapterInterface to allow injecting a custom http adapter. -- Criterion get() method for custom properties +- `HttpAdapterInterface` to allow injecting a custom http adapter. +- Criterion `get()` method for custom properties ## Changed -- Refactored Requests send method to only create a CurlAdapter object when needed. -- Refactored unit tests to inject a CurlAdapter object instead of an InterfaceProxy object. +- Refactored Requests send method to only create a `CurlAdapter` object when needed. +- Refactored unit tests to inject a `CurlAdapter` object instead of an InterfaceProxy object. ## [v1.1.0][v1.1.0] @@ -44,8 +77,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a - Changed namespaces to new repo name. ### Removed -- Needless parameters from registration()-method call in class "DirectDebitRegistration". +- Needless parameters from `registration()`-method call in class `DirectDebitRegistration`. -[v1.2.0]: https://github.com/heidelpay/php-payment-api/compare/v1.1.0...v1.2.0 +[v1.0.0]: https://github.com/heidelpay/php-payment-api/tree/v1.0.0 [v1.1.0]: https://github.com/heidelpay/php-payment-api/compare/v1.0.0...v1.1.0 -[v1.0.0]: https://github.com/heidelpay/php-payment-api/tree/v1.0.0 \ No newline at end of file +[v1.2.0]: https://github.com/heidelpay/php-payment-api/compare/v1.1.0...v1.2.0 +[v1.3.0]: https://github.com/heidelpay/php-payment-api/compare/v1.2.0...v1.3.0 +[v1.4.0]: https://github.com/heidelpay/php-payment-api/compare/v1.3.0...v1.4.0 diff --git a/vendor/heidelpay/php-payment-api/README.md b/vendor/heidelpay/php-payment-api/README.md index c35e5d2..195f2a3 100644 --- a/vendor/heidelpay/php-payment-api/README.md +++ b/vendor/heidelpay/php-payment-api/README.md @@ -5,6 +5,7 @@ [![PHP 5.6](https://img.shields.io/badge/php-5.6-blue.svg)](http://www.php.net) [![PHP 7.0](https://img.shields.io/badge/php-7.0-blue.svg)](http://www.php.net) [![PHP 7.1](https://img.shields.io/badge/php-7.1-blue.svg)](http://www.php.net) +[![PHP 7.1](https://img.shields.io/badge/php-7.2-blue.svg)](http://www.php.net) ![Logo](https://dev.heidelpay.de/devHeidelpay_400_180.jpg) # Welcome to the heidelpay payment api for php @@ -46,11 +47,11 @@ You can find a copy of this license in [LICENSE.txt](LICENSE.txt). ## Documentation -Please visit http://dev.heidelpay.com/heidelpay-php-api/ for the developer documentation. +Please visit [http://dev.heidelpay.com/heidelpay-php-api/](http://dev.heidelpay.com/heidelpay-php-api/) for the developer documentation. ### Unit- and Integration tests -This library comes with a set of unit tests. Please be do not run the integration tests on each build. +This library comes with a set of unit and integration tests. Please do not run the integration tests on each build. Run prior to tests: `codecept build` @@ -58,11 +59,14 @@ Run prior to tests: Run unit tests: `codecept run unit` +Run unit tests with code coverage report: +`codecept run unit --coverage --coverage-html` + Run integration tests: `codecept run integration` -Run unit tests with code coverage report: -`codecept run unit --coverage --coverage-html` +Run integration tests with debug output: +`codecept run integration --debug` For coverage analysis results see: `./tests/_output/coverage/index.html` @@ -71,13 +75,13 @@ For coverage analysis results see: Integration examples can be found in the example folder. Just open the -_enableExamples.php and change +`_enableExamples.php` and change -define('HEIDELPAY_PHP_PAYMENT_API_EXAMPLES', FALSE); +`define('HEIDELPAY_PHP_PAYMENT_API_EXAMPLES', FALSE);` to -define('HEIDELPAY_PHP_PAYMENT_API_EXAMPLES', TRUE); +`define('HEIDELPAY_PHP_PAYMENT_API_EXAMPLES', TRUE);` Please make sure to switch it off again, after you launch your application. diff --git a/vendor/heidelpay/php-payment-api/composer.json b/vendor/heidelpay/php-payment-api/composer.json index b80ba03..516cbd0 100644 --- a/vendor/heidelpay/php-payment-api/composer.json +++ b/vendor/heidelpay/php-payment-api/composer.json @@ -1,7 +1,7 @@ { "name": "heidelpay/php-payment-api", "description": "New client library for heidelpay payments replacing heidelpay/php-api.", - "license": "Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.", + "license": "proprietary", "authors": [ { "name": "Jens Richter" diff --git a/vendor/heidelpay/php-payment-api/lib/AbstractMethod.php b/vendor/heidelpay/php-payment-api/lib/AbstractMethod.php index 1a22fce..c6a4f15 100644 --- a/vendor/heidelpay/php-payment-api/lib/AbstractMethod.php +++ b/vendor/heidelpay/php-payment-api/lib/AbstractMethod.php @@ -2,6 +2,7 @@ namespace Heidelpay\PhpPaymentApi; +use Heidelpay\PhpPaymentApi\Exceptions\JsonParserException; use Heidelpay\PhpPaymentApi\ParameterGroups\AccountParameterGroup; use Heidelpay\PhpPaymentApi\ParameterGroups\AddressParameterGroup; use Heidelpay\PhpPaymentApi\ParameterGroups\BasketParameterGroup; @@ -29,9 +30,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api */ abstract class AbstractMethod implements MethodInterface { @@ -40,77 +39,77 @@ abstract class AbstractMethod implements MethodInterface * * @var \Heidelpay\PhpPaymentApi\ParameterGroups\AccountParameterGroup */ - protected $account = null; + protected $account; /** * AddressParameterGroup * * @var \Heidelpay\PhpPaymentApi\ParameterGroups\AddressParameterGroup */ - protected $address = null; + protected $address; /** * BasketParameterGroup * * @var \Heidelpay\PhpPaymentApi\ParameterGroups\BasketParameterGroup */ - protected $basket = null; + protected $basket; /** * ConfigParameterGroup * * @var \Heidelpay\PhpPaymentApi\ParameterGroups\ConfigParameterGroup */ - protected $config = null; + protected $config; /** * ContactParameterGroup * * @var \Heidelpay\PhpPaymentApi\ParameterGroups\ContactParameterGroup */ - protected $contact = null; + protected $contact; /** * CriterionParameterGroup * * @var \Heidelpay\PhpPaymentApi\ParameterGroups\CriterionParameterGroup */ - protected $criterion = null; + protected $criterion; /** * FrontendParameterGroup * * @var \Heidelpay\PhpPaymentApi\ParameterGroups\FrontendParameterGroup */ - protected $frontend = null; + protected $frontend; /** * IdentificationParameterGroup * * @var \Heidelpay\PhpPaymentApi\ParameterGroups\IdentificationParameterGroup */ - protected $identification = null; + protected $identification; /** * NameParameterGroup * * @var \Heidelpay\PhpPaymentApi\ParameterGroups\NameParameterGroup */ - protected $name = null; + protected $name; /** * PaymentParameterGroup * * @var \Heidelpay\PhpPaymentApi\ParameterGroups\PaymentParameterGroup */ - protected $payment = null; + protected $payment; /** * PresentationParameterGroup * * @var \Heidelpay\PhpPaymentApi\ParameterGroups\PresentationParameterGroup */ - protected $presentation = null; + protected $presentation; /** @@ -118,35 +117,35 @@ abstract class AbstractMethod implements MethodInterface * * @var \Heidelpay\PhpPaymentApi\ParameterGroups\RequestParameterGroup */ - protected $request = null; + protected $request; /** * RiskInformationParameterGroup * * @var \Heidelpay\PhpPaymentApi\ParameterGroups\RiskInformationParameterGroup */ - protected $riskinformation = null; + protected $riskinformation; /** * SecurityParameterGroup * * @var \Heidelpay\PhpPaymentApi\ParameterGroups\SecurityParameterGroup */ - protected $security = null; + protected $security; /** * TransactionParameterGroup * * @var \Heidelpay\PhpPaymentApi\ParameterGroups\TransactionParameterGroup */ - protected $transaction = null; + protected $transaction; /** * UserParameterGroup * * @var \Heidelpay\PhpPaymentApi\ParameterGroups\UserParameterGroup */ - protected $user = null; + protected $user; /** * Account getter @@ -158,6 +157,7 @@ public function getAccount() if ($this->account === null) { return $this->account = new AccountParameterGroup(); } + return $this->account; } @@ -171,6 +171,7 @@ public function getAddress() if ($this->address === null) { return $this->address = new AddressParameterGroup(); } + return $this->address; } @@ -184,6 +185,7 @@ public function getBasket() if ($this->basket === null) { return $this->basket = new BasketParameterGroup(); } + return $this->basket; } @@ -197,6 +199,7 @@ public function getConfig() if ($this->config === null) { return $this->config = new ConfigParameterGroup(); } + return $this->config; } @@ -210,6 +213,7 @@ public function getContact() if ($this->contact === null) { return $this->contact = new ContactParameterGroup(); } + return $this->contact; } @@ -223,6 +227,7 @@ public function getCriterion() if ($this->criterion === null) { return $this->criterion = new CriterionParameterGroup(); } + return $this->criterion; } @@ -236,6 +241,7 @@ public function getFrontend() if ($this->frontend === null) { return $this->frontend = new FrontendParameterGroup(); } + return $this->frontend; } @@ -249,6 +255,7 @@ public function getIdentification() if ($this->identification === null) { return $this->identification = new IdentificationParameterGroup(); } + return $this->identification; } @@ -262,6 +269,7 @@ public function getName() if ($this->name === null) { return $this->name = new NameParameterGroup(); } + return $this->name; } @@ -275,6 +283,7 @@ public function getPayment() if ($this->payment === null) { return $this->payment = new PaymentParameterGroup(); } + return $this->payment; } @@ -288,6 +297,7 @@ public function getPresentation() if ($this->presentation === null) { return $this->presentation = new PresentationParameterGroup(); } + return $this->presentation; } @@ -301,6 +311,7 @@ public function getRequest() if ($this->request === null) { return $this->request = new RequestParameterGroup(); } + return $this->request; } @@ -314,6 +325,7 @@ public function getRiskInformation() if ($this->riskinformation === null) { return $this->riskinformation = new RiskInformationParameterGroup(); } + return $this->riskinformation; } @@ -327,6 +339,7 @@ public function getSecurity() if ($this->security === null) { return $this->security = new SecurityParameterGroup(); } + return $this->security; } @@ -340,6 +353,7 @@ public function getTransaction() if ($this->transaction === null) { return $this->transaction = new TransactionParameterGroup(); } + return $this->transaction; } @@ -353,6 +367,7 @@ public function getUser() if ($this->user === null) { return $this->user = new UserParameterGroup(); } + return $this->user; } @@ -364,6 +379,39 @@ public function toJson($options = 0) return json_encode($this->jsonSerialize(), $options); } + /** + * @inheritdoc + */ + public function toArray($doSort = false) + { + $result = []; + $request = get_object_vars($this); + + if ($doSort) { + ksort($request); + } + + foreach ($request as $parameterGroup => $parameterValues) { + if ($parameterValues === null) { + continue; + } + + $paramValues = get_object_vars($parameterValues); + if ($doSort) { + ksort($paramValues); + } + + foreach ($paramValues as $parameterLastName => $parameterValue) { + if ($parameterValue === null) { + continue; + } + + $result[strtoupper($parameterGroup . '.' . $parameterLastName)] = $parameterValue; + } + } + return $result; + } + /** * @inheritdoc */ @@ -376,4 +424,75 @@ public function jsonSerialize() return $return; } + + /** + * @inheritdoc + */ + public static function fromJson($json) + { + $instance = new static(); + $instance->mapFromJson($json); + + return $instance; + } + + /** + * @inheritdoc + */ + public static function fromPost(array $post) + { + $instance = new static(); + $instance->mapFromPost($post); + + return $instance; + } + + /** + * Maps a JSON string into single ParameterGroup instances. + * + * @param string $json + * + * @throws JsonParserException + */ + protected function mapFromJson($json) + { + $mapClass = json_decode($json); + + if ($mapClass === null) { + throw new JsonParserException( + 'Error during JSON parsing! Last JSON error message: ' . json_last_error_msg(), + json_last_error() + ); + } + + foreach ($mapClass as $parameterGroupName => $parameterGroupObject) { + $parameterGroupGetterFunc = 'get' . ucfirst($parameterGroupName); + if (!empty($parameterGroupObject) && is_callable([$this, $parameterGroupGetterFunc])) { + foreach ($parameterGroupObject as $property => $value) { + $this->{$parameterGroupGetterFunc}()->set($property, $value); + } + } + } + } + + /** + * Maps a POST array into single ParameterGroup instances. + * + * @param array $post + */ + protected function mapFromPost(array $post) + { + if (empty($post)) { + return; + } + + foreach ($post as $paramGroupKey => $value) { + list($paramGroupName, $paramGroupProp) = explode('_', strtolower($paramGroupKey), 2); + + $parameterGroupGetterFunc = 'get' . ucfirst($paramGroupName); + if ($paramGroupProp !== null && is_callable([$this, $parameterGroupGetterFunc])) { + $this->{$parameterGroupGetterFunc}()->set($paramGroupProp, $value); + } + } + } } diff --git a/vendor/heidelpay/php-payment-api/lib/Constants/ApiConfig.php b/vendor/heidelpay/php-payment-api/lib/Constants/ApiConfig.php new file mode 100644 index 0000000..16acefb --- /dev/null +++ b/vendor/heidelpay/php-payment-api/lib/Constants/ApiConfig.php @@ -0,0 +1,25 @@ + + * + * @package heidelpay\php-payment-api\constants + * + * @since 1.3.0 First time this was introduced. + */ +class ApiConfig +{ + const SDK_VERSION = 'v1.4.0'; + + const LIVE_URL = 'https://heidelpay.hpcgw.net/ngw/post'; + const TEST_URL = 'https://test-heidelpay.hpcgw.net/ngw/post'; +} diff --git a/vendor/heidelpay/php-payment-api/lib/Constants/Brand.php b/vendor/heidelpay/php-payment-api/lib/Constants/Brand.php new file mode 100644 index 0000000..2d75aac --- /dev/null +++ b/vendor/heidelpay/php-payment-api/lib/Constants/Brand.php @@ -0,0 +1,79 @@ + + * + * @package heidelpay\php-payment-api\constants + * + * @since 1.3.0 First time this was introduced. + */ +class Brand +{ + // Credit Card + const AMERICAN_EXPRESS = 'AMEX'; + const DINERS = 'DINERS'; + const DISCOVER = 'DISCOVER'; + const JAPAN_CREDIT_BUREAU = 'JCB'; + const MASTERCARD = 'MASTER'; + const VISA = 'VISA'; + + // Debit Card + const FOURB = 'FOURB'; // 4B + const CARTE_BANCAIRE = 'CARTEBANCAIRE'; + const CARTE_BLEUE = 'CARTEBLEUE'; + const CARTA_SI = 'CARTASI'; + const DANKORT = 'DANKORT'; + const DELTA = 'DELTA'; + const EURO6000 = 'EURO6000'; + const HSBC = 'HSBC'; + const MAESTRO = 'MAESTRO'; + const MR_CASH = 'MRCASH'; + const NBAD = 'NBAD'; + const NORDEA_DEBIT = 'NORDEADEBIT'; + const POSTEPAY = 'POSTEPAY'; + const SERVIRED = 'SERVIRED'; + const SOLO = 'SOLO'; + const VISA_DEBIT = 'VISADEBIT'; + const VISA_ELECTRON = 'VISAELECTRON'; + const V_PAY = 'VPAY'; + + // Invoice + const BILLSAFE = 'BILLSAFE'; + const PAYOLUTION_DIRECT = 'PAYOLUTION_DIRECT'; + const SANTANDER = 'SANTANDER'; + + // Online Transfer + const EPS = 'EPS'; + const GIROPAY = 'GIROPAY'; + const IDEAL = 'IDEAL'; + const POSTFINANCE_CARD = 'PFCARD'; + const POSTFINANCE_EFINANCE = 'PFEFINANCE'; + const PRZELEWY24 = 'PRZELEWY24'; + const SOFORT = 'SOFORT'; + const SOFORT_PAYCODE = 'SOFORT_PAYCODE'; + + // Virtual Account + const PAYPAL = 'PAYPAL'; + + // Payment Card + const MANGIRKART = 'MANGIRKART'; + + // Mobile Payment + const MOBILE_BUSINESS_ENGINE = 'MBE4_ONE_PHASE'; + const MOBILE_BUSINESS_ENGINE_ABO = 'MBE4_ABO_ONE_PHASE'; + + // Wallet + const MASTERPASS = 'MASTERPASS'; + + // Hire Purchase + const EASYCREDIT = 'EASYCREDIT'; +} diff --git a/vendor/heidelpay/php-payment-api/lib/Constants/PaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/Constants/PaymentMethod.php new file mode 100644 index 0000000..d590a8f --- /dev/null +++ b/vendor/heidelpay/php-payment-api/lib/Constants/PaymentMethod.php @@ -0,0 +1,32 @@ + + * + * @package heidelpay\php-payment-api\constants + * + * @since 1.3.0 First time this was introduced. + */ +class PaymentMethod +{ + const CREDIT_CARD = 'CC'; + const DEBIT_CARD = 'DC'; + const DIRECT_DEBIT = 'DD'; + const INVOICE = 'IV'; + const MOBILE_PAYMENT = 'MP'; + const PAYMENT_CARD = 'PC'; + const PREPAYMENT = 'PP'; + const ONLINE_TRANSFER = 'OT'; + const VIRTUAL_ACCOUNT = 'VA'; + const WALLET = 'WT'; + const HIRE_PURCHASE = 'HP'; +} diff --git a/vendor/heidelpay/php-payment-api/lib/Constants/ProcessingResult.php b/vendor/heidelpay/php-payment-api/lib/Constants/ProcessingResult.php new file mode 100644 index 0000000..aa1dd4c --- /dev/null +++ b/vendor/heidelpay/php-payment-api/lib/Constants/ProcessingResult.php @@ -0,0 +1,23 @@ + + * + * @package heidelpay\php-payment-api\constants + * + * @since 1.3.0 First time this was introduced. + */ +class ProcessingResult +{ + const ACK = 'ACK'; + const NOK = 'NOK'; +} diff --git a/vendor/heidelpay/php-payment-api/lib/Constants/ReasonCode.php b/vendor/heidelpay/php-payment-api/lib/Constants/ReasonCode.php new file mode 100644 index 0000000..27a92a9 --- /dev/null +++ b/vendor/heidelpay/php-payment-api/lib/Constants/ReasonCode.php @@ -0,0 +1,31 @@ + + * + * @package heidelpay\php-payment-api\constants + * + * @since 1.3.0 First time this was introduced. + */ +class ReasonCode +{ + const REFERENCE_ERROR = '30'; + const ACCOUNT_VALIDATION = '40'; + const CC_ACCOUNT_VALIDATION = self::ACCOUNT_VALIDATION; + const BLACKLIST_VALIDATION = '50'; + const ADDRESS_ERROR = '60'; + const COMMUNICATION_ERROR = '70'; + const EXTERNAL_RISK_ERROR = '78'; + const ERROR_3DSECURE = '85'; + const ASYNC_ERROR = '90'; + const AUTHORIZATION_VALIDATION = '95'; +} diff --git a/vendor/heidelpay/php-payment-api/lib/Constants/StatusCode.php b/vendor/heidelpay/php-payment-api/lib/Constants/StatusCode.php new file mode 100644 index 0000000..d276453 --- /dev/null +++ b/vendor/heidelpay/php-payment-api/lib/Constants/StatusCode.php @@ -0,0 +1,29 @@ + + * + * @package heidelpay\php-payment-api\constants + * + * @since 1.3.0 First time this was introduced. + */ +class StatusCode +{ + const SUCCESS = '00'; + const NEUTRAL = '40'; + const WAITING_BANK = '59'; + const REJECTED_BANK = '60'; + const REJECTED_RISK = '65'; + const REJECTED_VALIDATION = '70'; + const WAITING = '80'; + const NEW_TRANSACTION = '90'; +} diff --git a/vendor/heidelpay/php-payment-api/lib/Constants/TransactionMode.php b/vendor/heidelpay/php-payment-api/lib/Constants/TransactionMode.php new file mode 100644 index 0000000..026eb00 --- /dev/null +++ b/vendor/heidelpay/php-payment-api/lib/Constants/TransactionMode.php @@ -0,0 +1,24 @@ + + * + * @package heidelpay\php-payment-api\constants + * + * @since 1.3.0 First time this was introduced. + */ +class TransactionMode +{ + const CONNECTOR_TEST = 'CONNECTOR_TEST'; + const INTEGRATOR_TEST = 'INTEGRATOR_TEST'; + const LIVE = 'LIVE'; +} diff --git a/vendor/heidelpay/php-payment-api/lib/Constants/TransactionType.php b/vendor/heidelpay/php-payment-api/lib/Constants/TransactionType.php new file mode 100644 index 0000000..d044967 --- /dev/null +++ b/vendor/heidelpay/php-payment-api/lib/Constants/TransactionType.php @@ -0,0 +1,47 @@ + + * + * @package heidelpay\php-payment-api\constants + * + * @since 1.3.0 First time this was introduced. + */ +class TransactionType +{ + const CREDIT = 'CD'; + const DEBIT = 'DB'; + const RESERVATION = 'PA'; + const CAPTURE = 'CP'; + const REVERSAL = 'RV'; + const REFUND = 'RF'; + const REBILL = 'RB'; + const CHARGEBACK = 'CB'; + const RECEIPT = 'RC'; + const INITIALIZE = 'IN'; + + const REGISTRATION = 'RG'; + const REREGISTRATION = 'RR'; + const DEREGISTRATION = 'DR'; + + const SCHEDULE = 'SD'; + const RESCHEDULE = 'RS'; + const CHANGE_SCHEDULE = self::RESCHEDULE; + const DESCHEDULE = 'DS'; + const END_SCHEDULE = self::DESCHEDULE; + + const CHARGEBACK_NOTIFICATION = 'CN'; + const CHARGEBACK_REVERSAL = 'CR'; + const RECONCILIATION = 'RL'; + const FINALIZE = 'FI'; + const PAYMENT_NOTIFICATION = 'PN'; +} diff --git a/vendor/heidelpay/php-payment-api/lib/Exceptions/HashVerificationException.php b/vendor/heidelpay/php-payment-api/lib/Exceptions/HashVerificationException.php index b538779..a632e9a 100644 --- a/vendor/heidelpay/php-payment-api/lib/Exceptions/HashVerificationException.php +++ b/vendor/heidelpay/php-payment-api/lib/Exceptions/HashVerificationException.php @@ -14,9 +14,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\exception */ class HashVerificationException extends Exception { diff --git a/vendor/heidelpay/php-payment-api/lib/Exceptions/JsonParserException.php b/vendor/heidelpay/php-payment-api/lib/Exceptions/JsonParserException.php new file mode 100644 index 0000000..ecd5452 --- /dev/null +++ b/vendor/heidelpay/php-payment-api/lib/Exceptions/JsonParserException.php @@ -0,0 +1,21 @@ + + * + * @package heidelpay\php-payment-api\exception + */ +class JsonParserException extends Exception +{ +} diff --git a/vendor/heidelpay/php-payment-api/lib/Exceptions/PaymentFormUrlException.php b/vendor/heidelpay/php-payment-api/lib/Exceptions/PaymentFormUrlException.php index d702d9e..ff80dae 100644 --- a/vendor/heidelpay/php-payment-api/lib/Exceptions/PaymentFormUrlException.php +++ b/vendor/heidelpay/php-payment-api/lib/Exceptions/PaymentFormUrlException.php @@ -14,9 +14,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\exception */ class PaymentFormUrlException extends Exception { diff --git a/vendor/heidelpay/php-payment-api/lib/Exceptions/UndefinedPropertyException.php b/vendor/heidelpay/php-payment-api/lib/Exceptions/UndefinedPropertyException.php index 514eb01..0c615c3 100644 --- a/vendor/heidelpay/php-payment-api/lib/Exceptions/UndefinedPropertyException.php +++ b/vendor/heidelpay/php-payment-api/lib/Exceptions/UndefinedPropertyException.php @@ -14,9 +14,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\exception */ class UndefinedPropertyException extends Exception { diff --git a/vendor/heidelpay/php-payment-api/lib/Exceptions/UndefinedTransactionModeException.php b/vendor/heidelpay/php-payment-api/lib/Exceptions/UndefinedTransactionModeException.php index 6d46c67..3a8fcfb 100644 --- a/vendor/heidelpay/php-payment-api/lib/Exceptions/UndefinedTransactionModeException.php +++ b/vendor/heidelpay/php-payment-api/lib/Exceptions/UndefinedTransactionModeException.php @@ -14,9 +14,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\exception */ class UndefinedTransactionModeException extends Exception { diff --git a/vendor/heidelpay/php-payment-api/lib/Exceptions/UndefinedXmlResponseException.php b/vendor/heidelpay/php-payment-api/lib/Exceptions/UndefinedXmlResponseException.php index b7a44aa..d044fea 100644 --- a/vendor/heidelpay/php-payment-api/lib/Exceptions/UndefinedXmlResponseException.php +++ b/vendor/heidelpay/php-payment-api/lib/Exceptions/UndefinedXmlResponseException.php @@ -16,9 +16,7 @@ * * @author Stephano Vogel * - * @package heidelpay - * @subpackage php-api - * @category php-api + * @package heidelpay\php-payment-api\exception */ class UndefinedXmlResponseException extends Exception { diff --git a/vendor/heidelpay/php-payment-api/lib/Exceptions/XmlResponseParserException.php b/vendor/heidelpay/php-payment-api/lib/Exceptions/XmlResponseParserException.php index 54d0541..dbb8dc5 100644 --- a/vendor/heidelpay/php-payment-api/lib/Exceptions/XmlResponseParserException.php +++ b/vendor/heidelpay/php-payment-api/lib/Exceptions/XmlResponseParserException.php @@ -16,9 +16,7 @@ * * @author Stephano Vogel * - * @package heidelpay - * @subpackage php-api - * @category php-api + * @package heidelpay\php-payment-api\exception */ class XmlResponseParserException extends Exception { diff --git a/vendor/heidelpay/php-payment-api/lib/MethodInterface.php b/vendor/heidelpay/php-payment-api/lib/MethodInterface.php index 05594ee..dd91692 100644 --- a/vendor/heidelpay/php-payment-api/lib/MethodInterface.php +++ b/vendor/heidelpay/php-payment-api/lib/MethodInterface.php @@ -2,6 +2,7 @@ namespace Heidelpay\PhpPaymentApi; +use Heidelpay\PhpPaymentApi\Exceptions\JsonParserException; use JsonSerializable; /** @@ -14,7 +15,7 @@ * * @author Stephano Vogel * - * @package heidelpay/php-api + * @package heidelpay/php-payment-api */ interface MethodInterface extends JsonSerializable { @@ -26,4 +27,42 @@ interface MethodInterface extends JsonSerializable * @return string */ public function toJson($options = 0); + + /** + * Returns an array that represents the object instance. + * + * Uses uppercase keys to be compatible with the + * heidelpay POST Payment API. + * + * @param bool $doSort sort the keys in alphabetical order + * + * @return array + */ + public function toArray($doSort); + + /** + * Takes a JSON representation of an instance and returns + * a PHP object instance representation of it. + * + * @since 1.3.0 First time this was introduced. + * + * @param string $json + * + * @return AbstractMethod + * + * @throws JsonParserException + */ + public static function fromJson($json); + + /** + * Takes an array, e.g. a POST response and returns + * a PHP object instance representation of it. + * + * @since 1.3.0 First time this was introduced. + * + * @param array $post + * + * @return AbstractMethod + */ + public static function fromPost(array $post); } diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/AbstractParameterGroup.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/AbstractParameterGroup.php index edeaa42..967f49e 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/AbstractParameterGroup.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/AbstractParameterGroup.php @@ -12,9 +12,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\parameter-groups */ abstract class AbstractParameterGroup implements ParameterGroupInterface { @@ -25,7 +23,7 @@ abstract class AbstractParameterGroup implements ParameterGroupInterface */ public static function getClassName() { - return get_called_class(); + return static::class; } /** diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/AccountParameterGroup.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/AccountParameterGroup.php index 32c6d62..dbf778f 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/AccountParameterGroup.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/AccountParameterGroup.php @@ -15,9 +15,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\parameter-groups */ class AccountParameterGroup extends AbstractParameterGroup { @@ -97,7 +95,6 @@ class AccountParameterGroup extends AbstractParameterGroup * Account number can be used for non sepa direct debit transactions * * @var string number of the given account - * */ public $number; @@ -168,7 +165,7 @@ public function getBrand() } /** - * Setter for the account brand name f.e. SOFORT or PAYPAL + * Setter for the account brand name, e.g. SOFORT or PAYPAL * * @param $brand string name of the used brand in upper case * @@ -338,4 +335,48 @@ public function getVerification() { return $this->verification; } + + /** + * @param string $expiry_month + * + * @return AccountParameterGroup + */ + public function setExpiryMonth($expiry_month) + { + $this->expiry_month = $expiry_month; + return $this; + } + + /** + * @param string $expiry_year + * + * @return AccountParameterGroup + */ + public function setExpiryYear($expiry_year) + { + $this->expiry_year = $expiry_year; + return $this; + } + + /** + * @param string $verification + * + * @return AccountParameterGroup + */ + public function setVerification($verification) + { + $this->verification = $verification; + return $this; + } + + /** + * @param string $identification + * + * @return AccountParameterGroup + */ + public function setIdentification($identification) + { + $this->identification = $identification; + return $this; + } } diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/AddressParameterGroup.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/AddressParameterGroup.php index bd6a387..da1b69d 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/AddressParameterGroup.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/AddressParameterGroup.php @@ -15,9 +15,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\parameter-groups */ class AddressParameterGroup extends AbstractParameterGroup { diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/BasketParameterGroup.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/BasketParameterGroup.php index 76bae4f..cfd8139 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/BasketParameterGroup.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/BasketParameterGroup.php @@ -16,9 +16,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\parameter-groups */ class BasketParameterGroup extends AbstractParameterGroup { diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ConfigParameterGroup.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ConfigParameterGroup.php index 4bffb96..6721cf8 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ConfigParameterGroup.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ConfigParameterGroup.php @@ -14,9 +14,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\parameter-groups */ class ConfigParameterGroup extends AbstractParameterGroup { @@ -70,7 +68,7 @@ public function getOptinText() { $result = json_decode($this->optin_text, true); - if (empty($result)) { + if ($result === null) { return $this->optin_text; } diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ConnectorParameterGroup.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ConnectorParameterGroup.php index 8705e85..23df078 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ConnectorParameterGroup.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ConnectorParameterGroup.php @@ -18,9 +18,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\parameter-groups */ class ConnectorParameterGroup extends AbstractParameterGroup { diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ContactParameterGroup.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ContactParameterGroup.php index ae399da..3444b8c 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ContactParameterGroup.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ContactParameterGroup.php @@ -12,9 +12,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\parameter-groups */ class ContactParameterGroup extends AbstractParameterGroup { diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/CriterionParameterGroup.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/CriterionParameterGroup.php index 177dc0f..c6b7e0a 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/CriterionParameterGroup.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/CriterionParameterGroup.php @@ -2,6 +2,8 @@ namespace Heidelpay\PhpPaymentApi\ParameterGroups; +use Heidelpay\PhpPaymentApi\Constants\ApiConfig; + /** * This class provides a key value store for api parameter * @@ -16,14 +18,10 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\parameter-groups */ class CriterionParameterGroup extends AbstractParameterGroup { - const SDK_VERSION = 'v1.1.0'; - /** * Currently used payment methode * @@ -46,11 +44,11 @@ class CriterionParameterGroup extends AbstractParameterGroup public $sdk_name = 'Heidelpay\PhpPaymentApi'; /** - * Sdk version + * SDK version * * @var string version */ - public $sdk_version = self::SDK_VERSION; + public $sdk_version = ApiConfig::SDK_VERSION; /** * CriterionPaymentMethod getter diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/FrontendParameterGroup.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/FrontendParameterGroup.php index 9cc9eec..84da2b6 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/FrontendParameterGroup.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/FrontendParameterGroup.php @@ -12,9 +12,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\parameter-groups */ class FrontendParameterGroup extends AbstractParameterGroup { @@ -25,7 +23,6 @@ class FrontendParameterGroup extends AbstractParameterGroup */ public $css_path; - /** * FrontendEnabled * @@ -55,11 +52,13 @@ class FrontendParameterGroup extends AbstractParameterGroup public $payment_frame_origin; /** - * FrontendPaymentFrameUrl + * The URL of the payment frame to be loaded within an iFrame by the shop (e.g. CreditCard). + * Provided in the response. * * @var string url of the payment iframe, only for credit card and debit card because of pci restrictions */ public $payment_frame_url; + /** * FrontendPreventAsyncRedirect * @@ -183,7 +182,7 @@ public function getPreventAsyncRedirect() * credit and debit card. Please have a look into our documentation * for the allowed ccs parameter * - * @param string $css_path url to a css file f.e https://dev.heidelpay.de/heidelpay_iframe.css + * @param string $css_path url to a css file, e.g. https://dev.heidelpay.de/heidelpay_iframe.css * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\FrontendParameterGroup */ @@ -196,11 +195,11 @@ public function setCssPath($css_path) /** * Setter to disable the frontend * - * This setting will force the payment to act in syn mode. This is only possible - * for transaction that do not need user input. F. e. prepayment, invoice or transactions - * like debitOnRegistration (only not 3DSecure). + * This setting will force the payment to act in sync mode. This is only possible for + * transactions that do not need user input, e.g.prepayment, invoice or + * transactions like debitOnRegistration (only non-3DSecure). * - * @param string $enabled + * @param string $enabled 'FALSE' or 'TRUE' * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\FrontendParameterGroup */ @@ -242,9 +241,9 @@ public function setMode($mode) * Setter for payment frame origin * * for the credit and debit card iframe you have to set the source of the javascipt - * post request. f.e. http://dev.heidelpay.com + * post request., e.g. http://dev.heidelpay.com * - * @param string $payment_frame_origin f.e. http://dev.heidelpay.com + * @param string $payment_frame_origin, e.g. http://dev.heidelpay.com * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\FrontendParameterGroup */ @@ -281,7 +280,7 @@ public function setPreventAsyncRedirect($prevent_async_redirect) * first, if there is nothing you can identify please write to support@heidelpay.de * this the shortid of the transaction or the email address used for the request- * - * @param string $response_url f.e https://dev.heidelpay.de/reponse.php + * @param string $response_url, e.g. https://dev.heidelpay.de/reponse.php * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\FrontendParameterGroup * @@ -291,4 +290,15 @@ public function setResponseUrl($response_url) $this->response_url = $response_url; return $this; } + + /** + * @param string $redirect_url + * + * @return FrontendParameterGroup + */ + public function setRedirectUrl($redirect_url) + { + $this->redirect_url = $redirect_url; + return $this; + } } diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/IdentificationParameterGroup.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/IdentificationParameterGroup.php index 0b8dc22..ca77e86 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/IdentificationParameterGroup.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/IdentificationParameterGroup.php @@ -12,9 +12,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\parameter-groups */ class IdentificationParameterGroup extends AbstractParameterGroup { @@ -140,7 +138,7 @@ public function getUniqueId() /** * Setter for the customer id of your application * - * @param string $shopperid customer id f.e. 12042 + * @param string $shopperid customer id, e.g. 12042 * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\IdentificationParameterGroup */ @@ -154,9 +152,9 @@ public function setShopperid($shopperid) * Setter for the transaction id * * The transaction id is an identifier given by your application to allow matching between - * your system and the payment system. This can be f.e. an order id or invoice id. + * your system and the payment system. This can be, e.g. an order id or invoice id. * - * @param string $transactionid f.e. order-1109 + * @param string $transactionid, e.g. order-1109 * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\IdentificationParameterGroup */ @@ -170,10 +168,10 @@ public function setTransactionid($transactionid) * Setter for the payment reference id or unique id * * Some kinds of transactions needs to reference to another transaction. This can be done - * by setting this parameter with the unique id of the reference transaction. F.e. if you + * by setting this parameter with the unique id of the reference transaction., e.g. if you * use debitOnRegistration you have to set the id of the registration. * - * @param string $referenceid f.e. 31HA07BC8142C5A171745D00AD63D182 + * @param string $referenceid, e.g. 31HA07BC8142C5A171745D00AD63D182 * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\IdentificationParameterGroup */ diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/NameParameterGroup.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/NameParameterGroup.php index e074609..fb6357b 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/NameParameterGroup.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/NameParameterGroup.php @@ -14,9 +14,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\parameter-groups */ class NameParameterGroup extends AbstractParameterGroup { @@ -152,7 +150,7 @@ public function setBirthdate($birthdate) /** * Setter for the company name * - * @param string $company f.e. Heidelberger Payment GmbH + * @param string $company, e.g. Heidelberger Payment GmbH * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\NameParameterGroup */ @@ -165,7 +163,7 @@ public function setCompany($company) /** * Setter for the given name of the customer * - * @param string $given f.e. John + * @param string $given, e.g. John * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\NameParameterGroup */ @@ -178,7 +176,7 @@ public function setGiven($given) /** * Setter for the family name of the customer * - * @param string $family f.e. Doe + * @param string $family, e.g. Doe * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\NameParameterGroup */ @@ -191,7 +189,7 @@ public function setFamily($family) /** * Setter for the salutation of the customer * - * @param string $salutation f.e. MR + * @param string $salutation, e.g. MR * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\NameParameterGroup */ @@ -204,7 +202,7 @@ public function setSalutation($salutation) /** * Setter for the title of the customer * - * @param string $title f.e. Doc. + * @param string $title, e.g. Doc. * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\NameParameterGroup */ diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ParameterGroupInterface.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ParameterGroupInterface.php index ca7c961..b6ea122 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ParameterGroupInterface.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ParameterGroupInterface.php @@ -14,7 +14,7 @@ * * @author Stephano Vogel * - * @package heidelpay/php-api + * @package heidelpay\php-payment-api\parameter-groups */ interface ParameterGroupInterface extends JsonSerializable { diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/PaymentParameterGroup.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/PaymentParameterGroup.php index a7ad5e7..7927a5a 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/PaymentParameterGroup.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/PaymentParameterGroup.php @@ -15,9 +15,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\parameter-groups */ class PaymentParameterGroup extends AbstractParameterGroup { diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/PresentationParameterGroup.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/PresentationParameterGroup.php index 19172d4..09eac87 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/PresentationParameterGroup.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/PresentationParameterGroup.php @@ -12,9 +12,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\parameter-groups */ class PresentationParameterGroup extends AbstractParameterGroup { @@ -82,7 +80,7 @@ public function getUsage() /** * Setter for the basket amount * - * @param float $amount f.e. 20.12 + * @param float $amount, e.g. 20.12 * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\PresentationParameterGroup */ @@ -95,7 +93,7 @@ public function setAmount($amount) /** * Setter for the currency in iso code 3 letters * - * @param string $currency f.e USD + * @param string $currency, e.g. USD * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\PresentationParameterGroup */ @@ -110,7 +108,7 @@ public function setCurrency($currency) * * The usage text on the customers account can be set for some payment methods * - * @param string $usage f.e. "Order 1232. Thank you for choosing Heidelpay" + * @param string $usage, e.g. "Order 1232. Thank you for choosing Heidelpay" * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\PresentationParameterGroup */ diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ProcessingParameterGroup.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ProcessingParameterGroup.php index 79c70fc..b586664 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ProcessingParameterGroup.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/ProcessingParameterGroup.php @@ -12,9 +12,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\parameter-groups */ class ProcessingParameterGroup extends AbstractParameterGroup { diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/RequestParameterGroup.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/RequestParameterGroup.php index 43ab2cd..be79a60 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/RequestParameterGroup.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/RequestParameterGroup.php @@ -12,9 +12,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\parameter-groups */ class RequestParameterGroup extends AbstractParameterGroup { diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/RiskInformationParameterGroup.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/RiskInformationParameterGroup.php index 3d91698..9839d95 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/RiskInformationParameterGroup.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/RiskInformationParameterGroup.php @@ -12,9 +12,7 @@ * * @author Daniel Kraut * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\parameter-groups */ class RiskInformationParameterGroup extends AbstractParameterGroup { diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/SecurityParameterGroup.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/SecurityParameterGroup.php index 9be72ee..7360328 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/SecurityParameterGroup.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/SecurityParameterGroup.php @@ -12,9 +12,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\parameter-groups */ class SecurityParameterGroup extends AbstractParameterGroup { @@ -38,7 +36,7 @@ public function getSender() * * This is one of the main authentication parameter * - * @param string $sender authentication parameter f.e. 31HA07BC8142C5A171745D00AD63D182 + * @param string $sender authentication parameter, e.g. 31HA07BC8142C5A171745D00AD63D182 * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\SecurityParameterGroup */ diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/TransactionParameterGroup.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/TransactionParameterGroup.php index 7ef7694..152e6b8 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/TransactionParameterGroup.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/TransactionParameterGroup.php @@ -2,6 +2,8 @@ namespace Heidelpay\PhpPaymentApi\ParameterGroups; +use Heidelpay\PhpPaymentApi\Constants\TransactionMode; + /** * Transaction parameter group * @@ -14,9 +16,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\parameter-groups */ class TransactionParameterGroup extends AbstractParameterGroup { @@ -39,7 +39,7 @@ class TransactionParameterGroup extends AbstractParameterGroup * * @var string mode (mandatory) */ - public $mode = 'CONNECTOR_TEST'; + public $mode = TransactionMode::CONNECTOR_TEST; /** * @var string @@ -80,7 +80,7 @@ public function getResponse() * A channel can be used as a separater between to two sales channels like german and uk market. * Another reason for a different channel is that some payment methods share one channel. * - * @param string $channel transaction channel id f.e. 31HA07BC8142C5A171749A60D979B6E4 + * @param string $channel transaction channel id, e.g. 31HA07BC8142C5A171749A60D979B6E4 * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\TransactionParameterGroup */ @@ -93,7 +93,7 @@ public function setChannel($channel) /** * Setter for the transaction mode * - * @param string $mode f.e LIVE + * @param string $mode, e.g. LIVE * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\TransactionParameterGroup */ diff --git a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/UserParameterGroup.php b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/UserParameterGroup.php index b650939..550d561 100644 --- a/vendor/heidelpay/php-payment-api/lib/ParameterGroups/UserParameterGroup.php +++ b/vendor/heidelpay/php-payment-api/lib/ParameterGroups/UserParameterGroup.php @@ -12,9 +12,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\parameter-groups */ class UserParameterGroup extends AbstractParameterGroup { @@ -60,7 +58,7 @@ public function getPassword() * * This is one of the main authentication parameter * - * @param string $login user login f.e 31ha07bc8142c5a171744e5aef11ffd3 + * @param string $login user login, e.g. 31ha07bc8142c5a171744e5aef11ffd3 * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\UserParameterGroup */ @@ -75,7 +73,7 @@ public function setLogin($login) * * This is one of the main authentication parameter * - * @param string $pwd user password parameter f.e. DAJapaewa434 + * @param string $pwd user password parameter, e.g. DAJapaewa434 * * @return \Heidelpay\PhpPaymentApi\ParameterGroups\UserParameterGroup */ diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/AbstractPaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/AbstractPaymentMethod.php deleted file mode 100644 index 3910d04..0000000 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/AbstractPaymentMethod.php +++ /dev/null @@ -1,43 +0,0 @@ -paymentCode; + } + + /** + * Returns the brand for the payment method. + * + * @return string + */ + public function getBrand() + { + if (!property_exists($this, 'brand')) { + return null; + } + + return $this->brand; + } /** * Return the name of the used class @@ -95,69 +105,65 @@ trait BasicPaymentMethodTrait */ public static function getClassName() { - return substr(strrchr(get_called_class(), '\\'), 1); + return substr(strrchr(static::class, '\\'), 1); } /** - * Set a new payment request object - * - * @param \Heidelpay\PhpPaymentApi\Request $Request + * @inheritdoc */ - public function setRequest(HeidelpayRequest $Request) + public function setRequest(HeidelpayRequest $heidelpayRequest) { - $this->_request = $Request; + $this->request = $heidelpayRequest; } /** - * Get payment request object + * Returns the Request instance. * * @return \Heidelpay\PhpPaymentApi\Request */ public function getRequest() { - if ($this->_request === null) { - return $this->_request = new HeidelpayRequest(); + if ($this->request === null) { + return $this->request = new HeidelpayRequest(); } - return $this->_request; + return $this->request; } /** - * Get response object + * Returns the Response instance. * * @return \Heidelpay\PhpPaymentApi\Response */ public function getResponse() { - return $this->_response; + return $this->response; } /** * Set a HTTP Adapter for payment communication * - * @param HttpAdapterInterface $adapter + * @param \Heidelpay\PhpPaymentApi\Adapter\HttpAdapterInterface $adapter */ public function setAdapter($adapter) { - $this->_adapter = $adapter; + $this->adapter = $adapter; } /** * Get HTTP Adapter for payment communication * - * @return HttpAdapterInterface + * @return \Heidelpay\PhpPaymentApi\Adapter\HttpAdapterInterface */ public function getAdapter() { - return $this->_adapter; + return $this->adapter; } /** - * Get url of the used payment api - * - * @throws \Exception mode not set + * @inheritdoc * - * @return boolean|string url of the payment api + * @throws UndefinedTransactionModeException */ public function getPaymentUrl() { @@ -165,11 +171,13 @@ public function getPaymentUrl() if ($mode === null) { throw new UndefinedTransactionModeException('Transaction mode is not set'); - } elseif ($mode == 'LIVE') { - return $this->_liveUrl; } - return $this->_sandboxUrl; + if ($mode === TransactionMode::LIVE) { + return ApiConfig::LIVE_URL; + } + + return ApiConfig::TEST_URL; } /** @@ -177,20 +185,22 @@ public function getPaymentUrl() * * It will add the used payment method and the brand to the request. If * dry run is set the request will only be convert to an array. + * + * @throws UndefinedTransactionModeException */ public function prepareRequest() { - $this->getRequest()->getCriterion()->set('payment_method', $this->getClassName()); - if ($this->_brand !== null) { - $this->getRequest()->getAccount()->setBrand($this->_brand); + $this->getRequest()->getCriterion()->set('payment_method', static::getClassName()); + if ($this->getBrand() !== null) { + $this->getRequest()->getAccount()->setBrand($this->brand); } $uri = $this->getPaymentUrl(); - $this->_requestArray = $this->getRequest()->convertToArray(); + $this->requestArray = $this->getRequest()->toArray(); - if ($this->_dryRun === false and $uri !== null and is_array($this->_requestArray)) { - list($this->_responseArray, $this->_response) = - $this->getRequest()->send($uri, $this->_requestArray, $this->getAdapter()); + if ($this->dryRun === false && $uri !== null && is_array($this->requestArray)) { + list($this->responseArray, $this->response) = + $this->getRequest()->send($uri, $this->requestArray, $this->getAdapter()); } } @@ -216,4 +226,12 @@ public function toJson($options = 0) { return json_encode($this->jsonSerialize(), $options); } + + /** + * @return array + */ + public function getResponseArray() + { + return $this->responseArray; + } } diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/CreditCardPaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/CreditCardPaymentMethod.php index 3204eee..0020b70 100644 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/CreditCardPaymentMethod.php +++ b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/CreditCardPaymentMethod.php @@ -2,12 +2,14 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; use Heidelpay\PhpPaymentApi\TransactionTypes\RegistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\DebitTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeOnRegistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\DebitOnRegistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType; +use Heidelpay\PhpPaymentApi\TransactionTypes\ReregistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\ReversalTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\CaptureTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\RebillTransactionType; @@ -24,16 +26,17 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\paymentmethods */ -class CreditCardPaymentMethod +class CreditCardPaymentMethod implements PaymentMethodInterface { use BasicPaymentMethodTrait; use RegistrationTransactionType { registration as registrationParent; } + use ReregistrationTransactionType { + reregistration as reregistrationParent; + } use AuthorizeTransactionType { authorize as authorizeParent; } @@ -48,22 +51,12 @@ class CreditCardPaymentMethod use RebillTransactionType; /** - * Payment code for this payment method - * - * @var string payment code + * @var string Payment Code for this payment method */ - protected $_paymentCode = 'CC'; - - /** - * Payment brand name for this payment method - * - * @var string brand name - */ - protected $_brand; + protected $paymentCode = PaymentMethod::CREDIT_CARD; /** * Payment type authorisation - * * Depending on the payment method this type normally means that the amount * of the given account will only be authorized. In case of payment methods * like Sofort and Giropay (so called online payments) this type will only be @@ -71,71 +64,98 @@ class CreditCardPaymentMethod * Because of payment card industry restrictions (Aka pci3), you have * to use a payment frame solution to handle the customers credit card information. * - * @param null|mixed $PaymentFrameOrigin uri of your application like http://dev.heidelpay.com - * @param mixed $PreventAsyncRedirect - prevention of redirecting the customer - * @param null|mixed $CssPath css url to style the Heidelpay payment frame + * @param null|mixed $paymentFrameOrigin uri of your application like http://dev.heidelpay.com + * @param mixed $preventAsyncRedirect - prevention of redirecting the customer + * @param null|mixed $cssPath css url to style the Heidelpay payment frame * - * @throws \Exception + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException * * @return \Heidelpay\PhpPaymentApi\PaymentMethods\CreditCardPaymentMethod */ - public function authorize($PaymentFrameOrigin = null, $PreventAsyncRedirect = 'FALSE', $CssPath = null) + public function authorize($paymentFrameOrigin = null, $preventAsyncRedirect = 'FALSE', $cssPath = null) { - $this->getRequest()->getFrontend()->set('enabled', 'TRUE'); - $this->getRequest()->getFrontend()->set('payment_frame_origin', $PaymentFrameOrigin); - $this->getRequest()->getFrontend()->set('prevent_async_redirect', $PreventAsyncRedirect); - $this->getRequest()->getFrontend()->set('css_path', $CssPath); + $this->getRequest()->getFrontend()->setEnabled('TRUE'); + $this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin); + $this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect); + $this->getRequest()->getFrontend()->setCssPath($cssPath); return $this->authorizeParent(); } /** * Payment type debit - * * This payment type will charge the given account directly. * Because of payment card industry restrictions (Aka pci3), you have * to use a payment frame solution to handle the customers credit card information. * - * @param null|mixed $PaymentFrameOrigin uri of your application like http://dev.heidelpay.com - * @param mixed $PreventAsyncRedirect prevention of redirecting the customer - * @param null|mixed $CssPath css url to style the Heidelpay payment frame + * @param null|mixed $paymentFrameOrigin uri of your application like http://dev.heidelpay.com + * @param mixed $preventAsyncRedirect prevention of redirecting the customer + * @param null|mixed $cssPath css url to style the Heidelpay payment frame * - * @throws \Exception + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException * - * @return \Heidelpay\PhpPaymentApi\PaymentMethods\CreditCardPaymentMethod|boolean + * @return \Heidelpay\PhpPaymentApi\PaymentMethods\CreditCardPaymentMethod */ - public function debit($PaymentFrameOrigin = null, $PreventAsyncRedirect = 'FALSE', $CssPath = null) + public function debit($paymentFrameOrigin = null, $preventAsyncRedirect = 'FALSE', $cssPath = null) { - $this->getRequest()->getFrontend()->set('payment_frame_origin', $PaymentFrameOrigin); - $this->getRequest()->getFrontend()->set('prevent_async_redirect', $PreventAsyncRedirect); - $this->getRequest()->getFrontend()->set('css_path', $CssPath); + $this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin); + $this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect); + $this->getRequest()->getFrontend()->setCssPath($cssPath); return $this->debitParent(); } /** * Payment type registration - * * This payment type will be used to save account data inside the heidelpay * system. You will get a payment reference id back. This provides you a way * to charge this account later or even to make a recurring payment. * Because of the payment card industry restrictions (Aka pci3), you have * to use a payment frame solution to handle the customers credit card information. * + * @param null|mixed $paymentFrameOrigin uri of your application like http://dev.heidelpay.com + * @param mixed $preventAsyncRedirect prevention of redirecting the customer + * @param null|mixed $cssPath css url to style the Heidelpay payment frame + * + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException + * + * @return \Heidelpay\PhpPaymentApi\PaymentMethods\CreditCardPaymentMethod + */ + public function registration($paymentFrameOrigin = null, $preventAsyncRedirect = 'FALSE', $cssPath = null) + { + $this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin); + $this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect); + $this->getRequest()->getFrontend()->setCssPath($cssPath); + + return $this->registrationParent(); + } + + /** + * This payment type will be used to update account data inside the heidelpay + * system. The passed reference Id identifies the registration which is to be updated. + * The reference id is obtained by using the register method first. + * Because of the payment card industry restrictions (Aka pci3), you have + * to use a payment frame solution to handle the customers credit card information. + * + * @param mixed $referenceId * @param null|mixed $PaymentFrameOrigin uri of your application like http://dev.heidelpay.com * @param mixed $PreventAsyncRedirect prevention of redirecting the customer * @param null|mixed $CssPath css url to style the Heidelpay payment frame * - * @throws \Exception + * @return ReregistrationTransactionType * - * @return \Heidelpay\PhpPaymentApi\PaymentMethods\CreditCardPaymentMethod|boolean + * @throws \Exception */ - public function registration($PaymentFrameOrigin = null, $PreventAsyncRedirect = 'FALSE', $CssPath = null) - { - $this->getRequest()->getFrontend()->set('payment_frame_origin', $PaymentFrameOrigin); - $this->getRequest()->getFrontend()->set('prevent_async_redirect', $PreventAsyncRedirect); - $this->getRequest()->getFrontend()->set('css_path', $CssPath); + public function reregistration( + $referenceId, + $PaymentFrameOrigin = null, + $PreventAsyncRedirect = 'FALSE', + $CssPath = null + ) { + $this->getRequest()->getFrontend()->setPaymentFrameOrigin($PaymentFrameOrigin); + $this->getRequest()->getFrontend()->setPreventAsyncRedirect($PreventAsyncRedirect); + $this->getRequest()->getFrontend()->setCssPath($CssPath); - return $this->registrationParent(); + return $this->reregistrationParent($referenceId); } } diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/DebitCardPaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/DebitCardPaymentMethod.php index 5a88309..0831120 100644 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/DebitCardPaymentMethod.php +++ b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/DebitCardPaymentMethod.php @@ -2,12 +2,14 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; use Heidelpay\PhpPaymentApi\TransactionTypes\RegistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\DebitTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeOnRegistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\DebitOnRegistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType; +use Heidelpay\PhpPaymentApi\TransactionTypes\ReregistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\ReversalTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\CaptureTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\RebillTransactionType; @@ -24,16 +26,17 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\paymentmethods */ -class DebitCardPaymentMethod +class DebitCardPaymentMethod implements PaymentMethodInterface { use BasicPaymentMethodTrait; use RegistrationTransactionType { registration as registrationParent; } + use ReregistrationTransactionType { + reregistration as reregistrationParent; + } use AuthorizeTransactionType { authorize as authorizeParent; } @@ -48,23 +51,12 @@ class DebitCardPaymentMethod use RebillTransactionType; /** - * Payment code for this payment method - * - * @var string payment code + * @var string Payment Code for this payment method */ - protected $_paymentCode = 'DC'; - - - /** - * Payment brand name for this payment method - * - * @var string brand name - */ - protected $_brand; + protected $paymentCode = PaymentMethod::DEBIT_CARD; /** * Payment type authorisation - * * Depending on the payment method this type normally means that the amount * of the given account will only be authorized. In case of payment methods * like Sofort and Giropay (so called online payments) this type will only be @@ -72,83 +64,110 @@ class DebitCardPaymentMethod * Because of the payment card industry restrictions (Aka pci3), you have * to use a payment frame solution to handle the customers credit card information. * - * @param null|mixed $PaymentFrameOrigin uri of your application like http://dev.heidelpay.com - * @param mixed $PreventAsyncRedirect prevention of redirecting the customer - * @param null|mixed $CssPath css url to style the Heidelpay payment frame + * @param null|mixed $paymentFrameOrigin uri of your application like http://dev.heidelpay.com + * @param mixed $preventAsyncRedirect prevention of redirecting the customer + * @param null|mixed $cssPath css url to style the Heidelpay payment frame * - * @throws \Exception + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException * - * @return \Heidelpay\PhpPaymentApi\PaymentMethods\CreditCardPaymentMethod|boolean + * @return \Heidelpay\PhpPaymentApi\PaymentMethods\DebitCardPaymentMethod */ - public function authorize($PaymentFrameOrigin = null, $PreventAsyncRedirect = 'FALSE', $CssPath = null) + public function authorize($paymentFrameOrigin = null, $preventAsyncRedirect = 'FALSE', $cssPath = null) { /** * Because of the payment card industriy restictions (Aka pci3) you have * to use a payment frame for the input of credit card information */ - $this->getRequest()->getFrontend()->set('enabled', 'TRUE'); - $this->getRequest()->getFrontend()->set('payment_frame_origin', $PaymentFrameOrigin); - $this->getRequest()->getFrontend()->set('prevent_async_redirect', $PreventAsyncRedirect); - $this->getRequest()->getFrontend()->set('css_path', $CssPath); + $this->getRequest()->getFrontend()->setEnabled('TRUE'); + $this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin); + $this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect); + $this->getRequest()->getFrontend()->setCssPath($cssPath); return $this->authorizeParent(); } /** * Payment type debit - * * This payment type will charge the given account directly. * Because of the payment card industry restrictions (Aka pci3), you have * to use a payment frame solution to handle the customers credit card information. * - * @param null|mixed $PaymentFrameOrigin uri of your application like http://dev.heidelpay.com - * @param mixed $PreventAsyncRedirect prevention of redirecting the customer - * @param null|mixed $CssPath css url to style the Heidelpay payment frame + * @param null|mixed $paymentFrameOrigin uri of your application like http://dev.heidelpay.com + * @param mixed $preventAsyncRedirect prevention of redirecting the customer + * @param null|mixed $cssPath css url to style the Heidelpay payment frame * - * @throws \Exception + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException * - * @return \Heidelpay\PhpPaymentApi\PaymentMethods\CreditCardPaymentMethod|boolean + * @return \Heidelpay\PhpPaymentApi\PaymentMethods\DebitCardPaymentMethod */ - public function debit($PaymentFrameOrigin = null, $PreventAsyncRedirect = 'FALSE', $CssPath = null) + public function debit($paymentFrameOrigin = null, $preventAsyncRedirect = 'FALSE', $cssPath = null) { /** * Because of the payment card industriy restictions (Aka pci3) you have * to use a payment frame for the input of credit card information */ - $this->getRequest()->getFrontend()->set('payment_frame_origin', $PaymentFrameOrigin); - $this->getRequest()->getFrontend()->set('prevent_async_redirect', $PreventAsyncRedirect); - $this->getRequest()->getFrontend()->set('css_path', $CssPath); + $this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin); + $this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect); + $this->getRequest()->getFrontend()->setCssPath($cssPath); return $this->debitParent(); } /** * Payment type registration - * * This payment type will be used to save account data inside the heidelpay * system. You will get a payment reference id back. This gives you a way * to charge this account later or even to make a recurring payment. * Because of the payment card industry restrictions (Aka pci3), you have * to use a payment frame solution to handle the customers credit card information. * - * @param null|mixed $PaymentFrameOrigin uri of your application like http://dev.heidelpay.com - * @param mixed $PreventAsyncRedirect prevention of redirecting the customer - * @param null|mixed $CssPath css url to style the Heidelpay payment frame + * @param null|mixed $paymentFrameOrigin uri of your application like http://dev.heidelpay.com + * @param mixed $preventAsyncRedirect prevention of redirecting the customer + * @param null|mixed $cssPath css url to style the Heidelpay payment frame * - * @throws \Exception + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException * - * @return \Heidelpay\PhpPaymentApi\PaymentMethods\CreditCardPaymentMethod|boolean + * @return \Heidelpay\PhpPaymentApi\PaymentMethods\DebitCardPaymentMethod */ - public function registration($PaymentFrameOrigin = null, $PreventAsyncRedirect = 'FALSE', $CssPath = null) + public function registration($paymentFrameOrigin = null, $preventAsyncRedirect = 'FALSE', $cssPath = null) { /** * Because of the payment card industriy restictions (Aka pci3) you have * to use a payment frame for the input of credit card information */ - $this->getRequest()->getFrontend()->set('payment_frame_origin', $PaymentFrameOrigin); - $this->getRequest()->getFrontend()->set('prevent_async_redirect', $PreventAsyncRedirect); - $this->getRequest()->getFrontend()->set('css_path', $CssPath); + $this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin); + $this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect); + $this->getRequest()->getFrontend()->setCssPath($cssPath); return $this->registrationParent(); } + + /** + * This payment type will be used to update account data inside the heidelpay + * system. The passed reference Id identifies the registration which is to be updated. + * The reference id is obtained by using the register method first. + * Because of the payment card industry restrictions (Aka pci3), you have + * to use a payment frame solution to handle the customers credit card information. + * + * @param mixed $referenceId + * @param null|mixed $PaymentFrameOrigin uri of your application like http://dev.heidelpay.com + * @param mixed $PreventAsyncRedirect prevention of redirecting the customer + * @param null|mixed $CssPath css url to style the Heidelpay payment frame + * + * @return ReregistrationTransactionType + * + * @throws \Exception + */ + public function reregistration( + $referenceId, + $PaymentFrameOrigin = null, + $PreventAsyncRedirect = 'FALSE', + $CssPath = null + ) { + $this->getRequest()->getFrontend()->setPaymentFrameOrigin($PaymentFrameOrigin); + $this->getRequest()->getFrontend()->setPreventAsyncRedirect($PreventAsyncRedirect); + $this->getRequest()->getFrontend()->setCssPath($CssPath); + + return $this->reregistrationParent($referenceId); + } } diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/DirectDebitB2CSecuredPaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/DirectDebitB2CSecuredPaymentMethod.php index a658e96..e53b456 100644 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/DirectDebitB2CSecuredPaymentMethod.php +++ b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/DirectDebitB2CSecuredPaymentMethod.php @@ -2,21 +2,23 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; use Heidelpay\PhpPaymentApi\TransactionTypes\RegistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\DebitTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeOnRegistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\DebitOnRegistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType; +use Heidelpay\PhpPaymentApi\TransactionTypes\ReregistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\ReversalTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\CaptureTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\RebillTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\FinalizeTransactionType; /** - * Direct debit secured for b2c payment Class + * Direct debit secured for B2C payment Class * - * Direct debit secured for b2c payment method + * Direct debit secured for B2C payment method * * @license Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. @@ -25,14 +27,13 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\paymentmethods */ -class DirectDebitB2CSecuredPaymentMethod +class DirectDebitB2CSecuredPaymentMethod implements PaymentMethodInterface { use BasicPaymentMethodTrait; use RegistrationTransactionType; + use ReregistrationTransactionType; use AuthorizeTransactionType; use DebitTransactionType; use AuthorizeOnRegistrationTransactionType; @@ -44,16 +45,7 @@ class DirectDebitB2CSecuredPaymentMethod use FinalizeTransactionType; /** - * Payment code for this payment method - * - * @var string payment code + * @var string Payment Code for this payment method */ - protected $_paymentCode = 'DD'; - - /** - * Payment brand name for this payment method - * - * @var string brand name - */ - protected $_brand; + protected $paymentCode = PaymentMethod::DIRECT_DEBIT; } diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/DirectDebitPaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/DirectDebitPaymentMethod.php index 249f09c..83289cd 100644 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/DirectDebitPaymentMethod.php +++ b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/DirectDebitPaymentMethod.php @@ -2,12 +2,14 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; use Heidelpay\PhpPaymentApi\TransactionTypes\RegistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\DebitTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeOnRegistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\DebitOnRegistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType; +use Heidelpay\PhpPaymentApi\TransactionTypes\ReregistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\ReversalTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\CaptureTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\RebillTransactionType; @@ -24,14 +26,13 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\paymentmethods */ -class DirectDebitPaymentMethod +class DirectDebitPaymentMethod implements PaymentMethodInterface { use BasicPaymentMethodTrait; use RegistrationTransactionType; + use ReregistrationTransactionType; use AuthorizeTransactionType; use DebitTransactionType; use AuthorizeOnRegistrationTransactionType; @@ -42,16 +43,7 @@ class DirectDebitPaymentMethod use RebillTransactionType; /** - * Payment code for this payment method - * - * @var string payment code + * @var string Payment Code for this payment method */ - protected $_paymentCode = 'DD'; - - /** - * Payment brand name for this payment method - * - * @var string brand name - */ - protected $_brand; + protected $paymentCode = PaymentMethod::DIRECT_DEBIT; } diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/EPSPaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/EPSPaymentMethod.php index b27ebe1..fac2691 100644 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/EPSPaymentMethod.php +++ b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/EPSPaymentMethod.php @@ -2,6 +2,11 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Constants\Brand; +use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; +use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeTransactionType; +use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType; + /** * EPS Payment Class * @@ -14,37 +19,21 @@ * * @author Ronja Wann * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\paymentmethods */ -class EPSPaymentMethod extends AbstractPaymentMethod +class EPSPaymentMethod implements PaymentMethodInterface { - /** - * Payment code for this payment method - * - * @var string payment code - */ - protected $_paymentCode = 'OT'; - - /** - * Weather this Payment method can authorise transactions or not - * - * @var boolean canAuthorise - */ - protected $_canAuthorise = true; + use BasicPaymentMethodTrait; + use AuthorizeTransactionType; + use RefundTransactionType; /** - * Weather this Payment method can refund transactions or not - * - * @var boolean canRefund + * @var string Payment Code for this payment method */ - protected $_canRefund = true; + protected $paymentCode = PaymentMethod::ONLINE_TRANSFER; /** - * Payment brand name for this payment method - * - * @var string brand name + * @var string Brand Code for this payment method */ - protected $_brand = 'EPS'; + protected $brand = Brand::EPS; } diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/EasyCreditPaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/EasyCreditPaymentMethod.php index 5bc7ba9..8538903 100644 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/EasyCreditPaymentMethod.php +++ b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/EasyCreditPaymentMethod.php @@ -2,6 +2,8 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Constants\Brand; +use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeOnRegistrationTransactionType as AuthorizeOnInitialization; use Heidelpay\PhpPaymentApi\TransactionTypes\FinalizeTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\InitializeTransactionType; @@ -18,7 +20,7 @@ * * @author Stephano Vogel * - * @package heidelpay\php-api\paymentmethods\easycredit + * @package heidelpay\php-payment-api\paymentmethods */ class EasyCreditPaymentMethod implements PaymentMethodInterface { @@ -30,16 +32,12 @@ class EasyCreditPaymentMethod implements PaymentMethodInterface use ReversalTransactionType; /** - * Payment code for this payment method - * - * @var string payment code + * @var string Payment Code for this payment method */ - protected $_paymentCode = 'HP'; + protected $paymentCode = PaymentMethod::HIRE_PURCHASE; /** - * Payment brand name for this payment method - * - * @var string brand name + * @var string Brand Code for this payment method */ - protected $_brand = 'EASYCREDIT'; + protected $brand = Brand::EASYCREDIT; } diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/GiropayPaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/GiropayPaymentMethod.php index 17f890d..bdf1fa2 100644 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/GiropayPaymentMethod.php +++ b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/GiropayPaymentMethod.php @@ -2,6 +2,11 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Constants\Brand; +use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; +use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeTransactionType; +use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType; + /** * Giropay Payment Class * @@ -14,37 +19,21 @@ * * @author Ronja Wann * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\paymentmethods */ -class GiropayPaymentMethod extends AbstractPaymentMethod +class GiropayPaymentMethod implements PaymentMethodInterface { - /** - * Payment code for this payment method - * - * @var string payment code - */ - protected $_paymentCode = 'OT'; - - /** - * Weather this Payment method can authorise transactions or not - * - * @var boolean canAuthorise - */ - protected $_canAuthorise = true; + use BasicPaymentMethodTrait; + use AuthorizeTransactionType; + use RefundTransactionType; /** - * Weather this Payment method can refund transactions or not - * - * @var boolean canRefund + * @var string Payment Code for this payment method */ - protected $_canRefund = true; + protected $paymentCode = PaymentMethod::ONLINE_TRANSFER; /** - * Payment brand name for this payment method - * - * @var string brand name + * @var string Brand Code for this payment method */ - protected $_brand = 'GIROPAY'; + protected $brand = Brand::GIROPAY; } diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/IDealPaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/IDealPaymentMethod.php index 334da79..a465144 100644 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/IDealPaymentMethod.php +++ b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/IDealPaymentMethod.php @@ -2,6 +2,11 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Constants\Brand; +use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; +use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeTransactionType; +use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType; + /** * iDeal Payment Class * @@ -14,30 +19,21 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\paymentmethods */ -class IDealPaymentMethod extends AbstractPaymentMethod +class IDealPaymentMethod implements PaymentMethodInterface { - /** - * Payment code for this payment method - * - * @var string payment code - */ - protected $_paymentCode = 'OT'; + use BasicPaymentMethodTrait; + use AuthorizeTransactionType; + use RefundTransactionType; /** - * Weather this Payment method can authorise transactions or not - * - * @var boolean canAuthorise + * @var string Payment Code for this payment method */ - protected $_canAuthorise = true; + protected $paymentCode = PaymentMethod::ONLINE_TRANSFER; /** - * Payment brand name for this payment method - * - * @var string brand name + * @var string Brand Code for this payment method */ - protected $_brand = 'IDEAL'; + protected $brand = Brand::IDEAL; } diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/InvoiceB2CSecuredPaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/InvoiceB2CSecuredPaymentMethod.php index ca5635f..3f447bf 100644 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/InvoiceB2CSecuredPaymentMethod.php +++ b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/InvoiceB2CSecuredPaymentMethod.php @@ -2,15 +2,16 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\ReversalTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\FinalizeTransactionType; /** - * Invoice b2c secured Payment Class + * Invoice B2C secured Payment Class * - * This payment method is the secured b2c invoice. + * This payment method is for the secured B2C invoice. * * @license Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. @@ -19,11 +20,9 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\paymentmethods */ -class InvoiceB2CSecuredPaymentMethod +class InvoiceB2CSecuredPaymentMethod implements PaymentMethodInterface { use BasicPaymentMethodTrait; use AuthorizeTransactionType; @@ -32,16 +31,7 @@ class InvoiceB2CSecuredPaymentMethod use FinalizeTransactionType; /** - * Payment code for this payment method - * - * @var string payment code + * @var string Payment Code for this payment method */ - protected $_paymentCode = 'IV'; - - /** - * Payment brand name for this payment method - * - * @var string brand name - */ - protected $_brand; + protected $paymentCode = PaymentMethod::INVOICE; } diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/InvoicePaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/InvoicePaymentMethod.php index 6af3b43..bdf4d7d 100644 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/InvoicePaymentMethod.php +++ b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/InvoicePaymentMethod.php @@ -2,6 +2,7 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\ReversalTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType; @@ -18,11 +19,9 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\paymentmethods */ -class InvoicePaymentMethod +class InvoicePaymentMethod implements PaymentMethodInterface { use BasicPaymentMethodTrait; use AuthorizeTransactionType; @@ -30,16 +29,7 @@ class InvoicePaymentMethod use RefundTransactionType; /** - * Payment code for this payment method - * - * @var string payment code + * @var string Payment Code for this payment method */ - protected $_paymentCode = 'IV'; - - /** - * Payment brand name for this payment method - * - * @var string brand name - */ - protected $_brand; + protected $paymentCode = PaymentMethod::INVOICE; } diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PayPalPaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PayPalPaymentMethod.php index b7831f0..0a455b2 100644 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PayPalPaymentMethod.php +++ b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PayPalPaymentMethod.php @@ -2,12 +2,15 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Constants\Brand; +use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; use Heidelpay\PhpPaymentApi\TransactionTypes\RegistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\DebitTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeOnRegistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\DebitOnRegistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType; +use Heidelpay\PhpPaymentApi\TransactionTypes\ReregistrationTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\ReversalTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\CaptureTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\RebillTransactionType; @@ -22,14 +25,13 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\paymentmethods */ -class PayPalPaymentMethod +class PayPalPaymentMethod implements PaymentMethodInterface { use BasicPaymentMethodTrait; use RegistrationTransactionType; + use ReregistrationTransactionType; use AuthorizeTransactionType; use DebitTransactionType; use AuthorizeOnRegistrationTransactionType; @@ -40,16 +42,12 @@ class PayPalPaymentMethod use RebillTransactionType; /** - * Payment code for this payment method - * - * @var string payment code + * @var string Payment Code for this payment method */ - protected $_paymentCode = 'VA'; + protected $paymentCode = PaymentMethod::VIRTUAL_ACCOUNT; /** - * Payment brand name for this payment method - * - * @var string brand name + * @var string Brand Code for this payment method */ - protected $_brand = 'PAYPAL'; + protected $brand = Brand::PAYPAL; } diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PaymentMethodInterface.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PaymentMethodInterface.php index 0ee8cb7..f231302 100644 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PaymentMethodInterface.php +++ b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PaymentMethodInterface.php @@ -2,6 +2,7 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Request; use JsonSerializable; /** @@ -14,10 +15,68 @@ * * @author Stephano Vogel * - * @package heidelpay/php-api + * @package heidelpay\php-payment-api\paymentmethods */ interface PaymentMethodInterface extends JsonSerializable { + /** + * Returns the payment code for the payment request. + * + * @return string + */ + public function getPaymentCode(); + + /** + * Returns the brand for the payment method. + * + * @return string + */ + public function getBrand(); + + /** + * Get url of the used payment api + * + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException + * + * @return boolean|string url of the payment api + */ + public function getPaymentUrl(); + + /** + * Get HTTP Adapter for payment communication + * + * @return \Heidelpay\PhpPaymentApi\Adapter\HttpAdapterInterface + */ + public function getAdapter(); + + /** + * Returns the Request instance. + * + * @return \Heidelpay\PhpPaymentApi\Request + */ + public function getRequest(); + + /** + * Returns the Response instance. + * + * @return \Heidelpay\PhpPaymentApi\Response + */ + public function getResponse(); + + /** + * Set a HTTP Adapter for payment communication + * + * @param \Heidelpay\PhpPaymentApi\Adapter\HttpAdapterInterface $adapter + */ + public function setAdapter($adapter); + + /** + * Set a new payment request object + * + * @param \Heidelpay\PhpPaymentApi\Request $heidelpayRequest + */ + public function setRequest(Request $heidelpayRequest); + /** * Returns a Json representation of itself. * diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PayolutionInvoicePaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PayolutionInvoicePaymentMethod.php index 732e69e..184c875 100644 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PayolutionInvoicePaymentMethod.php +++ b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PayolutionInvoicePaymentMethod.php @@ -2,6 +2,8 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Constants\Brand; +use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\FinalizeTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType; @@ -19,7 +21,7 @@ * * @author Stephano Vogel * - * @package heidelpay\php-api\payment-methods\payolution-invoice + * @package heidelpay\php-payment-api\paymentmethods */ class PayolutionInvoicePaymentMethod { @@ -30,12 +32,12 @@ class PayolutionInvoicePaymentMethod use ReversalTransactionType; /** - * @var string Payment code + * @var string Payment Code for this payment method */ - protected $_paymentCode = 'IV'; + protected $paymentCode = PaymentMethod::INVOICE; /** - * @var string Brand name + * @var string Brand Code for this payment method */ - protected $_brand = 'PAYOLUTION_DIRECT'; + protected $brand = Brand::PAYOLUTION_DIRECT; } diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PostFinanceCardPaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PostFinanceCardPaymentMethod.php index b381963..d814fa3 100644 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PostFinanceCardPaymentMethod.php +++ b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PostFinanceCardPaymentMethod.php @@ -2,6 +2,11 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Constants\Brand; +use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; +use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeTransactionType; +use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType; + /** * PostFinanceCard Payment Class * @@ -14,37 +19,21 @@ * * @author Ronja Wann * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\paymentmethods */ -class PostFinanceCardPaymentMethod extends AbstractPaymentMethod +class PostFinanceCardPaymentMethod implements PaymentMethodInterface { - /** - * Payment code for this payment method - * - * @var string payment code - */ - protected $_paymentCode = 'OT'; - - /** - * Weather this Payment method can authorise transactions or not - * - * @var boolean canAuthorise - */ - protected $_canAuthorise = true; + use BasicPaymentMethodTrait; + use AuthorizeTransactionType; + use RefundTransactionType; /** - * Weather this Payment method can refund transactions or not - * - * @var boolean canRefund + * @var string Payment Code for this payment method */ - protected $_canRefund = true; + protected $paymentCode = PaymentMethod::ONLINE_TRANSFER; /** - * Payment brand name for this payment method - * - * @var string brand name + * @var string Brand Code for this payment method */ - protected $_brand = 'PFCARD'; + protected $brand = Brand::POSTFINANCE_CARD; } diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PostFinanceEFinancePaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PostFinanceEFinancePaymentMethod.php index a46d53d..bb34b59 100644 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PostFinanceEFinancePaymentMethod.php +++ b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PostFinanceEFinancePaymentMethod.php @@ -2,6 +2,11 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Constants\Brand; +use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; +use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeTransactionType; +use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType; + /** * PostFinanceEFinance Payment Class * @@ -14,37 +19,21 @@ * * @author Ronja Wann * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\paymentmethods */ -class PostFinanceEFinancePaymentMethod extends AbstractPaymentMethod +class PostFinanceEFinancePaymentMethod implements PaymentMethodInterface { - /** - * Payment code for this payment method - * - * @var string payment code - */ - protected $_paymentCode = 'OT'; - - /** - * Weather this Payment method can authorise transactions or not - * - * @var boolean canAuthorise - */ - protected $_canAuthorise = true; + use BasicPaymentMethodTrait; + use AuthorizeTransactionType; + use RefundTransactionType; /** - * Weather this Payment method can refund transactions or not - * - * @var boolean canRefund + * @var string Payment Code for this payment method */ - protected $_canRefund = true; + protected $paymentCode = PaymentMethod::ONLINE_TRANSFER; /** - * Payment brand name for this payment method - * - * @var string brand name + * @var string Brand Code for this payment method */ - protected $_brand = 'PFEFINANCE'; + protected $brand = Brand::POSTFINANCE_EFINANCE; } diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PrepaymentPaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PrepaymentPaymentMethod.php index 8a48086..cf85184 100644 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PrepaymentPaymentMethod.php +++ b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/PrepaymentPaymentMethod.php @@ -2,6 +2,7 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\ReversalTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType; @@ -16,11 +17,9 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\paymentmethods */ -class PrepaymentPaymentMethod +class PrepaymentPaymentMethod implements PaymentMethodInterface { use BasicPaymentMethodTrait; use AuthorizeTransactionType; @@ -28,16 +27,7 @@ class PrepaymentPaymentMethod use RefundTransactionType; /** - * Payment code for this payment method - * - * @var string payment code + * @var string Payment Code for this payment method */ - protected $_paymentCode = 'PP'; - - /** - * Payment brand name for this payment method - * - * @var string brand name - */ - protected $_brand; + protected $paymentCode = PaymentMethod::PREPAYMENT; } diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/Przelewy24PaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/Przelewy24PaymentMethod.php index b063046..78205c3 100644 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/Przelewy24PaymentMethod.php +++ b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/Przelewy24PaymentMethod.php @@ -2,6 +2,11 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Constants\Brand; +use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; +use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeTransactionType; +use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType; + /** * Przelewy24 Payment Class * @@ -14,37 +19,21 @@ * * @author Ronja Wann * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\paymentmethods */ -class Przelewy24PaymentMethod extends AbstractPaymentMethod +class Przelewy24PaymentMethod implements PaymentMethodInterface { - /** - * Payment code for this payment method - * - * @var string payment code - */ - protected $_paymentCode = 'OT'; - - /** - * Weather this Payment method can authorise transactions or not - * - * @var boolean canAuthorise - */ - protected $_canAuthorise = true; + use BasicPaymentMethodTrait; + use AuthorizeTransactionType; + use RefundTransactionType; /** - * Weather this Payment method can refund transactions or not - * - * @var boolean canRefund + * @var string Payment Code for this payment method */ - protected $_canRefund = true; + protected $paymentCode = PaymentMethod::ONLINE_TRANSFER; /** - * Payment brand name for this payment method - * - * @var string brand name + * @var string Brand Code for this payment method */ - protected $_brand = 'PRZELEWY24'; + protected $brand = Brand::PRZELEWY24; } diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/SantanderInvoicePaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/SantanderInvoicePaymentMethod.php index 1da8eeb..a706f20 100644 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/SantanderInvoicePaymentMethod.php +++ b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/SantanderInvoicePaymentMethod.php @@ -2,6 +2,8 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Constants\Brand; +use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\ReversalTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType; @@ -19,11 +21,9 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\paymentmethods */ -class SantanderInvoicePaymentMethod +class SantanderInvoicePaymentMethod implements PaymentMethodInterface { use BasicPaymentMethodTrait; use AuthorizeTransactionType; @@ -32,16 +32,12 @@ class SantanderInvoicePaymentMethod use FinalizeTransactionType; /** - * Payment code for this payment method - * - * @var string payment code + * @var string Payment Code for this payment method */ - protected $_paymentCode = 'IV'; + protected $paymentCode = PaymentMethod::INVOICE; /** - * Payment brand name for this payment method - * - * @var string brand name + * @var string Brand Code for this payment method */ - protected $_brand = 'SANTANDER'; + protected $brand = Brand::SANTANDER; } diff --git a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/SofortPaymentMethod.php b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/SofortPaymentMethod.php index c0d30a2..355aac4 100644 --- a/vendor/heidelpay/php-payment-api/lib/PaymentMethods/SofortPaymentMethod.php +++ b/vendor/heidelpay/php-payment-api/lib/PaymentMethods/SofortPaymentMethod.php @@ -2,6 +2,8 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Constants\Brand; +use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; use Heidelpay\PhpPaymentApi\TransactionTypes\AuthorizeTransactionType; use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType; @@ -17,27 +19,21 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\paymentmethods */ -class SofortPaymentMethod +class SofortPaymentMethod implements PaymentMethodInterface { use BasicPaymentMethodTrait; use AuthorizeTransactionType; use RefundTransactionType; /** - * Payment code for this payment method - * - * @var string payment code + * @var string Payment Code for this payment method */ - protected $_paymentCode = 'OT'; + protected $paymentCode = PaymentMethod::ONLINE_TRANSFER; /** - * Payment brand name for this payment method - * - * @var string brand name + * @var string Brand Code for this payment method */ - protected $_brand = 'SOFORT'; + protected $brand = Brand::SOFORT; } diff --git a/vendor/heidelpay/php-payment-api/lib/Push.php b/vendor/heidelpay/php-payment-api/lib/Push.php index 41b2afa..1283018 100644 --- a/vendor/heidelpay/php-payment-api/lib/Push.php +++ b/vendor/heidelpay/php-payment-api/lib/Push.php @@ -86,6 +86,8 @@ class Push * Push constructor. * * @param string $xmlResponse a raw string in xml format + * + * @throws XmlResponseParserException */ public function __construct($xmlResponse = null) { @@ -112,6 +114,8 @@ public function setRawResponse($response) * Then return it. * * @return Response|null + * + * @throws XmlResponseParserException */ public function getResponse() { @@ -125,6 +129,8 @@ public function getResponse() /** * Parses the raw XML response and maps the * attributes to a PhpPaymentApi Response. + * + * @throws XmlResponseParserException */ private function parseXmlResponse() { @@ -152,7 +158,7 @@ private function parseXmlResponse() } // set the criterion data - if (isset($xml->Transaction->Analysis->Criterion)) { + if (isset($xml->Transaction, $xml->Transaction->Analysis->Criterion)) { foreach ($xml->Transaction->Analysis->Criterion as $criterion) { $this->response->getCriterion()->set($criterion['name'], (string)$criterion); } @@ -220,7 +226,7 @@ private function isParameterGroupGetter($methodName) * @param SimpleXMLElement $xmlResponse */ private function setParameterGroupProperties( - AbstractParameterGroup &$parameterGroupInstance, + AbstractParameterGroup $parameterGroupInstance, PushMappingInterface $mappingClassInstance, SimpleXMLElement $xmlResponse ) { diff --git a/vendor/heidelpay/php-payment-api/lib/PushMapping/AbstractPushMapper.php b/vendor/heidelpay/php-payment-api/lib/PushMapping/AbstractPushMapper.php index 2491979..801ad68 100644 --- a/vendor/heidelpay/php-payment-api/lib/PushMapping/AbstractPushMapper.php +++ b/vendor/heidelpay/php-payment-api/lib/PushMapping/AbstractPushMapper.php @@ -3,7 +3,7 @@ namespace Heidelpay\PhpPaymentApi\PushMapping; /** - * Summary + * Abstract Push Mapping Class for Parameter Groups * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. @@ -12,9 +12,7 @@ * * @author Stephano Vogel * - * @package heidelpay - * @subpackage php-api - * @category php-api + * @package heidelpay\php-payment-api\push-mapping */ abstract class AbstractPushMapper implements PushMappingInterface { diff --git a/vendor/heidelpay/php-payment-api/lib/PushMapping/Account.php b/vendor/heidelpay/php-payment-api/lib/PushMapping/Account.php index 5987728..12b72fa 100644 --- a/vendor/heidelpay/php-payment-api/lib/PushMapping/Account.php +++ b/vendor/heidelpay/php-payment-api/lib/PushMapping/Account.php @@ -12,12 +12,13 @@ * * @author Stephano Vogel * - * @package heidelpay - * @subpackage php-api - * @category php-api + * @package heidelpay\php-payment-api\push-mapping */ class Account extends AbstractPushMapper { + /** + * @inheritdoc + */ public $fields = [ 'Bank' => 'bank', 'BankName' => 'bankname', @@ -30,28 +31,37 @@ class Account extends AbstractPushMapper 'Number' => 'number', ]; + /** + * @inheritdoc + */ public $fieldAttributes = [ 'Expiry:year' => 'expiry_year', 'Expiry:month' => 'expiry_month', ]; + /** + * @inheritdoc + */ public function getXmlObjectField(\SimpleXMLElement $xmlElement, $field) { - if (isset($xmlElement->Transaction->Account->$field)) { + if (isset($xmlElement->Transaction, $xmlElement->Transaction->Account->$field)) { return (string)$xmlElement->Transaction->Account->$field; } return null; } + /** + * @inheritdoc + */ public function getXmlObjectFieldAttribute(\SimpleXMLElement $xmlElement, $fieldAttribute) { list($field, $attribute) = explode(':', $fieldAttribute); - if (isset($xmlElement->Transaction->Account->$field)) { - if (isset($xmlElement->Transaction->Account->$field->attributes()->$attribute)) { - return (string)$xmlElement->Transaction->Account->$field->attributes()->$attribute; - } + if (isset($xmlElement->Transaction, $xmlElement->Transaction->Account->$field, + $xmlElement->Transaction->Account->$field->attributes()->$attribute) + ) { + return (string)$xmlElement->Transaction->Account->$field->attributes()->$attribute; } return null; diff --git a/vendor/heidelpay/php-payment-api/lib/PushMapping/Address.php b/vendor/heidelpay/php-payment-api/lib/PushMapping/Address.php index bc10043..c618d18 100644 --- a/vendor/heidelpay/php-payment-api/lib/PushMapping/Address.php +++ b/vendor/heidelpay/php-payment-api/lib/PushMapping/Address.php @@ -3,9 +3,7 @@ namespace Heidelpay\PhpPaymentApi\PushMapping; /** - * Summary - * - * Desc + * XML Push Mapping Class for the Address Parameter Group * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. @@ -14,12 +12,13 @@ * * @author Stephano Vogel * - * @package heidelpay - * @subpackage php-api - * @category php-api + * @package heidelpay\php-payment-api\push-mapping */ class Address extends AbstractPushMapper { + /** + * @inheritdoc + */ public $fields = [ 'City' => 'city', 'Country' => 'country', @@ -28,9 +27,12 @@ class Address extends AbstractPushMapper 'Zip' => 'zip', ]; + /** + * @inheritdoc + */ public function getXmlObjectField(\SimpleXMLElement $xmlElement, $field) { - if (isset($xmlElement->Transaction->Customer->Address->$field)) { + if (isset($xmlElement->Transaction, $xmlElement->Transaction->Customer->Address->$field)) { return (string) $xmlElement->Transaction->Customer->Address->$field; } diff --git a/vendor/heidelpay/php-payment-api/lib/PushMapping/Connector.php b/vendor/heidelpay/php-payment-api/lib/PushMapping/Connector.php index 2c4a447..5e319c8 100644 --- a/vendor/heidelpay/php-payment-api/lib/PushMapping/Connector.php +++ b/vendor/heidelpay/php-payment-api/lib/PushMapping/Connector.php @@ -3,7 +3,7 @@ namespace Heidelpay\PhpPaymentApi\PushMapping; /** - * Summary + * XML Push Mapping Class for the Connector Parameter Group * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. @@ -12,12 +12,13 @@ * * @author Stephano Vogel * - * @package heidelpay - * @subpackage php-api - * @category php-api + * @package heidelpay\php-payment-api\push-mapping */ class Connector extends AbstractPushMapper { + /** + * @inheritdoc + */ public $fields = [ 'Bank' => 'account_bank', 'Bic' => 'account_bic', @@ -28,9 +29,12 @@ class Connector extends AbstractPushMapper 'Usage' => 'account_usage', ]; + /** + * @inheritdoc + */ public function getXmlObjectField(\SimpleXMLElement $xmlElement, $field) { - if (isset($xmlElement->Transaction->Connector->Account->$field)) { + if (isset($xmlElement->Transaction, $xmlElement->Transaction->Connector->Account->$field)) { return (string) $xmlElement->Transaction->Connector->Account->$field; } diff --git a/vendor/heidelpay/php-payment-api/lib/PushMapping/Contact.php b/vendor/heidelpay/php-payment-api/lib/PushMapping/Contact.php index 2d4b747..d605cc6 100644 --- a/vendor/heidelpay/php-payment-api/lib/PushMapping/Contact.php +++ b/vendor/heidelpay/php-payment-api/lib/PushMapping/Contact.php @@ -3,9 +3,7 @@ namespace Heidelpay\PhpPaymentApi\PushMapping; /** - * Summary - * - * Desc + * XML Push Mapping Class for the Contact Parameter Group * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. @@ -14,12 +12,13 @@ * * @author Stephano Vogel * - * @package heidelpay - * @subpackage php-api - * @category php-api + * @package heidelpay\php-payment-api\push-mapping */ class Contact extends AbstractPushMapper { + /** + * @inheritdoc + */ public $fields = [ 'Email' => 'email', 'Ip' => 'ip', @@ -27,9 +26,12 @@ class Contact extends AbstractPushMapper 'Phone' => 'phone', ]; + /** + * @inheritdoc + */ public function getXmlObjectField(\SimpleXMLElement $xmlElement, $field) { - if (isset($xmlElement->Transaction->Customer->Contact->$field)) { + if (isset($xmlElement->Transaction, $xmlElement->Transaction->Customer->Contact->$field)) { return (string)$xmlElement->Transaction->Customer->Contact->$field; } diff --git a/vendor/heidelpay/php-payment-api/lib/PushMapping/Frontend.php b/vendor/heidelpay/php-payment-api/lib/PushMapping/Frontend.php index a392ee4..2aaaeae 100644 --- a/vendor/heidelpay/php-payment-api/lib/PushMapping/Frontend.php +++ b/vendor/heidelpay/php-payment-api/lib/PushMapping/Frontend.php @@ -3,7 +3,7 @@ namespace Heidelpay\PhpPaymentApi\PushMapping; /** - * Summary + * XML Push Mapping Class for the Frontend Parameter Group * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. @@ -12,12 +12,13 @@ * * @author Stephano Vogel * - * @package heidelpay - * @subpackage php-api - * @category php-api + * @package heidelpay\php-payment-api\push-mapping */ class Frontend extends AbstractPushMapper { + /** + * @inheritdoc + */ public $fields = [ 'CssPath' => 'css_path', 'Enabled' => 'enabled', @@ -29,9 +30,12 @@ class Frontend extends AbstractPushMapper 'ResponseUrl' => 'response_url', ]; + /** + * @inheritdoc + */ public function getXmlObjectField(\SimpleXMLElement $xmlElement, $field) { - if (isset($xmlElement->Transaction->Frontend->$field)) { + if (isset($xmlElement->Transaction, $xmlElement->Transaction->Frontend->$field)) { return (string)$xmlElement->Transaction->Frontend->$field; } diff --git a/vendor/heidelpay/php-payment-api/lib/PushMapping/Identification.php b/vendor/heidelpay/php-payment-api/lib/PushMapping/Identification.php index ce1cb52..c513097 100644 --- a/vendor/heidelpay/php-payment-api/lib/PushMapping/Identification.php +++ b/vendor/heidelpay/php-payment-api/lib/PushMapping/Identification.php @@ -3,7 +3,7 @@ namespace Heidelpay\PhpPaymentApi\PushMapping; /** - * Summary + * XML Push Mapping Class for the Identification Parameter Group * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. @@ -12,12 +12,13 @@ * * @author Stephano Vogel * - * @package heidelpay - * @subpackage php-api - * @category php-api + * @package heidelpay\php-payment-api\push-mapping */ class Identification extends AbstractPushMapper { + /** + * @inheritdoc + */ public $fields = [ 'CreditorID' => 'creditor_id', 'ReferenceID' => 'referenceid', @@ -27,9 +28,12 @@ class Identification extends AbstractPushMapper 'UniqueID' => 'uniqueid', ]; + /** + * @inheritdoc + */ public function getXmlObjectField(\SimpleXMLElement $xmlElement, $field) { - if (isset($xmlElement->Transaction->Identification->$field)) { + if (isset($xmlElement->Transaction, $xmlElement->Transaction->Identification->$field)) { return (string)$xmlElement->Transaction->Identification->$field; } diff --git a/vendor/heidelpay/php-payment-api/lib/PushMapping/Name.php b/vendor/heidelpay/php-payment-api/lib/PushMapping/Name.php index 8e0280f..fd15d7c 100644 --- a/vendor/heidelpay/php-payment-api/lib/PushMapping/Name.php +++ b/vendor/heidelpay/php-payment-api/lib/PushMapping/Name.php @@ -3,7 +3,7 @@ namespace Heidelpay\PhpPaymentApi\PushMapping; /** - * XML Push Mapping Class for Name Parameter Group + * XML Push Mapping Class for the Name Parameter Group * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. @@ -12,12 +12,13 @@ * * @author Stephano Vogel * - * @package heidelpay - * @subpackage php-api - * @category php-api + * @package heidelpay\php-payment-api\push-mapping */ class Name extends AbstractPushMapper { + /** + * @inheritdoc + */ public $fields = [ 'Birthdate' => 'birthdate', 'Company' => 'company', @@ -27,9 +28,12 @@ class Name extends AbstractPushMapper 'Title' => 'title', ]; + /** + * @inheritdoc + */ public function getXmlObjectField(\SimpleXMLElement $xmlElement, $field) { - if (isset($xmlElement->Transaction->Customer->Name->$field)) { + if (isset($xmlElement->Transaction, $xmlElement->Transaction->Customer->Name->$field)) { return (string)$xmlElement->Transaction->Customer->Name->$field; } diff --git a/vendor/heidelpay/php-payment-api/lib/PushMapping/Payment.php b/vendor/heidelpay/php-payment-api/lib/PushMapping/Payment.php index 64e1dd0..ce5fa43 100644 --- a/vendor/heidelpay/php-payment-api/lib/PushMapping/Payment.php +++ b/vendor/heidelpay/php-payment-api/lib/PushMapping/Payment.php @@ -3,7 +3,7 @@ namespace Heidelpay\PhpPaymentApi\PushMapping; /** - * Summary + * XML Push Mapping Class for the Payment Parameter Group * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. @@ -12,19 +12,23 @@ * * @author Stephano Vogel * - * @package heidelpay - * @subpackage php-api - * @category php-api + * @package heidelpay\php-payment-api\push-mapping */ class Payment extends AbstractPushMapper { + /** + * @inheritdoc + */ public $properties = [ 'code' => 'code', ]; + /** + * @inheritdoc + */ public function getXmlObjectProperty(\SimpleXMLElement $xmlElement, $property) { - if (isset($xmlElement->Transaction->Payment[$property])) { + if (isset($xmlElement->Transaction, $xmlElement->Transaction->Payment[$property])) { return (string)$xmlElement->Transaction->Payment[$property]; } diff --git a/vendor/heidelpay/php-payment-api/lib/PushMapping/Presentation.php b/vendor/heidelpay/php-payment-api/lib/PushMapping/Presentation.php index cab256f..526ca68 100644 --- a/vendor/heidelpay/php-payment-api/lib/PushMapping/Presentation.php +++ b/vendor/heidelpay/php-payment-api/lib/PushMapping/Presentation.php @@ -3,7 +3,7 @@ namespace Heidelpay\PhpPaymentApi\PushMapping; /** - * Summary + * XML Push Mapping Class for the Presentation Parameter Group * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. @@ -12,21 +12,25 @@ * * @author Stephano Vogel * - * @package heidelpay - * @subpackage php-api - * @category php-api + * @package heidelpay\php-payment-api\push-mapping */ class Presentation extends AbstractPushMapper { + /** + * @inheritdoc + */ public $fields = [ 'Amount' => 'amount', 'Currency' => 'currency', 'Usage' => 'usage', ]; + /** + * @inheritdoc + */ public function getXmlObjectField(\SimpleXMLElement $xmlElement, $field) { - if (isset($xmlElement->Transaction->Payment->Presentation->$field)) { + if (isset($xmlElement->Transaction, $xmlElement->Transaction->Payment->Presentation->$field)) { return (string)$xmlElement->Transaction->Payment->Presentation->$field; } diff --git a/vendor/heidelpay/php-payment-api/lib/PushMapping/Processing.php b/vendor/heidelpay/php-payment-api/lib/PushMapping/Processing.php index e2bebeb..d9c1ee9 100644 --- a/vendor/heidelpay/php-payment-api/lib/PushMapping/Processing.php +++ b/vendor/heidelpay/php-payment-api/lib/PushMapping/Processing.php @@ -3,7 +3,7 @@ namespace Heidelpay\PhpPaymentApi\PushMapping; /** - * Summary + * XML Push Mapping Class for the Processing Parameter Group * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. @@ -12,12 +12,13 @@ * * @author Stephano Vogel * - * @package heidelpay - * @subpackage php-api - * @category php-api + * @package heidelpay\php-payment-api\push-mapping */ class Processing extends AbstractPushMapper { + /** + * @inheritdoc + */ public $fields = [ 'ConfirmationStatus' => 'confirmation_status', 'Reason' => 'reason', @@ -27,41 +28,56 @@ class Processing extends AbstractPushMapper 'Timestamp' => 'timestamp', ]; + /** + * @inheritdoc + */ public $fieldAttributes = [ 'Reason:code' => 'reason_code', 'Return:code' => 'return_code', 'Status:code' => 'status_code', ]; + /** + * @inheritdoc + */ public $properties = [ 'code' => 'code' ]; + /** + * @inheritdoc + */ public function getXmlObjectField(\SimpleXMLElement $xmlElement, $field) { - if (isset($xmlElement->Transaction->Processing->$field)) { + if (isset($xmlElement->Transaction, $xmlElement->Transaction->Processing->$field)) { return (string)$xmlElement->Transaction->Processing->$field; } return null; } + /** + * @inheritdoc + */ public function getXmlObjectFieldAttribute(\SimpleXMLElement $xmlElement, $fieldAttribute) { list($field, $attribute) = explode(':', $fieldAttribute); - if (isset($xmlElement->Transaction->Processing->$field)) { - if (isset($xmlElement->Transaction->Processing->$field->attributes()->$attribute)) { - return (string)$xmlElement->Transaction->Processing->$field->attributes()->$attribute; - } + if (isset($xmlElement->Transaction, $xmlElement->Transaction->Processing->$field, + $xmlElement->Transaction->Processing->$field->attributes()->$attribute) + ) { + return (string)$xmlElement->Transaction->Processing->$field->attributes()->$attribute; } return null; } + /** + * @inheritdoc + */ public function getXmlObjectProperty(\SimpleXMLElement $xmlElement, $property) { - if (isset($xmlElement->Transaction->Processing[$property])) { + if (isset($xmlElement->Transaction, $xmlElement->Transaction->Processing[$property])) { return (string)$xmlElement->Transaction->Processing[$property]; } diff --git a/vendor/heidelpay/php-payment-api/lib/PushMapping/PushMappingInterface.php b/vendor/heidelpay/php-payment-api/lib/PushMapping/PushMappingInterface.php index 169b7ef..65ee6f0 100644 --- a/vendor/heidelpay/php-payment-api/lib/PushMapping/PushMappingInterface.php +++ b/vendor/heidelpay/php-payment-api/lib/PushMapping/PushMappingInterface.php @@ -14,9 +14,7 @@ * * @author Stephano Vogel * - * @package heidelpay - * @subpackage php-api - * @category php-api + * @package heidelpay\php-payment-api\push-mapping */ interface PushMappingInterface { diff --git a/vendor/heidelpay/php-payment-api/lib/PushMapping/Transaction.php b/vendor/heidelpay/php-payment-api/lib/PushMapping/Transaction.php index 9eb0786..420c236 100644 --- a/vendor/heidelpay/php-payment-api/lib/PushMapping/Transaction.php +++ b/vendor/heidelpay/php-payment-api/lib/PushMapping/Transaction.php @@ -3,7 +3,7 @@ namespace Heidelpay\PhpPaymentApi\PushMapping; /** - * XML Push Mapping Class for Transaction Parameter Group + * XML Push Mapping Class for the Transaction Parameter Group * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. @@ -12,17 +12,21 @@ * * @author Stephano Vogel * - * @package heidelpay - * @subpackage php-api - * @category php-api + * @package heidelpay\php-payment-api\push-mapping */ class Transaction extends AbstractPushMapper { + /** + * @inheritdoc + */ public $properties = [ 'channel' => 'channel', 'mode' => 'mode', ]; + /** + * @inheritdoc + */ public function getXmlObjectProperty(\SimpleXMLElement $xmlElement, $property) { if (isset($xmlElement->Transaction[$property])) { diff --git a/vendor/heidelpay/php-payment-api/lib/Request.php b/vendor/heidelpay/php-payment-api/lib/Request.php index 8e8de96..8ea2b7b 100644 --- a/vendor/heidelpay/php-payment-api/lib/Request.php +++ b/vendor/heidelpay/php-payment-api/lib/Request.php @@ -15,9 +15,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api */ class Request extends AbstractMethod { @@ -39,10 +37,10 @@ public function __construct() /** * Set all necessary authentication parameters for this request * - * @param string $securitySender security sender parameter f.e 31HA07BC8142C5A171745D00AD63D182 - * @param string $userLogin user login parameter f.e. 31ha07bc8142c5a171744e5aef11ffd3 - * @param string $userPassword user password f.e. 93167DE7 - * @param string $transactionChannel channel id of the payment method f.e. 31HA07BC8142C5A171744F3D6D155865 + * @param string $securitySender security sender parameter, e.g. 31HA07BC8142C5A171745D00AD63D182 + * @param string $userLogin user login parameter, e.g. 31ha07bc8142c5a171744e5aef11ffd3 + * @param string $userPassword user password, e.g. 93167DE7 + * @param string $transactionChannel channel id of the payment method, e.g. 31HA07BC8142C5A171744F3D6D155865 * @param bool $sandboxRequest choose between sandbox and productive payment system * * @return \Heidelpay\PhpPaymentApi\Request @@ -58,10 +56,10 @@ public function authentification( $this->getUser()->setLogin($userLogin); $this->getUser()->setPassword($userPassword); $this->getTransaction()->setChannel($transactionChannel); - $this->getTransaction()->setMode("LIVE"); + $this->getTransaction()->setMode('LIVE'); if ($sandboxRequest) { - $this->getTransaction()->setMode("CONNECTOR_TEST"); + $this->getTransaction()->setMode('CONNECTOR_TEST'); } return $this; } @@ -69,12 +67,12 @@ public function authentification( /** * Set all necessary parameter for a asynchronous request * - * @param string $languageCode language code 2 letters for error messages and iframe f.e EN - * @param string $responseUrl response url of your application f.e https://www.url.com/response.php + * @param string $languageCode language code 2 letters for error messages and iframe, e.g. EN + * @param string $responseUrl response url of your application, e.g. https://www.url.com/response.php * * @return \Heidelpay\PhpPaymentApi\Request */ - public function async($languageCode = "EN", $responseUrl = null) + public function async($languageCode = 'EN', $responseUrl = null) { $this->getFrontend()->setLanguage($languageCode); @@ -88,16 +86,16 @@ public function async($languageCode = "EN", $responseUrl = null) /** * Set all necessary customer parameter for a request * - * @param string $nameGiven customer given name f.e. John - * @param string $nameFamily customer family name f.e. Doe - * @param string $nameCompany company name f.e. Heidelpay - * @param string $shopperId customer id in your application f.e. 1249 - * @param string $addressStreet address street of the customer f.e. Vagerowstr. - * @param string $addressState address state ot the customer f.e Bayern - * @param string $addressZip address zip code f.e. 69115 - * @param string $addressCity address city f.e. Heidelberg - * @param string $addressCountry address country code 2 letters f.e. DE - * @param string $contactMail email adress of the customer f.e. ab@mail.de + * @param string $nameGiven customer given name, e.g. John + * @param string $nameFamily customer family name, e.g. Doe + * @param string $nameCompany company name, e.g. Heidelpay + * @param string $shopperId customer id in your application, e.g. 1249 + * @param string $addressStreet address street of the customer, e.g. Vagerowstr. + * @param string $addressState address state ot the customer, e.g. Bayern + * @param string $addressZip address zip code, e.g. 69115 + * @param string $addressCity address city, e.g. Heidelberg + * @param string $addressCountry address country code 2 letters, e.g. DE + * @param string $contactMail email adress of the customer, e.g. ab@mail.de * * @return \Heidelpay\PhpPaymentApi\Request */ @@ -130,9 +128,9 @@ public function customerAddress( /** * Set all basket or order information * - * @param string $shopIdentifier id of your application f.e. order-125454 - * @param string $amount amount of the current basket f.e. 20.12 - * @param string $currency currency code 3 letters f.e. USD + * @param string $shopIdentifier id of your application, e.g. order-125454 + * @param string $amount amount of the current basket, e.g. 20.12 + * @param string $currency currency code 3 letters, e.g. USD * @param string $secret a secret to prevent your application against fake responses * * @return \Heidelpay\PhpPaymentApi\Request @@ -142,7 +140,7 @@ public function basketData($shopIdentifier = null, $amount = null, $currency = n $this->getIdentification()->setTransactionid($shopIdentifier); $this->getPresentation()->setAmount($amount); $this->getPresentation()->setCurrency($currency); - if ($secret !== null and $shopIdentifier !== null) { + if ($secret !== null && $shopIdentifier !== null) { $this->getCriterion()->setSecret($shopIdentifier, $secret); } @@ -153,25 +151,12 @@ public function basketData($shopIdentifier = null, $amount = null, $currency = n * Convert request object to post key value format * * @return array request + * + * @deprecated v1.3.1 replaced by toArray() in AbstractMethod */ public function convertToArray() { - $array = array(); - $request = (array)get_object_vars($this); - - foreach ($request as $parameterFirstName => $parmaterValues) { - if ($parmaterValues === null) { - continue; - } - - foreach ((array)get_object_vars($parmaterValues) as $parameterLastName => $parameterValue) { - if ($parameterValue === null) { - continue; - } - $array[strtoupper($parameterFirstName . '.' . $parameterLastName)] = $parameterValue; - } - } - return $array; + return $this->toArray(); } /** @@ -197,11 +182,11 @@ public function send($uri = null, $post = null, $adapter = null) /** * Parameter used in case of b2c secured invoice or direct debit * - * @param null $salutation customer salutation MR/MRS (Mandatory) - * @param null $birthdate customer birth date YYYY-MM-DD (Mandatory) - * @param null $basketId id of a given basket using heidelpay basket api (Optional) + * @param string $salutation customer salutation MR/MRS (Mandatory) + * @param string $birthdate customer birth date YYYY-MM-DD (Mandatory) + * @param string $basketId id of a given basket using heidelpay basket api (Optional) * - * @return $this \Heidelpay\PhpPaymentApi\Request + * @return \Heidelpay\PhpPaymentApi\Request */ public function b2cSecured($salutation = null, $birthdate = null, $basketId = null) { diff --git a/vendor/heidelpay/php-payment-api/lib/Response.php b/vendor/heidelpay/php-payment-api/lib/Response.php index d30bb71..da52530 100644 --- a/vendor/heidelpay/php-payment-api/lib/Response.php +++ b/vendor/heidelpay/php-payment-api/lib/Response.php @@ -2,6 +2,9 @@ namespace Heidelpay\PhpPaymentApi; +use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; +use Heidelpay\PhpPaymentApi\Constants\ProcessingResult; +use Heidelpay\PhpPaymentApi\Constants\StatusCode; use Heidelpay\PhpPaymentApi\Exceptions\HashVerificationException; use Heidelpay\PhpPaymentApi\Exceptions\PaymentFormUrlException; use Heidelpay\PhpPaymentApi\ParameterGroups\ConnectorParameterGroup; @@ -17,9 +20,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api */ class Response extends AbstractMethod { @@ -28,14 +29,14 @@ class Response extends AbstractMethod * * @var \Heidelpay\PhpPaymentApi\ParameterGroups\ConnectorParameterGroup */ - protected $connector = null; + protected $connector; /** * ProcessingParameterGroup * * @var \Heidelpay\PhpPaymentApi\ParameterGroups\ProcessingParameterGroup */ - protected $processing = null; + protected $processing; /** * The constructor will take a given response in post format and convert @@ -45,8 +46,8 @@ class Response extends AbstractMethod */ public function __construct($rawResponse = null) { - if ($rawResponse !== null and is_array($rawResponse)) { - $this->splitArray($rawResponse); + if ($rawResponse !== null && is_array($rawResponse)) { + $this->mapFromPost($rawResponse); } } @@ -84,71 +85,12 @@ public function getConnector() * @param array $rawResponse * * @return \Heidelpay\PhpPaymentApi\Response + * + * @deprecated 1.3.0 Response::fromPost should be used to create an instance with POST parameters. */ public function splitArray($rawResponse) { - foreach ($rawResponse as $arrayKey => $arrayValue) { - $responseGroup = explode('_', strtolower($arrayKey), 2); - - if (is_array($responseGroup)) { - switch ($responseGroup[0]) { - case 'address': - $this->getAddress()->set($responseGroup[1], $arrayValue); - break; - case 'account': - $this->getAccount()->set($responseGroup[1], $arrayValue); - break; - case 'basket': - $this->getBasket()->set($responseGroup[1], $arrayValue); - break; - case 'criterion': - $this->getCriterion()->set($responseGroup[1], $arrayValue); - break; - case 'config': - $this->getConfig()->set($responseGroup[1], $arrayValue); - break; - case 'contact': - $this->getContact()->set($responseGroup[1], $arrayValue); - break; - case 'connector': - $this->getConnector()->set($responseGroup[1], $arrayValue); - break; - case "frontend": - $this->getFrontend()->set($responseGroup[1], $arrayValue); - break; - case "identification": - $this->getIdentification()->set($responseGroup[1], $arrayValue); - break; - case "name": - $this->getName()->set($responseGroup[1], $arrayValue); - break; - case "payment": - $this->getPayment()->set($responseGroup[1], $arrayValue); - break; - case "presentation": - $this->getPresentation()->set($responseGroup[1], $arrayValue); - break; - case "processing": - $this->getProcessing()->set($responseGroup[1], $arrayValue); - break; - case "request": - $this->getRequest()->set($responseGroup[1], $arrayValue); - break; - case "riskinformation": - $this->getRequest()->set($responseGroup[1], $arrayValue); - break; - case "security": - $this->getSecurity()->set($responseGroup[1], $arrayValue); - break; - case "transaction": - $this->getTransaction()->set($responseGroup[1], $arrayValue); - break; - case "user": - $this->getUser()->set($responseGroup[1], $arrayValue); - break; - } - } - } + $this->mapFromPost($rawResponse); return $this; } @@ -159,10 +101,7 @@ public function splitArray($rawResponse) */ public function isSuccess() { - if ($this->getProcessing()->getResult() === 'ACK') { - return true; - } - return false; + return $this->getProcessing()->getResult() === ProcessingResult::ACK; } /** @@ -172,10 +111,7 @@ public function isSuccess() */ public function isPending() { - if ($this->getProcessing()->getStatusCode() === '80') { - return true; - } - return false; + return $this->getProcessing()->getStatusCode() === StatusCode::WAITING; } /** @@ -185,10 +121,7 @@ public function isPending() */ public function isError() { - if ($this->getProcessing()->getResult() === 'ACK') { - return false; - } - return true; + return $this->getProcessing()->getResult() !== ProcessingResult::ACK; } /** @@ -233,14 +166,14 @@ public function getPaymentFormUrl() $type = null; if ($this->getPayment()->getCode() === null) { - throw new PaymentFormUrlException('PaymentCode not set'); + throw new PaymentFormUrlException('The PaymentCode is not set.'); } list($code, $type) = explode('.', $this->getPayment()->getCode()); - if (($code == 'CC' or $code == 'DC') - and $this->getIdentification()->getReferenceId() === null - and $this->getFrontend()->getPaymentFrameUrl() !== null + if (($code === PaymentMethod::CREDIT_CARD || $code === PaymentMethod::DEBIT_CARD) + && $this->getIdentification()->getReferenceId() === null + && $this->getFrontend()->getPaymentFrameUrl() !== null ) { return $this->getFrontend()->getPaymentFrameUrl(); } @@ -266,14 +199,17 @@ public function getPaymentFormUrl() * @param string $secret your application's secret hash * @param string $identificationTransactionId basket or order reference id * - * @throws \Exception + * @throws HashVerificationException * * @return boolean */ public function verifySecurityHash($secret = null, $identificationTransactionId = null) { - if ($secret === null or $identificationTransactionId === null) { - throw new HashVerificationException('$secret or $identificationTransactionId undefined'); + if ($secret === null || $identificationTransactionId === null) { + throw new HashVerificationException( + 'verifySecurityHash() - $secret or $identificationTransactionId undefined. ' + . 'Do not call the Response script directly, it is meant to be called by the heidelpay system.' + ); } if ($this->getProcessing()->getResult() === null) { @@ -290,12 +226,12 @@ public function verifySecurityHash($secret = null, $identificationTransactionId $referenceHash = hash('sha512', $identificationTransactionId . $secret); - if ($referenceHash === (string)$this->getCriterion()->getSecretHash()) { + if ($referenceHash === $this->getCriterion()->getSecretHash()) { return true; } throw new HashVerificationException( - 'Hash does not match. This could be some kind of manipulation or misconfiguration!' + 'Hashes do not match. This could be some kind of manipulation or misconfiguration!' ); } } diff --git a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/AuthorizeOnRegistrationTransactionType.php b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/AuthorizeOnRegistrationTransactionType.php index ad43529..3cb7809 100644 --- a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/AuthorizeOnRegistrationTransactionType.php +++ b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/AuthorizeOnRegistrationTransactionType.php @@ -2,10 +2,12 @@ namespace Heidelpay\PhpPaymentApi\TransactionTypes; +use Heidelpay\PhpPaymentApi\Constants\TransactionType; + /** * Transaction type authorisation on registration * - * This payment type will be used to make an authorisation on a given registration. + * This payment type will be used to make an authorisation on a given registration. * * @license Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. @@ -14,25 +16,24 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\transaction-types */ trait AuthorizeOnRegistrationTransactionType { /** * Payment type authorisation on registration - * * This payment type will be used to make an authorisation on a given registration. * - * @param string $PaymentReferenceId (unique id of the registration) + * @param string $paymentReferenceId (unique id of the registration) + * + * @return $this * - * @return \Heidelpay\PhpPaymentApi\PaymentMethods\AbstractPaymentMethod + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ - public function authorizeOnRegistration($PaymentReferenceId) + public function authorizeOnRegistration($paymentReferenceId) { - $this->getRequest()->getPayment()->set('code', $this->_paymentCode . ".PA"); - $this->getRequest()->getIdentification()->set('referenceId', $PaymentReferenceId); + $this->getRequest()->getPayment()->setCode($this->getPaymentCode() . '.' . TransactionType::RESERVATION); + $this->getRequest()->getIdentification()->setReferenceId($paymentReferenceId); $this->prepareRequest(); return $this; diff --git a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/AuthorizeTransactionType.php b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/AuthorizeTransactionType.php index cf74043..737a689 100644 --- a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/AuthorizeTransactionType.php +++ b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/AuthorizeTransactionType.php @@ -2,6 +2,8 @@ namespace Heidelpay\PhpPaymentApi\TransactionTypes; +use Heidelpay\PhpPaymentApi\Constants\TransactionType; + /** * Transaction type authorize * @@ -17,9 +19,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\transaction-types */ trait AuthorizeTransactionType { @@ -31,11 +31,13 @@ trait AuthorizeTransactionType * like Sofort and Giropay (so called online payments) this type will be * used just to get the redirect to their systems. * - * @return \Heidelpay\PhpPaymentApi\PaymentMethods\AbstractPaymentMethod + * @return $this + * + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ public function authorize() { - $this->getRequest()->getPayment()->set('code', $this->_paymentCode . ".PA"); + $this->getRequest()->getPayment()->setCode($this->getPaymentCode() . '.' . TransactionType::RESERVATION); $this->prepareRequest(); return $this; diff --git a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/CaptureTransactionType.php b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/CaptureTransactionType.php index f7a3932..21e9db8 100644 --- a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/CaptureTransactionType.php +++ b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/CaptureTransactionType.php @@ -2,6 +2,8 @@ namespace Heidelpay\PhpPaymentApi\TransactionTypes; +use Heidelpay\PhpPaymentApi\Constants\TransactionType; + /** * Transaction type capture * @@ -14,9 +16,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\transaction-types */ trait CaptureTransactionType { @@ -25,15 +25,17 @@ trait CaptureTransactionType * * You can charge a given authorisation by capturing the transaction. * - * @param string $PaymentReferenceId ( unique id of the authorisation ) + * @param string $paymentReferenceId (unique id of the authorisation) + * + * @return $this * - * @return \Heidelpay\PhpPaymentApi\PaymentMethods\AbstractPaymentMethod + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ - public function capture($PaymentReferenceId) + public function capture($paymentReferenceId) { - $this->getRequest()->getPayment()->set('code', $this->_paymentCode . ".CP"); - $this->getRequest()->getFrontend()->set('enabled', 'FALSE'); - $this->getRequest()->getIdentification()->set('referenceId', $PaymentReferenceId); + $this->getRequest()->getPayment()->setCode($this->getPaymentCode() . '.' . TransactionType::CAPTURE); + $this->getRequest()->getFrontend()->setEnabled('FALSE'); + $this->getRequest()->getIdentification()->setReferenceId($paymentReferenceId); $this->prepareRequest(); return $this; diff --git a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/DebitOnRegistrationTransactionType.php b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/DebitOnRegistrationTransactionType.php index 97737e9..5c311fe 100644 --- a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/DebitOnRegistrationTransactionType.php +++ b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/DebitOnRegistrationTransactionType.php @@ -2,6 +2,8 @@ namespace Heidelpay\PhpPaymentApi\TransactionTypes; +use Heidelpay\PhpPaymentApi\Constants\TransactionType; + /** * Transaction type debit on registration * @@ -15,9 +17,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\transaction-types */ trait DebitOnRegistrationTransactionType { @@ -27,14 +27,16 @@ trait DebitOnRegistrationTransactionType * This payment type will charge the given account directly. The debit is * related to a registration. * - * @param string $PaymentReferenceId ( unique id of the registration + * @param string $paymentReferenceId ( unique id of the registration + * + * @return $this * - * @return \Heidelpay\PhpPaymentApi\PaymentMethods\AbstractPaymentMethod|boolean + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ - public function debitOnRegistration($PaymentReferenceId) + public function debitOnRegistration($paymentReferenceId) { - $this->getRequest()->getPayment()->set('code', $this->_paymentCode . ".DB"); - $this->getRequest()->getIdentification()->set('referenceId', $PaymentReferenceId); + $this->getRequest()->getPayment()->setCode($this->getPaymentCode() . '.' . TransactionType::DEBIT); + $this->getRequest()->getIdentification()->setReferenceId($paymentReferenceId); $this->prepareRequest(); return $this; diff --git a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/DebitTransactionType.php b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/DebitTransactionType.php index 22f7f4e..39fbd34 100644 --- a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/DebitTransactionType.php +++ b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/DebitTransactionType.php @@ -2,6 +2,8 @@ namespace Heidelpay\PhpPaymentApi\TransactionTypes; +use Heidelpay\PhpPaymentApi\Constants\TransactionType; + /** * Transaction type debit * @@ -14,9 +16,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\transaction-types */ trait DebitTransactionType { @@ -25,11 +25,13 @@ trait DebitTransactionType * * This payment type will charge the given account directly. * - * @return \Heidelpay\PhpPaymentApi\PaymentMethods\AbstractPaymentMethod + * @return $this + * + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ public function debit() { - $this->getRequest()->getPayment()->set('code', $this->_paymentCode . ".DB"); + $this->getRequest()->getPayment()->setCode($this->getPaymentCode() . '.' . TransactionType::DEBIT); $this->prepareRequest(); return $this; diff --git a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/FinalizeTransactionType.php b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/FinalizeTransactionType.php index f605592..951073c 100644 --- a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/FinalizeTransactionType.php +++ b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/FinalizeTransactionType.php @@ -2,6 +2,8 @@ namespace Heidelpay\PhpPaymentApi\TransactionTypes; +use Heidelpay\PhpPaymentApi\Constants\TransactionType; + /** * Transaction type finalize * @@ -15,9 +17,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\transaction-types */ trait FinalizeTransactionType { @@ -27,15 +27,17 @@ trait FinalizeTransactionType * This payment type will be used to inform heidelpay about goods ship out. * Necessary for secured direct debit,secured invoice and Santander. * - * @param mixed $PaymentReferenceId reference id ( uniqe id of the debit or capture) + * @param string $paymentReferenceId reference id (uniqe id of the debit or capture) + * + * @return $this * - * @return \Heidelpay\PhpPaymentApi\PaymentMethods\AbstractPaymentMethod + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ - public function finalize($PaymentReferenceId) + public function finalize($paymentReferenceId) { - $this->getRequest()->getPayment()->set('code', $this->_paymentCode . ".FI"); - $this->getRequest()->getFrontend()->set('enabled', 'FALSE'); - $this->getRequest()->getIdentification()->set('referenceId', $PaymentReferenceId); + $this->getRequest()->getPayment()->setCode($this->getPaymentCode() . '.' . TransactionType::FINALIZE); + $this->getRequest()->getFrontend()->setEnabled('FALSE'); + $this->getRequest()->getIdentification()->setReferenceId($paymentReferenceId); $this->prepareRequest(); return $this; diff --git a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/InitializeTransactionType.php b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/InitializeTransactionType.php index 30b2d5e..dcac08f 100644 --- a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/InitializeTransactionType.php +++ b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/InitializeTransactionType.php @@ -2,6 +2,8 @@ namespace Heidelpay\PhpPaymentApi\TransactionTypes; +use Heidelpay\PhpPaymentApi\Constants\TransactionType; + /** * Trait for the Initialize transaction type * @@ -10,22 +12,25 @@ * * @link https://dev.heidelpay.de/php-api * - * @author Stephano Vogel + * @author Stephano Vogel * - * @package heidelpay/php-api/transactiontypes/initialize + * @package heidelpay\php-payment-api\transaction-types */ trait InitializeTransactionType { /** * Initialize Payment Request + * * The initialize request is for payment methods like wallet and hire purchase. * It initializes the request for the certain payment. * * @return $this + * + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ public function initialize() { - $this->getRequest()->getPayment()->set('code', $this->_paymentCode . ".IN"); + $this->getRequest()->getPayment()->setCode($this->getPaymentCode() . '.' . TransactionType::INITIALIZE); $this->prepareRequest(); return $this; diff --git a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/RebillTransactionType.php b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/RebillTransactionType.php index 9ea753d..92fb5ac 100644 --- a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/RebillTransactionType.php +++ b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/RebillTransactionType.php @@ -2,6 +2,8 @@ namespace Heidelpay\PhpPaymentApi\TransactionTypes; +use Heidelpay\PhpPaymentApi\Constants\TransactionType; + /** * Transaction type rebill * @@ -16,9 +18,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\transaction-types */ trait RebillTransactionType { @@ -29,15 +29,17 @@ trait RebillTransactionType * example, in case of a higher shipping cost. Please make sure that you * have the permission of your customer to charge again. * - * @param string $PaymentReferenceId ( unique id of the debit or capture ) + * @param string $paymentReferenceId (unique id of the debit or capture) + * + * @return $this * - * @return \Heidelpay\PhpPaymentApi\PaymentMethods\AbstractPaymentMethod|boolean + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ - public function rebill($PaymentReferenceId) + public function rebill($paymentReferenceId) { - $this->getRequest()->getPayment()->set('code', $this->_paymentCode . ".RB"); - $this->getRequest()->getFrontend()->set('enabled', 'FALSE'); - $this->getRequest()->getIdentification()->set('referenceId', $PaymentReferenceId); + $this->getRequest()->getPayment()->setCode($this->getPaymentCode() . '.' . TransactionType::REBILL); + $this->getRequest()->getFrontend()->setEnabled('FALSE'); + $this->getRequest()->getIdentification()->setReferenceId($paymentReferenceId); $this->prepareRequest(); return $this; diff --git a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/RefundTransactionType.php b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/RefundTransactionType.php index c9ed2ef..f81def6 100644 --- a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/RefundTransactionType.php +++ b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/RefundTransactionType.php @@ -2,6 +2,8 @@ namespace Heidelpay\PhpPaymentApi\TransactionTypes; +use Heidelpay\PhpPaymentApi\Constants\TransactionType; + /** * Transaction type refund * @@ -15,9 +17,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\transaction-types */ trait RefundTransactionType { @@ -27,15 +27,17 @@ trait RefundTransactionType * This payment type will be used to give a charge amount or even parts of * it back to the given account. * - * @param mixed $PaymentReferenceId payment reference id ( uniqe id of the debit or capture) + * @param mixed $paymentReferenceId payment reference id (unique id of the debit or capture) + * + * @return $this * - * @return \Heidelpay\PhpPaymentApi\PaymentMethods\AbstractPaymentMethod + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ - public function refund($PaymentReferenceId) + public function refund($paymentReferenceId) { - $this->getRequest()->getPayment()->set('code', $this->_paymentCode . ".RF"); - $this->getRequest()->getFrontend()->set('enabled', 'FALSE'); - $this->getRequest()->getIdentification()->set('referenceId', $PaymentReferenceId); + $this->getRequest()->getPayment()->setCode($this->getPaymentCode() . '.' . TransactionType::REFUND); + $this->getRequest()->getFrontend()->setEnabled('FALSE'); + $this->getRequest()->getIdentification()->setReferenceId($paymentReferenceId); $this->prepareRequest(); return $this; diff --git a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/RegistrationTransactionType.php b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/RegistrationTransactionType.php index 10aff49..b037b23 100644 --- a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/RegistrationTransactionType.php +++ b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/RegistrationTransactionType.php @@ -2,6 +2,8 @@ namespace Heidelpay\PhpPaymentApi\TransactionTypes; +use Heidelpay\PhpPaymentApi\Constants\TransactionType; + /** * Transaction type registration * @@ -16,9 +18,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\transaction-types */ trait RegistrationTransactionType { @@ -29,11 +29,13 @@ trait RegistrationTransactionType * system. You will get back a payment reference id. This gives you a way * to charge this account later or even to make a recurring payment. * - * @return \Heidelpay\PhpPaymentApi\PaymentMethods\AbstractPaymentMethod + * @return $this + * + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ public function registration() { - $this->getRequest()->getPayment()->set('code', $this->_paymentCode . ".RG"); + $this->getRequest()->getPayment()->setCode($this->getPaymentCode() . '.' . TransactionType::REGISTRATION); $this->prepareRequest(); return $this; diff --git a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/ReregistrationTransactionType.php b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/ReregistrationTransactionType.php new file mode 100644 index 0000000..18138d0 --- /dev/null +++ b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/ReregistrationTransactionType.php @@ -0,0 +1,44 @@ +getRequest()->getPayment()->setCode($this->paymentCode . '.' . TransactionType::REREGISTRATION); + $this->getRequest()->getIdentification()->setReferenceId($referenceId); + $this->prepareRequest(); + + return $this; + } +} diff --git a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/ReversalTransactionType.php b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/ReversalTransactionType.php index 088a4c2..3b7151c 100644 --- a/vendor/heidelpay/php-payment-api/lib/TransactionTypes/ReversalTransactionType.php +++ b/vendor/heidelpay/php-payment-api/lib/TransactionTypes/ReversalTransactionType.php @@ -2,6 +2,8 @@ namespace Heidelpay\PhpPaymentApi\TransactionTypes; +use Heidelpay\PhpPaymentApi\Constants\TransactionType; + /** * Transaction type reversal * @@ -16,9 +18,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category PhpPaymentApi + * @package heidelpay\php-payment-api\transaction-types */ trait ReversalTransactionType { @@ -29,15 +29,17 @@ trait ReversalTransactionType * it back to the given account. This can be used to lower an amount on an * invoice for example. * - * @param mixed $PaymentReferenceId payment reference id ( unique id of the authorisation) + * @param mixed $paymentReferenceId payment reference id (unique id of the authorisation) + * + * @return $this * - * @return \Heidelpay\PhpPaymentApi\PaymentMethods\AbstractPaymentMethod + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ - public function reversal($PaymentReferenceId) + public function reversal($paymentReferenceId) { - $this->getRequest()->getPayment()->set('code', $this->_paymentCode . ".RV"); - $this->getRequest()->getFrontend()->set('enabled', 'FALSE'); - $this->getRequest()->getIdentification()->set('referenceId', $PaymentReferenceId); + $this->getRequest()->getPayment()->setCode($this->getPaymentCode() . '.' . TransactionType::REVERSAL); + $this->getRequest()->getFrontend()->setEnabled('FALSE'); + $this->getRequest()->getIdentification()->setReferenceId($paymentReferenceId); $this->prepareRequest(); return $this; diff --git a/vendor/heidelpay/php-payment-api/phpdoc.dist.xml b/vendor/heidelpay/php-payment-api/phpdoc.dist.xml index fb5572c..63fff08 100644 --- a/vendor/heidelpay/php-payment-api/phpdoc.dist.xml +++ b/vendor/heidelpay/php-payment-api/phpdoc.dist.xml @@ -10,6 +10,9 @@ . + tests/_data/* + tests/_output/* + tests/_support/* vendor/* diff --git a/vendor/heidelpay/php-payment-api/tests/Helper/BasePaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/Helper/BasePaymentMethodTest.php index d2796b1..9f9ec64 100644 --- a/vendor/heidelpay/php-payment-api/tests/Helper/BasePaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/Helper/BasePaymentMethodTest.php @@ -189,5 +189,20 @@ protected function success() $output->writeln(' success'); } + /** + * Print debug data to codecept console (codecept run integration --debug) + * Pass result data if send has been called manually. + * + * @param mixed $result + */ + protected function logDataToDebug($result = null) + { + $result = $result ?: $this->paymentObject->getResponseArray(); + codecept_debug("\nrequest: " . print_r($this->paymentObject->getRequest()->toArray(), 1)); + if (!empty($result)) { + codecept_debug('response: ' . print_r($result, 1)); + } + } + // } diff --git a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/CreditCardPaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/CreditCardPaymentMethodTest.php index e9c6a59..43e27e2 100644 --- a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/CreditCardPaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/CreditCardPaymentMethodTest.php @@ -29,9 +29,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\integration */ class CreditCardPaymentMethodTest extends BasePaymentMethodTest { @@ -44,6 +42,13 @@ class CreditCardPaymentMethodTest extends BasePaymentMethodTest */ protected $holder = 'Heidel Berger-Payment'; + /** + * Used to test reregistration + * + * @var string Account holder + */ + protected $holder2 = 'Payment Berger-Heidel'; + /** * Transaction currency * @@ -135,7 +140,7 @@ public function _before() $CreditCard->getRequest()->authentification(...$this->authentication->getAuthenticationArray()); $CreditCard->getRequest()->customerAddress(...$this->customerData->getCustomerDataArray()); $CreditCard->getRequest()->getCriterion()->set('TestValue', 'test'); - $CreditCard->_dryRun = true; + $CreditCard->dryRun = true; $this->paymentObject = $CreditCard; } @@ -148,10 +153,57 @@ public function _before() * Test case for credit cart registration without payment frame * * @return string payment reference id to the credit card registration + * * @group connectionTest * @test + * + * @throws \Exception */ public function registration() + { + $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); + $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); + + $this->paymentObject->registration('http://www.heidelpay.de', 'FALSE', 'http://www.heidelpay.de'); + + /* disable frontend (iframe) and submit the credit card information directly (only for testing) */ + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); + $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); + $this->paymentObject->getRequest()->getAccount()->setNumber($this->creditCartNumber); + $this->paymentObject->getRequest()->getAccount()->set('expiry_month', $this->creditCardExpiryMonth); + $this->paymentObject->getRequest()->getAccount()->set('expiry_year', $this->creditCardExpiryYear); + $this->paymentObject->getRequest()->getAccount()->setBrand($this->creditCardBrand); + $this->paymentObject->getRequest()->getAccount()->set('verification', $this->creditCardVerification); + + /* prepare request and send it to payment api */ + $request = $this->paymentObject->getRequest()->toArray(); + + /** @var Response $response */ + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + + $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); + $this->assertFalse($response->isPending(), 'registration is pending'); + $this->assertFalse($response->isError(), 'registration failed : ' . print_r($response->getError(), 1)); + + $this->logDataToDebug($result); + + return (string)$response->getPaymentReferenceId(); + } + + /** + * Test case for credit cart reregistration without payment frame + * + * @param null $referenceId + * + * @return string + * + * @throws \Exception + * @group connectionTest + * @depends registration + * @test + */ + public function reregistration($referenceId = null) { $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData( @@ -161,26 +213,28 @@ public function registration() $this->secret ); - $this->paymentObject->registration( + $this->paymentObject->reregistration( + $referenceId, 'http://www.heidelpay.de', 'FALSE', 'http://www.heidelpay.de' ); /* disable frontend (iframe) and submit the credit card information directly (only for testing) */ - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); - $this->paymentObject->getRequest()->getAccount()->set('holder', $this->holder); - $this->paymentObject->getRequest()->getAccount()->set('number', $this->creditCartNumber); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); + $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder2); + $this->paymentObject->getRequest()->getAccount()->setNumber($this->creditCartNumber); + $this->paymentObject->getRequest()->getAccount()->setBrand($this->creditCardBrand); $this->paymentObject->getRequest()->getAccount()->set('expiry_month', $this->creditCardExpiryMonth); $this->paymentObject->getRequest()->getAccount()->set('expiry_year', $this->creditCardExpiryYear); - $this->paymentObject->getRequest()->getAccount()->set('brand', $this->creditCardBrand); $this->paymentObject->getRequest()->getAccount()->set('verification', $this->creditCardVerification); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'registration is pending'); @@ -188,6 +242,8 @@ public function registration() $this->assertEquals('test', $response->getCriterion()->get('TestValue')); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -197,18 +253,21 @@ public function registration() * @param $referenceId string reference id of the credit card registration * * @return string payment reference id to the credit card debit transaction + * * @depends registration * @group connectionTest * @test + * + * @throws \Exception */ public function debitOnRegistration($referenceId = null) { $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); - $this->paymentObject->_dryRun = false; + $this->paymentObject->dryRun = false; - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); $this->paymentObject->debitOnRegistration((string)$referenceId); @@ -222,28 +281,32 @@ public function debitOnRegistration($referenceId = null) 'debit on registration failed : ' . print_r($this->paymentObject->getResponse()->getError(), 1) ); + $this->logDataToDebug(); + return (string)$this->paymentObject->getResponse()->getPaymentReferenceId(); } /** * Test case for credit card authorisation on a registration * - * @param string referenceId reference id of the credit card registration - * @param mixed $referenceId + * @param mixed $referenceId reference id of the credit card registration * * @return string payment reference id of the credit card authorisation + * * @depends registration * @group connectionTest * @test + * + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ public function authorizeOnRegistration($referenceId = null) { $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); - $this->paymentObject->_dryRun = false; + $this->paymentObject->dryRun = false; - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); $this->paymentObject->authorizeOnRegistration((string)$referenceId); @@ -257,6 +320,8 @@ public function authorizeOnRegistration($referenceId = null) 'authorized on registration failed : ' . print_r($this->paymentObject->getResponse()->getError(), 1) ); + $this->logDataToDebug(); + return (string)$this->paymentObject->getResponse()->getPaymentReferenceId(); } @@ -267,6 +332,8 @@ public function authorizeOnRegistration($referenceId = null) * @param mixed $referenceId * * @return string + * + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ public function capture($referenceId = null) { @@ -276,15 +343,18 @@ public function capture($referenceId = null) $this->paymentObject->capture((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'capture is pending'); $this->assertFalse($response->isError(), 'capture failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -294,9 +364,12 @@ public function capture($referenceId = null) * @param $referenceId string reference id of the credit card debit/capture to refund * * @return string payment reference id of the credit card refund transaction + * * @depends capture * @group connectionTest * @test + * + * @throws \Exception */ public function refund($referenceId = null) { @@ -306,9 +379,11 @@ public function refund($referenceId = null) $this->paymentObject->refund((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); + /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'authorize on registration is pending'); @@ -317,6 +392,8 @@ public function refund($referenceId = null) 'authorized on registration failed : ' . print_r($response->getError(), 1) ); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -324,8 +401,11 @@ public function refund($referenceId = null) * Test case for a single credit card debit transaction without payment frame * * @return string payment reference id for the credit card debit transaction + * * @group connectionTest * @test + * + * @throws \Exception */ public function debit() { @@ -335,23 +415,27 @@ public function debit() $this->paymentObject->debit('http://www.heidelpay.de', 'FALSE', 'http://www.heidelpay.de'); /* disable frontend (ifame) and submit the credit card information directly (only for testing) */ - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); - $this->paymentObject->getRequest()->getAccount()->set('holder', $this->holder); - $this->paymentObject->getRequest()->getAccount()->set('number', $this->creditCartNumber); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); + $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); + $this->paymentObject->getRequest()->getAccount()->setNumber($this->creditCartNumber); $this->paymentObject->getRequest()->getAccount()->set('expiry_month', $this->creditCardExpiryMonth); $this->paymentObject->getRequest()->getAccount()->set('expiry_year', $this->creditCardExpiryYear); - $this->paymentObject->getRequest()->getAccount()->set('brand', $this->creditCardBrand); + $this->paymentObject->getRequest()->getAccount()->setBrand($this->creditCardBrand); $this->paymentObject->getRequest()->getAccount()->set('verification', $this->creditCardVerification); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); + /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'debit is pending'); $this->assertFalse($response->isError(), 'debit failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -359,8 +443,11 @@ public function debit() * Test case for a single credit card authorisation without payment frame * * @return string payment reference id for the credit card authorize transaction + * * @group connectionTest * @test + * + * @throws \Exception */ public function authorize() { @@ -370,37 +457,41 @@ public function authorize() $this->paymentObject->authorize('http://www.heidelpay.de', 'FALSE', 'http://www.heidelpay.de'); /* disable frontend (ifame) and submit the credit card information directly (only for testing) */ - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); - $this->paymentObject->getRequest()->getAccount()->set('holder', $this->holder); - $this->paymentObject->getRequest()->getAccount()->set('number', $this->creditCartNumber); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); + $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); + $this->paymentObject->getRequest()->getAccount()->setNumber($this->creditCartNumber); $this->paymentObject->getRequest()->getAccount()->set('expiry_month', $this->creditCardExpiryMonth); $this->paymentObject->getRequest()->getAccount()->set('expiry_year', $this->creditCardExpiryYear); - $this->paymentObject->getRequest()->getAccount()->set('brand', $this->creditCardBrand); + $this->paymentObject->getRequest()->getAccount()->setBrand($this->creditCardBrand); $this->paymentObject->getRequest()->getAccount()->set('verification', $this->creditCardVerification); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); + /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'authorize is pending'); $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } /** - * Test case for a credit card reversal of a existing authorisation + * Test case for a credit card reversal of a existing authorization * - * @var string payment reference id of the credit card authorisation + * @param mixed $referenceId id of the credit card authorisation * * @return string payment reference id for the credit card reversal transaction + * + * @throws \Exception * @depends authorize * @group connectionTest * @test - * - * @param mixed $referenceId */ public function reversal($referenceId = null) { @@ -410,28 +501,32 @@ public function reversal($referenceId = null) $this->paymentObject->reversal((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); + /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'reversal is pending'); $this->assertFalse($response->isError(), 'reversal failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } /** * Test case for a credit card rebill of an existing debit or capture * - * @var string payment reference id of the credit card debit or capture + * @param mixed $referenceId id of the credit card debit or capture * * @return string payment reference id for the credit card rebill transaction + * + * @throws \Exception * @depends debit * @group connectionTest * @test - * - * @param mixed $referenceId */ public function rebill($referenceId = null) { @@ -441,14 +536,18 @@ public function rebill($referenceId = null) $this->paymentObject->rebill((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); + /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'reversal is pending'); $this->assertFalse($response->isError(), 'reversal failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } diff --git a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/DebitCardPaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/DebitCardPaymentMethodTest.php index 2289f0c..00b6678 100644 --- a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/DebitCardPaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/DebitCardPaymentMethodTest.php @@ -29,9 +29,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\integration */ class DebitCardPaymentMethodTest extends BasePaymentMethodTest { @@ -60,6 +58,13 @@ class DebitCardPaymentMethodTest extends BasePaymentMethodTest */ protected $holder = 'Heidel Berger-Payment'; + /** + * Used to test reregistration + * + * @var string Account holder + */ + protected $holder2 = 'Payment Berger-Heidel'; + /** * Debit card number * Do not use real debit card information for this test. For more details read the information @@ -130,7 +135,7 @@ public function _before() $DebitCard = new DebitCard(); $DebitCard->getRequest()->authentification(...$authentication); $DebitCard->getRequest()->customerAddress(...$customerDetails); - $DebitCard->_dryRun = true; + $DebitCard->dryRun = true; $this->paymentObject = $DebitCard; } @@ -139,8 +144,12 @@ public function _before() * Test case for debit cart registration without payment frame * * @return string payment reference id to the credit card registration + * * @group connectionTest + * * @test + * + * @throws \Exception */ public function registration() { @@ -150,52 +159,102 @@ public function registration() $this->paymentObject->registration('http://www.heidelpay.de', 'FALSE', 'http://www.heidelpay.de'); /* disable frontend (ifame) and submit the debit card information directly (only for testing) */ - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); - $this->paymentObject->getRequest()->getAccount()->set('holder', $this->holder); - $this->paymentObject->getRequest()->getAccount()->set('number', $this->creditCartNumber); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); + $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); + $this->paymentObject->getRequest()->getAccount()->setNumber($this->creditCartNumber); + $this->paymentObject->getRequest()->getAccount()->setBrand($this->creditCardBrand); $this->paymentObject->getRequest()->getAccount()->set('expiry_month', $this->creditCardExpiryMonth); $this->paymentObject->getRequest()->getAccount()->set('expiry_year', $this->creditCardExpiryYear); - $this->paymentObject->getRequest()->getAccount()->set('brand', $this->creditCardBrand); $this->paymentObject->getRequest()->getAccount()->set('verification', $this->creditCardVerification); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'registration is pending'); $this->assertFalse($response->isError(), 'registration failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } + /** + * Test case for debit cart reregistration without payment frame + * + * @depends registration + * @group connectionTest + * @test + * + * @param null $referenceId + * + * @throws \Exception + */ + public function reregistration($referenceId = null) + { + $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); + $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); + + $this->paymentObject->reregistration( + $referenceId, + 'http://www.heidelpay.de', + 'FALSE', + 'http://www.heidelpay.de' + ); + + /* disable frontend (ifame) and submit the debit card information directly (only for testing) */ + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); + $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder2); + $this->paymentObject->getRequest()->getAccount()->setNumber($this->creditCartNumber); + $this->paymentObject->getRequest()->getAccount()->setBrand($this->creditCardBrand); + $this->paymentObject->getRequest()->getAccount()->set('expiry_month', $this->creditCardExpiryMonth); + $this->paymentObject->getRequest()->getAccount()->set('expiry_year', $this->creditCardExpiryYear); + $this->paymentObject->getRequest()->getAccount()->set('verification', $this->creditCardVerification); + + /* prepare request and send it to payment api */ + $request = $this->paymentObject->getRequest()->toArray(); + /** @var Response $response */ + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + + $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); + $this->assertFalse($response->isPending(), 'registration is pending'); + $this->assertFalse($response->isError(), 'registration failed : ' . print_r($response->getError(), 1)); + + $this->logDataToDebug($result); + } + /** * Test case for a debit card debit on a registration * - * @var string reference id of the debit card registration + * @param mixed $referenceId id of the debit card registration * * @return string payment reference id to the debit card debit transaction + * + * @throws \Exception * @depends registration * @group connectionTest - * @test * - * @param mixed $referenceId + * @test */ public function debitOnRegistration($referenceId = null) { $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); $this->paymentObject->debitOnRegistration((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'debit on registration is pending'); @@ -204,6 +263,8 @@ public function debitOnRegistration($referenceId = null) 'debit on registration failed : ' . print_r($response->getError(), 1) ); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -213,23 +274,28 @@ public function debitOnRegistration($referenceId = null) * @param $referenceId string reference id of the debit card registration * * @return string payment reference id of the debit card authorisation + * * @depends registration * @group connectionTest + * * @test + * + * @throws \Exception */ public function authorizeOnRegistration($referenceId = null) { $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); $this->paymentObject->authorizeOnRegistration((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'authorize on registration is pending'); @@ -238,6 +304,8 @@ public function authorizeOnRegistration($referenceId = null) 'authorized on registration failed : ' . print_r($response->getError(), 1) ); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -248,6 +316,8 @@ public function authorizeOnRegistration($referenceId = null) * @param $referenceId string * * @return string + * + * @throws \Exception */ public function capture($referenceId = null) { @@ -257,14 +327,17 @@ public function capture($referenceId = null) $this->paymentObject->capture((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'capture is pending'); $this->assertFalse($response->isError(), 'capture failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -276,7 +349,10 @@ public function capture($referenceId = null) * @return string payment reference id of the debit card refund transaction * @depends capture * @test + * * @group connectionTest + * + * @throws \Exception */ public function refund($referenceId = null) { @@ -286,9 +362,10 @@ public function refund($referenceId = null) $this->paymentObject->refund((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'authorize on registration is pending'); @@ -297,6 +374,8 @@ public function refund($referenceId = null) 'authorized on registration failed : ' . print_r($response->getError(), 1) ); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -305,33 +384,40 @@ public function refund($referenceId = null) * * @return string payment reference id for the debit card debit transaction * @group connectionTest + * * @test + * + * @throws \Exception */ public function debit() { $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); + $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); $this->paymentObject->debit('http://www.heidelpay.de', 'FALSE', 'http://www.heidelpay.de'); /* disable frontend (ifame) and submit the credit card information directly (only for testing) */ - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); - $this->paymentObject->getRequest()->getAccount()->set('holder', $this->holder); - $this->paymentObject->getRequest()->getAccount()->set('number', $this->creditCartNumber); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); + $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); + $this->paymentObject->getRequest()->getAccount()->setNumber($this->creditCartNumber); $this->paymentObject->getRequest()->getAccount()->set('expiry_month', $this->creditCardExpiryMonth); $this->paymentObject->getRequest()->getAccount()->set('expiry_year', $this->creditCardExpiryYear); - $this->paymentObject->getRequest()->getAccount()->set('brand', $this->creditCardBrand); + $this->paymentObject->getRequest()->getAccount()->setBrand($this->creditCardBrand); $this->paymentObject->getRequest()->getAccount()->set('verification', $this->creditCardVerification); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'debit is pending'); $this->assertFalse($response->isError(), 'debit failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -340,7 +426,10 @@ public function debit() * * @return string payment reference id for the debit card authorize transaction * @group connectionTest + * * @test + * + * @throws \Exception */ public function authorize() { @@ -350,23 +439,26 @@ public function authorize() $this->paymentObject->authorize('http://www.heidelpay.de', 'FALSE', 'http://www.heidelpay.de'); /* disable frontend (ifame) and submit the credit card information directly (only for testing) */ - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); - $this->paymentObject->getRequest()->getAccount()->set('holder', $this->holder); - $this->paymentObject->getRequest()->getAccount()->set('number', $this->creditCartNumber); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); + $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); + $this->paymentObject->getRequest()->getAccount()->setNumber($this->creditCartNumber); + $this->paymentObject->getRequest()->getAccount()->setBrand($this->creditCardBrand); $this->paymentObject->getRequest()->getAccount()->set('expiry_month', $this->creditCardExpiryMonth); $this->paymentObject->getRequest()->getAccount()->set('expiry_year', $this->creditCardExpiryYear); - $this->paymentObject->getRequest()->getAccount()->set('brand', $this->creditCardBrand); $this->paymentObject->getRequest()->getAccount()->set('verification', $this->creditCardVerification); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'authorize is pending'); $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -378,7 +470,10 @@ public function authorize() * @return string payment reference id for the debit card reversal transaction * @depends authorize * @group connectionTest + * * @test + * + * @throws \Exception */ public function reversal($referenceId = null) { @@ -388,14 +483,17 @@ public function reversal($referenceId = null) $this->paymentObject->reversal((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'reversal is pending'); $this->assertFalse($response->isError(), 'reversal failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -407,7 +505,10 @@ public function reversal($referenceId = null) * @return string payment reference id for the debit card rebill transaction * @depends debit * @test + * * @group connectionTest + * + * @throws \Exception */ public function rebill($referenceId = null) { @@ -417,14 +518,18 @@ public function rebill($referenceId = null) $this->paymentObject->rebill((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); + /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'reversal is pending'); $this->assertFalse($response->isError(), 'reversal failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } } diff --git a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/DirectDebitB2CSecuredPaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/DirectDebitB2CSecuredPaymentMethodTest.php index a889344..b6ef36d 100644 --- a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/DirectDebitB2CSecuredPaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/DirectDebitB2CSecuredPaymentMethodTest.php @@ -19,9 +19,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\integration */ class DirectDebitB2CSecuredPaymentMethodTest extends BasePaymentMethodTest { @@ -39,6 +37,13 @@ class DirectDebitB2CSecuredPaymentMethodTest extends BasePaymentMethodTest */ protected $holder = 'Heidel Berger-Payment'; + /** + * Used to test reregistration + * + * @var string Account holder + */ + protected $holder2 = 'Payment Berger-Heidel'; + /** * Transaction currency * @@ -92,7 +97,7 @@ public function _before() $DirectDebitSecured->getRequest()->authentification(...$authentication); $DirectDebitSecured->getRequest()->customerAddress(...$customerDetails); $DirectDebitSecured->getRequest()->b2cSecured('MR', '1982-07-12'); - $DirectDebitSecured->_dryRun = true; + $DirectDebitSecured->dryRun = true; $this->paymentObject = $DirectDebitSecured; } @@ -102,28 +107,34 @@ public function _before() * * @return string payment reference id for the direct debit transaction * @group connectionTest + * * @test + * + * @throws \Exception */ public function authorize() { $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); $this->paymentObject->getRequest()->async('DE', 'https://dev.heidelpay.de'); - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); - $this->paymentObject->getRequest()->getAccount()->set('iban', $this->iban); - $this->paymentObject->getRequest()->getAccount()->set('holder', $this->holder); + $this->paymentObject->getRequest()->getAccount()->setIban($this->iban); + $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); $this->paymentObject->authorize(); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -136,6 +147,8 @@ public function authorize() * @param $referenceId string * * @return string + * + * @throws \Exception */ public function capture($referenceId = null) { @@ -145,14 +158,17 @@ public function capture($referenceId = null) $this->paymentObject->capture((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'capture is pending'); $this->assertFalse($response->isError(), 'capture failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -161,28 +177,34 @@ public function capture($referenceId = null) * * @return string payment reference id for the direct debit transaction * @group connectionTest + * * @test + * + * @throws \Exception */ public function debit() { $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 13.42, $this->currency, $this->secret); $this->paymentObject->getRequest()->async('DE', 'https://dev.heidelpay.de'); - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); - $this->paymentObject->getRequest()->getAccount()->set('iban', $this->iban); - $this->paymentObject->getRequest()->getAccount()->set('holder', $this->holder); + $this->paymentObject->getRequest()->getAccount()->setIban($this->iban); + $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); $this->paymentObject->debit(); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -194,7 +216,10 @@ public function debit() * @return string payment reference id of the direct debit refund transaction * @depends debit * @test + * * @group connectionTest + * + * @throws \Exception */ public function refund($referenceId = null) { @@ -204,9 +229,10 @@ public function refund($referenceId = null) $this->paymentObject->refund((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'authorize on registration is pending'); @@ -215,39 +241,83 @@ public function refund($referenceId = null) 'authorized on registration failed : ' . print_r($response->getError(), 1) ); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } /** - * Test case for a single direct debit debit + * Test case for a direct debit registration * * @return string payment reference id for the direct debit transaction * @group connectionTest + * * @test + * + * @throws \Exception */ public function registration() { $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 13.42, $this->currency, $this->secret); $this->paymentObject->getRequest()->async('DE', 'https://dev.heidelpay.de'); - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); - $this->paymentObject->getRequest()->getAccount()->set('iban', $this->iban); - $this->paymentObject->getRequest()->getAccount()->set('holder', $this->holder); + $this->paymentObject->getRequest()->getAccount()->setIban($this->iban); + $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); $this->paymentObject->registration(); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } + /** + * Test case for a direct debit reregistration + * + * @param null $referenceId + * + * @return string payment reference id for the direct debit transaction + * + * @throws \Exception + * @depends registration + * @group connectionTest + * + * @test + */ + public function reregistration($referenceId = null) + { + $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); + $this->paymentObject->getRequest()->basketData($timestamp, 13.42, $this->currency, $this->secret); + $this->paymentObject->getRequest()->async('DE', 'https://dev.heidelpay.de'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); + $this->paymentObject->getRequest()->getAccount()->setIban($this->iban); + $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder2); + + $this->paymentObject->reregistration($referenceId); + + /* prepare request and send it to payment api */ + $request = $this->paymentObject->getRequest()->toArray(); + /** @var Response $response */ + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + + $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); + $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); + + $this->logDataToDebug($result); + } + /** * Test case for a direct debit reversal of a existing authorisation * @@ -256,7 +326,10 @@ public function registration() * @return string payment reference id for the credit card reversal transaction * @depends authorize * @test + * * @group connectionTest + * + * @throws \Exception */ public function reversal($referenceId = null) { @@ -266,14 +339,17 @@ public function reversal($referenceId = null) $this->paymentObject->reversal((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'reversal is pending'); $this->assertFalse($response->isError(), 'reversal failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -285,25 +361,30 @@ public function reversal($referenceId = null) * @return string payment reference id for the direct debit rebill transaction * @depends debit * @test + * * @group connectionTest + * + * @throws \Exception */ public function rebill($referenceId = null) { $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 12.12, $this->currency, $this->secret); - $this->paymentObject->rebill((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'reversal is pending'); $this->assertFalse($response->isError(), 'reversal failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -315,21 +396,25 @@ public function rebill($referenceId = null) * @return string payment reference id of the direct debit authorisation * @depends registration * @test - * @group connectionTest + * + * @group connectionTest + * + * @throws \Exception */ public function authorizeOnRegistration($referenceId = null) { $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); $this->paymentObject->authorizeOnRegistration((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'authorize on registration is pending'); @@ -338,6 +423,8 @@ public function authorizeOnRegistration($referenceId = null) 'authorized on registration failed : ' . print_r($response->getError(), 1) ); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -349,21 +436,25 @@ public function authorizeOnRegistration($referenceId = null) * @return string payment reference id of the direct debit registration * @depends registration * @test - * @group connectionTest + * + * @group connectionTest + * + * @throws \Exception */ public function debitOnRegistration($referenceId = null) { $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); $this->paymentObject->debitOnRegistration((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'authorize on registration is pending'); @@ -372,6 +463,8 @@ public function debitOnRegistration($referenceId = null) 'authorized on registration failed : ' . print_r($response->getError(), 1) ); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -383,14 +476,17 @@ public function debitOnRegistration($referenceId = null) * @return string payment reference id for the prepayment reversal transaction * @depends authorizeOnRegistration * @group connectionTest + * * @test + * + * @throws \Exception */ public function finalize($referenceId) { $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 2.12, $this->currency, $this->secret); - $this->paymentObject->_dryRun = false; + $this->paymentObject->dryRun = false; $this->paymentObject->finalize($referenceId); @@ -408,6 +504,8 @@ public function finalize($referenceId) 'reversal failed : ' . print_r($this->paymentObject->getResponse()->getError(), 1) ); + $this->logDataToDebug(); + return (string)$this->paymentObject->getResponse()->getPaymentReferenceId(); } } diff --git a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/DirectDebitPaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/DirectDebitPaymentMethodTest.php index f521c91..3f80601 100644 --- a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/DirectDebitPaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/DirectDebitPaymentMethodTest.php @@ -20,9 +20,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\integration */ class DirectDebitPaymentMethodTest extends BasePaymentMethodTest { @@ -40,6 +38,13 @@ class DirectDebitPaymentMethodTest extends BasePaymentMethodTest */ protected $holder = 'Heidel Berger-Payment'; + /** + * Used to test reregistration + * + * @var string Account holder + */ + protected $holder2 = 'Payment Berger-Heidel'; + /** * Transaction currency * @@ -95,7 +100,7 @@ public function _before() $DirectDebit = new DirectDebit(); $DirectDebit->getRequest()->authentification(...$authentication); $DirectDebit->getRequest()->customerAddress(...$customerDetails); - $DirectDebit->_dryRun = true; + $DirectDebit->dryRun = true; $this->paymentObject = $DirectDebit; } @@ -114,18 +119,17 @@ public function authorize() $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); $this->paymentObject->getRequest()->async('DE', 'https://dev.heidelpay.de'); - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); $this->paymentObject->setAdapter(new CurlAdapter()); - $this->paymentObject->getRequest()->getAccount()->set('iban', $this->iban); - $this->paymentObject->getRequest()->getAccount()->set('holder', $this->holder); + $this->paymentObject->getRequest()->getAccount()->setIban($this->iban); + $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); - $this->paymentObject->_dryRun = false; + $this->paymentObject->dryRun = false; $this->paymentObject->authorize(); - $this->assertTrue( $this->paymentObject->getResponse()->isSuccess(), 'Transaction failed : ' . print_r($this->paymentObject->getResponse(), 1) @@ -135,6 +139,8 @@ public function authorize() 'authorize failed : ' . print_r($this->paymentObject->getResponse()->getError(), 1) ); + $this->logDataToDebug(); + return (string)$this->paymentObject->getResponse()->getPaymentReferenceId(); } @@ -158,14 +164,18 @@ public function capture($referenceId = null) $this->paymentObject->capture((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); + /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'capture is pending'); $this->assertFalse($response->isError(), 'capture failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -183,21 +193,25 @@ public function debit() $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 13.42, $this->currency, $this->secret); $this->paymentObject->getRequest()->async('DE', 'https://dev.heidelpay.de'); - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); - $this->paymentObject->getRequest()->getAccount()->set('iban', $this->iban); - $this->paymentObject->getRequest()->getAccount()->set('holder', $this->holder); + $this->paymentObject->getRequest()->getAccount()->setIban($this->iban); + $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); $this->paymentObject->debit(); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); + /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -221,9 +235,10 @@ public function refund($referenceId = null) $this->paymentObject->refund((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'authorize on registration is pending'); @@ -232,11 +247,13 @@ public function refund($referenceId = null) 'authorized on registration failed : ' . print_r($response->getError(), 1) ); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } /** - * Test case for a single direct debit debit + * Test case for a direct debit registration * * @return string payment reference id for the direct debit transaction * @group connectionTest @@ -249,24 +266,62 @@ public function registration() $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 13.42, $this->currency, $this->secret); $this->paymentObject->getRequest()->async('DE', 'https://dev.heidelpay.de'); - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); - $this->paymentObject->getRequest()->getAccount()->set('iban', $this->iban); - $this->paymentObject->getRequest()->getAccount()->set('holder', $this->holder); + $this->paymentObject->getRequest()->getAccount()->setIban($this->iban); + $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); $this->paymentObject->registration(); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } + /** + * Test case for a direct debit reregistration + * + * @param null $referenceId + * + * @return string payment reference id for the direct debit transaction + * + * @throws \Exception + * @group connectionTest + * @depends registration + * @test + */ + public function reregistration($referenceId = null) + { + $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); + $this->paymentObject->getRequest()->basketData($timestamp, 13.42, $this->currency, $this->secret); + $this->paymentObject->getRequest()->async('DE', 'https://dev.heidelpay.de'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); + $this->paymentObject->getRequest()->getAccount()->setIban($this->iban); + $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder2); + + $this->paymentObject->reregistration($referenceId); + + /* prepare request and send it to payment api */ + $request = $this->paymentObject->getRequest()->toArray(); + /** @var Response $response */ + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + + $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); + $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); + + $this->logDataToDebug($result); + } + /** * Test case for a direct debit reversal of a existing authorisation * @@ -287,14 +342,17 @@ public function reversal($referenceId = null) $this->paymentObject->reversal((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'reversal is pending'); $this->assertFalse($response->isError(), 'reversal failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -318,14 +376,17 @@ public function rebill($referenceId = null) $this->paymentObject->rebill((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'reversal is pending'); $this->assertFalse($response->isError(), 'reversal failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -346,14 +407,15 @@ public function authorizeOnRegistration($referenceId = null) $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); $this->paymentObject->authorizeOnRegistration((string)$referenceId); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response->getError(), 1)); $this->assertFalse($response->isPending(), 'authorize on registration is pending'); @@ -362,6 +424,8 @@ public function authorizeOnRegistration($referenceId = null) 'authorized on registration failed : ' . print_r($response->getError(), 1) ); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } } diff --git a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/EPSPaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/EPSPaymentMethodTest.php index af85066..8a6dcd4 100644 --- a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/EPSPaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/EPSPaymentMethodTest.php @@ -19,9 +19,7 @@ * * @author Ronja Wann * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\integration */ class EPSPaymentMethodTest extends BasePaymentMethodTest { @@ -80,7 +78,7 @@ public function _before() $EPS = new EPS(); $EPS->getRequest()->authentification(...$authentication); $EPS->getRequest()->customerAddress(...$customerDetails); - $EPS->_dryRun = true; + $EPS->dryRun = true; $this->paymentObject = $EPS; } @@ -90,6 +88,8 @@ public function _before() * * @return string payment reference id for the EPS authorize transaction * @group connectionTest + * + * @throws \Exception */ public function testAuthorize() { @@ -100,13 +100,16 @@ public function testAuthorize() $this->paymentObject->authorize(); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } } diff --git a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/EasyCreditPaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/EasyCreditPaymentMethodTest.php index 9d8e3c8..1f03603 100644 --- a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/EasyCreditPaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/EasyCreditPaymentMethodTest.php @@ -15,7 +15,7 @@ * * @author Stephano Vogel * - * @package heidelpay/php-api/tests/unit/paymentmethods/easycredit + * @package heidelpay\php-payment-api\tests\integration */ class EasyCreditPaymentMethodTest extends BasePaymentMethodTest { @@ -58,6 +58,8 @@ public function __construct() * Set up function will create a invoice object for each test case * * @see PHPUnit_Framework_TestCase::setUp() + * + * @throws \Exception */ // @codingStandardsIgnoreStart public function _before() @@ -71,7 +73,6 @@ public function _before() ->getAuthenticationArray(); $customerDetails = $this->customerData->getCustomerDataArray(); - $easyCredit = new EasyCreditPaymentMethod(); $easyCredit->getRequest()->authentification(...$authentication); @@ -95,6 +96,8 @@ public function _before() /** * @test + * + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ public function initialRequest() { @@ -107,5 +110,7 @@ public function initialRequest() // following fields are essential for easy credit, so they must not be null. $this->assertNotNull($response->getConfig()->optin_text, 'easyCredit Optin Text is null.'); $this->assertNotNull($response->getFrontend()->getRedirectUrl(), 'RedirectUrl is null.'); + + $this->logDataToDebug(); } } diff --git a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/GiropayPaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/GiropayPaymentMethodTest.php index defd8d1..895fe46 100644 --- a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/GiropayPaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/GiropayPaymentMethodTest.php @@ -19,9 +19,7 @@ * * @author Ronja Wann * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\integration */ class GiropayPaymentMethodTest extends BasePaymentMethodTest { @@ -78,7 +76,7 @@ public function _before() $giropay = new Giropay(); $giropay->getRequest()->authentification(...$authentication); $giropay->getRequest()->customerAddress(...$customerDetails); - $giropay->_dryRun = true; + $giropay->dryRun = true; $this->paymentObject = $giropay; } @@ -88,6 +86,8 @@ public function _before() * * @return string payment reference id for the Giropay authorize transaction * @group connectionTest + * + * @throws \Exception */ public function testAuthorize() { @@ -98,13 +98,16 @@ public function testAuthorize() $this->paymentObject->authorize(); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } } diff --git a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/IdealPaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/IdealPaymentMethodTest.php index 79d6d55..6090f9d 100644 --- a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/IdealPaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/IdealPaymentMethodTest.php @@ -19,9 +19,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\integration */ class IdealPaymentMethodTest extends BasePaymentMethodTest { @@ -78,7 +76,7 @@ public function _before() $iDeal = new iDeal(); $iDeal->getRequest()->authentification(...$authentication); $iDeal->getRequest()->customerAddress(...$customerDetails); - $iDeal->_dryRun = true; + $iDeal->dryRun = true; $this->paymentObject = $iDeal; } @@ -88,6 +86,8 @@ public function _before() * * @return string payment reference id for the iDeal authorize transaction * @group connectionTest + * + * @throws \Exception */ public function testAuthorize() { @@ -98,9 +98,10 @@ public function testAuthorize() $this->paymentObject->authorize(); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); /* test if config parameters exists */ $configBankCountry = array('NL' => 'Niederlande'); @@ -118,6 +119,8 @@ public function testAuthorize() $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } } diff --git a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/InvoiceB2CSecuredPaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/InvoiceB2CSecuredPaymentMethodTest.php index 603adcf..117eb23 100644 --- a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/InvoiceB2CSecuredPaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/InvoiceB2CSecuredPaymentMethodTest.php @@ -18,9 +18,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\integration */ class InvoiceB2CSecuredPaymentMethodTest extends BasePaymentMethodTest { @@ -98,13 +96,16 @@ public function _before() * * @return string payment reference id for the invoice authorize transaction * @group connectionTest + * * @test + * + * @throws \Exception */ public function authorize() { $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); $this->paymentObject->getRequest()->b2cSecured('MRS', '1982-07-12'); @@ -124,6 +125,8 @@ public function authorize() 'authorize failed : ' . print_r($this->paymentObject->getResponse()->getError(), 1) ); + $this->logDataToDebug(); + return $this->authorizeReference = (string)$this->paymentObject->getResponse()->getPaymentReferenceId(); } @@ -135,7 +138,10 @@ public function authorize() * @return string payment reference id for the prepayment reversal transaction * @depends authorize * @group connectionTest + * * @test + * + * @throws \Exception */ public function finalize($referenceId) { @@ -158,6 +164,8 @@ public function finalize($referenceId) 'reversal failed : ' . print_r($this->paymentObject->getResponse()->getError(), 1) ); + $this->logDataToDebug(); + return $referenceId; } @@ -169,7 +177,10 @@ public function finalize($referenceId) * @return string payment reference id for the prepayment reversal transaction * @depends authorize * @group connectionTest + * * @test + * + * @throws \Exception */ public function reversal($referenceId) { @@ -194,6 +205,8 @@ public function reversal($referenceId) 'reversal failed : ' . print_r($this->paymentObject->getResponse()->getError(), 1) ); + $this->logDataToDebug(); + return (string)$this->paymentObject->getResponse()->getPaymentReferenceId(); } @@ -202,10 +215,12 @@ public function reversal($referenceId) * * @param string $referenceId reference id of the invoice to refund * - * @return string payment reference id of the invoice refund transaction * @depends authorize * @test + * * @group connectionTest + * + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ public function refund($referenceId = null) { @@ -213,12 +228,13 @@ public function refund($referenceId = null) $this->paymentObject->getRequest()->basketData($timestamp, 3.54, $this->currency, $this->secret); /* the refund can not be processed because there will be no receipt automatically on the sandbox */ - $this->paymentObject->_dryRun = true; + $this->paymentObject->dryRun = true; $this->paymentObject->refund((string)$referenceId); $this->assertEquals('IV.RF', $this->paymentObject->getRequest()->getPayment()->getCode()); - return true; + + $this->logDataToDebug(); } // diff --git a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/InvoicePaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/InvoicePaymentMethodTest.php index 4be4b9b..d0c9edb 100644 --- a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/InvoicePaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/InvoicePaymentMethodTest.php @@ -18,9 +18,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\integration */ class InvoicePaymentMethodTest extends BasePaymentMethodTest { @@ -84,13 +82,16 @@ public function _before() * * @return string payment reference id for the invoice authorize transaction * @group connectionTest + * * @test + * + * @throws \Exception */ public function authorize() { $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); $this->paymentObject->authorize(); @@ -119,7 +120,10 @@ public function authorize() * @return string payment reference id for the prepayment reversal transaction * @depends authorize * @group connectionTest - * @test * + * + * @test + * + * @throws \Exception */ public function reversal($referenceId) { @@ -142,6 +146,8 @@ public function reversal($referenceId) 'reversal failed : ' . print_r($this->paymentObject->getResponse()->getError(), 1) ); + $this->logDataToDebug(); + return (string)$this->paymentObject->getResponse()->getPaymentReferenceId(); } @@ -153,7 +159,10 @@ public function reversal($referenceId) * @return string payment reference id of the invoice refund transaction * @depends authorize * @test + * * @group connectionTest + * + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ public function refund($referenceId = null) { @@ -161,11 +170,14 @@ public function refund($referenceId = null) $this->paymentObject->getRequest()->basketData($timestamp, 3.54, $this->currency, $this->secret); /* the refund can not be processed because there will be no receipt automatically on the sandbox */ - $this->paymentObject->_dryRun = true; + $this->paymentObject->dryRun = true; $this->paymentObject->refund((string)$referenceId); $this->assertEquals('IV.RF', $this->paymentObject->getRequest()->getPayment()->getCode()); + + $this->logDataToDebug(); + return true; } } diff --git a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PayPalPaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PayPalPaymentMethodTest.php index 30e57c5..cc853d4 100644 --- a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PayPalPaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PayPalPaymentMethodTest.php @@ -19,9 +19,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\integration */ class PayPalPaymentMethodTest extends BasePaymentMethodTest { @@ -80,18 +78,88 @@ public function _before() $PayPal = new PayPal(); $PayPal->getRequest()->authentification(...$authentication); $PayPal->getRequest()->customerAddress(...$customerDetails); - $PayPal->_dryRun = true; + $PayPal->dryRun = true; $this->paymentObject = $PayPal; } + /** + * Test case for a PayPal registration + * + * @return string payment reference id for the PayPal registration transaction + * @group connectionTest + * + * @throws \Exception + * @test + */ + public function registration() + { + $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); + $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); + $this->paymentObject->getRequest()->async('DE', 'https://dev.heidelpay.de'); + + $this->paymentObject->registration(); + + /* prepare request and send it to payment api */ + $request = $this->paymentObject->getRequest()->toArray(); + + /** @var Response $response */ + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + + $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); + $this->assertFalse($response->isError(), 'Transaction failed : ' . print_r($response->getError(), 1)); + + $this->logDataToDebug($result); + + return (string)$response->getPaymentReferenceId(); + } + + /** + * Test case for a PayPal reregistration + * + * @group connectionTest + * + * @param null $referenceId + * + * @throws \Exception + * @depends registration + * + * @test + */ + public function reregistration($referenceId = null) + { + $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); + $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); + $this->paymentObject->getRequest()->async('DE', 'https://dev.heidelpay.de'); + + $this->paymentObject->reregistration($referenceId); + + /* prepare request and send it to payment api */ + $request = $this->paymentObject->getRequest()->toArray(); + + /** @var Response $response */ + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + + $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); + $this->assertFalse($response->isError(), 'Transaction failed : ' . print_r($response->getError(), 1)); + + $this->logDataToDebug($result); + } + /** * Test case for a single PayPal authorisation * * @return string payment reference id for the PayPal authorize transaction * @group connectionTest + * + * @depends registration + * + * @throws \Exception + * @test */ - public function testAuthorize() + public function authorize() { $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); @@ -100,14 +168,16 @@ public function testAuthorize() $this->paymentObject->authorize(); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); + /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); - return (string)$response->getPaymentReferenceId(); + $this->logDataToDebug($result); } /** @@ -115,8 +185,13 @@ public function testAuthorize() * * @return string payment reference id for the PayPal authorize transaction * @group connectionTest + * + * @depends registration + * + * @throws \Exception + * @test */ - public function testDebit() + public function debit() { $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); @@ -125,13 +200,15 @@ public function testDebit() $this->paymentObject->debit(); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); + /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); $this->assertFalse($response->isError(), 'debit failed : ' . print_r($response->getError(), 1)); - return (string)$response->getPaymentReferenceId(); + $this->logDataToDebug($result); } } diff --git a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PayolutionInvoicePaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PayolutionInvoicePaymentMethodTest.php index 074c369..85696d9 100644 --- a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PayolutionInvoicePaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PayolutionInvoicePaymentMethodTest.php @@ -16,9 +16,7 @@ * * @author Simon Gabriel * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category IntegrationTest + * @package heidelpay\php-payment-api\tests\integration */ class PayolutionInvoicePaymentMethodTest extends BasePaymentMethodTest { @@ -89,6 +87,7 @@ public function _before() * * @return string payment reference id for the invoice authorize transaction * @group connectionTest + * * @test * * @throws \Exception @@ -100,7 +99,7 @@ public function authorize() $this->paymentObject->getRequest()->b2cSecured('MRS', '1982-07-12'); $this->paymentObject->getRequest()->async('DE', 'https://dev.heidelpay.de'); - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); $this->paymentObject->authorize(); @@ -118,6 +117,8 @@ public function authorize() 'authorize failed : ' . print_r($this->paymentObject->getResponse()->getError(), 1) ); + $this->logDataToDebug(); + return $this->authorizeReference = (string)$this->paymentObject->getResponse()->getPaymentReferenceId(); } @@ -129,6 +130,7 @@ public function authorize() * @return string payment reference id for the prepayment reversal transaction * @depends authorize * @group connectionTest + * * @test * * @throws \Exception @@ -156,6 +158,8 @@ public function finalize($referenceId) 'reversal failed : ' . print_r($this->paymentObject->getResponse()->getError(), 1) ); + $this->logDataToDebug(); + return (string)$this->paymentObject->getResponse()->getPaymentReferenceId(); } @@ -166,6 +170,7 @@ public function finalize($referenceId) * @return string payment reference id for the prepayment reversal transaction * @depends finalize * @group connectionTest + * * @test * * @throws \Exception @@ -194,6 +199,8 @@ public function reversal() 'reversal failed : ' . print_r($this->paymentObject->getResponse()->getError(), 1) ); + $this->logDataToDebug(); + return (string)$this->paymentObject->getResponse()->getPaymentReferenceId(); } @@ -202,10 +209,12 @@ public function reversal() * * @param string $referenceId reference id of the invoice to refund * - * @return string payment reference id of the invoice refund transaction * @depends authorize * @test + * * @group connectionTest + * + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ public function refund($referenceId = null) { @@ -213,11 +222,12 @@ public function refund($referenceId = null) $this->paymentObject->getRequest()->basketData($timestamp, 23.54, $this->currency, $this->secret); /* the refund can not be processed because there will be no receipt automatically on the sandbox */ - $this->paymentObject->_dryRun = true; + $this->paymentObject->dryRun = true; $this->paymentObject->refund((string)$referenceId); $this->assertEquals('IV.RF', $this->paymentObject->getRequest()->getPayment()->getCode()); - return true; + + $this->logDataToDebug(); } } diff --git a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PostFinanceCardPaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PostFinanceCardPaymentMethodTest.php index 5994afc..cfbdc82 100644 --- a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PostFinanceCardPaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PostFinanceCardPaymentMethodTest.php @@ -19,9 +19,7 @@ * * @author Ronja Wann * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\integration */ class PostFinanceCardPaymentMethodTest extends BasePaymentMethodTest { @@ -80,7 +78,7 @@ public function _before() $PostFinanceCard = new PostFinanceCard(); $PostFinanceCard->getRequest()->authentification(...$authentication); $PostFinanceCard->getRequest()->customerAddress(...$customerDetails); - $PostFinanceCard->_dryRun = true; + $PostFinanceCard->dryRun = true; $this->paymentObject = $PostFinanceCard; } @@ -90,8 +88,12 @@ public function _before() * * @return string payment reference id for the PostFinanceCard authorize transaction * @group connectionTest + * + * @test + * + * @throws \Exception */ - public function testAuthorize() + public function authorize() { $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); @@ -100,13 +102,16 @@ public function testAuthorize() $this->paymentObject->authorize(); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); + /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } } diff --git a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PostFinanceEFinancePaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PostFinanceEFinancePaymentMethodTest.php index 8e3d3e2..4ffe127 100644 --- a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PostFinanceEFinancePaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PostFinanceEFinancePaymentMethodTest.php @@ -19,9 +19,7 @@ * * @author Ronja Wann * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\integration */ class PostFinanceEFinancePaymentMethodTest extends BasePaymentMethodTest { @@ -81,7 +79,7 @@ public function _before() $PostFinanceEFinance = new PostFinanceEFinance(); $PostFinanceEFinance->getRequest()->authentification(...$authentication); $PostFinanceEFinance->getRequest()->customerAddress(...$customerDetails); - $PostFinanceEFinance->_dryRun = true; + $PostFinanceEFinance->dryRun = true; $this->paymentObject = $PostFinanceEFinance; } @@ -91,6 +89,8 @@ public function _before() * * @return string payment reference id for the PostFinanceEFinance authorize transaction * @group connectionTest + * + * @throws \Exception */ public function testAuthorize() { @@ -101,13 +101,16 @@ public function testAuthorize() $this->paymentObject->authorize(); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } } diff --git a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PrepaymentPaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PrepaymentPaymentMethodTest.php index 6e3720e..7fef03c 100644 --- a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PrepaymentPaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/PrepaymentPaymentMethodTest.php @@ -18,9 +18,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\integration */ class PrepaymentPaymentMethodTest extends BasePaymentMethodTest { @@ -85,13 +83,16 @@ public function _before() * * @return string payment reference id for the prepayment authorize transaction * @group connectionTest + * * @test + * + * @throws \Exception */ public function authorize() { $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); $this->paymentObject->authorize(); @@ -120,7 +121,10 @@ public function authorize() * @return string payment reference id for the prepayment reversal transaction * @depends authorize * @group connectionTest - * @test * + * + * @test + * + * @throws \Exception */ public function reversal($referenceId) { @@ -143,6 +147,8 @@ public function reversal($referenceId) 'reversal failed : ' . print_r($this->paymentObject->getResponse()->getError(), 1) ); + $this->logDataToDebug(); + return (string)$this->paymentObject->getResponse()->getPaymentReferenceId(); } @@ -154,7 +160,10 @@ public function reversal($referenceId) * @return string payment reference id of the prepayment refund transaction * @depends authorize * @test + * * @group connectionTest + * + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ public function refund($referenceId = null) { @@ -162,11 +171,14 @@ public function refund($referenceId = null) $this->paymentObject->getRequest()->basketData($timestamp, 3.54, $this->currency, $this->secret); /* the refund can not be processed because there will be no receipt automatically on the sandbox */ - $this->paymentObject->_dryRun = true; + $this->paymentObject->dryRun = true; $this->paymentObject->refund((string)$referenceId); $this->assertEquals('PP.RF', $this->paymentObject->getRequest()->getPayment()->getCode()); + + $this->logDataToDebug(); + return true; } } diff --git a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/Przelewy24PaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/Przelewy24PaymentMethodTest.php index b14a625..942594d 100644 --- a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/Przelewy24PaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/Przelewy24PaymentMethodTest.php @@ -19,9 +19,7 @@ * * @author Ronja Wann * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\integration */ class Przelewy24PaymentMethodTest extends BasePaymentMethodTest { @@ -81,7 +79,7 @@ public function _before() $Przelewy24 = new Przelewy24(); $Przelewy24->getRequest()->authentification(...$authentication); $Przelewy24->getRequest()->customerAddress(...$customerDetails); - $Przelewy24->_dryRun = true; + $Przelewy24->dryRun = true; $this->paymentObject = $Przelewy24; } @@ -91,6 +89,8 @@ public function _before() * * @return string payment reference id for the Przelewy24 authorize transaction * @group connectionTest + * + * @throws \Exception */ public function testAuthorize() { @@ -101,13 +101,16 @@ public function testAuthorize() $this->paymentObject->authorize(); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } } diff --git a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/SantanderInvoicePaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/SantanderInvoicePaymentMethodTest.php index 17d9702..86d1042 100644 --- a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/SantanderInvoicePaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/SantanderInvoicePaymentMethodTest.php @@ -18,9 +18,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\integration */ class SantanderInvoicePaymentMethodTest extends BasePaymentMethodTest { @@ -88,6 +86,7 @@ public function _before() * * @return string payment reference id for the invoice authorize transaction * @group connectionTest + * * @test * * @throws \Exception @@ -99,7 +98,7 @@ public function authorize() $this->paymentObject->getRequest()->b2cSecured('MRS', '1982-07-12'); $this->paymentObject->getRequest()->async('DE', 'https://dev.heidelpay.de'); - $this->paymentObject->getRequest()->getFrontend()->set('enabled', 'FALSE'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); $this->paymentObject->authorize(); @@ -117,6 +116,8 @@ public function authorize() 'authorize failed : ' . print_r($this->paymentObject->getResponse()->getError(), 1) ); + $this->logDataToDebug(); + return $this->authorizeReference = (string)$this->paymentObject->getResponse()->getPaymentReferenceId(); } @@ -128,6 +129,7 @@ public function authorize() * @return string payment reference id for the prepayment reversal transaction * @depends authorize * @group connectionTest + * * @test * * @throws \Exception @@ -153,6 +155,8 @@ public function finalize($referenceId) 'reversal failed : ' . print_r($this->paymentObject->getResponse()->getError(), 1) ); + $this->logDataToDebug(); + return (string)$this->paymentObject->getResponse()->getPaymentReferenceId(); } @@ -163,6 +167,7 @@ public function finalize($referenceId) * @return string payment reference id for the prepayment reversal transaction * @depends finalize * @group connectionTest + * * @test * * @throws \Exception @@ -191,6 +196,8 @@ public function reversal() 'reversal failed : ' . print_r($this->paymentObject->getResponse()->getError(), 1) ); + $this->logDataToDebug(); + return (string)$this->paymentObject->getResponse()->getPaymentReferenceId(); } @@ -199,10 +206,12 @@ public function reversal() * * @param string $referenceId reference id of the invoice to refund * - * @return string payment reference id of the invoice refund transaction * @depends authorize * @test + * * @group connectionTest + * + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ public function refund($referenceId = null) { @@ -210,11 +219,12 @@ public function refund($referenceId = null) $this->paymentObject->getRequest()->basketData($timestamp, 23.54, $this->currency, $this->secret); /* the refund can not be processed because there will be no receipt automatically on the sandbox */ - $this->paymentObject->_dryRun = true; + $this->paymentObject->dryRun = true; $this->paymentObject->refund((string)$referenceId); $this->assertEquals('IV.RF', $this->paymentObject->getRequest()->getPayment()->getCode()); - return true; + + $this->logDataToDebug(); } } diff --git a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/SofortPaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/SofortPaymentMethodTest.php index 3769093..840c352 100644 --- a/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/SofortPaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/integration/PaymentMethods/SofortPaymentMethodTest.php @@ -19,9 +19,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\integration */ class SofortPaymentMethodTest extends BasePaymentMethodTest { @@ -80,7 +78,7 @@ public function _before() $Sofort = new Sofort(); $Sofort->getRequest()->authentification(...$authentication); $Sofort->getRequest()->customerAddress(...$customerDetails); - $Sofort->_dryRun = true; + $Sofort->dryRun = true; $this->paymentObject = $Sofort; } @@ -90,7 +88,10 @@ public function _before() * * @return string payment reference id for the sofort authorize transaction * @group connectionTest + * * @test + * + * @throws \Exception */ public function authorize() { @@ -101,13 +102,16 @@ public function authorize() $this->paymentObject->authorize(); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->convertToArray(); + $request = $this->paymentObject->getRequest()->toArray(); /** @var Response $response */ - list(, $response) = $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); + $this->logDataToDebug($result); + return (string)$response->getPaymentReferenceId(); } @@ -119,7 +123,10 @@ public function authorize() * @return string payment reference id of the Sofort refund transaction * @depends authorize * @test + * * @group connectionTest + * + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ public function refund($referenceId = null) { @@ -127,11 +134,12 @@ public function refund($referenceId = null) $this->paymentObject->getRequest()->basketData($timestamp, 3.54, $this->currency, $this->secret); /* the refund can not be processed because there will be no receipt automatically on the sandbox */ - $this->paymentObject->_dryRun = true; + $this->paymentObject->dryRun = true; $this->paymentObject->refund((string)$referenceId); $this->assertEquals('OT.RF', $this->paymentObject->getRequest()->getPayment()->getCode()); - return true; + + $this->logDataToDebug(); } } diff --git a/vendor/heidelpay/php-payment-api/tests/script/travis_before_install.sh b/vendor/heidelpay/php-payment-api/tests/script/travis_before_install.sh new file mode 100644 index 0000000..8e8b9b1 --- /dev/null +++ b/vendor/heidelpay/php-payment-api/tests/script/travis_before_install.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -e +trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit code $?' ERR + +## backup and disable xdebug +cp ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ~/.phpenv/versions/$(phpenv version-name)/xdebug.ini.bak +echo > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini +phpenv rehash + +# create directories for the tests +mkdir -p "$HOME/.php-cs-fixer" +mkdir -p build/logs + +composer self-update diff --git a/vendor/heidelpay/php-payment-api/tests/script/travis_install.sh b/vendor/heidelpay/php-payment-api/tests/script/travis_install.sh new file mode 100644 index 0000000..be5ea77 --- /dev/null +++ b/vendor/heidelpay/php-payment-api/tests/script/travis_install.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -e +trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit code $?' ERR + +PHPVER=$(phpenv version-name) +INSTALL_COMMAND="composer install --no-interaction --prefer-dist" +UPDATE_COMMAND="composer update --no-interaction --prefer-source" + +if [ "$deps" == "no" ]; then + ${INSTALL_COMMAND} +fi + +if [ "$deps" == "high" ]; then + ${UPDATE_COMMAND} +fi diff --git a/vendor/heidelpay/php-payment-api/tests/script/travis_script.sh b/vendor/heidelpay/php-payment-api/tests/script/travis_script.sh new file mode 100644 index 0000000..eb8da79 --- /dev/null +++ b/vendor/heidelpay/php-payment-api/tests/script/travis_script.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e +trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit code $?' ERR + +# run static php-cs-fixer code analysis +./vendor/bin/php-cs-fixer fix --dry-run --diff --verbose + +## enable xdebug again +mv ~/.phpenv/versions/$(phpenv version-name)/xdebug.ini.bak ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini + +## run the tests +./vendor/bin/codecept build +./vendor/bin/codecept run unit --coverage --coverage-xml + +## perform this task only for php 7 with deps=no +if [[ ($(phpenv version-name) == "7.0") && ("$deps" == "no") ]]; then + echo "Perform integration tests as well"; + ./vendor/bin/codecept run integration +fi diff --git a/vendor/heidelpay/php-payment-api/tests/unit/Adapter/CurlAdapterTest.php b/vendor/heidelpay/php-payment-api/tests/unit/Adapter/CurlAdapterTest.php index 0a57758..b7d5bce 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/Adapter/CurlAdapterTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/Adapter/CurlAdapterTest.php @@ -23,7 +23,7 @@ * * @author Jens Richter * - * @category unittest + * @package heidelpay\php-payment-api\tests\unit */ class CurlAdapterTest extends Unit { diff --git a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/AccountParameterGroupTest.php b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/AccountParameterGroupTest.php index 8ff561a..72e7b38 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/AccountParameterGroupTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/AccountParameterGroupTest.php @@ -15,7 +15,7 @@ * * @author Jens Richter * - * @category unittest + * @package heidelpay\php-payment-api\tests\unit */ class AccountParameterGroupTest extends Test { @@ -136,7 +136,7 @@ public function identification() $account = new Account(); $value = '3516.0799.6864'; - $account->set('identification', $value); + $account->setIdentification($value); $this->assertEquals($value, $account->getIdentification()); } @@ -151,7 +151,7 @@ public function expiryMonth() $account = new Account(); $value = '05'; - $account->set('expiry_month', $value); + $account->setExpiryMonth($value); $this->assertEquals($value, $account->getExpiryMonth()); } @@ -166,7 +166,7 @@ public function expiryYear() $account = new Account(); $value = '2080'; - $account->set('expiry_year', $value); + $account->setExpiryYear($value); $this->assertEquals($value, $account->getExpiryYear()); } @@ -197,7 +197,7 @@ public function verification() $account = new Account(); $value = '***'; - $account->set('verification', $value); + $account->setVerification($value); $this->assertEquals($value, $account->getVerification()); } diff --git a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/AddressParameterGroupTest.php b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/AddressParameterGroupTest.php index ee92425..292ee79 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/AddressParameterGroupTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/AddressParameterGroupTest.php @@ -16,7 +16,7 @@ * * @author Jens Richter * - * @category unittest + * @package heidelpay\php-payment-api\tests\unit */ class AddressParameterGroupTest extends Test { diff --git a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/BasketParameterGroupTest.php b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/BasketParameterGroupTest.php index b63129a..9a95735 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/BasketParameterGroupTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/BasketParameterGroupTest.php @@ -16,7 +16,7 @@ * * @author Jens Richter * - * @category unittest + * @package heidelpay\php-payment-api\tests\unit */ class BasketParameterGroupTest extends Test { diff --git a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/ConfigParameterGroupTest.php b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/ConfigParameterGroupTest.php index 9301b70..2e7cf48 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/ConfigParameterGroupTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/ConfigParameterGroupTest.php @@ -15,7 +15,7 @@ * * @author Jens Richter * - * @category unittest + * @package heidelpay\php-payment-api\tests\unit */ class ConfigParameterGroupTest extends Test { diff --git a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/ConnectorParameterGroupTest.php b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/ConnectorParameterGroupTest.php index cbdf2d1..4f6179f 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/ConnectorParameterGroupTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/ConnectorParameterGroupTest.php @@ -15,7 +15,7 @@ * * @author Jens Richter * - * @category unittest + * @package heidelpay\php-payment-api\tests\unit */ class ConnectorParameterGroupTest extends Test { diff --git a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/ContactParameterGroupTest.php b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/ContactParameterGroupTest.php index b377d51..323d6f8 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/ContactParameterGroupTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/ContactParameterGroupTest.php @@ -15,7 +15,7 @@ * * @author Jens Richter * - * @category unittest + * @package heidelpay\php-payment-api\tests\unit */ class ContactParameterGroupTest extends Test { diff --git a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/CriterionParameterGroupTest.php b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/CriterionParameterGroupTest.php index 133bf34..1c36cc8 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/CriterionParameterGroupTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/CriterionParameterGroupTest.php @@ -15,7 +15,7 @@ * * @author Jens Richter * - * @category unittest + * @package heidelpay\php-payment-api\tests\unit */ class CriterionParameterGroupTest extends Test { diff --git a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/FrontendParameterGroupTest.php b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/FrontendParameterGroupTest.php index 599587f..a7e915d 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/FrontendParameterGroupTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/FrontendParameterGroupTest.php @@ -15,7 +15,7 @@ * * @author Jens Richter * - * @category unittest + * @package heidelpay\php-payment-api\tests\unit */ class FrontendParameterGroupTest extends Test { @@ -59,7 +59,7 @@ public function redirectUrl() $frontend = new Frontend(); $value = 'https://dev.heidelpay.de'; - $frontend->set('redirect_url', $value); + $frontend->setRedirectUrl($value); $this->assertEquals($value, $frontend->getRedirectUrl()); } diff --git a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/IdentificationParameterGroupTest.php b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/IdentificationParameterGroupTest.php index 0251806..7c972f7 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/IdentificationParameterGroupTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/IdentificationParameterGroupTest.php @@ -15,7 +15,7 @@ * * @author Jens Richter * - * @category unittest + * @package heidelpay\php-payment-api\tests\unit */ class IdentificationParameterGroupTest extends Test { diff --git a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/NameParameterGroupTest.php b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/NameParameterGroupTest.php index 295ca2f..c2f4fd2 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/NameParameterGroupTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/NameParameterGroupTest.php @@ -15,7 +15,7 @@ * * @author Jens Richter * - * @category unittest + * @package heidelpay\php-payment-api\tests\unit */ class NameParameterGroupTest extends Test { diff --git a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/PaymentParameterGroupTest.php b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/PaymentParameterGroupTest.php index 6daea34..593465c 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/PaymentParameterGroupTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/PaymentParameterGroupTest.php @@ -15,7 +15,7 @@ * * @author Jens Richter * - * @category unittest + * @package heidelpay\php-payment-api\tests\unit */ class PaymentParameterGroupTest extends Test { diff --git a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/PresentationParameterGroupTest.php b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/PresentationParameterGroupTest.php index f0fe249..0766b8c 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/PresentationParameterGroupTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/PresentationParameterGroupTest.php @@ -15,7 +15,7 @@ * * @author Jens Richter * - * @category unittest + * @package heidelpay\php-payment-api\tests\unit */ class PresentationParameterGroupTest extends Test { diff --git a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/RequestParameterGroupTest.php b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/RequestParameterGroupTest.php index 895ccb6..ab5e174 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/RequestParameterGroupTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/RequestParameterGroupTest.php @@ -15,7 +15,7 @@ * * @author Jens Richter * - * @category unittest + * @package heidelpay\php-payment-api\tests\unit */ class RequestParameterGroupTest extends Test { diff --git a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/RiskInformationParameterGroupTest.php b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/RiskInformationParameterGroupTest.php index 73fbf6e..bf72936 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/RiskInformationParameterGroupTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/RiskInformationParameterGroupTest.php @@ -15,7 +15,7 @@ * * @author Daniel Kraut * - * @category unittest + * @package heidelpay\php-payment-api\tests\unit */ class RiskInformationParameterGroupTest extends Test { diff --git a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/SecurityParameterGroupTest.php b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/SecurityParameterGroupTest.php index 412d9f5..372ebe9 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/SecurityParameterGroupTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/SecurityParameterGroupTest.php @@ -15,7 +15,7 @@ * * @author Jens Richter * - * @category unittest + * @package heidelpay\php-payment-api\tests\unit */ class SecurityParameterGroupTest extends Test { diff --git a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/TransactionParameterGroupTest.php b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/TransactionParameterGroupTest.php index c3b3f42..68b89ee 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/TransactionParameterGroupTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/TransactionParameterGroupTest.php @@ -15,7 +15,7 @@ * * @author Jens Richter * - * @category unittest + * @package heidelpay\php-payment-api\tests\unit */ class TransactionParameterGroupTest extends Test { diff --git a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/UserParameterGroupTest.php b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/UserParameterGroupTest.php index b78eb39..acceda6 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/UserParameterGroupTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/ParameterGroups/UserParameterGroupTest.php @@ -15,7 +15,7 @@ * * @author Jens Richter * - * @category unittest + * @package heidelpay\php-payment-api\tests\unit */ class UserParameterGroupTest extends Test { diff --git a/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/AbstractPaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/AbstractPaymentMethodTest.php index e7dbe01..40a92ca 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/AbstractPaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/AbstractPaymentMethodTest.php @@ -3,6 +3,7 @@ namespace Heidelpay\Tests\PhpPaymentApi\Unit\PaymentMethods; use Heidelpay\PhpPaymentApi\Adapter\CurlAdapter; +use Heidelpay\PhpPaymentApi\Constants\ApiConfig; use Heidelpay\PhpPaymentApi\Request; use Heidelpay\PhpPaymentApi\PaymentMethods\SofortPaymentMethod; use Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException; @@ -19,9 +20,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\unit */ class AbstractPaymentMethodTest extends BasePaymentMethodTest { @@ -97,8 +96,8 @@ public function adapter() */ public function getPaymentUrl() { - $this->paymentObject->getRequest()->getTransaction()->set('mode', 'LIVE'); - $this->assertSame('https://heidelpay.hpcgw.net/ngw/post', $this->paymentObject->getPaymentUrl()); + $this->paymentObject->getRequest()->getTransaction()->setMode('LIVE'); + $this->assertSame(ApiConfig::LIVE_URL, $this->paymentObject->getPaymentUrl()); } /** @@ -110,7 +109,7 @@ public function getPaymentUrl() */ public function getPaymentUrlException() { - $this->paymentObject->getRequest()->getTransaction()->set('mode', null); + $this->paymentObject->getRequest()->getTransaction()->setMode(null); $this->expectException(UndefinedTransactionModeException::class); $this->paymentObject->getPaymentUrl(); } @@ -124,16 +123,14 @@ public function jsonSerializeTest() { $objectAsJson = $this->paymentObject->jsonSerialize(); $this->assertNotEmpty($objectAsJson); - $this->assertArrayHasKey('_paymentCode', $objectAsJson); - $this->assertArrayHasKey('_brand', $objectAsJson); - $this->assertArrayHasKey('_liveUrl', $objectAsJson); - $this->assertArrayHasKey('_sandboxUrl', $objectAsJson); - $this->assertArrayHasKey('_adapter', $objectAsJson); - $this->assertArrayHasKey('_request', $objectAsJson); - $this->assertArrayHasKey('_requestArray', $objectAsJson); - $this->assertArrayHasKey('_response', $objectAsJson); - $this->assertArrayHasKey('_responseArray', $objectAsJson); - $this->assertArrayHasKey('_dryRun', $objectAsJson); + $this->assertArrayHasKey('paymentCode', $objectAsJson); + $this->assertArrayHasKey('brand', $objectAsJson); + $this->assertArrayHasKey('adapter', $objectAsJson); + $this->assertArrayHasKey('request', $objectAsJson); + $this->assertArrayHasKey('requestArray', $objectAsJson); + $this->assertArrayHasKey('response', $objectAsJson); + $this->assertArrayHasKey('responseArray', $objectAsJson); + $this->assertArrayHasKey('dryRun', $objectAsJson); } /** diff --git a/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/CreditCardPaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/CreditCardPaymentMethodTest.php index 7e2d2b8..ab74013 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/CreditCardPaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/CreditCardPaymentMethodTest.php @@ -3,7 +3,7 @@ namespace Heidelpay\Tests\PhpPaymentApi\Unit\PaymentMethods; use AspectMock\Test as test; -use Heidelpay\PhpPaymentApi\ParameterGroups\CriterionParameterGroup; +use Heidelpay\PhpPaymentApi\Constants\ApiConfig; use Heidelpay\PhpPaymentApi\PaymentMethods\CreditCardPaymentMethod; use Heidelpay\Tests\PhpPaymentApi\Helper\BasePaymentMethodTest; @@ -19,9 +19,7 @@ * * @author Simon Gabriel * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\unit */ class CreditCardPaymentMethodTest extends BasePaymentMethodTest { @@ -121,7 +119,7 @@ public function _before() $paymentObject = new CreditCardPaymentMethod(); $paymentObject->getRequest()->authentification(...$this->authentication->getAuthenticationArray()); $paymentObject->getRequest()->customerAddress(...$this->customerData->getCustomerDataArray()); - $paymentObject->_dryRun = false; + $paymentObject->dryRun = false; $this->paymentObject = $paymentObject; @@ -152,7 +150,7 @@ public function _after() */ public function registrationParametersShouldBeSetUpAsExpected() { - $timestamp = 'CreditCardPaymentMethodTest::authorizeParameterJsonShouldBeSetUpAsExpected 2017-10-26 15:41:12'; + $timestamp = 'CreditCardPaymentMethodTest::registrationParametersShouldBeSetUpAsExpected 2017-10-26 15:41:12'; $this->paymentObject->getRequest()->basketData($timestamp, self::TEST_AMOUNT, $this->currency, $this->secret); $preventAsyncRedirect = 'FALSE'; @@ -163,10 +161,10 @@ public function registrationParametersShouldBeSetUpAsExpected() $this->paymentObject->getRequest()->getFrontend()->setEnabled($frontendEnabled); $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); $this->paymentObject->getRequest()->getAccount()->setNumber($this->cartNumber); - $this->paymentObject->getRequest()->getAccount()->set('expiry_month', $this->cardExpiryMonth); - $this->paymentObject->getRequest()->getAccount()->set('expiry_year', $this->cardExpiryYear); + $this->paymentObject->getRequest()->getAccount()->setExpiryMonth($this->cardExpiryMonth); + $this->paymentObject->getRequest()->getAccount()->setExpiryYear($this->cardExpiryYear); $this->paymentObject->getRequest()->getAccount()->setBrand($this->cardBrand); - $this->paymentObject->getRequest()->getAccount()->set('verification', $this->cardVerification); + $this->paymentObject->getRequest()->getAccount()->setVerification($this->cardVerification); list($firstName, $lastName, , $shopperId, $street, $state, $zip, $city, $country, $email) = $this->customerData->getCustomerDataArray(); @@ -192,10 +190,10 @@ public function registrationParametersShouldBeSetUpAsExpected() 'ADDRESS.ZIP' => $zip, 'CONTACT.EMAIL' => $email, 'CRITERION.PAYMENT_METHOD' => $object::getClassName(), - 'CRITERION.SECRET' => '73c237c4b5cb4aded8d87cbc85f2f1a5a83f9123d353d9ddb26e54fdfb00b7ac59b188f4' . - '44f85de486ee906862d0570ef7c5f4447343f370db0098c3f5867d92', + 'CRITERION.SECRET' => 'b2741166ff6bbb45bca9dd74b4dbdfbc9bc92b13d943bdf8c0d557fb42fa6b475cff230' . + 'c930068cddb18f384fda940a2f8831782e2c2559544319dee0f33a237', 'CRITERION.SDK_NAME' => 'Heidelpay\\PhpPaymentApi', - 'CRITERION.SDK_VERSION' => CriterionParameterGroup::SDK_VERSION, + 'CRITERION.SDK_VERSION' => ApiConfig::SDK_VERSION, 'FRONTEND.CSS_PATH' => self::CSS_PATH, 'FRONTEND.ENABLED' => 'FALSE', 'FRONTEND.MODE' => 'WHITELABEL', @@ -216,7 +214,90 @@ public function registrationParametersShouldBeSetUpAsExpected() 'USER.PWD' => $userPassword, ]; - $this->assertThat($this->paymentObject->getRequest()->convertToArray(), $this->arraysMatchExactly($expected)); + $this->assertThat($this->paymentObject->getRequest()->toArray(), $this->arraysMatchExactly($expected)); + } + + /** + * Verify registration parameters generated as expected + * + * @test + * + * @throws \Exception + */ + public function reregistrationParametersShouldBeSetUpAsExpected() + { + $timestamp = 'CreditCardPaymentMethodTest::reregistrationParametersShouldBeSetUpAsExpected 2017-10-26 15:41:12'; + $this->paymentObject->getRequest()->basketData($timestamp, self::TEST_AMOUNT, $this->currency, $this->secret); + + $preventAsyncRedirect = 'FALSE'; + $referenceId = 123456789; + $this->paymentObject->reregistration( + $referenceId, + self::PAYMENT_FRAME_ORIGIN, + $preventAsyncRedirect, + self::CSS_PATH + ); + + /* disable frontend (iframe) and submit the card information directly (only for testing) */ + $frontendEnabled = 'FALSE'; + $this->paymentObject->getRequest()->getFrontend()->setEnabled($frontendEnabled); + $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); + $this->paymentObject->getRequest()->getAccount()->setNumber($this->cartNumber); + $this->paymentObject->getRequest()->getAccount()->setExpiryMonth($this->cardExpiryMonth); + $this->paymentObject->getRequest()->getAccount()->setExpiryYear($this->cardExpiryYear); + $this->paymentObject->getRequest()->getAccount()->setBrand($this->cardBrand); + $this->paymentObject->getRequest()->getAccount()->setVerification($this->cardVerification); + + list($firstName, $lastName, , $shopperId, $street, $state, $zip, $city, $country, $email) = + $this->customerData->getCustomerDataArray(); + + list($securitySender, $userLogin, $userPassword, $transactionChannel, ) = + $this->authentication->getAuthenticationArray(); + + // this is done to avoid syntax warnings + $object = $this->paymentObject; + + $expected = + [ + 'ACCOUNT.BRAND' => $this->cardBrand, + 'ACCOUNT.EXPIRY_MONTH' => $this->cardExpiryMonth, + 'ACCOUNT.EXPIRY_YEAR' => $this->cardExpiryYear, + 'ACCOUNT.HOLDER' => $this->holder, + 'ACCOUNT.NUMBER' => $this->cartNumber, + 'ACCOUNT.VERIFICATION' => $this->cardVerification, + 'ADDRESS.CITY' => $city, + 'ADDRESS.COUNTRY' => $country, + 'ADDRESS.STATE' => $state, + 'ADDRESS.STREET' => $street, + 'ADDRESS.ZIP' => $zip, + 'CONTACT.EMAIL' => $email, + 'CRITERION.PAYMENT_METHOD' => $object::getClassName(), + 'CRITERION.SECRET' => '53ebf32eb481bc80cb4e2d36cd37599cc29328ff2f1e0bc03d2fc3e293377a43aa0c' . + 'f3d895699fac634ee3e49024bc2eb2dedeb91929bd8150877ce328e6544e', + 'CRITERION.SDK_NAME' => 'Heidelpay\\PhpPaymentApi', + 'CRITERION.SDK_VERSION' => ApiConfig::SDK_VERSION, + 'FRONTEND.CSS_PATH' => self::CSS_PATH, + 'FRONTEND.ENABLED' => 'FALSE', + 'FRONTEND.MODE' => 'WHITELABEL', + 'FRONTEND.PAYMENT_FRAME_ORIGIN' => self::PAYMENT_FRAME_ORIGIN, + 'FRONTEND.PREVENT_ASYNC_REDIRECT' => $preventAsyncRedirect, + 'IDENTIFICATION.SHOPPERID' => $shopperId, + 'IDENTIFICATION.TRANSACTIONID' => $timestamp, + 'IDENTIFICATION.REFERENCEID' => $referenceId, + 'NAME.GIVEN' => $firstName, + 'NAME.FAMILY' => $lastName, + 'PAYMENT.CODE' => self::PAYMENT_METHOD_SHORT . '.RR', + 'PRESENTATION.AMOUNT' => self::TEST_AMOUNT, + 'PRESENTATION.CURRENCY' => $this->currency, + 'REQUEST.VERSION' => '1.0', + 'SECURITY.SENDER' => $securitySender, + 'TRANSACTION.CHANNEL' => $transactionChannel, + 'TRANSACTION.MODE' => 'CONNECTOR_TEST', + 'USER.LOGIN' => $userLogin, + 'USER.PWD' => $userPassword, + ]; + + $this->assertThat($this->paymentObject->getRequest()->toArray(), $this->arraysMatchExactly($expected)); } /** @@ -239,10 +320,10 @@ public function authorizeParametersShouldBeSetUpAsExpected() $this->paymentObject->getRequest()->getFrontend()->setEnabled($frontendEnabled); $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); $this->paymentObject->getRequest()->getAccount()->setNumber($this->cartNumber); - $this->paymentObject->getRequest()->getAccount()->set('expiry_month', $this->cardExpiryMonth); - $this->paymentObject->getRequest()->getAccount()->set('expiry_year', $this->cardExpiryYear); + $this->paymentObject->getRequest()->getAccount()->setExpiryMonth($this->cardExpiryMonth); + $this->paymentObject->getRequest()->getAccount()->setExpiryYear($this->cardExpiryYear); $this->paymentObject->getRequest()->getAccount()->setBrand($this->cardBrand); - $this->paymentObject->getRequest()->getAccount()->set('verification', $this->cardVerification); + $this->paymentObject->getRequest()->getAccount()->setVerification($this->cardVerification); list($firstName, $lastName, , $shopperId, $street, $state, $zip, $city, $country, $email) = $this->customerData->getCustomerDataArray(); @@ -270,7 +351,7 @@ public function authorizeParametersShouldBeSetUpAsExpected() 'CRITERION.SECRET' => '965e4267bc0d3e9313f07aaff8ac602681d9e1643677dc4c39853022c227ff23ef30ca' . '1f92b955c2f2335becba777fe2c3ad4b036c62deb81d1b2800fb31e655', 'CRITERION.SDK_NAME' => 'Heidelpay\\PhpPaymentApi', - 'CRITERION.SDK_VERSION' => CriterionParameterGroup::SDK_VERSION, + 'CRITERION.SDK_VERSION' => ApiConfig::SDK_VERSION, 'FRONTEND.CSS_PATH' => self::CSS_PATH, 'FRONTEND.ENABLED' => $frontendEnabled, 'FRONTEND.MODE' => 'WHITELABEL', @@ -291,7 +372,7 @@ public function authorizeParametersShouldBeSetUpAsExpected() 'USER.PWD' => $userPassword, ]; - $this->assertThat($this->paymentObject->getRequest()->convertToArray(), $this->arraysMatchExactly($expected)); + $this->assertThat($this->paymentObject->getRequest()->toArray(), $this->arraysMatchExactly($expected)); } /** @@ -314,10 +395,10 @@ public function debitParametersShouldBeSetUpAsExpected() $this->paymentObject->getRequest()->getFrontend()->setEnabled($frontendEnabled); $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); $this->paymentObject->getRequest()->getAccount()->setNumber($this->cartNumber); - $this->paymentObject->getRequest()->getAccount()->set('expiry_month', $this->cardExpiryMonth); - $this->paymentObject->getRequest()->getAccount()->set('expiry_year', $this->cardExpiryYear); + $this->paymentObject->getRequest()->getAccount()->setExpiryMonth($this->cardExpiryMonth); + $this->paymentObject->getRequest()->getAccount()->setExpiryYear($this->cardExpiryYear); $this->paymentObject->getRequest()->getAccount()->setBrand($this->cardBrand); - $this->paymentObject->getRequest()->getAccount()->set('verification', $this->cardVerification); + $this->paymentObject->getRequest()->getAccount()->setVerification($this->cardVerification); list($firstName, $lastName, , $shopperId, $street, $state, $zip, $city, $country, $email) = $this->customerData->getCustomerDataArray(); @@ -345,7 +426,7 @@ public function debitParametersShouldBeSetUpAsExpected() 'CRITERION.SECRET' => '3fcdb7e573521e40823f5875195f635f4cbdda39c6de0e8a10b816313ace6b4f1d77' . 'cfa6b38ea9a575e7b038530caa49966df3794014d8ded8bf5a5f79185e56', 'CRITERION.SDK_NAME' => 'Heidelpay\\PhpPaymentApi', - 'CRITERION.SDK_VERSION' => CriterionParameterGroup::SDK_VERSION, + 'CRITERION.SDK_VERSION' => ApiConfig::SDK_VERSION, 'FRONTEND.CSS_PATH' => self::CSS_PATH, 'FRONTEND.ENABLED' => $frontendEnabled, 'FRONTEND.MODE' => 'WHITELABEL', @@ -366,7 +447,7 @@ public function debitParametersShouldBeSetUpAsExpected() 'USER.PWD' => $userPassword, ]; - $this->assertThat($this->paymentObject->getRequest()->convertToArray(), $this->arraysMatchExactly($expected)); + $this->assertThat($this->paymentObject->getRequest()->toArray(), $this->arraysMatchExactly($expected)); } // diff --git a/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/DebitCardPaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/DebitCardPaymentMethodTest.php index 5a7ca26..c7b8550 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/DebitCardPaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/DebitCardPaymentMethodTest.php @@ -3,7 +3,7 @@ namespace Heidelpay\Tests\PhpPaymentApi\Unit\PaymentMethods; use AspectMock\Test as test; -use Heidelpay\PhpPaymentApi\ParameterGroups\CriterionParameterGroup; +use Heidelpay\PhpPaymentApi\Constants\ApiConfig; use Heidelpay\PhpPaymentApi\PaymentMethods\DebitCardPaymentMethod; use Heidelpay\Tests\PhpPaymentApi\Helper\BasePaymentMethodTest; @@ -19,9 +19,7 @@ * * @author Simon Gabriel * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\unit */ class DebitCardPaymentMethodTest extends BasePaymentMethodTest { @@ -104,6 +102,8 @@ class DebitCardPaymentMethodTest extends BasePaymentMethodTest /** * Set up function will create a payment method object for each test case + * + * @throws \Exception */ // @codingStandardsIgnoreStart public function _before() @@ -115,7 +115,7 @@ public function _before() $paymentObject = new DebitCardPaymentMethod(); $paymentObject->getRequest()->authentification(...$authentication->getAuthenticationArray()); $paymentObject->getRequest()->customerAddress(...$customerDetails->getCustomerDataArray()); - $paymentObject->_dryRun = false; + $paymentObject->dryRun = false; $this->paymentObject = $paymentObject; @@ -168,10 +168,10 @@ public function registrationParametersShouldBeSetUpAsExpected() $this->paymentObject->getRequest()->getFrontend()->setEnabled($frontendEnabled); $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); $this->paymentObject->getRequest()->getAccount()->setNumber($this->cartNumber); - $this->paymentObject->getRequest()->getAccount()->set('expiry_month', $this->cardExpiryMonth); - $this->paymentObject->getRequest()->getAccount()->set('expiry_year', $this->cardExpiryYear); + $this->paymentObject->getRequest()->getAccount()->setExpiryMonth($this->cardExpiryMonth); + $this->paymentObject->getRequest()->getAccount()->setExpiryYear($this->cardExpiryYear); $this->paymentObject->getRequest()->getAccount()->setBrand($this->cardBrand); - $this->paymentObject->getRequest()->getAccount()->set('verification', $this->cardVerification); + $this->paymentObject->getRequest()->getAccount()->setVerification($this->cardVerification); list($firstName, $lastName, , $shopperId, $street, $state, $zip, $city, $country, $email) = $this->customerData->getCustomerDataArray(); @@ -200,7 +200,7 @@ public function registrationParametersShouldBeSetUpAsExpected() 'CRITERION.SECRET' => '39fca69e5c569134ba2b34b43916692e7dfb2200adb9c85da67bb0fa4bb49faaa7' . 'a151930c2a08de1ad6f8a3d11edb00ab071889ac2505c02a898a8e3ba68987', 'CRITERION.SDK_NAME' => 'Heidelpay\\PhpPaymentApi', - 'CRITERION.SDK_VERSION' => CriterionParameterGroup::SDK_VERSION, + 'CRITERION.SDK_VERSION' => ApiConfig::SDK_VERSION, 'FRONTEND.CSS_PATH' => $cssPath, 'FRONTEND.ENABLED' => 'FALSE', 'FRONTEND.MODE' => 'WHITELABEL', @@ -221,7 +221,90 @@ public function registrationParametersShouldBeSetUpAsExpected() 'USER.PWD' => $userPassword, ]; - $this->assertThat($this->paymentObject->getRequest()->convertToArray(), $this->arraysMatchExactly($expected)); + $this->assertThat($this->paymentObject->getRequest()->toArray(), $this->arraysMatchExactly($expected)); + } + + /** + * Verify registration parameters generated as expected + * + * @test + * + * @throws \Exception + */ + public function reregistrationParametersShouldBeSetUpAsExpected() + { + $timestamp = 'DebitCardPaymentMethodTest::reregistrationParametersShouldBeSetUpAsExpected 2017-10-26 15:41:12'; + $this->paymentObject->getRequest()->basketData($timestamp, self::TEST_AMOUNT, $this->currency, $this->secret); + + $preventAsyncRedirect = 'FALSE'; + $referenceId = 987654321; + $this->paymentObject->reregistration( + $referenceId, + self::PAYMENT_FRAME_ORIGIN, + $preventAsyncRedirect, + self::CSS_PATH + ); + + /* disable frontend (iframe) and submit the card information directly (only for testing) */ + $frontendEnabled = 'FALSE'; + $this->paymentObject->getRequest()->getFrontend()->setEnabled($frontendEnabled); + $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); + $this->paymentObject->getRequest()->getAccount()->setNumber($this->cartNumber); + $this->paymentObject->getRequest()->getAccount()->setExpiryMonth($this->cardExpiryMonth); + $this->paymentObject->getRequest()->getAccount()->setExpiryYear($this->cardExpiryYear); + $this->paymentObject->getRequest()->getAccount()->setBrand($this->cardBrand); + $this->paymentObject->getRequest()->getAccount()->setVerification($this->cardVerification); + + list($firstName, $lastName, , $shopperId, $street, $state, $zip, $city, $country, $email) = + $this->customerData->getCustomerDataArray(); + + list($securitySender, $userLogin, $userPassword, $transactionChannel, ) = + $this->authentication->getAuthenticationArray(); + + // this is done to avoid syntax warnings + $object = $this->paymentObject; + + $expected = + [ + 'ACCOUNT.BRAND' => $this->cardBrand, + 'ACCOUNT.EXPIRY_MONTH' => $this->cardExpiryMonth, + 'ACCOUNT.EXPIRY_YEAR' => $this->cardExpiryYear, + 'ACCOUNT.HOLDER' => $this->holder, + 'ACCOUNT.NUMBER' => $this->cartNumber, + 'ACCOUNT.VERIFICATION' => $this->cardVerification, + 'ADDRESS.CITY' => $city, + 'ADDRESS.COUNTRY' => $country, + 'ADDRESS.STATE' => $state, + 'ADDRESS.STREET' => $street, + 'ADDRESS.ZIP' => $zip, + 'CONTACT.EMAIL' => $email, + 'CRITERION.PAYMENT_METHOD' => $object::getClassName(), + 'CRITERION.SECRET' => 'd0b4585746164f19fbbea1c55ea88a1776f79b72b0ca4aee770413dbd1c79123f8d15aed7' . + '5e4642b03b4dc604c6c41d1bc8b5f55212022f012ec4c3d57c6172d', + 'CRITERION.SDK_NAME' => 'Heidelpay\\PhpPaymentApi', + 'CRITERION.SDK_VERSION' => ApiConfig::SDK_VERSION, + 'FRONTEND.CSS_PATH' => self::CSS_PATH, + 'FRONTEND.ENABLED' => 'FALSE', + 'FRONTEND.MODE' => 'WHITELABEL', + 'FRONTEND.PAYMENT_FRAME_ORIGIN' => self::PAYMENT_FRAME_ORIGIN, + 'FRONTEND.PREVENT_ASYNC_REDIRECT' => $preventAsyncRedirect, + 'IDENTIFICATION.SHOPPERID' => $shopperId, + 'IDENTIFICATION.TRANSACTIONID' => $timestamp, + 'IDENTIFICATION.REFERENCEID' => $referenceId, + 'NAME.GIVEN' => $firstName, + 'NAME.FAMILY' => $lastName, + 'PAYMENT.CODE' => self::PAYMENT_METHOD_SHORT . '.RR', + 'PRESENTATION.AMOUNT' => self::TEST_AMOUNT, + 'PRESENTATION.CURRENCY' => $this->currency, + 'REQUEST.VERSION' => '1.0', + 'SECURITY.SENDER' => $securitySender, + 'TRANSACTION.CHANNEL' => $transactionChannel, + 'TRANSACTION.MODE' => 'CONNECTOR_TEST', + 'USER.LOGIN' => $userLogin, + 'USER.PWD' => $userPassword, + ]; + + $this->assertThat($this->paymentObject->getRequest()->toArray(), $this->arraysMatchExactly($expected)); } /** @@ -233,7 +316,7 @@ public function registrationParametersShouldBeSetUpAsExpected() */ public function authorizeParametersShouldBeSetUpAsExpected() { - $timestamp = 'DebitCardPaymentMethodTest::authorize 2017-10-27 13:10:40'; + $timestamp = 'DebitCardPaymentMethodTest::authorizeParametersShouldBeSetUpAsExpected 2017-10-27 13:10:40'; $this->paymentObject->getRequest()->basketData( $timestamp, self::TEST_AMOUNT, @@ -253,10 +336,10 @@ public function authorizeParametersShouldBeSetUpAsExpected() $this->paymentObject->getRequest()->getFrontend()->setEnabled($frontendEnabled); $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); $this->paymentObject->getRequest()->getAccount()->setNumber($this->cartNumber); - $this->paymentObject->getRequest()->getAccount()->set('expiry_month', $this->cardExpiryMonth); - $this->paymentObject->getRequest()->getAccount()->set('expiry_year', $this->cardExpiryYear); + $this->paymentObject->getRequest()->getAccount()->setExpiryMonth($this->cardExpiryMonth); + $this->paymentObject->getRequest()->getAccount()->setExpiryYear($this->cardExpiryYear); $this->paymentObject->getRequest()->getAccount()->setBrand($this->cardBrand); - $this->paymentObject->getRequest()->getAccount()->set('verification', $this->cardVerification); + $this->paymentObject->getRequest()->getAccount()->setVerification($this->cardVerification); list($firstName, $lastName, , $shopperId, $street, $state, $zip, $city, $country, $email) = $this->customerData->getCustomerDataArray(); @@ -281,10 +364,10 @@ public function authorizeParametersShouldBeSetUpAsExpected() 'ADDRESS.ZIP' => $zip, 'CONTACT.EMAIL' => $email, 'CRITERION.PAYMENT_METHOD' => $object::getClassName(), - 'CRITERION.SECRET' => '6f9d4135538597a082ed393edc4fc6bdc535118b1f01be319e3ae3eeaf09d17dcefc1' . - '7a9c01bb1031ceaf68eea615ac971cc9de06f166335e40795d874dde889', + 'CRITERION.SECRET' => '5350067cbc3a27a5772bd5a193788a832ff5bbab9dfe44f18539ec512a700d04748bb43b546f1' . + 'fe8c3b8f1b99a28a376c2119d04fe51ef06b4f8456c69ce6d92', 'CRITERION.SDK_NAME' => 'Heidelpay\\PhpPaymentApi', - 'CRITERION.SDK_VERSION' => CriterionParameterGroup::SDK_VERSION, + 'CRITERION.SDK_VERSION' => ApiConfig::SDK_VERSION, 'FRONTEND.CSS_PATH' => self::CSS_PATH, 'FRONTEND.ENABLED' => $frontendEnabled, 'FRONTEND.MODE' => 'WHITELABEL', @@ -305,7 +388,7 @@ public function authorizeParametersShouldBeSetUpAsExpected() 'USER.PWD' => $userPassword, ]; - $this->assertThat($this->paymentObject->getRequest()->convertToArray(), $this->arraysMatchExactly($expected)); + $this->assertThat($this->paymentObject->getRequest()->toArray(), $this->arraysMatchExactly($expected)); } /** @@ -317,7 +400,7 @@ public function authorizeParametersShouldBeSetUpAsExpected() */ public function debitParametersShouldBeSetUpAsExpected() { - $timestamp = 'DebitCardPaymentMethodTest::debit 2017-10-27 13:24:08'; + $timestamp = 'DebitCardPaymentMethodTest::debitParametersShouldBeSetUpAsExpected 2017-10-27 13:24:08'; $this->paymentObject->getRequest()->basketData($timestamp, self::TEST_AMOUNT, $this->currency, $this->secret); $preventAsyncRedirect = 'FALSE'; @@ -332,10 +415,10 @@ public function debitParametersShouldBeSetUpAsExpected() $this->paymentObject->getRequest()->getFrontend()->setEnabled($frontendEnabled); $this->paymentObject->getRequest()->getAccount()->setHolder($this->holder); $this->paymentObject->getRequest()->getAccount()->setNumber($this->cartNumber); - $this->paymentObject->getRequest()->getAccount()->set('expiry_month', $this->cardExpiryMonth); - $this->paymentObject->getRequest()->getAccount()->set('expiry_year', $this->cardExpiryYear); + $this->paymentObject->getRequest()->getAccount()->setExpiryMonth($this->cardExpiryMonth); + $this->paymentObject->getRequest()->getAccount()->setExpiryYear($this->cardExpiryYear); $this->paymentObject->getRequest()->getAccount()->setBrand($this->cardBrand); - $this->paymentObject->getRequest()->getAccount()->set('verification', $this->cardVerification); + $this->paymentObject->getRequest()->getAccount()->setVerification($this->cardVerification); list($firstName, $lastName, , $shopperId, $street, $state, $zip, $city, $country, $email) = $this->customerData->getCustomerDataArray(); @@ -360,10 +443,10 @@ public function debitParametersShouldBeSetUpAsExpected() 'ADDRESS.ZIP' => $zip, 'CONTACT.EMAIL' => $email, 'CRITERION.PAYMENT_METHOD' => $object::getClassName(), - 'CRITERION.SECRET' => '6867a929d7c41dcd2b425eaf10f1e8229cf630d3a6a5658d4ce72ce0f8f9e6' . - 'ae3e13ba64ec41e448724e2a13f683bb5eb29a31517db61dc46426ff0694bc7d15', + 'CRITERION.SECRET' => '58c2799a16d7deedc91193ae728898ff9051d9fe618b888e770f34c240771edfadf999583f60' . + '725dba2f00292c2a4b6d8b358112154032d97ded97757a0425b1', 'CRITERION.SDK_NAME' => 'Heidelpay\\PhpPaymentApi', - 'CRITERION.SDK_VERSION' => CriterionParameterGroup::SDK_VERSION, + 'CRITERION.SDK_VERSION' => ApiConfig::SDK_VERSION, 'FRONTEND.CSS_PATH' => self::CSS_PATH, 'FRONTEND.ENABLED' => $frontendEnabled, 'FRONTEND.MODE' => 'WHITELABEL', @@ -384,7 +467,7 @@ public function debitParametersShouldBeSetUpAsExpected() 'USER.PWD' => $userPassword, ]; - $this->assertThat($this->paymentObject->getRequest()->convertToArray(), $this->arraysMatchExactly($expected)); + $this->assertThat($this->paymentObject->getRequest()->toArray(), $this->arraysMatchExactly($expected)); } // diff --git a/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/EasyCreditPaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/EasyCreditPaymentMethodTest.php index 0dfdefb..34f0263 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/EasyCreditPaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/EasyCreditPaymentMethodTest.php @@ -3,7 +3,7 @@ namespace Heidelpay\Tests\PhpPaymentApi\Unit\PaymentMethods; use AspectMock\Test as test; -use Heidelpay\PhpPaymentApi\ParameterGroups\CriterionParameterGroup; +use Heidelpay\PhpPaymentApi\Constants\ApiConfig; use Heidelpay\PhpPaymentApi\PaymentMethods\EasyCreditPaymentMethod; use Heidelpay\Tests\PhpPaymentApi\Helper\BasePaymentMethodTest; @@ -19,9 +19,7 @@ * * @author Simon Gabriel * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\unit */ class EasyCreditPaymentMethodTest extends BasePaymentMethodTest { @@ -112,7 +110,7 @@ public function _before() $paymentObject = new EasyCreditPaymentMethod(); $paymentObject->getRequest()->authentification(...$this->authentication->getAuthenticationArray()); $paymentObject->getRequest()->customerAddress(...$this->customerData->getCustomerDataArray()); - $paymentObject->_dryRun = false; + $paymentObject->dryRun = false; $this->paymentObject = $paymentObject; @@ -167,7 +165,7 @@ public function initializeParametersShouldBeSetUpAsExpected() 'CRITERION.SECRET' => '8263dc9e31b5754332aa23752b0044f4f6ab716ca9ec8d94a1b74ac19d2c5b822d3b' . '1a0d8106c93cd02f2f5654d54c510444e310576e5559e3926fbdab0af02b', 'CRITERION.SDK_NAME' => 'Heidelpay\\PhpPaymentApi', - 'CRITERION.SDK_VERSION' => CriterionParameterGroup::SDK_VERSION, + 'CRITERION.SDK_VERSION' => ApiConfig::SDK_VERSION, 'FRONTEND.ENABLED' => 'TRUE', 'FRONTEND.MODE' => 'WHITELABEL', 'IDENTIFICATION.SHOPPERID' => $shopperId, @@ -185,7 +183,7 @@ public function initializeParametersShouldBeSetUpAsExpected() 'USER.PWD' => $userPassword, ]; - $this->assertThat($this->paymentObject->getRequest()->convertToArray(), $this->arraysMatchExactly($expected)); + $this->assertThat($this->paymentObject->getRequest()->toArray(), $this->arraysMatchExactly($expected)); } // diff --git a/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/GenericPaymentMethodTest.php b/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/GenericPaymentMethodTest.php index 725b137..ba213b3 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/GenericPaymentMethodTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/GenericPaymentMethodTest.php @@ -17,9 +17,7 @@ * * @author Simon Gabriel * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\unit */ class GenericPaymentMethodTest extends BasePaymentMethodTest { @@ -139,7 +137,7 @@ public function verifyPaymentMethodPresentsAsExpected($paymentMethodClass, $paym $returnObject = $this->paymentObject->refund(''); $this->assertSame($paymentMethodClassPath, get_class($returnObject)); - $requestArray = $this->paymentObject->getRequest()->convertToArray(); + $requestArray = $this->paymentObject->getRequest()->toArray(); $this->assertArrayHasKey('PAYMENT.CODE', $requestArray); $this->assertSame($paymentCode . '.RF', $requestArray['PAYMENT.CODE']); $this->assertSame($paymentMethodClass, $requestArray['CRITERION.PAYMENT_METHOD']); diff --git a/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/PaymentMethodTransactionTest.php b/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/PaymentMethodTransactionTest.php index 096af70..f22fe3a 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/PaymentMethodTransactionTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/PaymentMethods/PaymentMethodTransactionTest.php @@ -4,7 +4,7 @@ use AspectMock\Proxy\InstanceProxy; use AspectMock\Test as test; -use Heidelpay\PhpPaymentApi\ParameterGroups\CriterionParameterGroup; +use Heidelpay\PhpPaymentApi\Constants\ApiConfig; use Heidelpay\PhpPaymentApi\PaymentMethods\DirectDebitB2CSecuredPaymentMethod; use Heidelpay\Tests\PhpPaymentApi\Helper\BasePaymentMethodTest; @@ -19,9 +19,7 @@ * * @author Simon Gabriel * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\unit */ class PaymentMethodTransactionTest extends BasePaymentMethodTest { @@ -92,7 +90,7 @@ public function _before() $directDebitSecured->getRequest()->authentification(...$authentication); $directDebitSecured->getRequest()->customerAddress(...$customerDetails); $directDebitSecured->getRequest()->b2cSecured(self::CUSTOMER_SALUTATION, self::CUSTOMER_BIRTHDAY); - $directDebitSecured->_dryRun = false; + $directDebitSecured->dryRun = false; $this->paymentObject = $directDebitSecured; @@ -220,7 +218,7 @@ public function registrationParametersShouldBeSetUpAsExpected() 'CRITERION.SECRET' => '1ce9f65da579ce18dce622dd5dfeca2e87a379f52451202ef58ebdfac1e15b4' . '5e649b0cb7466e040011f3f76e056b2ce83561063815ef935cbb0c6b421cc3317', 'CRITERION.SDK_NAME' => 'Heidelpay\\PhpPaymentApi', - 'CRITERION.SDK_VERSION' => CriterionParameterGroup::SDK_VERSION, + 'CRITERION.SDK_VERSION' => ApiConfig::SDK_VERSION, 'FRONTEND.ENABLED' => 'FALSE', 'FRONTEND.MODE' => 'WHITELABEL', 'FRONTEND.LANGUAGE' => 'DE', @@ -242,7 +240,7 @@ public function registrationParametersShouldBeSetUpAsExpected() 'USER.PWD' => $userPassword, ]; - $this->assertThat($this->paymentObject->getRequest()->convertToArray(), $this->arraysMatchExactly($expected)); + $this->assertThat($this->paymentObject->getRequest()->toArray(), $this->arraysMatchExactly($expected)); } /** @@ -291,7 +289,7 @@ public function authorizeParametersShouldBeSetUpAsExpected() 'CRITERION.SECRET' => 'e03d34e875cf7c5fd97e3a207cc5d54007509585475e0359cbcb0678c874bca9a1' . '9e10c4cc11d5ee1e7bda3e46c85008bfc38955621301c25d00adcabd2d20a8', 'CRITERION.SDK_NAME' => 'Heidelpay\PhpPaymentApi', - 'CRITERION.SDK_VERSION' => CriterionParameterGroup::SDK_VERSION, + 'CRITERION.SDK_VERSION' => ApiConfig::SDK_VERSION, 'FRONTEND.ENABLED' => $frontendEnabled, 'FRONTEND.MODE' => 'WHITELABEL', 'FRONTEND.RESPONSE_URL' => self::REDIRECT_URL, @@ -313,7 +311,7 @@ public function authorizeParametersShouldBeSetUpAsExpected() 'USER.PWD' => $userPassword, ]; - $this->assertThat($this->paymentObject->getRequest()->convertToArray(), $this->arraysMatchExactly($expected)); + $this->assertThat($this->paymentObject->getRequest()->toArray(), $this->arraysMatchExactly($expected)); } /** @@ -351,7 +349,7 @@ public function authorizeOnRegistrationParametersShouldBeSetUpAsExpected() 'CRITERION.SECRET' => '6a98064cd9fe2b1044c8e0ef339a3b6956d700854c5fd67165a1fcf9e9b845c9b2' . '0a2f68a8dde6bd783d04350ca4d349eb10f4bbebb1ae37cb621b48aca67c59', 'CRITERION.SDK_NAME' => 'Heidelpay\\PhpPaymentApi', - 'CRITERION.SDK_VERSION' => CriterionParameterGroup::SDK_VERSION, + 'CRITERION.SDK_VERSION' => ApiConfig::SDK_VERSION, 'FRONTEND.ENABLED' => $frontendEnabled, 'FRONTEND.MODE' => 'WHITELABEL', 'IDENTIFICATION.SHOPPERID' => $shopperId, @@ -372,7 +370,7 @@ public function authorizeOnRegistrationParametersShouldBeSetUpAsExpected() 'USER.PWD' => $userPassword, ]; - $this->assertThat($this->paymentObject->getRequest()->convertToArray(), $this->arraysMatchExactly($expected)); + $this->assertThat($this->paymentObject->getRequest()->toArray(), $this->arraysMatchExactly($expected)); } /** @@ -415,7 +413,7 @@ public function debitParametersShouldBeSetUpAsExpected() 'CRITERION.SECRET' => '9cd425b6a0d82057f1cedbed87c2a6d9fdcc720a72192bc333bffe67965e503cd1b6' . '004f7c5551ecf9f55615b372e8d775ce9aae85cb94ba480653a5c1f4c3ae', 'CRITERION.SDK_NAME' => 'Heidelpay\\PhpPaymentApi', - 'CRITERION.SDK_VERSION' => CriterionParameterGroup::SDK_VERSION, + 'CRITERION.SDK_VERSION' => ApiConfig::SDK_VERSION, 'FRONTEND.ENABLED' => $frontendEnabled, 'FRONTEND.MODE' => 'WHITELABEL', 'FRONTEND.RESPONSE_URL' => self::REDIRECT_URL, @@ -437,7 +435,7 @@ public function debitParametersShouldBeSetUpAsExpected() 'USER.PWD' => $userPassword, ]; - $this->assertThat($this->paymentObject->getRequest()->convertToArray(), $this->arraysMatchExactly($expected)); + $this->assertThat($this->paymentObject->getRequest()->toArray(), $this->arraysMatchExactly($expected)); } /** @@ -480,7 +478,7 @@ public function debitOnRegistrationParametersShouldBeSetUpAsExpected() 'CRITERION.SECRET' => '40e583afeffc94547183c736e6219ceffbc1425a99695742f22d71cdd06475f34550cfb2' . 'a145a39e72ee818385ade0adb8d571da3c0fa6e094fd43c900192166', 'CRITERION.SDK_NAME' => 'Heidelpay\\PhpPaymentApi', - 'CRITERION.SDK_VERSION' => CriterionParameterGroup::SDK_VERSION, + 'CRITERION.SDK_VERSION' => ApiConfig::SDK_VERSION, 'FRONTEND.ENABLED' => $frontendEnabled, 'FRONTEND.MODE' => 'WHITELABEL', 'IDENTIFICATION.SHOPPERID' => $shopperId, @@ -501,7 +499,7 @@ public function debitOnRegistrationParametersShouldBeSetUpAsExpected() 'USER.PWD' => $userPassword, ]; - $this->assertThat($this->paymentObject->getRequest()->convertToArray(), $this->arraysMatchExactly($expected)); + $this->assertThat($this->paymentObject->getRequest()->toArray(), $this->arraysMatchExactly($expected)); } /** @@ -541,7 +539,7 @@ public function refundParametersShouldBeSetUpAsExpected() 'CRITERION.SECRET' => 'e2cf8f7086cad3dc71972f193d6a5a230d3dd00e13d20ad876ba2feae868bf6b79c4564' . '0f88576ed39546dc68e15f87eaf7557618426d904245b745cdc65c881', 'CRITERION.SDK_NAME' => 'Heidelpay\\PhpPaymentApi', - 'CRITERION.SDK_VERSION' => CriterionParameterGroup::SDK_VERSION, + 'CRITERION.SDK_VERSION' => ApiConfig::SDK_VERSION, 'FRONTEND.MODE' => 'WHITELABEL', 'FRONTEND.ENABLED' => 'FALSE', 'IDENTIFICATION.SHOPPERID' => $shopperId, @@ -562,7 +560,7 @@ public function refundParametersShouldBeSetUpAsExpected() 'USER.PWD' => $userPassword, ]; - $this->assertThat($this->paymentObject->getRequest()->convertToArray(), $this->arraysMatchExactly($expected)); + $this->assertThat($this->paymentObject->getRequest()->toArray(), $this->arraysMatchExactly($expected)); } /** @@ -602,7 +600,7 @@ public function reversalParametersShouldBeSetUpAsExpected() 'CRITERION.SECRET' => '716703bf5cc18f83b3231474f773a69ad98e2f477c2abe0b5b904e02d232432b7ce90' . '20da68fb0a77464b94fd26d71cceab58d36a0b378759054fabf8a65a7aa', 'CRITERION.SDK_NAME' => 'Heidelpay\\PhpPaymentApi', - 'CRITERION.SDK_VERSION' => CriterionParameterGroup::SDK_VERSION, + 'CRITERION.SDK_VERSION' => ApiConfig::SDK_VERSION, 'FRONTEND.ENABLED' => 'FALSE', 'FRONTEND.MODE' => 'WHITELABEL', 'IDENTIFICATION.SHOPPERID' => $shopperId, @@ -623,7 +621,7 @@ public function reversalParametersShouldBeSetUpAsExpected() 'USER.PWD' => $userPassword ]; - $this->assertThat($this->paymentObject->getRequest()->convertToArray(), $this->arraysMatchExactly($expected)); + $this->assertThat($this->paymentObject->getRequest()->toArray(), $this->arraysMatchExactly($expected)); } /** @@ -663,7 +661,7 @@ public function rebillParametersShouldBeSetUpAsExpected() 'CRITERION.SECRET' => '59718aa5021d53aa936ec7d516791a94cec0eaf799d854105b40fe97fbb5fc8f6ca40be4' . '999f057d0eda9316c18d26ecbcca684ac143b134cf19135215ee0d73', 'CRITERION.SDK_NAME' => 'Heidelpay\\PhpPaymentApi', - 'CRITERION.SDK_VERSION' => CriterionParameterGroup::SDK_VERSION, + 'CRITERION.SDK_VERSION' => ApiConfig::SDK_VERSION, 'FRONTEND.ENABLED' => 'FALSE', 'FRONTEND.MODE' => 'WHITELABEL', 'IDENTIFICATION.SHOPPERID' => $shopperId, @@ -684,7 +682,7 @@ public function rebillParametersShouldBeSetUpAsExpected() 'USER.PWD' => $userPassword, ]; - $this->assertThat($this->paymentObject->getRequest()->convertToArray(), $this->arraysMatchExactly($expected)); + $this->assertThat($this->paymentObject->getRequest()->toArray(), $this->arraysMatchExactly($expected)); } /** @@ -724,7 +722,7 @@ public function captureParametersShouldBeSetUpAsExpected() 'CRITERION.SECRET' => '235f76675fb775e3a931608125c9ed4d404a8aa5f28b76019d7a1816cd533a3d47fc05ef1f' . 'f0f84cef09b3fc92374c64018a05e08827684c54fd0c309373ba2e', 'CRITERION.SDK_NAME' => 'Heidelpay\\PhpPaymentApi', - 'CRITERION.SDK_VERSION' => CriterionParameterGroup::SDK_VERSION, + 'CRITERION.SDK_VERSION' => ApiConfig::SDK_VERSION, 'FRONTEND.ENABLED' => 'FALSE', 'FRONTEND.MODE' => 'WHITELABEL', 'IDENTIFICATION.SHOPPERID' => $shopperId, @@ -745,7 +743,7 @@ public function captureParametersShouldBeSetUpAsExpected() 'USER.PWD' => $userPassword, ]; - $this->assertThat($this->paymentObject->getRequest()->convertToArray(), $this->arraysMatchExactly($expected)); + $this->assertThat($this->paymentObject->getRequest()->toArray(), $this->arraysMatchExactly($expected)); } /** @@ -785,7 +783,7 @@ public function finalizeParametersShouldBeSetUpAsExpected() 'CRITERION.SECRET' => '665cfc0c6452721445c66e6017566f303d0a557ff857348c8f65f6a73f042d1f2824470' . 'ef9ae56dabe050f0078c5abcebe2ca6d42612c400fa9c3f58ad219853', 'CRITERION.SDK_NAME' => 'Heidelpay\\PhpPaymentApi', - 'CRITERION.SDK_VERSION' => CriterionParameterGroup::SDK_VERSION, + 'CRITERION.SDK_VERSION' => ApiConfig::SDK_VERSION, 'FRONTEND.ENABLED' => 'FALSE', 'FRONTEND.MODE' => 'WHITELABEL', 'IDENTIFICATION.SHOPPERID' => $shopperId, @@ -806,7 +804,7 @@ public function finalizeParametersShouldBeSetUpAsExpected() 'USER.PWD' => $userPassword, ]; - $this->assertThat($this->paymentObject->getRequest()->convertToArray(), $this->arraysMatchExactly($expected)); + $this->assertThat($this->paymentObject->getRequest()->toArray(), $this->arraysMatchExactly($expected)); } // diff --git a/vendor/heidelpay/php-payment-api/tests/unit/PushTest.php b/vendor/heidelpay/php-payment-api/tests/unit/PushTest.php index 6fde090..52ffea6 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/PushTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/PushTest.php @@ -2,6 +2,8 @@ namespace Heidelpay\Tests\PhpPaymentApi\Unit; +use Heidelpay\PhpPaymentApi\Constants\ProcessingResult; +use Heidelpay\PhpPaymentApi\Constants\StatusCode; use Heidelpay\PhpPaymentApi\Exceptions\XmlResponseParserException; use Heidelpay\PhpPaymentApi\Push; use Heidelpay\PhpPaymentApi\PushMapping\Account; @@ -22,11 +24,9 @@ * * @link http://dev.heidelpay.com/heidelpay-php-api/ * - * @author Stephano Vogel + * @author Stephano Vogel * - * @package heidelpay - * @subpackage php-api - * @category php-api + * @package heidelpay\php-payment-api\tests\unit */ class PushTest extends Test { @@ -156,8 +156,8 @@ public function hasValidMappedCcRgProperties() 'Request successfully processed in \'Merchant in Connector Test Mode\'', $response->getProcessing()->getReturn() ); - $this->assertEquals('90', $response->getProcessing()->getStatusCode()); - $this->assertEquals('ACK', $response->getProcessing()->getResult()); + $this->assertEquals(StatusCode::NEW_TRANSACTION, $response->getProcessing()->getStatusCode()); + $this->assertEquals(ProcessingResult::ACK, $response->getProcessing()->getResult()); $this->assertEquals('23.12', $response->getPresentation()->getAmount()); $this->assertNotEquals('12.34', $response->getPresentation()->getAmount()); @@ -219,8 +219,8 @@ public function hasValidMappedCcDbPendingProperties() $this->assertEquals('000.200.000', $response->getProcessing()->getReturnCode()); $this->assertEquals('Transaction pending', $response->getProcessing()->getReturn()); - $this->assertEquals('80', $response->getProcessing()->getStatusCode()); - $this->assertEquals('ACK', $response->getProcessing()->getResult()); + $this->assertEquals(StatusCode::WAITING, $response->getProcessing()->getStatusCode()); + $this->assertEquals(ProcessingResult::ACK, $response->getProcessing()->getResult()); $this->assertEquals('150.37', $response->getPresentation()->getAmount()); $this->assertNotEquals('15.37', $response->getPresentation()->getAmount()); @@ -285,8 +285,8 @@ public function hasValidMappedDdDbProperties() 'Request successfully processed in \'Merchant in Connector Test Mode\'', $response->getProcessing()->getReturn() ); - $this->assertEquals('90', $response->getProcessing()->getStatusCode()); - $this->assertEquals('ACK', $response->getProcessing()->getResult()); + $this->assertEquals(StatusCode::NEW_TRANSACTION, $response->getProcessing()->getStatusCode()); + $this->assertEquals(ProcessingResult::ACK, $response->getProcessing()->getResult()); $this->assertEquals('51.00', $response->getPresentation()->getAmount()); $this->assertNotEquals('510.00', $response->getPresentation()->getAmount()); @@ -333,8 +333,8 @@ public function hasValidMappedIvRcProperties() 'Request successfully processed in \'Merchant in Connector Test Mode\'', $response->getProcessing()->getReturn() ); - $this->assertEquals('90', $response->getProcessing()->getStatusCode()); - $this->assertEquals('ACK', $response->getProcessing()->getResult()); + $this->assertEquals(StatusCode::NEW_TRANSACTION, $response->getProcessing()->getStatusCode()); + $this->assertEquals(ProcessingResult::ACK, $response->getProcessing()->getResult()); $this->assertEquals('56.99', $response->getPresentation()->getAmount()); $this->assertNotEquals('57.00', $response->getPresentation()->getAmount()); @@ -404,8 +404,8 @@ public function hasValidMappedPpPaProperties() 'Request successfully processed in \'Merchant in Connector Test Mode\'', $response->getProcessing()->getReturn() ); - $this->assertEquals('90', $response->getProcessing()->getStatusCode()); - $this->assertEquals('ACK', $response->getProcessing()->getResult()); + $this->assertEquals(StatusCode::NEW_TRANSACTION, $response->getProcessing()->getStatusCode()); + $this->assertEquals(ProcessingResult::ACK, $response->getProcessing()->getResult()); $this->assertEquals('107.00', $response->getPresentation()->getAmount()); $this->assertNotEquals('106.99', $response->getPresentation()->getAmount()); @@ -483,7 +483,10 @@ public function abstractGetXmlObjectFieldAttributeGetterImplementationShouldRetu // implements the tested method $connector = new Processing(); - $this->assertEquals(90, $connector->getXmlObjectFieldAttribute($xmlElement, 'Status:code')); + $this->assertEquals( + StatusCode::NEW_TRANSACTION, + $connector->getXmlObjectFieldAttribute($xmlElement, 'Status:code') + ); } /** diff --git a/vendor/heidelpay/php-payment-api/tests/unit/RequestTest.php b/vendor/heidelpay/php-payment-api/tests/unit/RequestTest.php index 1122d5a..a00019f 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/RequestTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/RequestTest.php @@ -3,8 +3,11 @@ namespace Heidelpay\Tests\PhpPaymentApi\Unit; use Codeception\TestCase\Test; +use Heidelpay\PhpPaymentApi\Constants\TransactionMode; +use Heidelpay\PhpPaymentApi\Exceptions\JsonParserException; use Heidelpay\PhpPaymentApi\Request; use Heidelpay\PhpPaymentApi\ParameterGroups\CriterionParameterGroup; +use AspectMock\Test as aspectMockTest; /** * @@ -18,9 +21,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\unit */ class RequestTest extends Test { @@ -47,7 +48,7 @@ public function prepareAuthenticationData() $this->assertEquals($UserLogin, $Request->getUser()->getLogin()); $this->assertEquals($UserPassword, $Request->getUser()->getPassword()); $this->assertEquals($TransactionChannel, $Request->getTransaction()->getChannel()); - $this->assertEquals('CONNECTOR_TEST', $Request->getTransaction()->getMode()); + $this->assertEquals(TransactionMode::CONNECTOR_TEST, $Request->getTransaction()->getMode()); } /** @@ -148,7 +149,7 @@ public function setBasketData() * @group integrationTest * @test */ - public function convertToArray() + public function compareToArrayWithInputArray() { $request = new Request(); $criterion = new CriterionParameterGroup(); @@ -173,7 +174,7 @@ public function convertToArray() 'CRITERION.SDK_VERSION' => $criterion->getSdkVersion() ); - $this->assertEquals($referenceVars, $request->convertToArray()); + $this->assertEquals($referenceVars, $request->toArray()); } /** @@ -223,4 +224,77 @@ public function requestCriterionParameterGroupGetterShouldReturnSetValue() $this->assertEquals($value, $request->getCriterion()->get($fieldName)); } + + /** + * Test that checks if the static fromJson method returns an instance of Request. + * + * @test + */ + public function staticFromJsonMethodShouldReturnNewRequestInstanceOnEmptyJsonObject() + { + $request = Request::fromJson('{}'); + $this->assertEquals(Request::class, get_class($request)); + } + + /** + * Test that checks if an existing Request instance and an instance + * created by the fromJson mapper are matching ParameterGroup + * instances and their respective properies and values. + * + * @test + */ + public function mappedJsonRequestAndToJsonRepresentationOfRequestObjectMustBeEqual() + { + $request = new Request(); + + $mappedRequest = Request::fromJson($request->toJson()); + $this->assertEquals($request, $mappedRequest); + } + + /** + * Test that checks if a JsonParserException will be thrown when an + * invalid JSON string is being provided to the fromJson method. + * + * @test + */ + public function fromJsonMapperShouldThrowExceptionOnInvalidJson() + { + $invalidJson = '{"test: 0}'; + + $this->expectException(JsonParserException::class); + $request = Request::fromJson($invalidJson); + $request->getBasket(); + } + + /** + * Test that checks if the static fromPost method returns an instance of Request. + * + * @test + */ + public function staticFromPostMethodShouldReturnNewRequestInstanceOnEmptyArray() + { + $request = Request::fromPost([]); + $this->assertEquals(Request::class, get_class($request)); + } + + /** + * @test + */ + public function sendShouldCreateCurlAdapterIfNoneExists() + { + aspectMockTest::func( + 'Heidelpay\PhpPaymentApi\Adapter', + 'extension_loaded', + false + ); + + $request = new Request(); + $request->send(); + + aspectMockTest::func( + 'Heidelpay\PhpPaymentApi\Adapter', + 'extension_loaded', + false + )->verifyInvokedOnce(); + } } diff --git a/vendor/heidelpay/php-payment-api/tests/unit/ResponseTest.php b/vendor/heidelpay/php-payment-api/tests/unit/ResponseTest.php index 88004b3..4b95b20 100644 --- a/vendor/heidelpay/php-payment-api/tests/unit/ResponseTest.php +++ b/vendor/heidelpay/php-payment-api/tests/unit/ResponseTest.php @@ -3,6 +3,7 @@ namespace Heidelpay\Tests\PhpPaymentApi\Unit; use Codeception\TestCase\Test; +use Heidelpay\PhpPaymentApi\Exceptions\JsonParserException; use Heidelpay\PhpPaymentApi\Response; use Heidelpay\PhpPaymentApi\Exceptions\PaymentFormUrlException; use Heidelpay\PhpPaymentApi\Exceptions\HashVerificationException; @@ -18,9 +19,7 @@ * * @author Jens Richter * - * @package Heidelpay - * @subpackage PhpPaymentApi - * @category UnitTest + * @package heidelpay\php-payment-api\tests\unit */ class ResponseTest extends Test { @@ -29,6 +28,11 @@ class ResponseTest extends Test */ protected $responseObject; + /** + * @var array + */ + protected $responseArray; + /** * Secret * @@ -49,7 +53,7 @@ class ResponseTest extends Test public function _before() { // @codingStandardsIgnoreEnd - $responseSample = array( + $this->responseArray = array( 'NAME_FAMILY' => 'Berger-Payment', 'IDENTIFICATION_TRANSACTIONID' => '2843294932', 'ADDRESS_COUNTRY' => 'DE', @@ -101,9 +105,10 @@ public function _before() 'RISKINFORMATION_GUESTCHECKOUT' => 'FALSE', 'CONNECTOR_ACCOUNT_HOLDER' => 'Test Account Holder', 'CRITERION_TEST_VALUE' => 'Test Value', + 'INVALID_PROP' => 'Invalid', ); - $this->responseObject = new Response($responseSample); + $this->responseObject = new Response($this->responseArray); } /** @@ -185,7 +190,7 @@ public function getPaymentFormUrl() $this->assertEquals($expectedUrl, $this->responseObject->getPaymentFormUrl()); $expectedUrl = 'http://www.heidelpay.de'; - $this->responseObject->getFrontend()->set('redirect_url', $expectedUrl); + $this->responseObject->getFrontend()->setRedirectUrl($expectedUrl); /** url in case of credit and debit card reference Transaction */ $this->responseObject->getIdentification()->set('referenceid', '31HA07BC8108A9126F199F2784552637'); @@ -195,8 +200,8 @@ public function getPaymentFormUrl() $this->responseObject->getIdentification()->set('referenceid', null); /** url for non credit or debit card transactions */ - $this->responseObject->getPayment()->set('code', 'OT.PA'); - $this->responseObject->getFrontend()->set('redirect_url', $expectedUrl); + $this->responseObject->getPayment()->setCode('OT.PA'); + $this->responseObject->getFrontend()->setRedirectUrl($expectedUrl); $this->assertEquals($expectedUrl, $this->responseObject->getPaymentFormUrl()); } @@ -210,7 +215,7 @@ public function getPaymentFormUrlPaymentCodeException() { $response = new Response(); - $response->getFrontend()->set('redirect_url', null); + $response->getFrontend()->setRedirectUrl(null); $this->expectException(PaymentFormUrlException::class); $response->getPaymentFormUrl(); } @@ -225,8 +230,8 @@ public function getPaymentFormUrlException() { $response = new Response(); - $response->getPayment()->set('code', 'OT.PA'); - $response->getFrontend()->set('redirect_url', null); + $response->getPayment()->setCode('OT.PA'); + $response->getFrontend()->setRedirectUrl(null); $this->expectException(PaymentFormUrlException::class); $response->getPaymentFormUrl(); } @@ -372,4 +377,66 @@ public function responseCriterionShouldContainTestValueCustomProperty() $this->assertSame('Test Value', $this->responseObject->getCriterion()->get('test_value')); $this->assertSame('Test Value', $this->responseObject->getCriterion()->get('Test_Value')); } + + /** + * Test that checks if the static fromJson metod returns an instance + * of Response even when an empty JSON object is provided. + * + * @test + */ + public function staticFromJsonMethodShouldReturnANewResponseInstanceOnEmptyJsonObject() + { + $response = Response::fromJson('{}'); + $this->assertEquals(Response::class, get_class($response)); + } + + /** + * Test that checks if the static fromJson method returns an instance of Response. + * + * @test + */ + public function staticFromJsonMethodShouldReturnNewResponseInstanceOnValidJsonObject() + { + $response = Response::fromJson($this->responseObject->toJson()); + $this->assertEquals(Response::class, get_class($response)); + } + + /** + * Test that checks if an existing Response instance and an instance + * created by the fromJson mapper are matching ParameterGroup + * instances and their respective properies and values. + * + * @test + */ + public function mappedJsonResponseAndToJsonRepresentationOfResponseObjectMustBeEqual() + { + $response = Response::fromJson($this->responseObject->toJson()); + $this->assertEquals($this->responseObject, $response); + } + + /** + * Test that checks if a JsonParserException will be thrown when an + * invalid JSON string is being provided to the fromJson method. + * + * @test + */ + public function fromJsonMapperShouldThrowExceptionOnInvalidJsonString() + { + $invalidJson = '{"test: 0}'; + + $this->expectException(JsonParserException::class); + $response = Response::fromJson($invalidJson); + $response->getError(); + } + + /** + * Test that checks if the static fromPost method returns an instance of Response. + * + * @test + */ + public function staticFromPostMethodShouldReturnNewResponseInstanceOnEmptyArray() + { + $reponse = Response::fromPost([]); + $this->assertEquals(Response::class, get_class($reponse)); + } } diff --git a/vendor/zendframework/zend-validator/CHANGELOG.md b/vendor/zendframework/zend-validator/CHANGELOG.md index 9362e89..77341a3 100644 --- a/vendor/zendframework/zend-validator/CHANGELOG.md +++ b/vendor/zendframework/zend-validator/CHANGELOG.md @@ -2,6 +2,47 @@ All notable changes to this project will be documented in this file, in reverse chronological order by release. +## 2.10.2 - 2018-02-01 + +### Added + +- [#202](https://github.com/zendframework/zend-validator/pull/202) adds the + ability to use custom constant types in extensions of + `Zend\Validator\CreditCard`, fixing an issue where users were unable to add + new brands as they are created. + +- [#203](https://github.com/zendframework/zend-validator/pull/203) adds support + for the new Russian bank card "Mir". + +- [#204](https://github.com/zendframework/zend-validator/pull/204) adds support + to the IBAN validator for performing SEPA validation against Croatia and San + Marino. + +- [#209](https://github.com/zendframework/zend-validator/pull/209) adds + documentation for the `Explode` validator. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#195](https://github.com/zendframework/zend-validator/pull/195) adds + missing `GpsPoint` validator entries to the `ValidatorPluginManager`, ensuring + they may be retrieved from it correctly. + +- [#212](https://github.com/zendframework/zend-validator/pull/212) updates the + `CSRF` validator to automatically mark any non-string values as invalid, + preventing errors such as array to string conversion. + ## 2.10.1 - 2017-08-22 ### Added diff --git a/vendor/zendframework/zend-validator/composer.json b/vendor/zendframework/zend-validator/composer.json index a65cf39..17f2915 100644 --- a/vendor/zendframework/zend-validator/composer.json +++ b/vendor/zendframework/zend-validator/composer.json @@ -45,8 +45,8 @@ "prefer-stable": true, "extra": { "branch-alias": { - "dev-master": "2.10-dev", - "dev-develop": "2.11-dev" + "dev-master": "2.10.x-dev", + "dev-develop": "2.11.x-dev" }, "zf": { "component": "Zend\\Validator", @@ -66,7 +66,6 @@ "cs-check": "phpcs", "cs-fix": "phpcbf", "test": "phpunit --colors=always", - "test-coverage": "phpunit --colors=always --coverage-clover clover.xml", - "upload-coverage": "coveralls -v" + "test-coverage": "phpunit --colors=always --coverage-clover clover.xml" } } diff --git a/vendor/zendframework/zend-validator/composer.lock b/vendor/zendframework/zend-validator/composer.lock index ae669d8..3452b24 100644 --- a/vendor/zendframework/zend-validator/composer.lock +++ b/vendor/zendframework/zend-validator/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "46afb6e9936c113e4c87a16296b9d2dd", + "content-hash": "202752ae2a5ef78cc657783a20e371cb", "packages": [ { "name": "container-interop/container-interop", diff --git a/vendor/zendframework/zend-validator/doc/book/validators/credit-card.md b/vendor/zendframework/zend-validator/doc/book/validators/credit-card.md index 8cea647..e1a7f0a 100644 --- a/vendor/zendframework/zend-validator/doc/book/validators/credit-card.md +++ b/vendor/zendframework/zend-validator/doc/book/validators/credit-card.md @@ -33,6 +33,7 @@ The following issuing institutes are accepted: - Solo - Visa - Visa Electron +- Russia Mir > ### Invalid institutes > diff --git a/vendor/zendframework/zend-validator/doc/book/validators/explode.md b/vendor/zendframework/zend-validator/doc/book/validators/explode.md new file mode 100644 index 0000000..fc057ec --- /dev/null +++ b/vendor/zendframework/zend-validator/doc/book/validators/explode.md @@ -0,0 +1,48 @@ +# Explode Validator + +`Zend\Validator\Explode` executes a validator for each item exploded from an +array. + +## Supported options + +The following options are supported for `Zend\Validator\Explode`: + +- `valueDelimiter`: Defines the delimiter used to explode values from an array. + It defaults to `,`. If the given value is an array, this option isn't used. +- `validator`: Sets the validator that will be executed on each exploded item. + This may be a validator instance, or a validator service name. + +## Basic usage + +To validate if every item in an array is in a specified haystack: + +```php +$inArrayValidator = new Zend\Validator\InArray([ + 'haystack' => [1, 2, 3, 4, 5, 6], +]); + +$explodeValidator = new Zend\Validator\Explode([ + 'validator' => $inArrayValidator +]); + +$explodeValidator->isValid([1, 4, 6]); // returns true +$explodeValidator->isValid([1, 4, 6, 8]); // returns false +``` + +## Exploding strings + +To validate if every e-mail in a string is contained in a list of names: + +```php +$inEmailListValidator = new Zend\Validator\InArray([ + 'haystack' => ['joseph@test.com', 'mark@test.com', 'lucia@test.com'], +]); + +$explodeValidator = new Zend\Validator\Explode([ + 'validator' => $inEmailListValidator, + 'valueDelimiter' => ',' +]); + +$explodeValidator->isValid('joseph@test.com,mark@test.com'); // returns true +$explodeValidator->isValid('lucia@test.com,maria@test.com'); // returns false +``` diff --git a/vendor/zendframework/zend-validator/mkdocs.yml b/vendor/zendframework/zend-validator/mkdocs.yml index 277caf7..7bc382a 100644 --- a/vendor/zendframework/zend-validator/mkdocs.yml +++ b/vendor/zendframework/zend-validator/mkdocs.yml @@ -17,6 +17,7 @@ pages: - "Db\\RecordExists and Db\\NoRecordExists": validators/db.md - Digits: validators/digits.md - EmailAddress: validators/email-address.md + - Explode: validators/explode.md - GreaterThan: validators/greater-than.md - Hex: validators/hex.md - Hostname: validators/hostname.md diff --git a/vendor/zendframework/zend-validator/src/CreditCard.php b/vendor/zendframework/zend-validator/src/CreditCard.php index 6bf514b..242f638 100644 --- a/vendor/zendframework/zend-validator/src/CreditCard.php +++ b/vendor/zendframework/zend-validator/src/CreditCard.php @@ -31,6 +31,7 @@ class CreditCard extends AbstractValidator const MASTERCARD = 'Mastercard'; const SOLO = 'Solo'; const VISA = 'Visa'; + const MIR = 'Mir'; const CHECKSUM = 'creditcardChecksum'; const CONTENT = 'creditcardContent'; @@ -72,6 +73,7 @@ class CreditCard extends AbstractValidator 8 => self::SOLO, 9 => self::UNIONPAY, 10 => self::VISA, + 11 => self::MIR, ]; /** @@ -91,6 +93,7 @@ class CreditCard extends AbstractValidator self::SOLO => [16, 18, 19], self::UNIONPAY => [16, 17, 18, 19], self::VISA => [13, 16, 19], + self::MIR => [13, 16], ]; /** @@ -122,6 +125,7 @@ class CreditCard extends AbstractValidator '6224', '6225', '6226', '6227', '6228', '62290', '62291', '622920', '622921', '622922', '622923', '622924', '622925'], self::VISA => ['4'], + self::MIR => ['2200', '2201', '2202', '2203', '2204'], ]; /** @@ -203,13 +207,20 @@ public function addType($type) } foreach ($type as $typ) { - if (defined('self::' . strtoupper($typ)) && ! in_array($typ, $this->options['type'])) { - $this->options['type'][] = $typ; - } - if (($typ == self::ALL)) { $this->options['type'] = array_keys($this->cardLength); + continue; + } + + if (in_array($typ, $this->options['type'])) { + continue; + } + + $constant = 'static::' . strtoupper($typ); + if (! defined($constant) || in_array(constant($constant), $this->options['type'])) { + continue; } + $this->options['type'][] = constant($constant); } return $this; diff --git a/vendor/zendframework/zend-validator/src/Csrf.php b/vendor/zendframework/zend-validator/src/Csrf.php index 3c888c8..2f9079c 100644 --- a/vendor/zendframework/zend-validator/src/Csrf.php +++ b/vendor/zendframework/zend-validator/src/Csrf.php @@ -116,7 +116,11 @@ public function __construct($options = []) */ public function isValid($value, $context = null) { - $this->setValue((string) $value); + if (! is_string($value)) { + return false; + } + + $this->setValue($value); $tokenId = $this->getTokenIdFromHash($value); $hash = $this->getValidationToken($tokenId); diff --git a/vendor/zendframework/zend-validator/src/Hostname.php b/vendor/zendframework/zend-validator/src/Hostname.php index f30c35f..97d543b 100644 --- a/vendor/zendframework/zend-validator/src/Hostname.php +++ b/vendor/zendframework/zend-validator/src/Hostname.php @@ -69,7 +69,7 @@ class Hostname extends AbstractValidator /** * Array of valid top-level-domains - * IanaVersion 2017082200 + * IanaVersion 2018013101 * * @see ftp://data.iana.org/TLD/tlds-alpha-by-domain.txt List of all TLDs by domain * @see http://www.iana.org/domains/root/db/ Official list of supported TLDs @@ -321,7 +321,6 @@ class Hostname extends AbstractValidator 'chat', 'cheap', 'chintai', - 'chloe', 'christmas', 'chrome', 'chrysler', @@ -672,7 +671,6 @@ class Hostname extends AbstractValidator 'hr', 'hsbc', 'ht', - 'htc', 'hu', 'hughes', 'hyatt', @@ -866,8 +864,6 @@ class Hostname extends AbstractValidator 'mattel', 'mba', 'mc', - 'mcd', - 'mcdonalds', 'mckinsey', 'md', 'me', @@ -909,7 +905,6 @@ class Hostname extends AbstractValidator 'monash', 'money', 'monster', - 'montblanc', 'mopar', 'mormon', 'mortgage', @@ -1015,7 +1010,6 @@ class Hostname extends AbstractValidator 'ovh', 'pa', 'page', - 'pamperedchef', 'panasonic', 'panerai', 'paris', @@ -1239,6 +1233,7 @@ class Hostname extends AbstractValidator 'soy', 'space', 'spiegel', + 'sport', 'spot', 'spreadbetting', 'sr', @@ -1566,6 +1561,7 @@ class Hostname extends AbstractValidator '健康', 'ไทย', 'سورية', + '招聘', 'рус', 'рф', '珠宝', diff --git a/vendor/zendframework/zend-validator/src/Iban.php b/vendor/zendframework/zend-validator/src/Iban.php index 926573b..af148e0 100644 --- a/vendor/zendframework/zend-validator/src/Iban.php +++ b/vendor/zendframework/zend-validator/src/Iban.php @@ -56,7 +56,8 @@ class Iban extends AbstractValidator protected static $sepaCountries = [ 'AT', 'BE', 'BG', 'CY', 'CZ', 'DK', 'FO', 'GL', 'EE', 'FI', 'FR', 'DE', 'GI', 'GR', 'HU', 'IS', 'IE', 'IT', 'LV', 'LI', 'LT', 'LU', 'MT', 'MC', - 'NL', 'NO', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'CH', 'GB' + 'NL', 'NO', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'CH', 'GB', 'SM', + 'HR', ]; /** diff --git a/vendor/zendframework/zend-validator/src/Regex.php b/vendor/zendframework/zend-validator/src/Regex.php index 5c3764f..2a6af7c 100644 --- a/vendor/zendframework/zend-validator/src/Regex.php +++ b/vendor/zendframework/zend-validator/src/Regex.php @@ -45,7 +45,7 @@ class Regex extends AbstractValidator /** * Sets validator options * - * @param string|Traversable $pattern + * @param string|array|Traversable $pattern * @throws Exception\InvalidArgumentException On missing 'pattern' parameter */ public function __construct($pattern) diff --git a/vendor/zendframework/zend-validator/src/ValidatorPluginManager.php b/vendor/zendframework/zend-validator/src/ValidatorPluginManager.php index ef0d2fa..48f4119 100644 --- a/vendor/zendframework/zend-validator/src/ValidatorPluginManager.php +++ b/vendor/zendframework/zend-validator/src/ValidatorPluginManager.php @@ -120,6 +120,9 @@ class ValidatorPluginManager extends AbstractPluginManager 'FileWordCount' => File\WordCount::class, 'float' => I18nValidator\IsFloat::class, 'Float' => I18nValidator\IsFloat::class, + 'gpspoint' => GpsPoint::class, + 'gpsPoint' => GpsPoint::class, + 'GpsPoint' => GpsPoint::class, 'greaterthan' => GreaterThan::class, 'greaterThan' => GreaterThan::class, 'GreaterThan' => GreaterThan::class, @@ -230,6 +233,7 @@ class ValidatorPluginManager extends AbstractPluginManager File\UploadFile::class => InvokableFactory::class, File\WordCount::class => InvokableFactory::class, I18nValidator\IsFloat::class => InvokableFactory::class, + GpsPoint::class => InvokableFactory::class, GreaterThan::class => InvokableFactory::class, Hex::class => InvokableFactory::class, Hostname::class => InvokableFactory::class, @@ -318,6 +322,7 @@ class ValidatorPluginManager extends AbstractPluginManager 'zendvalidatorfileupload' => InvokableFactory::class, 'zendvalidatorfileuploadfile' => InvokableFactory::class, 'zendvalidatorfilewordcount' => InvokableFactory::class, + 'zendvalidatorgpspoint' => InvokableFactory::class, 'zendvalidatorgreaterthan' => InvokableFactory::class, 'zendvalidatorhex' => InvokableFactory::class, 'zendvalidatorhostname' => InvokableFactory::class, From dea618d31dd20a52d2a1044f72c79ece4564893d Mon Sep 17 00:00:00 2001 From: Florian Evertz Date: Fri, 16 Feb 2018 15:05:19 +0100 Subject: [PATCH 09/62] [refactor](-) Format - resolving psr2 hints --- .../heidelpay_standard.class.php | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/version/114/paymentmethod/heidelpay_standard.class.php b/version/114/paymentmethod/heidelpay_standard.class.php index bb64e1b..e0ff13c 100644 --- a/version/114/paymentmethod/heidelpay_standard.class.php +++ b/version/114/paymentmethod/heidelpay_standard.class.php @@ -747,8 +747,8 @@ public function handleNotification($order, $paymentHash, $args) $error = $HeidelpayResponse->getError(); //TODO: an dieser Stelle auf INSURANCE-Dingens prüfen und Funktion ausführen - echo $this->getErrorReturnURL($order) . '&hperror=' . $error['code']. - $this->disableInvoiceSecured($args); + echo $this->getErrorReturnURL($order) . '&hperror=' . $error['code'] . + $this->disableInvoiceSecured($args); } elseif ($HeidelpayResponse->isPending()) { echo $this->getReturnURL($order); } @@ -763,7 +763,7 @@ public function handleNotification($order, $paymentHash, $args) */ public function verifyNotification($order, $post) { - if ($post['CLEARING_AMOUNT'] != number_format($order->fGesamtsummeKundenwaehrung, 2, '.', '')) { + if ($post['CLEARING_AMOUNT'] != number_format($order->fGesamtsummeKundenwaehrung,2, '.', '')) { return false; } @@ -781,7 +781,8 @@ public function verifyNotification($order, $post) */ public function setPayInfo($post, $orderId) { - $bookingtext = 'Bitte überweisen Sie uns den Betrag von ' . $post['PRESENTATION_AMOUNT'] . ' ' . $post['PRESENTATION_CURRENCY'] . ' nach Erhalt der Ware auf folgendes Konto: + $bookingtext = 'Bitte überweisen Sie uns den Betrag von ' . $post['PRESENTATION_AMOUNT'] . ' ' . + $post['PRESENTATION_CURRENCY'] . ' nach Erhalt der Ware auf folgendes Konto: Kontoinhaber: ' . $post['CONNECTOR_ACCOUNT_HOLDER'] . ' IBAN: ' . $post['CONNECTOR_ACCOUNT_IBAN'] . ' @@ -803,14 +804,23 @@ public function setPayInfo($post, $orderId) */ public function getErrorReturnURL($order) { - if (!isset($_SESSION['Zahlungsart']->nWaehrendBestellung) || $_SESSION['Zahlungsart']->nWaehrendBestellung == 0) { - + if (!isset($_SESSION['Zahlungsart']->nWaehrendBestellung) || + $_SESSION['Zahlungsart']->nWaehrendBestellung == 0) { return $order->BestellstatusURL; } return Shop::getURL() . '/bestellvorgang.php'; } + public function disableInvoiceSecured($response) + { + if (isset($response['CRITERION_INSURANCE-RESERVATION']) && + $response['CRITERION_INSURANCE-RESERVATION'] === 'DENIED') { + return '&disableInvoice=true'; + } + return ''; + } + public function finalizeOrder($order, $hash, $args) { global $cEditZahlungHinweis; @@ -829,15 +839,6 @@ public function finalizeOrder($order, $hash, $args) } } - public function disableInvoiceSecured($response) - { - if (isset($response['CRITERION_INSURANCE-RESERVATION'])&& - $response['CRITERION_INSURANCE-RESERVATION'] === 'DENIED') { - return '&disableInvoice=true'; - } - return ''; - } - /** * prepares payment text * @@ -848,7 +849,8 @@ public function disableInvoiceSecured($response) public function prepaymentText($res, $lang = 'EN') { if ($lang == 'DE') { - define('PREPAYMENT_TEXT', + define( + 'PREPAYMENT_TEXT', 'Bitte überweisen Sie uns den Betrag von {CURRENCY} {AMOUNT} auf folgendes Konto:

Land : {ACC_COUNTRY}
Kontoinhaber : {ACC_OWNER}
@@ -858,9 +860,11 @@ public function prepaymentText($res, $lang = 'EN') BIC: {ACC_BIC}


Geben sie bitte im Verwendungszweck UNBEDINGT die Identifikationsnummer
{SHORTID}
- und NICHTS ANDERES an.
'); + und NICHTS ANDERES an.' + ); } else { - define('PREPAYMENT_TEXT', + define( + 'PREPAYMENT_TEXT', 'Please transfer the amount of {CURRENCY} {AMOUNT} to the following account:

Country : {ACC_COUNTRY}
Account holder : {ACC_OWNER}
@@ -870,7 +874,8 @@ public function prepaymentText($res, $lang = 'EN') BIC: {ACC_BIC}


Please use the identification number
{SHORTID}
- as the descriptor and nothing else. Otherwise we cannot match your transaction!
'); + as the descriptor and nothing else. Otherwise we cannot match your transaction!' + ); } $repl = array( From f12c6425db87174ba4348e1eb97bd3179a8244d9 Mon Sep 17 00:00:00 2001 From: Florian Evertz Date: Fri, 16 Feb 2018 15:17:35 +0100 Subject: [PATCH 10/62] [refactor](-) change isset to array_key_exists --- version/114/frontend/heidelpay.hook008.php | 2 +- .../heidelpay_standard.class.php | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/version/114/frontend/heidelpay.hook008.php b/version/114/frontend/heidelpay.hook008.php index 4f99c11..5327b91 100644 --- a/version/114/frontend/heidelpay.hook008.php +++ b/version/114/frontend/heidelpay.hook008.php @@ -6,7 +6,7 @@ * Time: 12:09 */ -if (isset($_GET['disableInvoice']) && $_GET['disableInvoice']) { +if (array_key_exists('disableInvoice', $_GET) && $_GET['disableInvoice']) { $_SESSION['InvoiceDisabled'] = true; } diff --git a/version/114/paymentmethod/heidelpay_standard.class.php b/version/114/paymentmethod/heidelpay_standard.class.php index 428d1e8..6bc04e6 100644 --- a/version/114/paymentmethod/heidelpay_standard.class.php +++ b/version/114/paymentmethod/heidelpay_standard.class.php @@ -726,8 +726,8 @@ public function handleNotification($order, $paymentHash, $args) $error = $HeidelpayResponse->getError(); //TODO: an dieser Stelle auf INSURANCE-Dingens prüfen und Funktion ausführen - echo $this->getErrorReturnURL($order) . '&hperror=' . $error['code']. - $this->disableInvoiceSecured($args); + echo $this->getErrorReturnURL($order) . '&hperror=' . $error['code'] . + $this->disableInvoiceSecured($args); } elseif ($HeidelpayResponse->isPending()) { echo $this->getReturnURL($order); } @@ -790,6 +790,15 @@ public function getErrorReturnURL($order) return Shop::getURL() . '/bestellvorgang.php'; } + public function disableInvoiceSecured($response) + { + if (array_key_exists('CRITERION_INSURANCE-RESERVATION', $response) && + $response['CRITERION_INSURANCE-RESERVATION'] === 'DENIED') { + return '&disableInvoice=true'; + } + return ''; + } + public function finalizeOrder($order, $hash, $args) { global $cEditZahlungHinweis; @@ -808,15 +817,6 @@ public function finalizeOrder($order, $hash, $args) } } - public function disableInvoiceSecured($response) - { - if (isset($response['CRITERION_INSURANCE-RESERVATION'])&& - $response['CRITERION_INSURANCE-RESERVATION'] === 'DENIED') { - return '&disableInvoice=true'; - } - return ''; - } - /** * prepares payment text * From 089b5e3cca049e39d1155662aaf65a6325dc76ed Mon Sep 17 00:00:00 2001 From: Florian Evertz Date: Fri, 16 Feb 2018 15:46:08 +0100 Subject: [PATCH 11/62] [refactor](-) solve PSR 2 hints --- .../heidelpay_standard.class.php | 81 +++++++++++-------- 1 file changed, 47 insertions(+), 34 deletions(-) diff --git a/version/114/paymentmethod/heidelpay_standard.class.php b/version/114/paymentmethod/heidelpay_standard.class.php index 9d6913d..25c32f6 100644 --- a/version/114/paymentmethod/heidelpay_standard.class.php +++ b/version/114/paymentmethod/heidelpay_standard.class.php @@ -50,7 +50,7 @@ public function setShortId($shortId, $orderId) $sql = 'UPDATE `tbestellung` SET `cKommentar` = ? WHERE `cBestellNr` = ?'; - $GLOBALS ["DB"]->executeQueryPrepared($sql, array($shortId, $orderId), 3); + $GLOBALS ['DB']->executeQueryPrepared($sql, array($shortId, $orderId), 3); } /** @@ -179,7 +179,7 @@ public function init($nAgainCheckout = 0) $this->caption = 'Heidelpay'; $sql = "SELECT * FROM `tzahlungsart` WHERE `cModulId` = '{$this->moduleID}'"; - $this->info = $GLOBALS ["DB"]->executeQuery($sql, 1); + $this->info = $GLOBALS ['DB']->executeQuery($sql, 1); } /** @@ -418,15 +418,18 @@ public function isEqualAddress($order) ); foreach ($keyList as $key) { // key exists only in billing address - if (array_key_exists($key, (array)$order->oRechnungsadresse) and !array_key_exists($key, (array)$order->Lieferadresse)) { + if (array_key_exists($key, (array)$order->oRechnungsadresse) and + !array_key_exists($key, (array)$order->Lieferadresse)) { return false; } // key exists only in delivery address - if (array_key_exists($key, (array)$order->Lieferadresse) and !array_key_exists($key, (array)$order->oRechnungsadresse)) { + if (array_key_exists($key, (array)$order->Lieferadresse) and + !array_key_exists($key, (array)$order->oRechnungsadresse)) { return false; } // merge keys - if (array_key_exists($key, (array)$order->Lieferadresse) and array_key_exists($key, (array)$order->oRechnungsadresse)) { + if (array_key_exists($key, (array)$order->Lieferadresse) and + array_key_exists($key, (array)$order->oRechnungsadresse)) { // return false on unmatched if ($order->Lieferadresse->$key != $order->oRechnungsadresse->$key) { return false; @@ -534,10 +537,9 @@ public function setPaymentTemplate($paymentMethodPrefix) */ public function getPayButtonLabel() { + $payButtonLabel = 'Pay now'; if ($_SESSION ['cISOSprache'] == 'ger') { $payButtonLabel = 'Jetzt zahlen'; - } else { - $payButtonLabel = 'Pay now'; } return $payButtonLabel; } @@ -549,10 +551,9 @@ public function getPayButtonLabel() */ public function getPayText() { + $payText = 'Please complete the following data and complete the order process.'; if ($_SESSION ['cISOSprache'] == 'ger') { $payText = 'Bitte vervollständigen Sie die unten aufgeführten Daten und schließen Sie den Bestellprozess ab.'; - } else { - $payText = 'Please complete the following data and complete the order process.'; } return $payText; } @@ -564,10 +565,9 @@ public function getPayText() */ public function getHolderLabel() { + $holderLabel = 'Holder'; if ($_SESSION ['cISOSprache'] == 'ger') { $holderLabel = 'Kontoinhaber'; - } else { - $holderLabel = 'Holder'; } return $holderLabel; } @@ -579,10 +579,9 @@ public function getHolderLabel() */ public function getBirthdateLabel() { + $birthdateLabel = 'Birthdate'; if ($_SESSION ['cISOSprache'] == 'ger') { $birthdateLabel = 'Geburtsdatum'; - } else { - $birthdateLabel = 'Birthdate'; } return $birthdateLabel; } @@ -594,10 +593,9 @@ public function getBirthdateLabel() */ public function getSalutationArray() { + $salutationArray = array('MR' => 'Mr', 'MRS' => 'Mrs'); if ($_SESSION ['cISOSprache'] == 'ger') { $salutationArray = array('MR' => 'Herr', 'MRS' => 'Frau'); - } else { - $salutationArray = array('MR' => 'Mr', 'MRS' => 'Mrs'); } return $salutationArray; } @@ -609,10 +607,9 @@ public function getSalutationArray() */ public function getSalutation() { + $salutation = 'MRS'; if ($_SESSION['Kunde']->cAnrede == 'm') { $salutation = 'MR'; - } else { - $salutation = 'MRS'; } return $salutation; } @@ -656,7 +653,8 @@ public function handleNotification($order, $paymentHash, $args) /* If the verification does not match this can mean some kind of manipulation or * miss configuration. So you can log $e->getMessage() for debugging.*/ $callers = debug_backtrace(); - Jtllog::write("Heidelpay - " . $callers [0] ['function'] . ": Invalid response hash from " . $_SERVER ['REMOTE_ADDR'] . ", suspecting manipulation", 2, false, 'Notify'); + Jtllog::write("Heidelpay - " . $callers [0] ['function'] . ": Invalid response hash from " . + $_SERVER ['REMOTE_ADDR'] . ", suspecting manipulation", 2, false, 'Notify'); exit(); } } else { @@ -666,12 +664,14 @@ public function handleNotification($order, $paymentHash, $args) /* save order and transaction result to your database */ if ($this->verifyNotification($order, $args)) { $payCode = explode('.', $args ['PAYMENT_CODE']); - if ((strtoupper($payCode [0]) == 'DD') && (!isset($args ['TRANSACTION_SOURCE']))) { + if (strtoupper($payCode [0]) == 'DD' && !isset($args ['TRANSACTION_SOURCE'])) { $language = $_SESSION ['cISOSprache'] == 'ger' ? 'DE' : 'EN'; if ($language == 'DE') { - include_once(PFAD_ROOT . PFAD_PLUGIN . 'heidelpay_standard/version/112/paymentmethod/template/heidelpay_ddMail_de.tpl'); + include_once PFAD_ROOT . PFAD_PLUGIN . $oPlugin->cVerzeichnis . '/version/' . + $oPlugin->nVersion . '/paymentmethod/template/heidelpay_ddMail_de.tpl'; } else { - include_once(PFAD_ROOT . PFAD_PLUGIN . 'heidelpay_standard/version/112/paymentmethod/template/heidelpay_ddMail_en.tpl'); + include_once PFAD_ROOT . PFAD_PLUGIN . $oPlugin->cVerzeichnis . '/version/' . + $oPlugin->nVersion . '/paymentmethod/template/heidelpay_ddMail_en.tpl'; } $repl = array( '{ACC_IBAN}' => $args ['ACCOUNT_IBAN'], @@ -681,18 +681,25 @@ public function handleNotification($order, $paymentHash, $args) '{CURRENCY}' => $args ['PRESENTATION_CURRENCY'], '{HOLDER}' => $args ['ACCOUNT_HOLDER'] ); - if ((isset($args ['IDENTIFICATION_CREDITOR_ID']) && ($args ['IDENTIFICATION_CREDITOR_ID'] != ''))) { + if (isset($args ['IDENTIFICATION_CREDITOR_ID']) && ($args ['IDENTIFICATION_CREDITOR_ID'] != '')) { $repl ['{IDENT_CREDITOR}'] = $args ['IDENTIFICATION_CREDITOR_ID']; } else { $repl ['{IDENT_CREDITOR}'] = '-'; } - mail($order->oRechnungsadresse->cMail, constant('DD_MAIL_SUBJECT'), strtr(constant('DD_MAIL_TEXT'), $repl), constant('DD_MAIL_HEADERS')); - } elseif ((strtoupper($payCode [0]) == 'PP') && (!isset($args ['TRANSACTION_SOURCE']))) { + mail( + $order->oRechnungsadresse->cMail, + constant('DD_MAIL_SUBJECT'), + strtr(constant('DD_MAIL_TEXT'), $repl), + constant('DD_MAIL_HEADERS') + ); + } elseif (strtoupper($payCode [0]) == 'PP' && !isset($args ['TRANSACTION_SOURCE'])) { $language = $_SESSION ['cISOSprache'] == 'ger' ? 'DE' : 'EN'; if ($language == 'DE') { - include_once(PFAD_ROOT . PFAD_PLUGIN . 'heidelpay_standard/version/112/paymentmethod/template/heidelpay_ppMail_de.tpl'); + include_once PFAD_ROOT . PFAD_PLUGIN . $oPlugin->cVerzeichnis . '/version/' . + $oPlugin->nVersion . '/paymentmethod/template/heidelpay_ppMail_de.tpl'; } else { - include_once(PFAD_ROOT . PFAD_PLUGIN . 'heidelpay_standard/version/112/paymentmethod/template/heidelpay_ppMail_en.tpl'); + include_once PFAD_ROOT . PFAD_PLUGIN . $oPlugin->cVerzeichnis . '/version/' . + $oPlugin->nVersion . '/paymentmethod/template/heidelpay_ppMail_en.tpl'; } $repl = array( '{ACC_IBAN}' => $args ['CONNECTOR_ACCOUNT_IBAN'], @@ -702,15 +709,22 @@ public function handleNotification($order, $paymentHash, $args) '{CURRENCY}' => $args ['PRESENTATION_CURRENCY'], '{USAGE}' => $args ['IDENTIFICATION_SHORTID'] ); - mail($order->oRechnungsadresse->cMail, constant('PP_MAIL_SUBJECT'), strtr(constant('PP_MAIL_TEXT'), $repl), constant('PP_MAIL_HEADERS')); + mail( + $order->oRechnungsadresse->cMail, + constant('PP_MAIL_SUBJECT'), + strtr(constant('PP_MAIL_TEXT'), $repl), + constant('PP_MAIL_HEADERS') + ); } elseif ((strtoupper($payCode [0]) == 'IV') && (!isset($args ['TRANSACTION_SOURCE']))) { $this->setPayInfo($args, $order->cBestellNr); } - if (strtoupper($payCode [0]) != 'PP' AND strtoupper($payCode [0]) != 'IV') { // Nur wenn nicht Vorkasse od. Rechnung + // Nur wenn nicht Vorkasse od. Rechnung + if (strtoupper($payCode [0]) != 'PP' AND strtoupper($payCode [0]) != 'IV') { try { $this->setOrderStatusToPaid($order); } catch (Exception $e) { - $e = 'Update order status failed on order: ' . $order . ' in file: ' . $e->getFile() . ' on line: ' . $e->getLine() . ' with message: ' . $e->getMessage(); + $e = 'Update order status failed on order: ' . $order . ' in file: ' . + $e->getFile() . ' on line: ' . $e->getLine() . ' with message: ' . $e->getMessage(); $logData = array( 'module' => 'Heidelpay Standard', 'order' => $order, @@ -721,7 +735,8 @@ public function handleNotification($order, $paymentHash, $args) try { $this->sendConfirmationMail($order); } catch (Exception $e) { - $e = 'Update order status failed on order: ' . $order . ' in file: ' . $e->getFile() . ' on line: ' . $e->getLine() . ' with message: ' . $e->getMessage(); + $e = 'Update order status failed on order: ' . $order . ' in file: ' . + $e->getFile() . ' on line: ' . $e->getLine() . ' with message: ' . $e->getMessage(); $logData = array( 'module' => 'Heidelpay Standard', 'order' => $order, @@ -745,8 +760,6 @@ public function handleNotification($order, $paymentHash, $args) /*save order */ } elseif ($HeidelpayResponse->isError()) { $error = $HeidelpayResponse->getError(); - //TODO: an dieser Stelle auf INSURANCE-Dingens prüfen und Funktion ausführen - echo $this->getErrorReturnURL($order) . '&hperror=' . $error['code'] . $this->disableInvoiceSecured($args); } elseif ($HeidelpayResponse->isPending()) { @@ -763,7 +776,7 @@ public function handleNotification($order, $paymentHash, $args) */ public function verifyNotification($order, $post) { - if ($post['CLEARING_AMOUNT'] != number_format($order->fGesamtsummeKundenwaehrung,2, '.', '')) { + if ($post['CLEARING_AMOUNT'] != number_format($order->fGesamtsummeKundenwaehrung, 2, '.', '')) { return false; } @@ -794,7 +807,7 @@ public function setPayInfo($post, $orderId) $sql = 'UPDATE `tbestellung` SET `cKommentar` ="' . htmlspecialchars(utf8_decode($bookingtext)) . '" WHERE `cBestellNr` ="' . htmlspecialchars($orderId) . '";'; - $GLOBALS ["DB"]->executeQuery($sql, 1); + $GLOBALS ['DB']->executeQuery($sql, 1); } /** From 92a2ecbb0225cbf94a50840934ed3b5aa3ceee18 Mon Sep 17 00:00:00 2001 From: Florian Evertz Date: Wed, 21 Feb 2018 16:23:18 +0100 Subject: [PATCH 12/62] [feature](JTL-15) add uniqueID to addIncomingPayment Added field cHinweis to be set in DB tzahlungseingang. cHinweis will be Transaction-ID in JTL Wawi after synchronisation. --- version/114/paymentmethod/heidelpay_standard.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/version/114/paymentmethod/heidelpay_standard.class.php b/version/114/paymentmethod/heidelpay_standard.class.php index 25c32f6..ba6e6db 100644 --- a/version/114/paymentmethod/heidelpay_standard.class.php +++ b/version/114/paymentmethod/heidelpay_standard.class.php @@ -750,6 +750,7 @@ public function handleNotification($order, $paymentHash, $args) $incomingPayment = new stdClass(); $incomingPayment->fBetrag = number_format($order->fGesamtsummeKundenwaehrung, 2, '.', ''); $incomingPayment->cISO = $order->Waehrung->cISO; + $incomingPayment->cHinweis = $args['IDENTIFICATION_UNIQUEID']; $this->addIncomingPayment($order, $incomingPayment); } $this->updateNotificationID($order->kBestellung, $args['IDENTIFICATION_UNIQUEID']); From 1552d8b7b47c725cea01250d60076f5c4ed5e7dc Mon Sep 17 00:00:00 2001 From: Florian Evertz Date: Thu, 22 Feb 2018 14:24:19 +0100 Subject: [PATCH 13/62] [feature](JTL-15) add array_key_exists --- version/114/paymentmethod/heidelpay_standard.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/version/114/paymentmethod/heidelpay_standard.class.php b/version/114/paymentmethod/heidelpay_standard.class.php index ba6e6db..fb41a27 100644 --- a/version/114/paymentmethod/heidelpay_standard.class.php +++ b/version/114/paymentmethod/heidelpay_standard.class.php @@ -750,7 +750,8 @@ public function handleNotification($order, $paymentHash, $args) $incomingPayment = new stdClass(); $incomingPayment->fBetrag = number_format($order->fGesamtsummeKundenwaehrung, 2, '.', ''); $incomingPayment->cISO = $order->Waehrung->cISO; - $incomingPayment->cHinweis = $args['IDENTIFICATION_UNIQUEID']; + $incomingPayment->cHinweis = (array_key_exists('IDENTIFICATION_UNIQUEID', $args) + ? $args['IDENTIFICATION_UNIQUEID'] : ''); $this->addIncomingPayment($order, $incomingPayment); } $this->updateNotificationID($order->kBestellung, $args['IDENTIFICATION_UNIQUEID']); From 67ba5f76f606fc3570cc7255e04eeb6cf37c1a07 Mon Sep 17 00:00:00 2001 From: Florian Evertz Date: Mon, 26 Feb 2018 13:35:43 +0100 Subject: [PATCH 14/62] =?UTF-8?q?[change](JTL-16)=20renamed=20Sofort=C3=BC?= =?UTF-8?q?berweisung=20to=20Sofort?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- info.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/info.xml b/info.xml index d560057..c69d5b5 100644 --- a/info.xml +++ b/info.xml @@ -215,7 +215,7 @@ - Heidelpay Sofortberweisung Plugin + Heidelpay Sofort Plugin template/heidelpay.png 3 0 @@ -229,9 +229,9 @@ heidelpay_standard template/new_bestellabschluss.tpl - Sofortberweisung - Sofortberweisung - Sicher zahlen per Sofortberweisung + Sofort + Sofort + Sicher zahlen per Sofort SofortBanking From 95cfe58b26f341aae76774382d5dc498fd8d1d13 Mon Sep 17 00:00:00 2001 From: Florian Evertz Date: Tue, 27 Feb 2018 15:19:01 +0100 Subject: [PATCH 15/62] [refactor](JTL-18) renamed Heidelberger Payment GmbH to heidelpay GmbH --- LICENSE.txt | 78 +++++++++---------- version/114/frontend/heidelpay.hook140.php | 4 +- version/114/frontend/heidelpay.hook153.php | 2 +- version/114/frontend/heidelpay_style.css | 2 +- .../heidelpay_standard.class.php | 2 +- version/114/paymentmethod/returnHPMailStr.php | 2 +- .../template/css/hppaymentframe.css | 2 +- .../template/heidelpay_3dsecure.tpl | 2 +- .../template/heidelpay_CreditDebitCard.tpl | 2 +- .../template/heidelpay_DirectDebit.tpl | 2 +- .../template/heidelpay_InvoiceSec.tpl | 2 +- .../template/heidelpay_Santander.tpl | 2 +- .../template/heidelpay_ddMail_de.tpl | 2 +- .../template/heidelpay_ddMail_en.tpl | 2 +- .../template/heidelpay_iDealEPS_Bank.tpl | 2 +- .../template/heidelpay_ppMail_de.tpl | 2 +- .../template/heidelpay_ppMail_en.tpl | 2 +- .../template/js/birthDateAction.js | 2 +- .../template/js/creditCardFrame.js | 2 +- .../template/new_bestellabschluss.tpl | 2 +- .../template/old_bestellabschluss.tpl | 2 +- 21 files changed, 60 insertions(+), 60 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 436193f..e1cd396 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -3,51 +3,51 @@ Lizenzvereinbarung Plug-in -I. Prambel +I. Pr�ambel - Diese Lizenzvereinbarung Plug-in (nachfolgend Vereinbarung) bildet einen Vertrag zwischen dem Nutzer des Plug-ins und der Heidelberger Payment GmbH (nachfolgend heidelpay). + Diese Lizenzvereinbarung Plug-in (nachfolgend � �Vereinbarung�) bildet einen Vertrag zwischen dem Nutzer des Plug-ins und der heidelpay GmbH (nachfolgend �heidelpay�). Das Plug-in von heidelpay ist ein Software-Programm, welches die Schnittstelle zum Payment-System von heidelpay mit einer Anwendung (zum Beispiel: Shopsystem, Warenwirtschaft, Debitorenmanagement etc.) verbindet. Das Plug-in dient dem Datenaustausch zwischen dem Payment-System von heidelpay und der Anwendung. Das Plug-in erweitert den Funktionsumfang der Anwendung hinsichtlich der mit heidelpay gesondert vertraglich vereinbarten Leistungen. - Diese Vereinbarung regelt die Bestimmungen unter denen heidelpay die Nutzung des zur Verfgung gestellten Plug-in gestattet. + Diese Vereinbarung regelt die Bestimmungen unter denen heidelpay die Nutzung des zur Verf�gung gestellten Plug-in gestattet. Dies vorausgeschickt, treffen der Nutzer und heidelpay die folgende Vereinbarung: II. Begriffsbestimmungen - Object Code Die maschinenlesbare, bersetzte Form des Plug-ins. + Object Code Die maschinenlesbare, �bersetzte Form des Plug-ins. - Plug-in Das unter dieser Lizenzvereinbarung angebotene Programm, das von heidelpay nach den Bestim-mungen dieser Lizenzvereinbarung verbreitet oder ffentlich zugnglich gemacht hat. + Plug-in Das unter dieser Lizenzvereinbarung angebotene Programm, das von heidelpay nach den Bestim-mungen dieser Lizenzvereinbarung verbreitet oder �ffentlich zug�nglich gemacht hat. - Source Code Die fr Menschen lesbare, in Programmiersprache dargestellte Form des Plug-in. + Source Code Die f�r Menschen lesbare, in Programmiersprache dargestellte Form des Plug-in. - Verndern Jede Erweiterung, Krzung und Bearbeitung des Plug-ins, insbesondere Weiterentwicklungen + Ver�ndern Jede Erweiterung, K�rzung und Bearbeitung des Plug-ins, insbesondere Weiterentwicklungen - Verbreiten Die ffentliche Weitergabe des Plug-ins, biespielsweise das Bereitstellen zum Download auf ffent-lich zugnglichen Internetseiten. + Verbreiten Die �ffentliche Weitergabe des Plug-ins, biespielsweise das Bereitstellen zum Download auf �ffent-lich zug�nglichen Internetseiten. III. Geltenden Bestimmungen - Im Falle eines zwischen dem Nutzer und heidelpay abgeschlossenen Hndlervertrages fr die Abwicklung der dort bestimmten Leistungen, gilt der Hndlervertrag ab Vertragsschluss und gilt in diesem Fall zustzlich zu dieser Ver-einbarung. Im Falle des Widerspruchs zwischen dieser Vereinbarung und dem Hndlervertrag hat der Hndlerver-trag Vorrang. + Im Falle eines zwischen dem Nutzer und heidelpay abgeschlossenen H�ndlervertrages f�r die Abwicklung der dort bestimmten Leistungen, gilt der H�ndlervertrag ab Vertragsschluss und gilt in diesem Fall zus�tzlich zu dieser Ver-einbarung. Im Falle des Widerspruchs zwischen dieser Vereinbarung und dem H�ndlervertrag hat der H�ndlerver-trag Vorrang. IV. Lizenz - 1. Diese Vereinbarung rumt nur solchen Nutzern Nutzungsrechte ein, die Unternehmer im Sinne des BGB sind. Eine Nutzung durch Verbraucher ist nicht gestattet. - 2. Die von heidelpay im Rahmen dieser Vereinbarung gewhrte Lizenz, ist fr den Nutzer unentgeltlich. - 3. Unter der Voraussetzung der Einhaltung der Bestimmungen dieser Vereinbarung, erteilt heidelpay dem Nut-zer das zeitlich unbefristete, widerrufliche, rumlich auf Europa begrenzte Recht, das Plug-in zu verndern, unverndert oder in vernderter Form zu dem in der Prambel dargestellten Zweck fr geschftliche Zwecke zu nutzen, d.h. das Plug-in zu speichern, ablaufen zu lassen, zu vervielfltigen, zu verbreiten und ffentlich zugnglich zu machen. - 4. Heidelpay kann neue Versionen/Updates des Plug-ins anbieten, die zum Beispiel Fehlerbehebungen und neue Funktionalitten beinhalten knnen. Heidelpay empfiehlt daher die regelmssige berprfung der Ak-tualitt des Plug-in, dies wird auf der Seite http://dev.heidelpay.de verffentlicht. Auch diese neuen Versio-nen/Updates unterliegen den Bedingungen dieser Vereinbarung. + 1. Diese Vereinbarung r�umt nur solchen Nutzern Nutzungsrechte ein, die Unternehmer im Sinne des BGB sind. Eine Nutzung durch Verbraucher ist nicht gestattet. + 2. Die von heidelpay im Rahmen dieser Vereinbarung gew�hrte Lizenz, ist f�r den Nutzer unentgeltlich. + 3. Unter der Voraussetzung der Einhaltung der Bestimmungen dieser Vereinbarung, erteilt heidelpay dem Nut-zer das zeitlich unbefristete, widerrufliche, r�umlich auf Europa begrenzte Recht, das Plug-in zu ver�ndern, unver�ndert oder in ver�nderter Form zu dem in der Pr�ambel dargestellten Zweck f�r gesch�ftliche Zwecke zu nutzen, d.h. das Plug-in zu speichern, ablaufen zu lassen, zu vervielf�ltigen, zu verbreiten und �ffentlich zug�nglich zu machen. + 4. heidelpay kann neue Versionen/Updates des Plug-ins anbieten, die zum Beispiel Fehlerbehebungen und neue Funktionalit�ten beinhalten k�nnen. heidelpay empfiehlt daher die regelm�ssige �berpr�fung der Ak-tualit�t des Plug-in, dies wird auf der Seite http://dev.heidelpay.de ver�ffentlicht. Auch diese neuen Versio-nen/Updates unterliegen den Bedingungen dieser Vereinbarung. -V. Beschrnkungen +V. Beschr�nkungen - 1. Durch diese Vereinbarung erfolgt keine bertragung jedweder Schutzrechte von heidelpay. - 2. Das Recht, das Plug-in zu verndern und diese vernderte Version zu vervielfltigen, zu verbreiten oder f-fentlich zugnglich zu machen, setzt voraus, dass + 1. Durch diese Vereinbarung erfolgt keine �bertragung jedweder Schutzrechte von heidelpay. + 2. Das Recht, das Plug-in zu ver�ndern und diese ver�nderte Version zu vervielf�ltigen, zu verbreiten oder �f-fentlich zug�nglich zu machen, setzt voraus, dass a. die im Source Code bzw. Object Code enthaltenen Hinweise auf diese Lizenz erhalten bleiben; und - b. alle Hinweise und Vermerke im Source Code bzw. Object Code, hinsichtlich des Urhebers des Plug-in un-verndert bleiben; und - c. ein deutlicher Hinweis erteilt wird, dass es sich um eine vernderte Version des Plug-in handelt, eine Do-kumentation darber, welche Teile verndert wurden, mitgeliefert wird; und - d. Heidelpay fr smtliche aus der Vernderung resultierende Ansprche freigestellt wird und zudem das vernderte Plug-in mit einer Klarstellung versehen wird, dass heidelpay fr das Plug-in in der vernderten Form keine Haftung bernimmt; und - e. das vernderte Plug-in unter einer Lizenzvereinbarung zur Verfgung gestellt wird, die das Interesse von heidelpay entsprechend den Bedingungen dieser Vereinbarung schtzt; und - f. die im Zusammenhang mit dem Plug-in angezeigten rechtlichen Hinweise nicht entfernt, verdeckt oder abgendert werden. - 3. Der Nutzer sichert zu, dass er bei der Nutzung des Plug-in von heidelpay die geltenden nationalen und inter-nationalen Gesetze einhlt; - 4. Der Nutzer sichert zu, heidelpay unverzglich zu informieren, wenn Dritte ihm gegenber Ansprche im Zu-sammenhang mit dem Plug-in anmelden und/oder behaupten, das Plug-in verletze Rechte Dritter, und hei-delpay alle Dokumente und/oder Informationen zur Verfgung zu stellen, die der Nutzer im Zusammenhang mit einem solchen Anspruch erhlt. + b. alle Hinweise und Vermerke im Source Code bzw. Object Code, hinsichtlich des Urhebers des Plug-in un-ver�ndert bleiben; und + c. ein deutlicher Hinweis erteilt wird, dass es sich um eine ver�nderte Version des Plug-in handelt, eine Do-kumentation dar�ber, welche Teile ver�ndert wurden, mitgeliefert wird; und + d. heidelpay f�r s�mtliche aus der Ver�nderung resultierende Anspr�che freigestellt wird und zudem das ver�nderte Plug-in mit einer Klarstellung versehen wird, dass heidelpay f�r das Plug-in in der ver�nderten Form keine Haftung �bernimmt; und + e. das ver�nderte Plug-in unter einer Lizenzvereinbarung zur Verf�gung gestellt wird, die das Interesse von heidelpay entsprechend den Bedingungen dieser Vereinbarung sch�tzt; und + f. die im Zusammenhang mit dem Plug-in angezeigten rechtlichen Hinweise nicht entfernt, verdeckt oder abge�ndert werden. + 3. Der Nutzer sichert zu, dass er bei der Nutzung des Plug-in von heidelpay die geltenden nationalen und inter-nationalen Gesetze einh�lt; + 4. Der Nutzer sichert zu, heidelpay unverz�glich zu informieren, wenn Dritte ihm gegen�ber Anspr�che im Zu-sammenhang mit dem Plug-in anmelden und/oder behaupten, das Plug-in verletze Rechte Dritter, und hei-delpay alle Dokumente und/oder Informationen zur Verf�gung zu stellen, die der Nutzer im Zusammenhang mit einem solchen Anspruch erh�lt. VI. Datenschutz @@ -55,34 +55,34 @@ VI. Datenschutz VII. FREISTELLUNG - Der Nutzer erklrt sich einverstanden, heidelpay, deren Tochtergesellschaften, angeschlossenen Unternehmen, Geschftsfhrer, leitenden Angestellten, Mitarbeiter, Vertreter, Geschftspartner und Lizenzgeber gegen alle An-sprche oder Forderungen Dritter, einschlielich Gerichtskosten, angemessener Anwaltsgebhren und Sachver-stndigenkosten, freizustellen, die entstehen weil: + Der Nutzer erkl�rt sich einverstanden, heidelpay, deren Tochtergesellschaften, angeschlossenen Unternehmen, Gesch�ftsf�hrer, leitenden Angestellten, Mitarbeiter, Vertreter, Gesch�ftspartner und Lizenzgeber gegen alle An-spr�che oder Forderungen Dritter, einschlie�lich Gerichtskosten, angemessener Anwaltsgeb�hren und Sachver-st�ndigenkosten, freizustellen, die entstehen weil: (a) die Nutzung des Plug-ins von heidelpay unter Verletzung der Bestimmungen dieser Vereinbarung erfolgt; oder - (b) der Nutzer gegen geltende Gesetze oder aufsichtsrechtliche Bestimmungen verstsst oder - (c) der Nutzer seine Identitt in einer falschen, betrgerischen, bswilligen oder unzutreffenden Weise dar-stellt. + (b) der Nutzer gegen geltende Gesetze oder aufsichtsrechtliche Bestimmungen verst�sst oder + (c) der Nutzer seine Identit�t in einer falschen, betr�gerischen, b�swilligen oder unzutreffenden Weise dar-stellt. VIII. TECHNISCHER SUPPORT - Heidelpay kann dem Nutzer, welcher das Plug-in in unverndertem Zustand nutzt, Support zur Verfgung stellen. Hierzu bedarf es einer gesonderten Vereinbarung zwischen dem Nutzer und heidelpay. + heidelpay kann dem Nutzer, welcher das Plug-in in unver�ndertem Zustand nutzt, Support zur Verf�gung stellen. Hierzu bedarf es einer gesonderten Vereinbarung zwischen dem Nutzer und heidelpay. -IX.LAUFZEIT UND KNDIGUNG +IX.LAUFZEIT UND K�NDIGUNG - 1. Diese Vereinbarung kann von den Parteien jederzeit fristlos gekndigt werden. + 1. Diese Vereinbarung kann von den Parteien jederzeit fristlos gek�ndigt werden. 2. Es steht heidelpay frei, das Downloadangebot jederzeit einzustellen. - 3. Alle Rechte des Nutzers aus dieser Vereinbarung erlschen unmittelbar, sobald der Nutzer wesentliche Best-immungen dieser Vereinbarung verletzt. - 4. Sobald diese Vereinbarung beendet ist oder der Nutzer seine Rechte gemss Ziffer 3 verliert, hat der Nutzer smtliche Kopien des Plug-ins (und alle entsprechenden Sicherungen) zu lschen. + 3. Alle Rechte des Nutzers aus dieser Vereinbarung erl�schen unmittelbar, sobald der Nutzer wesentliche Best-immungen dieser Vereinbarung verletzt. + 4. Sobald diese Vereinbarung beendet ist oder der Nutzer seine Rechte gem�ss Ziffer 3 verliert, hat der Nutzer s�mtliche Kopien des Plug-ins (und alle entsprechenden Sicherungen) zu l�schen. X. HAFTUNG - 1. Da die Lizenz unentgeltlich zur Verfgung gestellt wird, handelt es sich um einen Schenkungsvertrag, Daher haftet heidelpay fr etwaige Schden nur gem. 524 BGB. - 2. Soweit ein Schaden - unmittelbar oder mittelbar - auf einem Datenverlust beruht und heidelpay nach Ziffer 1 hierfr haftbar gemacht werden kann, ist die Haftung von heidelpay auf den Wiederherstellungsaufwand be-schrnkt, der bei regelmiger gefahrentsprechender Datensicherung eingetreten wre. - 3. Ansprche auf Schadensersatz, ausgenommen solche aus einer vorstzlichen oder grob fahrlssigen Pflicht-verletzung, einer Verletzung des Lebens, des Krpers, der Gesundheit, unerlaubter Handlung oder aus dem Produkthaftungsgesetz, verjhren sptestens in einem Jahr von dem Zeitpunkt an, an dem die geschdigte Partei von dem Schaden und den Umstnden, aus denen sich die Anspruchsberechtigung ergibt, Kenntnis er-langt, ohne Rcksicht auf Kenntnis drei Jahre ab dem schdigenden Ereignis. Krzere gesetzliche Verjh-rungsfristen bleiben unberhrt. + 1. Da die Lizenz unentgeltlich zur Verf�gung gestellt wird, handelt es sich um einen Schenkungsvertrag, Daher haftet heidelpay f�r etwaige Sch�den nur gem. � 524 BGB. + 2. Soweit ein Schaden - unmittelbar oder mittelbar - auf einem Datenverlust beruht und heidelpay nach Ziffer 1 hierf�r haftbar gemacht werden kann, ist die Haftung von heidelpay auf den Wiederherstellungsaufwand be-schr�nkt, der bei regelm��iger gefahrentsprechender Datensicherung eingetreten w�re. + 3. Anspr�che auf Schadensersatz, ausgenommen solche aus einer vors�tzlichen oder grob fahrl�ssigen Pflicht-verletzung, einer Verletzung des Lebens, des K�rpers, der Gesundheit, unerlaubter Handlung oder aus dem Produkthaftungsgesetz, verj�hren sp�testens in einem Jahr von dem Zeitpunkt an, an dem die gesch�digte Partei von dem Schaden und den Umst�nden, aus denen sich die Anspruchsberechtigung ergibt, Kenntnis er-langt, ohne R�cksicht auf Kenntnis drei Jahre ab dem sch�digenden Ereignis. K�rzere gesetzliche Verj�h-rungsfristen bleiben unber�hrt. XI. Schlussbestimmungen - 1. Diese Vereinbarung unterliegt den Gesetzen der Bundesrepublik Deutschland unter Ausschluss des UN-Kaufrechts. Der ausschlieliche Gerichtsstand ist das Landgericht Heidelberg. - 2. In einige Lnder, inklusive der Vereinigten Staaten von Amerika, gelten Exportbeschrnkungen. Das Plug-in kann solchen Beschrnkungen unterliegen. Diese sind insbesondere zu beachten, als das Plug-in in andere Lnder exportiert wird. Wenn der Nutzer das Plug-in exportiert, ist allein er fr die Einhaltung der magebli-chen Regelungen verantwortlich. In jedem Fall ist es untersagt, das Plug-in in ein Land zu exportieren, wel-ches einem Embargo der Vereinigten Staaten von Amerika oder der Europischen Union unterliegt, oder ei-ner Person zu berlassen, an die eine Lieferung nach U.S. amerikanischen oder europischen Regelung un-tersagt ist. - 3. Diese Bestimmungen oder die Nutzung des Plug-ins begrndet kein Joint Venture, keine Teilhaberschaft, kei-ne Beschftigung mit heidelpay und keine Befugnis zur Vertretung von heidelpay. - 4. Die Bestimmungen der Abschnitte IV, V, VI, VII, X, XI. berdauern die Beendigung dieser Bestimmungen, gleich aus welchem Grund. + 1. Diese Vereinbarung unterliegt den Gesetzen der Bundesrepublik Deutschland unter Ausschluss des UN-Kaufrechts. Der ausschlie�liche Gerichtsstand ist das Landgericht Heidelberg. + 2. In einige L�nder, inklusive der Vereinigten Staaten von Amerika, gelten Exportbeschr�nkungen. Das Plug-in kann solchen Beschr�nkungen unterliegen. Diese sind insbesondere zu beachten, als das Plug-in in andere L�nder exportiert wird. Wenn der Nutzer das Plug-in exportiert, ist allein er f�r die Einhaltung der ma�gebli-chen Regelungen verantwortlich. In jedem Fall ist es untersagt, das Plug-in in ein Land zu exportieren, wel-ches einem Embargo der Vereinigten Staaten von Amerika oder der Europ�ischen Union unterliegt, oder ei-ner Person zu �berlassen, an die eine Lieferung nach U.S. amerikanischen oder europ�ischen Regelung un-tersagt ist. + 3. Diese Bestimmungen oder die Nutzung des Plug-ins begr�ndet kein Joint Venture, keine Teilhaberschaft, kei-ne Besch�ftigung mit heidelpay und keine Befugnis zur Vertretung von heidelpay. + 4. Die Bestimmungen der Abschnitte IV, V, VI, VII, X, XI. �berdauern die Beendigung dieser Bestimmungen, gleich aus welchem Grund. ==== ENGLISH VERSION ==== @@ -90,7 +90,7 @@ Plug-in Licence Agreement I. Introduction - This Plug-in Licence Agreement (hereinafter 'Agreement') constitutes a contract between the plug-in user and Heidelberger Payment GmbH (hereinafter 'heidelpay'). + This Plug-in Licence Agreement (hereinafter 'Agreement') constitutes a contract between the plug-in user and heidelpay GmbH (hereinafter 'heidelpay'). The plug-in from heidelpay is a software programme which links the heidelpay payment system interface to an application (for example, shop system, merchandise management, debtor management etc.). The plug-in is used to exchange data between the heidelpay payment system and the application. The plug-in expands the range of features in the application with regard to the services agreed separately with heidelpay. diff --git a/version/114/frontend/heidelpay.hook140.php b/version/114/frontend/heidelpay.hook140.php index a820c41..d1e9033 100644 --- a/version/114/frontend/heidelpay.hook140.php +++ b/version/114/frontend/heidelpay.hook140.php @@ -5,7 +5,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. - * @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. + * @copyright Copyright � 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Ronja Wann * @category JTL @@ -23,7 +23,7 @@ $local = ($_SESSION ['cISOSprache'] == 'ger') ? 'de_DE' : 'en_US'; - $customerErrorMessage = new \Heidelpay\MessageCodeMapper\MessageCodeMapper($local); + $customerErrorMessage = new \heidelpay\MessageCodeMapper\MessageCodeMapper($local); $divStart = '
Error:
'; $divEnd = '
'; diff --git a/version/114/frontend/heidelpay.hook153.php b/version/114/frontend/heidelpay.hook153.php index 7f0b39b..60dd4b0 100644 --- a/version/114/frontend/heidelpay.hook153.php +++ b/version/114/frontend/heidelpay.hook153.php @@ -5,7 +5,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. - * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. + * @copyright Copyright © 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Ronja Wann * @category JTL diff --git a/version/114/frontend/heidelpay_style.css b/version/114/frontend/heidelpay_style.css index 6298c64..b3a8825 100644 --- a/version/114/frontend/heidelpay_style.css +++ b/version/114/frontend/heidelpay_style.css @@ -3,7 +3,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. -* @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. +* @copyright Copyright � 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Ronja Wann * @category JTL diff --git a/version/114/paymentmethod/heidelpay_standard.class.php b/version/114/paymentmethod/heidelpay_standard.class.php index fb41a27..c8c8ba8 100644 --- a/version/114/paymentmethod/heidelpay_standard.class.php +++ b/version/114/paymentmethod/heidelpay_standard.class.php @@ -5,7 +5,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. - * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. + * @copyright Copyright © 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Ronja Wann, Florian Evertz * @category JTL diff --git a/version/114/paymentmethod/returnHPMailStr.php b/version/114/paymentmethod/returnHPMailStr.php index f539886..5e40f45 100644 --- a/version/114/paymentmethod/returnHPMailStr.php +++ b/version/114/paymentmethod/returnHPMailStr.php @@ -7,7 +7,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. - * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. + * @copyright Copyright © 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Ronja Wann * @category JTL diff --git a/version/114/paymentmethod/template/css/hppaymentframe.css b/version/114/paymentmethod/template/css/hppaymentframe.css index b9bc69b..a55d3dc 100644 --- a/version/114/paymentmethod/template/css/hppaymentframe.css +++ b/version/114/paymentmethod/template/css/hppaymentframe.css @@ -3,7 +3,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. -* @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. +* @copyright Copyright � 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Ronja Wann * @category JTL diff --git a/version/114/paymentmethod/template/heidelpay_3dsecure.tpl b/version/114/paymentmethod/template/heidelpay_3dsecure.tpl index 77eb045..43fa196 100644 --- a/version/114/paymentmethod/template/heidelpay_3dsecure.tpl +++ b/version/114/paymentmethod/template/heidelpay_3dsecure.tpl @@ -3,7 +3,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. -* @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. +* @copyright Copyright � 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Andreas Nemet/Jens Richter/Marijo Prskalo/Ronja Wann * @category JTL diff --git a/version/114/paymentmethod/template/heidelpay_CreditDebitCard.tpl b/version/114/paymentmethod/template/heidelpay_CreditDebitCard.tpl index cb09b8d..506c6d7 100644 --- a/version/114/paymentmethod/template/heidelpay_CreditDebitCard.tpl +++ b/version/114/paymentmethod/template/heidelpay_CreditDebitCard.tpl @@ -3,7 +3,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. -* @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. +* @copyright Copyright � 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Andreas Nemet/Jens Richter/Marijo Prskalo/Ronja Wann * @category JTL diff --git a/version/114/paymentmethod/template/heidelpay_DirectDebit.tpl b/version/114/paymentmethod/template/heidelpay_DirectDebit.tpl index 4c70343..4ad0b22 100644 --- a/version/114/paymentmethod/template/heidelpay_DirectDebit.tpl +++ b/version/114/paymentmethod/template/heidelpay_DirectDebit.tpl @@ -3,7 +3,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. -* @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. +* @copyright Copyright � 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Ronja Wann * @category JTL diff --git a/version/114/paymentmethod/template/heidelpay_InvoiceSec.tpl b/version/114/paymentmethod/template/heidelpay_InvoiceSec.tpl index ae88ef4..c6c607d 100644 --- a/version/114/paymentmethod/template/heidelpay_InvoiceSec.tpl +++ b/version/114/paymentmethod/template/heidelpay_InvoiceSec.tpl @@ -3,7 +3,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. -* @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. +* @copyright Copyright � 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Andreas Nemet/Jens Richter/Marijo Prskalo/Ronja Wann * @category JTL diff --git a/version/114/paymentmethod/template/heidelpay_Santander.tpl b/version/114/paymentmethod/template/heidelpay_Santander.tpl index 4baa272..3ca87e8 100644 --- a/version/114/paymentmethod/template/heidelpay_Santander.tpl +++ b/version/114/paymentmethod/template/heidelpay_Santander.tpl @@ -3,7 +3,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. -* @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. +* @copyright Copyright � 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Andreas Nemet/Jens Richter/Marijo Prskalo/Ronja Wann * @category JTL diff --git a/version/114/paymentmethod/template/heidelpay_ddMail_de.tpl b/version/114/paymentmethod/template/heidelpay_ddMail_de.tpl index 2c0ccaf..eae6699 100644 --- a/version/114/paymentmethod/template/heidelpay_ddMail_de.tpl +++ b/version/114/paymentmethod/template/heidelpay_ddMail_de.tpl @@ -5,7 +5,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. -* @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. +* @copyright Copyright © 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Ronja Wann * @category JTL diff --git a/version/114/paymentmethod/template/heidelpay_ddMail_en.tpl b/version/114/paymentmethod/template/heidelpay_ddMail_en.tpl index e22841f..250401b 100644 --- a/version/114/paymentmethod/template/heidelpay_ddMail_en.tpl +++ b/version/114/paymentmethod/template/heidelpay_ddMail_en.tpl @@ -5,7 +5,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. -* @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. +* @copyright Copyright � 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Ronja Wann * @category JTL diff --git a/version/114/paymentmethod/template/heidelpay_iDealEPS_Bank.tpl b/version/114/paymentmethod/template/heidelpay_iDealEPS_Bank.tpl index 75aa066..a6e4869 100644 --- a/version/114/paymentmethod/template/heidelpay_iDealEPS_Bank.tpl +++ b/version/114/paymentmethod/template/heidelpay_iDealEPS_Bank.tpl @@ -3,7 +3,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. -* @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. +* @copyright Copyright � 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Andreas Nemet/Jens Richter/Marijo Prskalo/Ronja Wann * @category JTL diff --git a/version/114/paymentmethod/template/heidelpay_ppMail_de.tpl b/version/114/paymentmethod/template/heidelpay_ppMail_de.tpl index f65a50f..138c433 100644 --- a/version/114/paymentmethod/template/heidelpay_ppMail_de.tpl +++ b/version/114/paymentmethod/template/heidelpay_ppMail_de.tpl @@ -5,7 +5,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. -* @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. +* @copyright Copyright © 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Andreas Nemet/Jens Richter/Marijo Prskalo/Ronja Wann * @category JTL diff --git a/version/114/paymentmethod/template/heidelpay_ppMail_en.tpl b/version/114/paymentmethod/template/heidelpay_ppMail_en.tpl index bc1692c..dad0e98 100644 --- a/version/114/paymentmethod/template/heidelpay_ppMail_en.tpl +++ b/version/114/paymentmethod/template/heidelpay_ppMail_en.tpl @@ -5,7 +5,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. -* @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. +* @copyright Copyright © 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Andreas Nemet/Jens Richter/Marijo Prskalo/Ronja Wann * @category JTL diff --git a/version/114/paymentmethod/template/js/birthDateAction.js b/version/114/paymentmethod/template/js/birthDateAction.js index c2fddea..85b4610 100644 --- a/version/114/paymentmethod/template/js/birthDateAction.js +++ b/version/114/paymentmethod/template/js/birthDateAction.js @@ -4,7 +4,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. - * @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. + * @copyright Copyright � 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Ronja Wann * @category JTL diff --git a/version/114/paymentmethod/template/js/creditCardFrame.js b/version/114/paymentmethod/template/js/creditCardFrame.js index 3a866bc..f625f6f 100644 --- a/version/114/paymentmethod/template/js/creditCardFrame.js +++ b/version/114/paymentmethod/template/js/creditCardFrame.js @@ -4,7 +4,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. - * @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. + * @copyright Copyright � 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Ronja Wann * @category JTL diff --git a/version/114/paymentmethod/template/new_bestellabschluss.tpl b/version/114/paymentmethod/template/new_bestellabschluss.tpl index 8603758..c16259e 100644 --- a/version/114/paymentmethod/template/new_bestellabschluss.tpl +++ b/version/114/paymentmethod/template/new_bestellabschluss.tpl @@ -3,7 +3,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. -* @copyright Copyright � 2016-present Heidelberger Payment GmbH. All rights reserved. +* @copyright Copyright � 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Andreas Nemet/Jens Richter/Marijo Prskalo/Ronja Wann * @category JTL diff --git a/version/114/paymentmethod/template/old_bestellabschluss.tpl b/version/114/paymentmethod/template/old_bestellabschluss.tpl index 76329ba..9326511 100644 --- a/version/114/paymentmethod/template/old_bestellabschluss.tpl +++ b/version/114/paymentmethod/template/old_bestellabschluss.tpl @@ -3,7 +3,7 @@ * DESC * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. -* @copyright Copyright 2016-present Heidelberger Payment GmbH. All rights reserved. +* @copyright Copyright � 2016-present heidelpay GmbH. All rights reserved. * @link https://dev.heidelpay.de/JTL * @author Andreas Nemet/Jens Richter/Marijo Prskalo/Ronja Wann * @category JTL From 0e1dbbb282e3dbe4aa62715019b927ecb6b11efb Mon Sep 17 00:00:00 2001 From: "David.Owusu" Date: Thu, 8 Mar 2018 10:08:00 +0100 Subject: [PATCH 16/62] [feature] (JTL-19) basket-api: Add basket-api to composer and update. Include the require statement for version 1.* to composer.json and update with no-dev. --- composer.json | 4 +- vendor/composer/ClassLoader.php | 4 +- vendor/composer/autoload_psr4.php | 1 + vendor/composer/autoload_static.php | 5 + vendor/composer/installed.json | 60 ++ vendor/heidelpay/php-basket-api/.codacy.yml | 2 + vendor/heidelpay/php-basket-api/.gitignore | 4 + vendor/heidelpay/php-basket-api/.php_cs | 30 + vendor/heidelpay/php-basket-api/.travis.yml | 39 + vendor/heidelpay/php-basket-api/LICENSE.txt | 83 ++ vendor/heidelpay/php-basket-api/README.md | 32 + vendor/heidelpay/php-basket-api/composer.json | 51 ++ .../lib/Adapter/AdapterInterface.php | 35 + .../lib/Adapter/CurlAdapter.php | 66 ++ .../php-basket-api/lib/BasketError.php | 105 +++ .../lib/Exception/BasketException.php | 21 + .../lib/Exception/BasketItemException.php | 21 + .../lib/Exception/CurlAdapterException.php | 21 + .../InvalidBasketitemIdException.php | 21 + .../InvalidBasketitemPositionException.php | 21 + .../Exception/ParameterOverflowException.php | 21 + .../lib/Exception/RequestException.php | 21 + .../lib/Object/AbstractObject.php | 34 + .../lib/Object/Authentication.php | 140 ++++ .../php-basket-api/lib/Object/Basket.php | 676 +++++++++++++++ .../php-basket-api/lib/Object/BasketItem.php | 780 ++++++++++++++++++ .../heidelpay/php-basket-api/lib/Request.php | 219 +++++ .../heidelpay/php-basket-api/lib/Response.php | 393 +++++++++ .../heidelpay/php-basket-api/phpdoc.dist.xml | 21 + vendor/heidelpay/php-basket-api/phpunit.xml | 22 + .../tests/Integration/RequestTest.php | 401 +++++++++ .../tests/Unit/BasketErrorTest.php | 88 ++ .../tests/Unit/Object/AuthenticationTest.php | 118 +++ .../tests/Unit/Object/BasketItemTest.php | 456 ++++++++++ .../tests/Unit/Object/BasketTest.php | 412 +++++++++ .../php-basket-api/tests/Unit/RequestTest.php | 73 ++ .../tests/Unit/ResponseTest.php | 69 ++ .../php-basket-api/tests/bootstrap.php | 17 + 38 files changed, 4584 insertions(+), 3 deletions(-) create mode 100644 vendor/heidelpay/php-basket-api/.codacy.yml create mode 100644 vendor/heidelpay/php-basket-api/.gitignore create mode 100644 vendor/heidelpay/php-basket-api/.php_cs create mode 100644 vendor/heidelpay/php-basket-api/.travis.yml create mode 100644 vendor/heidelpay/php-basket-api/LICENSE.txt create mode 100644 vendor/heidelpay/php-basket-api/README.md create mode 100644 vendor/heidelpay/php-basket-api/composer.json create mode 100644 vendor/heidelpay/php-basket-api/lib/Adapter/AdapterInterface.php create mode 100644 vendor/heidelpay/php-basket-api/lib/Adapter/CurlAdapter.php create mode 100644 vendor/heidelpay/php-basket-api/lib/BasketError.php create mode 100644 vendor/heidelpay/php-basket-api/lib/Exception/BasketException.php create mode 100644 vendor/heidelpay/php-basket-api/lib/Exception/BasketItemException.php create mode 100644 vendor/heidelpay/php-basket-api/lib/Exception/CurlAdapterException.php create mode 100644 vendor/heidelpay/php-basket-api/lib/Exception/InvalidBasketitemIdException.php create mode 100644 vendor/heidelpay/php-basket-api/lib/Exception/InvalidBasketitemPositionException.php create mode 100644 vendor/heidelpay/php-basket-api/lib/Exception/ParameterOverflowException.php create mode 100644 vendor/heidelpay/php-basket-api/lib/Exception/RequestException.php create mode 100644 vendor/heidelpay/php-basket-api/lib/Object/AbstractObject.php create mode 100644 vendor/heidelpay/php-basket-api/lib/Object/Authentication.php create mode 100644 vendor/heidelpay/php-basket-api/lib/Object/Basket.php create mode 100644 vendor/heidelpay/php-basket-api/lib/Object/BasketItem.php create mode 100644 vendor/heidelpay/php-basket-api/lib/Request.php create mode 100644 vendor/heidelpay/php-basket-api/lib/Response.php create mode 100644 vendor/heidelpay/php-basket-api/phpdoc.dist.xml create mode 100644 vendor/heidelpay/php-basket-api/phpunit.xml create mode 100644 vendor/heidelpay/php-basket-api/tests/Integration/RequestTest.php create mode 100644 vendor/heidelpay/php-basket-api/tests/Unit/BasketErrorTest.php create mode 100644 vendor/heidelpay/php-basket-api/tests/Unit/Object/AuthenticationTest.php create mode 100644 vendor/heidelpay/php-basket-api/tests/Unit/Object/BasketItemTest.php create mode 100644 vendor/heidelpay/php-basket-api/tests/Unit/Object/BasketTest.php create mode 100644 vendor/heidelpay/php-basket-api/tests/Unit/RequestTest.php create mode 100644 vendor/heidelpay/php-basket-api/tests/Unit/ResponseTest.php create mode 100644 vendor/heidelpay/php-basket-api/tests/bootstrap.php diff --git a/composer.json b/composer.json index b3fa82b..e540ed9 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,9 @@ "php" : "~5.6.0|~7.0.0|~7.1.0", "zendframework/zend-http" : "2.*", "heidelpay/php-payment-api" : "v1.4.0", - "heidelpay/php-message-code-mapper": "v1.0.0" + "heidelpay/php-message-code-mapper": "v1.0.0", + "heidelpay/php-basket-api": "1.*" + }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.0", diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index dc02dfb..2c72175 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -379,9 +379,9 @@ private function findFileWithExtension($class, $ext) $subPath = substr($subPath, 0, $lastPos); $search = $subPath.'\\'; if (isset($this->prefixDirsPsr4[$search])) { - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); foreach ($this->prefixDirsPsr4[$search] as $dir) { - if (file_exists($file = $dir . $pathEnd)) { + $length = $this->prefixLengthsPsr4[$first][$search]; + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { return $file; } } diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 10aa8d6..e5cbccb 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -16,5 +16,6 @@ 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), 'Interop\\Container\\' => array($vendorDir . '/container-interop/container-interop/src/Interop/Container'), 'Heidelpay\\PhpPaymentApi\\' => array($vendorDir . '/heidelpay/php-payment-api/lib'), + 'Heidelpay\\PhpBasketApi\\' => array($vendorDir . '/heidelpay/php-basket-api/lib'), 'Heidelpay\\MessageCodeMapper\\' => array($vendorDir . '/heidelpay/php-message-code-mapper/lib'), ); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 75baf97..df5b013 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -28,6 +28,7 @@ class ComposerStaticInitbadef46de6d4939f7b7f0c55452ba087 'H' => array ( 'Heidelpay\\PhpPaymentApi\\' => 24, + 'Heidelpay\\PhpBasketApi\\' => 23, 'Heidelpay\\MessageCodeMapper\\' => 28, ), ); @@ -73,6 +74,10 @@ class ComposerStaticInitbadef46de6d4939f7b7f0c55452ba087 array ( 0 => __DIR__ . '/..' . '/heidelpay/php-payment-api/lib', ), + 'Heidelpay\\PhpBasketApi\\' => + array ( + 0 => __DIR__ . '/..' . '/heidelpay/php-basket-api/lib', + ), 'Heidelpay\\MessageCodeMapper\\' => array ( 0 => __DIR__ . '/..' . '/heidelpay/php-message-code-mapper/lib', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 0cff93e..bf5f62a 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -602,5 +602,65 @@ "validator", "zf2" ] + }, + { + "name": "heidelpay/php-basket-api", + "version": "v1.0.2", + "version_normalized": "1.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/heidelpay/php-basket-api.git", + "reference": "3029c2e705c4f5cd36f585bdb1577322b2915846" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/heidelpay/php-basket-api/zipball/3029c2e705c4f5cd36f585bdb1577322b2915846", + "reference": "3029c2e705c4f5cd36f585bdb1577322b2915846", + "shasum": "" + }, + "require": { + "lib-curl": ">=7.26.0", + "lib-openssl": ">=1.0.1.5", + "php": ">=5.6.0" + }, + "require-dev": { + "codacy/coverage": "~1.1.0", + "friendsofphp/php-cs-fixer": "^2.0", + "phpunit/phpunit": "~5" + }, + "time": "2018-03-01T09:53:58+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Heidelpay\\PhpBasketApi\\": "lib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "proprietary" + ], + "authors": [ + { + "name": "Jens Richter", + "email": "development@heidelpay.com", + "homepage": "http://dev.heidelpay.com", + "role": "Developer" + }, + { + "name": "Stephano Vogel", + "email": "development@heidelpay.com", + "homepage": "http://dev.heidelpay.com", + "role": "Developer" + } + ], + "description": "Client library for heidelpay basket api.", + "homepage": "http://dev.heidelpay.com", + "keywords": [ + "api", + "basket-api", + "php", + "sdk" + ] } ] diff --git a/vendor/heidelpay/php-basket-api/.codacy.yml b/vendor/heidelpay/php-basket-api/.codacy.yml new file mode 100644 index 0000000..2acb25c --- /dev/null +++ b/vendor/heidelpay/php-basket-api/.codacy.yml @@ -0,0 +1,2 @@ +exclude_paths: + - tests/** \ No newline at end of file diff --git a/vendor/heidelpay/php-basket-api/.gitignore b/vendor/heidelpay/php-basket-api/.gitignore new file mode 100644 index 0000000..0640e4c --- /dev/null +++ b/vendor/heidelpay/php-basket-api/.gitignore @@ -0,0 +1,4 @@ +docs/ +vendor +composer.lock +.idea/ \ No newline at end of file diff --git a/vendor/heidelpay/php-basket-api/.php_cs b/vendor/heidelpay/php-basket-api/.php_cs new file mode 100644 index 0000000..52595f8 --- /dev/null +++ b/vendor/heidelpay/php-basket-api/.php_cs @@ -0,0 +1,30 @@ +in(__DIR__.'/lib') + ->in(__DIR__.'/tests'); + +return PhpCsFixer\Config::create() + ->setUsingCache(false) + ->setRules( + array( + '@PSR2' => true, + 'no_blank_lines_after_phpdoc' => true, + 'phpdoc_add_missing_param_annotation' => true, + 'native_function_casing' => true, + 'method_separation' => true, + 'method_argument_space' => true, + 'no_empty_statement' => true, + 'no_leading_import_slash' => true, + 'no_multiline_whitespace_around_double_arrow' => true, + 'no_multiline_whitespace_before_semicolons' => true, + 'no_singleline_whitespace_before_semicolons' => true, + 'no_spaces_around_offset' => true, + 'no_trailing_comma_in_singleline_array' => true, + 'no_unused_imports' => true, + 'normalize_index_brace' => true, + 'phpdoc_align' => true, + 'phpdoc_separation' => true, + ) + ) + ->setFinder($finder); \ No newline at end of file diff --git a/vendor/heidelpay/php-basket-api/.travis.yml b/vendor/heidelpay/php-basket-api/.travis.yml new file mode 100644 index 0000000..e4ff346 --- /dev/null +++ b/vendor/heidelpay/php-basket-api/.travis.yml @@ -0,0 +1,39 @@ +language: php +dist: trusty + +matrix: + fast_finish: true + include: + - php: 5.6 + env: deps=no + - php: 7 + env: deps=no + - php: 7 + env: deps=high + - php: 7.1 + env: deps=no + - php: 7.1 + env: deps=high + - php: 7.2 + env: deps=no + - php: 7.2 + env: deps=high + +cache: + directories: + - $HOME/.composer/cache + - $HOME/.php-cs-fixer + - $HOME/.local + +before_script: + - mkdir -p "$HOME/.php-cs-fixer" + - composer self-update + - if [ "$deps" = "no" ]; then composer --prefer-dist install; fi; + - if [ "$deps" = "high" ]; then composer --prefer-source update; fi; + +script: + - php vendor/bin/phpunit --coverage-clover build/logs/clover.xml + - php vendor/bin/php-cs-fixer fix --dry-run --diff --verbose + +after_script: + - php vendor/bin/codacycoverage clover build/logs/clover.xml \ No newline at end of file diff --git a/vendor/heidelpay/php-basket-api/LICENSE.txt b/vendor/heidelpay/php-basket-api/LICENSE.txt new file mode 100644 index 0000000..0a4a8a8 --- /dev/null +++ b/vendor/heidelpay/php-basket-api/LICENSE.txt @@ -0,0 +1,83 @@ + +Lizenzvereinbarung Plug-in + +I. Präambel + +Diese Lizenzvereinbarung Plug-in (nachfolgend – „Vereinbarung“) bildet einen Vertrag zwischen dem Nutzer des Plug-ins und der heidelpay GmbH (nachfolgend „heidelpay“). + +Das Plug-in von heidelpay ist ein Software-Programm, welches die Schnittstelle zum Payment-System von heidelpay mit einer Anwendung (zum Beispiel: Shopsystem, Warenwirtschaft, Debitorenmanagement etc.) verbindet. Das Plug-in dient dem Datenaustausch zwischen dem Payment-System von heidelpay und der Anwendung. Das Plug-in erweitert den Funktionsumfang der Anwendung hinsichtlich der mit heidelpay gesondert vertraglich vereinbarten Leistungen. + +Diese Vereinbarung regelt die Bestimmungen unter denen heidelpay die Nutzung des zur Verfügung gestellten Plug-in gestattet. + +Dies vorausgeschickt, treffen der Nutzer und heidelpay die folgende Vereinbarung: + +II. Begriffsbestimmungen + + Object Code Die maschinenlesbare, übersetzte Form des Plug-ins. + + Plug-in Das unter dieser Lizenzvereinbarung angebotene Programm, das von heidelpay nach den Bestim-mungen dieser Lizenzvereinbarung verbreitet oder öffentlich zugänglich gemacht hat. + + Source Code Die für Menschen lesbare, in Programmiersprache dargestellte Form des Plug-in. + + Verändern Jede Erweiterung, Kürzung und Bearbeitung des Plug-ins, insbesondere Weiterentwicklungen + + Verbreiten Die öffentliche Weitergabe des Plug-ins, biespielsweise das Bereitstellen zum Download auf öffent-lich zugänglichen Internetseiten. + +III. Geltenden Bestimmungen + +Im Falle eines zwischen dem Nutzer und heidelpay abgeschlossenen Händlervertrages für die Abwicklung der dort bestimmten Leistungen, gilt der Händlervertrag ab Vertragsschluss und gilt in diesem Fall zusätzlich zu dieser Ver-einbarung. Im Falle des Widerspruchs zwischen dieser Vereinbarung und dem Händlervertrag hat der Händlerver-trag Vorrang. + +IV. Lizenz + + 1. Diese Vereinbarung räumt nur solchen Nutzern Nutzungsrechte ein, die Unternehmer im Sinne des BGB sind. Eine Nutzung durch Verbraucher ist nicht gestattet. + 2. Die von heidelpay im Rahmen dieser Vereinbarung gewährte Lizenz, ist für den Nutzer unentgeltlich. + 3. Unter der Voraussetzung der Einhaltung der Bestimmungen dieser Vereinbarung, erteilt heidelpay dem Nut-zer das zeitlich unbefristete, widerrufliche, räumlich auf Europa begrenzte Recht, das Plug-in zu verändern, unverändert oder in veränderter Form zu dem in der Präambel dargestellten Zweck für geschäftliche Zwecke zu nutzen, d.h. das Plug-in zu speichern, ablaufen zu lassen, zu vervielfältigen, zu verbreiten und öffentlich zugänglich zu machen. + 4. Heidelpay kann neue Versionen/Updates des Plug-ins anbieten, die zum Beispiel Fehlerbehebungen und neue Funktionalitäten beinhalten können. Heidelpay empfiehlt daher die regelmässige Überprüfung der Ak-tualität des Plug-in, dies wird auf der Seite http://dev.heidelpay.com veröffentlicht. Auch diese neuen Versio-nen/Updates unterliegen den Bedingungen dieser Vereinbarung. + +V. Beschränkungen + + 1. Durch diese Vereinbarung erfolgt keine Übertragung jedweder Schutzrechte von heidelpay. + 2. Das Recht, das Plug-in zu verändern und diese veränderte Version zu vervielfältigen, zu verbreiten oder öf-fentlich zugänglich zu machen, setzt voraus, dass + a. die im Source Code bzw. Object Code enthaltenen Hinweise auf diese Lizenz erhalten bleiben; und + b. alle Hinweise und Vermerke im Source Code bzw. Object Code, hinsichtlich des Urhebers des Plug-in un-verändert bleiben; und + c. ein deutlicher Hinweis erteilt wird, dass es sich um eine veränderte Version des Plug-in handelt, eine Do-kumentation darüber, welche Teile verändert wurden, mitgeliefert wird; und + d. Heidelpay für sämtliche aus der Veränderung resultierende Ansprüche freigestellt wird und zudem das veränderte Plug-in mit einer Klarstellung versehen wird, dass heidelpay für das Plug-in in der veränderten Form keine Haftung übernimmt; und + e. das veränderte Plug-in unter einer Lizenzvereinbarung zur Verfügung gestellt wird, die das Interesse von heidelpay entsprechend den Bedingungen dieser Vereinbarung schützt; und + f. die im Zusammenhang mit dem Plug-in angezeigten rechtlichen Hinweise nicht entfernt, verdeckt oder abgeändert werden. + 3. Der Nutzer sichert zu, dass er bei der Nutzung des Plug-in von heidelpay die geltenden nationalen und inter-nationalen Gesetze einhält; + 4. Der Nutzer sichert zu, heidelpay unverzüglich zu informieren, wenn Dritte ihm gegenüber Ansprüche im Zu-sammenhang mit dem Plug-in anmelden und/oder behaupten, das Plug-in verletze Rechte Dritter, und hei-delpay alle Dokumente und/oder Informationen zur Verfügung zu stellen, die der Nutzer im Zusammenhang mit einem solchen Anspruch erhält. + +VI. Datenschutz + +Es gelten die Datenschutzbestimmugen, abrufbar unter https://dev.heidelpay.de/datenschutzerklaerung/ . + +VII. FREISTELLUNG + +Der Nutzer erklärt sich einverstanden, heidelpay, deren Tochtergesellschaften, angeschlossenen Unternehmen, Geschäftsführer, leitenden Angestellten, Mitarbeiter, Vertreter, Geschäftspartner und Lizenzgeber gegen alle An-sprüche oder Forderungen Dritter, einschließlich Gerichtskosten, angemessener Anwaltsgebühren und Sachver-ständigenkosten, freizustellen, die entstehen weil: + (a) die Nutzung des Plug-ins von heidelpay unter Verletzung der Bestimmungen dieser Vereinbarung erfolgt; oder + (b) der Nutzer gegen geltende Gesetze oder aufsichtsrechtliche Bestimmungen verstösst oder + (c) der Nutzer seine Identität in einer falschen, betrügerischen, böswilligen oder unzutreffenden Weise dar-stellt. + +VIII. TECHNISCHER SUPPORT + +Heidelpay kann dem Nutzer, welcher das Plug-in in unverändertem Zustand nutzt, Support zur Verfügung stellen. Hierzu bedarf es einer gesonderten Vereinbarung zwischen dem Nutzer und heidelpay. + +IX.LAUFZEIT UND KÜNDIGUNG + + 1. Diese Vereinbarung kann von den Parteien jederzeit fristlos gekündigt werden. + 2. Es steht heidelpay frei, das Downloadangebot jederzeit einzustellen. + 3. Alle Rechte des Nutzers aus dieser Vereinbarung erlöschen unmittelbar, sobald der Nutzer wesentliche Best-immungen dieser Vereinbarung verletzt. + 4. Sobald diese Vereinbarung beendet ist oder der Nutzer seine Rechte gemäss Ziffer 3 verliert, hat der Nutzer sämtliche Kopien des Plug-ins (und alle entsprechenden Sicherungen) zu löschen. + +X. HAFTUNG + + 1. Da die Lizenz unentgeltlich zur Verfügung gestellt wird, handelt es sich um einen Schenkungsvertrag, Daher haftet heidelpay für etwaige Schäden nur gem. § 524 BGB. + 2. Soweit ein Schaden - unmittelbar oder mittelbar - auf einem Datenverlust beruht und heidelpay nach Ziffer 1 hierfür haftbar gemacht werden kann, ist die Haftung von heidelpay auf den Wiederherstellungsaufwand be-schränkt, der bei regelmäßiger gefahrentsprechender Datensicherung eingetreten wäre. + 3. Ansprüche auf Schadensersatz, ausgenommen solche aus einer vorsätzlichen oder grob fahrlässigen Pflicht-verletzung, einer Verletzung des Lebens, des Körpers, der Gesundheit, unerlaubter Handlung oder aus dem Produkthaftungsgesetz, verjähren spätestens in einem Jahr von dem Zeitpunkt an, an dem die geschädigte Partei von dem Schaden und den Umständen, aus denen sich die Anspruchsberechtigung ergibt, Kenntnis er-langt, ohne Rücksicht auf Kenntnis drei Jahre ab dem schädigenden Ereignis. Kürzere gesetzliche Verjäh-rungsfristen bleiben unberührt. + +XI. Schlussbestimmungen + + 1. Diese Vereinbarung unterliegt den Gesetzen der Bundesrepublik Deutschland unter Ausschluss des UN-Kaufrechts. Der ausschließliche Gerichtsstand ist das Landgericht Heidelberg. + 2. In einige Länder, inklusive der Vereinigten Staaten von Amerika, gelten Exportbeschränkungen. Das Plug-in kann solchen Beschränkungen unterliegen. Diese sind insbesondere zu beachten, als das Plug-in in andere Länder exportiert wird. Wenn der Nutzer das Plug-in exportiert, ist allein er für die Einhaltung der maßgebli-chen Regelungen verantwortlich. In jedem Fall ist es untersagt, das Plug-in in ein Land zu exportieren, wel-ches einem Embargo der Vereinigten Staaten von Amerika oder der Europäischen Union unterliegt, oder ei-ner Person zu überlassen, an die eine Lieferung nach U.S. amerikanischen oder europäischen Regelung un-tersagt ist. + 3. Diese Bestimmungen oder die Nutzung des Plug-ins begründet kein Joint Venture, keine Teilhaberschaft, kei-ne Beschäftigung mit heidelpay und keine Befugnis zur Vertretung von heidelpay. + 4. Die Bestimmungen der Abschnitte IV, V, VI, VII, X, XI. überdauern die Beendigung dieser Bestimmungen, gleich aus welchem Grund. \ No newline at end of file diff --git a/vendor/heidelpay/php-basket-api/README.md b/vendor/heidelpay/php-basket-api/README.md new file mode 100644 index 0000000..9dc4547 --- /dev/null +++ b/vendor/heidelpay/php-basket-api/README.md @@ -0,0 +1,32 @@ +[![Build Status](https://travis-ci.org/heidelpay/php-basket-api.svg?branch=develop)](https://travis-ci.org/heidelpay/php-basket-api) +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/13dd225543524c93b2a9400e4b343fe1)](https://www.codacy.com/app/heidelpay/php-basket-api?utm_source=github.com&utm_medium=referral&utm_content=heidelpay/php-basket-api&utm_campaign=Badge_Grade) +[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/13dd225543524c93b2a9400e4b343fe1)](https://www.codacy.com/app/heidelpay/php-basket-api?utm_source=github.com&utm_medium=referral&utm_content=heidelpay/php-basket-api&utm_campaign=Badge_Coverage) +[![Latest Stable Version](https://poser.pugx.org/heidelpay/php-basket-api/v/stable)](https://packagist.org/packages/heidelpay/php-basket-api) +[![PHP 5.6](https://img.shields.io/badge/php-5.6-blue.svg)](http://www.php.net) +[![PHP 7.0](https://img.shields.io/badge/php-7.0-blue.svg)](http://www.php.net) +[![PHP 7.1](https://img.shields.io/badge/php-7.1-blue.svg)](http://www.php.net) +[![PHP 7.2](https://img.shields.io/badge/php-7.2-blue.svg)](http://www.php.net) + +![Logo](http://dev.heidelpay.com/devHeidelpay_400_180.jpg) + +# Welcome to the heidelpay basket api + +This is the PHP Basket API for heidelpay. The library will help you to easily integrate heidelpay into your application. + +### SYSTEM REQUIREMENTS + +php-basket-api requires PHP 5.6 or higher; we recommend using the +latest stable PHP version whenever possible. + +## SECURITY ADVICE +If you want to store the output of this library into a database or something, please make sure that your +application takes care of sql injection, cross-site-scripting (xss) and so on. There is no build in protection +by now. + +## LICENSE + +You can find a copy of this license in [LICENSE.txt](LICENSE.txt). + +## Documentation + +Please visit http://dev.heidelpay.com/php-basket-api/ for the developer documentation. diff --git a/vendor/heidelpay/php-basket-api/composer.json b/vendor/heidelpay/php-basket-api/composer.json new file mode 100644 index 0000000..aaae197 --- /dev/null +++ b/vendor/heidelpay/php-basket-api/composer.json @@ -0,0 +1,51 @@ +{ + "name": "heidelpay/php-basket-api", + "description": "Client library for heidelpay basket api.", + "license": "proprietary", + "authors": [ + { + "name": "Jens Richter", + "email": "development@heidelpay.com", + "homepage": "http://dev.heidelpay.com", + "role": "Developer" + }, + { + "name": "Stephano Vogel", + "email": "development@heidelpay.com", + "homepage": "http://dev.heidelpay.com", + "role": "Developer" + } + ], + "require": { + "php": ">=5.6.0", + "lib-curl": ">=7.26.0", + "lib-openssl": ">=1.0.1.5" + }, + "require-dev": { + "codacy/coverage": "~1.1.0", + "friendsofphp/php-cs-fixer" : "^2.0", + "phpunit/phpunit": "~5" + }, + "autoload": { + "psr-4": { + "Heidelpay\\PhpBasketApi\\": "lib" + } + }, + "autoload-dev": { + "psr-4": { + "Heidelpay\\Tests\\PhpBasketApi\\": "tests/" + } + }, + "support": { + "email": "development@heidelpay.com" + }, + "homepage": "http://dev.heidelpay.com", + "minimum-stability": "dev", + "type": "library", + "keywords": [ + "php", + "api", + "sdk", + "basket-api" + ] +} \ No newline at end of file diff --git a/vendor/heidelpay/php-basket-api/lib/Adapter/AdapterInterface.php b/vendor/heidelpay/php-basket-api/lib/Adapter/AdapterInterface.php new file mode 100644 index 0000000..0363ccf --- /dev/null +++ b/vendor/heidelpay/php-basket-api/lib/Adapter/AdapterInterface.php @@ -0,0 +1,35 @@ + + * + * @package heidelpay\php-basket-api\interfaces\adapter + */ +interface AdapterInterface +{ + /** + * Sends a post request to the $url containing the $payload Request + * + * @param string $url + * @param Request $payload + * + * @throws Exception + * @throws CurlAdapterException + * + * @return string The BasketApi JSON response + */ + public function sendPost($url, Request $payload); +} diff --git a/vendor/heidelpay/php-basket-api/lib/Adapter/CurlAdapter.php b/vendor/heidelpay/php-basket-api/lib/Adapter/CurlAdapter.php new file mode 100644 index 0000000..ea01bf9 --- /dev/null +++ b/vendor/heidelpay/php-basket-api/lib/Adapter/CurlAdapter.php @@ -0,0 +1,66 @@ + + * + * @package heidelpay + */ +class CurlAdapter implements AdapterInterface +{ + /** + * @inheritdoc + */ + public function sendPost($uri, Request $payload) + { + if (!extension_loaded('curl')) { + throw new Exception('The php-curl library is not installed.'); + } + + $curlRequest = curl_init(); + curl_setopt($curlRequest, CURLOPT_URL, $uri); + curl_setopt($curlRequest, CURLOPT_HEADER, 0); + curl_setopt($curlRequest, CURLOPT_TIMEOUT, 60); + curl_setopt($curlRequest, CURLOPT_CONNECTTIMEOUT, 60); + curl_setopt($curlRequest, CURLOPT_POST, true); + curl_setopt($curlRequest, CURLOPT_POSTFIELDS, $payload->toJson()); + curl_setopt($curlRequest, CURLOPT_HTTPHEADER, [ + 'Accept: application/json', + 'Content-Type: application/json', + 'Content-Length: ' . strlen($payload->toJson()) + ]); + + curl_setopt($curlRequest, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curlRequest, CURLOPT_SSL_VERIFYPEER, 1); + curl_setopt($curlRequest, CURLOPT_SSL_VERIFYHOST, 2); + curl_setopt($curlRequest, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2); + curl_setopt($curlRequest, CURLOPT_USERAGENT, 'PhpBasketApi'); + + $response = curl_exec($curlRequest); + $error = curl_error($curlRequest); + $info = curl_getinfo($curlRequest, CURLINFO_HTTP_CODE); + + curl_close($curlRequest); + + if ($info != 200 && !empty($error)) { + throw new CurlAdapterException($error); + } + + return $response; + } +} diff --git a/vendor/heidelpay/php-basket-api/lib/BasketError.php b/vendor/heidelpay/php-basket-api/lib/BasketError.php new file mode 100644 index 0000000..dbb68f0 --- /dev/null +++ b/vendor/heidelpay/php-basket-api/lib/BasketError.php @@ -0,0 +1,105 @@ + + * + * @package heidelpay\php-basket-api\Interaction\Object + */ +class BasketError extends AbstractObject +{ + /** + * @var string $code The Error code + */ + protected $code; + + /** + * @var string $message The Error message + */ + protected $message; + + /** + * Returns the Error code. + * + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * Returns the Error message. + * + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Sets the error code. + * + * @param string $code + * + * @return $this + */ + public function setCode($code) + { + $this->code = $code; + + return $this; + } + + /** + * Sets the error code. + * + * @param string $message + * + * @return $this + */ + public function setMessage($message) + { + $this->message = $message; + + return $this; + } + + /** + * Returns an array that is used for the JSON representation when using json_encode or toJson(). + * + * @return array + */ + public function jsonSerialize() + { + return [ + 'code' => $this->code, + 'message' => $this->message + ]; + } + + /** + * Prints the error message that the BasketError instance is representing. + * + * @return string + */ + public function printMessage() + { + return sprintf('[Errorcode %s, Message: %s]', $this->code, $this->message); + } +} diff --git a/vendor/heidelpay/php-basket-api/lib/Exception/BasketException.php b/vendor/heidelpay/php-basket-api/lib/Exception/BasketException.php new file mode 100644 index 0000000..976941e --- /dev/null +++ b/vendor/heidelpay/php-basket-api/lib/Exception/BasketException.php @@ -0,0 +1,21 @@ + + * + * @package heidelpay\php-basket-api\Exception + */ +class BasketException extends Exception +{ +} diff --git a/vendor/heidelpay/php-basket-api/lib/Exception/BasketItemException.php b/vendor/heidelpay/php-basket-api/lib/Exception/BasketItemException.php new file mode 100644 index 0000000..7c7c883 --- /dev/null +++ b/vendor/heidelpay/php-basket-api/lib/Exception/BasketItemException.php @@ -0,0 +1,21 @@ + + * + * @package heidelpay\php-basket-api\Exception + */ +class BasketItemException extends Exception +{ +} diff --git a/vendor/heidelpay/php-basket-api/lib/Exception/CurlAdapterException.php b/vendor/heidelpay/php-basket-api/lib/Exception/CurlAdapterException.php new file mode 100644 index 0000000..34bb8f9 --- /dev/null +++ b/vendor/heidelpay/php-basket-api/lib/Exception/CurlAdapterException.php @@ -0,0 +1,21 @@ + + * + * @package heidelpay\php-basket-api\Exception + */ +class CurlAdapterException extends Exception +{ +} diff --git a/vendor/heidelpay/php-basket-api/lib/Exception/InvalidBasketitemIdException.php b/vendor/heidelpay/php-basket-api/lib/Exception/InvalidBasketitemIdException.php new file mode 100644 index 0000000..89d0f84 --- /dev/null +++ b/vendor/heidelpay/php-basket-api/lib/Exception/InvalidBasketitemIdException.php @@ -0,0 +1,21 @@ + + * + * @package heidelpay\php-basket-api\Exception + */ +class InvalidBasketitemIdException extends Exception +{ +} diff --git a/vendor/heidelpay/php-basket-api/lib/Exception/InvalidBasketitemPositionException.php b/vendor/heidelpay/php-basket-api/lib/Exception/InvalidBasketitemPositionException.php new file mode 100644 index 0000000..2c26b10 --- /dev/null +++ b/vendor/heidelpay/php-basket-api/lib/Exception/InvalidBasketitemPositionException.php @@ -0,0 +1,21 @@ + + * + * @package heidelpay\php-basket-api\Exception + */ +class InvalidBasketitemPositionException extends Exception +{ +} diff --git a/vendor/heidelpay/php-basket-api/lib/Exception/ParameterOverflowException.php b/vendor/heidelpay/php-basket-api/lib/Exception/ParameterOverflowException.php new file mode 100644 index 0000000..e81d289 --- /dev/null +++ b/vendor/heidelpay/php-basket-api/lib/Exception/ParameterOverflowException.php @@ -0,0 +1,21 @@ + + * + * @package heidelpay\php-basket-api\Exception + */ +class ParameterOverflowException extends Exception +{ +} diff --git a/vendor/heidelpay/php-basket-api/lib/Exception/RequestException.php b/vendor/heidelpay/php-basket-api/lib/Exception/RequestException.php new file mode 100644 index 0000000..b576a91 --- /dev/null +++ b/vendor/heidelpay/php-basket-api/lib/Exception/RequestException.php @@ -0,0 +1,21 @@ + + * + * @package heidelpay\php-basket-api\Exception + */ +class RequestException extends Exception +{ +} diff --git a/vendor/heidelpay/php-basket-api/lib/Object/AbstractObject.php b/vendor/heidelpay/php-basket-api/lib/Object/AbstractObject.php new file mode 100644 index 0000000..0a90377 --- /dev/null +++ b/vendor/heidelpay/php-basket-api/lib/Object/AbstractObject.php @@ -0,0 +1,34 @@ + + * + * @package heidelpay\php-basket-api\Object + */ +abstract class AbstractObject implements JsonSerializable +{ + /** + * Returns a Json representation of the object instance. + * + * @param int $options json_encode options + * + * @return string + */ + public function toJson($options = 0) + { + return json_encode($this->jsonSerialize(), $options); + } +} diff --git a/vendor/heidelpay/php-basket-api/lib/Object/Authentication.php b/vendor/heidelpay/php-basket-api/lib/Object/Authentication.php new file mode 100644 index 0000000..104a144 --- /dev/null +++ b/vendor/heidelpay/php-basket-api/lib/Object/Authentication.php @@ -0,0 +1,140 @@ + + * @author Stephano Vogel + * + * @package heidelpay\php-basket-api\Object + */ +class Authentication extends AbstractObject +{ + /** + * @var int Max character count for the Sender ID + */ + const MAX_SENDER_LENGTH = 32; + + /** + * @var string user login + */ + protected $login; + + /** + * @var string user password + */ + protected $password; + + /** + * @var string sender id + */ + protected $sender; + + /** + * Authentication constructor. + * + * @param string $login + * @param string $password + * @param string $senderId + * + * @throws ParameterOverflowException + */ + public function __construct($login = null, $password = null, $senderId = null) + { + $this->setLogin($login); + $this->setPassword($password); + $this->setSender($senderId); + } + + /** + * Sets the user login + * + * @param string $login + * + * @return Authentication + */ + public function setLogin($login) + { + $this->login = $login; + return $this; + } + + /** + * @return string + */ + public function getLogin() + { + return $this->login; + } + + /** + * Sets the user password + * + * @param string $password + * + * @return Authentication + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } + + /** + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets the Sender ID. + * + * @param string $sender + * + * @throws ParameterOverflowException + * + * @return Authentication + */ + public function setSender($sender) + { + if (strlen($sender) > $this::MAX_SENDER_LENGTH) { + throw new ParameterOverflowException( + 'Sender ID cannot be longer than ' . $this::MAX_SENDER_LENGTH . ' characters.' + ); + } + + $this->sender = $sender; + return $this; + } + + /** + * @return string + */ + public function getSender() + { + return $this->sender; + } + + /** + * @return array + */ + public function jsonSerialize() + { + return [ + 'login' => $this->login, + 'password' => $this->password, + 'sender' => $this->sender, + ]; + } +} diff --git a/vendor/heidelpay/php-basket-api/lib/Object/Basket.php b/vendor/heidelpay/php-basket-api/lib/Object/Basket.php new file mode 100644 index 0000000..a8649a7 --- /dev/null +++ b/vendor/heidelpay/php-basket-api/lib/Object/Basket.php @@ -0,0 +1,676 @@ + + * @author Stephano Vogel + * + * @package heidelpay\php-basket-api\Object + */ +class Basket extends AbstractObject +{ + /** + * @var int $amountTotalNet The total amount of the whole basket without Tax in the smallest unit of the currency + */ + protected $amountTotalNet; + + /** + * @var int $amountTotalVat The total amount of the Vat in smallest unit of the currency + */ + protected $amountTotalVat; + + /** + * @var int $amountTotalDiscount The total discount amount of the whole basket in the smallest unit of the currency + */ + protected $amountTotalDiscount; + + /** + * @var BasketItem[] $basketItems An array containing BasketItems + */ + protected $basketItems = []; + + /** + * @var string $basketReferenceId A basket reference ID sent from the shop backend with a maximum length of 255 + */ + protected $basketReferenceId; + + /** + * @var string $currencyCode The currency code in ISO 4217 format with 3 characters + */ + protected $currencyCode; + + /** + * @var string $note A note sent from the application with a maximum length of 3900 characters + */ + protected $note; + + /** + * @var int $voucherAmount Voucher amount to be applied on a whole basket + */ + protected $voucherAmount; + + /** + * @var string $voucherId A Voucher ID for a whole basket + */ + protected $voucherId; + + /** + * @var array $mandatory An array of attributes that are mandatory for the Basket + */ + protected static $mandatory = [ + 'amountTotalNet', + 'currencyCode', + 'basketItems' + ]; + + /** + * Returns the total discount. + * + * @return int + */ + public function getAmountTotalDiscount() + { + return $this->amountTotalDiscount; + } + + /** + * Sets the total discount amount. + * + * @param int $amountTotalDiscount + * + * @return $this + */ + public function setAmountTotalDiscount($amountTotalDiscount) + { + $this->amountTotalDiscount = $amountTotalDiscount; + + return $this; + } + + /** + * Returns the total net amount. + * + * @return int + */ + public function getAmountTotalNet() + { + return $this->amountTotalNet; + } + + /** + * Sets the total net amount. + * + * @param int $value + * + * @return $this + */ + public function setAmountTotalNet($value) + { + $this->amountTotalNet = $value; + return $this; + } + + /** + * Returns the total vat amount. + * + * @return int + */ + public function getAmountTotalVat() + { + return $this->amountTotalVat; + } + + /** + * Sets the total vat amount. + * + * @param int $value + * + * @return $this + */ + public function setAmountTotalVat($value) + { + $this->amountTotalVat = $value; + return $this; + } + + /** + * Returns the Basket reference id. + * + * @return string basketReferenceId + */ + public function getBasketReferenceId() + { + return $this->basketReferenceId; + } + + /** + * Sets the Basket reference id. + * + * @param string $value + * + * @return $this + */ + public function setBasketReferenceId($value) + { + $this->basketReferenceId = $value; + return $this; + } + + /** + * Returns the currency code. + * + * @return string currency code + */ + public function getCurrencyCode() + { + return $this->currencyCode; + } + + /** + * Sets the currency code. + * + * @param string $value + * + * @return $this + */ + public function setCurrencyCode($value) + { + $this->currencyCode = $value; + return $this; + } + + /** + * Returns the amount of BasketItems. + * + * @return int + */ + public function getItemCount() + { + return count($this->basketItems); + } + + /** + * Returns the Basket note. + * + * @return string + */ + public function getNote() + { + return $this->note; + } + + /** + * Sets the Basket note. + * + * @param string $value + * + * @return $this + */ + public function setNote($value) + { + $this->note = $value; + return $this; + } + + /** + * Returns the voucher amount. + * + * @return int + */ + public function getVoucherAmount() + { + return $this->voucherAmount; + } + + /** + * Sets the voucher amount. + * + * @param int $voucherAmount + * + * @return $this + */ + public function setVoucherAmount($voucherAmount) + { + $this->voucherAmount = $voucherAmount; + return $this; + } + + /** + * Returns the voucher ID. + * + * @return string + */ + public function getVoucherId() + { + return $this->voucherId; + } + + /** + * Sets the voucher ID. + * + * @param string $voucherId + * + * @return $this + */ + public function setVoucherId($voucherId) + { + $this->voucherId = $voucherId; + return $this; + } + + /** + * Returns the array of all BasketItems. + * + * @return BasketItem[] + */ + public function getBasketItems() + { + return $this->basketItems; + } + + /** + * Returns a BasketItem at the given position. + * + * @param int $position + * + * @throws InvalidBasketitemPositionException + * + * @return BasketItem|null + */ + public function getBasketItemByPosition($position) + { + if ($position <= 0) { + throw new InvalidBasketitemPositionException('BasketItem position cannot be equal or less than 0.'); + } + + if (array_key_exists($position - 1, $this->basketItems)) { + return $this->basketItems[$position - 1]; + } + + return null; + } + + /** + * Returns a BasketItem by it's reference id. + * + * @param string $referenceId + * + * @return BasketItem|null + */ + public function getBasketItemByReferenceId($referenceId) + { + foreach ($this->getBasketItems() as $basketItem) { + if ($basketItem->getReferenceId() === $referenceId) { + return $basketItem; + } + } + + return null; + } + + /** + * Returns the 'real' position of a BasketItem in the array, where 'real' means + * the array equivalent of a position (0 array => 1 Basket position) + * + * @param int $position + * + * @throws InvalidBasketitemPositionException + * + * @return BasketItem + */ + private function getBasketItemByRealPosition($position) + { + if (isset($this->basketItems[$position])) { + return $this->basketItems[$position]; + } + + throw new InvalidBasketitemPositionException('BasketItem position ' . $position . ' is invalid.'); + } + + /** + * Adds a BasketItem to the Basket. + * + * @param BasketItem $item The BasketItem to be added + * @param int|null $position The position where the item should be placed (optional) + * @param bool $autoUpdate If the BasketItem amounts can be added to the Basket automatically + * + * @throws InvalidBasketitemPositionException + * + * @return $this + */ + public function addBasketItem(BasketItem $item, $position = null, $autoUpdate = false) + { + // do this to avoid having copies or references. + $newItem = clone $item; + + $realPosition = !$position ? $this->getBasketItemPosition($newItem, $position) : $position; + + if ($autoUpdate) { + $this->addBasketItemAmountsToBasket($newItem); + } + + if ($realPosition === null) { + $newItem->setPosition($this->getItemCount() + 1); + } + + $this->basketItems[$realPosition] = $newItem; + sort($this->basketItems); + + return $this; + } + + /** + * Updates the object at the given index. + * + * @param BasketItem $item the item to be set + * @param int $position The position of the BasketItem + * @param bool $autoUpdate If Basket amounts should be updated automatically + * + * @throws InvalidBasketitemPositionException + * + * @return $this + */ + public function updateBasketItem(BasketItem $item, $position = null, $autoUpdate = false) + { + $updateItem = clone $item; + + $realPosition = $this->getBasketItemPosition($updateItem, $position, true); + + if ($realPosition === null) { + throw new InvalidBasketitemPositionException('BasketItem has no position, and no position was given.'); + } + + if (array_key_exists($realPosition, $this->basketItems)) { + if ($autoUpdate) { + $oldItem = $this->getBasketItemByRealPosition($realPosition); + $this->updateAmountBalances($oldItem, $updateItem); + } + + $this->basketItems[$realPosition] = $updateItem; + return $this; + } + + throw new InvalidBasketitemPositionException('Basket item with id ' . $position . ' does not exist.'); + } + + /** + * Removes an item of the basket at the given position. + * + * @param int $position the basket index of the item + * @param bool $autoUpdate decrease Basket amounts by BasketItem amounts + * + * @throws InvalidBasketitemPositionException + * + * @return $this + */ + public function deleteBasketItemByPosition($position, $autoUpdate = true) + { + if ($position <= 0) { + throw new InvalidBasketitemPositionException('BasketItem position cannot be equal or less than 0.'); + } + + if (array_key_exists($position - 1, $this->basketItems)) { + if ($autoUpdate) { + $this->decreaseBasketItemAmountsFromBasket($this->getBasketItemByPosition($position)); + } + + unset($this->basketItems[$position - 1]); + return $this; + } + + throw new InvalidBasketitemPositionException('Basket item on position ' . $position . ' does not exist.'); + } + + /** + * Deletes a BasketItem by it's reference id. + * + * @param string $referenceId + * @param bool $autoUpdate decrease Basket amounts by BasketItem amounts + * + * @return $this + * + * @throws InvalidBasketitemIdException + */ + public function deleteBasketItemByReferenceId($referenceId, $autoUpdate = true) + { + foreach ($this->getBasketItems() as $basketItem) { + if ($basketItem->getReferenceId() === $referenceId) { + if ($autoUpdate) { + $this->decreaseBasketItemAmountsFromBasket($basketItem); + } + + unset($this->basketItems[$basketItem->getPosition() - 1]); + return $this; + } + } + + throw new InvalidBasketitemIdException('Basket item with refereceId ' . $referenceId . ' does not exist.'); + } + + /** + * Returns an array that is used for the JSON representation when using json_encode or toJson(). + * + * @return array + */ + public function jsonSerialize() + { + return [ + 'amountTotalNet' => $this->amountTotalNet, + 'amountTotalVat' => $this->amountTotalVat, + 'amountTotalDiscount' => $this->amountTotalDiscount, + 'basketReferenceId' => $this->basketReferenceId, + 'currencyCode' => $this->currencyCode, + 'voucherAmount' => $this->voucherAmount, + 'voucherId' => $this->voucherId, + 'itemCount' => $this->getItemCount(), + 'note' => $this->note, + 'basketItems' => array_values($this->basketItems) + ]; + } + + /** + * Determines the position of the BasketItem in the BasketItem array. + * + * @param BasketItem $item The BasketItem containing the changes + * @param int|null $position The position where a BasketItem should be updated + * @param bool $doUpdate If the position is needed for an update + * + * @return int|null + */ + private function getBasketItemPosition(BasketItem $item, $position = null, $doUpdate = false) + { + $result = null; + + // in case the item position is not null and > 0 + if (is_numeric($item->getPosition()) && $item->getPosition() > 0) { + $result = $item->getPosition(); + } + + // in case the position is not null and > 0 + if (is_numeric($position) && $position > 0) { + $result = $position - 1; + } + + // if an item already exists on the determined position, just increase the result number... + if ($result !== null && isset($this->basketItems[$result])) { + ++$result; + } + + // getBasketItemPosition determines a position for a new item, so if + // we do an update, we'll decrease the found position by one. + if ($doUpdate && $result !== null && is_numeric($result)) { + --$result; + } + + return $result; + } + + /** + * Increases the total discount amount. + * + * @param int $amount + */ + public function addAmountTotalDiscount($amount) + { + $this->amountTotalDiscount += $amount; + } + + /** + * Decreases the total discount amount. + * + * @param int $amount + */ + public function decreaseAmountTotalDiscount($amount) + { + $this->amountTotalDiscount -= $amount; + } + + /** + * Increases the total net amount. + * + * @param int $amount + */ + public function addAmountTotalNet($amount) + { + $this->amountTotalNet += $amount; + } + + /** + * Decreases the total net amount. + * + * @param int $amount + */ + public function decreaseAmountTotalNet($amount) + { + $this->amountTotalNet -= $amount; + } + + /** + * Increases the total vat amount. + * + * @param int $amount + */ + public function addAmountTotalVat($amount) + { + $this->amountTotalVat += $amount; + } + + /** + * Decreases the total vat amount. + * + * @param int $amount + */ + public function decreaseAmountTotalVat($amount) + { + $this->amountTotalVat -= $amount; + } + + /** + * Increases the Basket amounts by the BasketItem amounts. + * + * @param BasketItem $basketItem + */ + private function addBasketItemAmountsToBasket(BasketItem $basketItem) + { + $this->addAmountTotalDiscount($basketItem->getAmountDiscount()); + $this->addAmountTotalNet($basketItem->getAmountNet()); + $this->addAmountTotalVat($basketItem->getAmountVat()); + } + + /** + * Decreases the Basket amounts by the BasketItem amounts. + * + * @param BasketItem $basketItem + */ + private function decreaseBasketItemAmountsFromBasket(BasketItem $basketItem) + { + $this->decreaseAmountTotalDiscount($basketItem->getAmountDiscount()); + $this->decreaseAmountTotalNet($basketItem->getAmountNet()); + $this->decreaseAmountTotalVat($basketItem->getAmountVat()); + } + + /** + * Updates the Basket balances according to the differences + * of an updated BasketItem and it's predecessor. + * + * @param BasketItem $oldItem + * @param BasketItem $newItem + */ + private function updateAmountBalances(BasketItem $oldItem, BasketItem $newItem) + { + $discountBalance = $newItem->getAmountDiscount() - $oldItem->getAmountDiscount(); + if ($discountBalance !== 0) { + $this->addAmountTotalDiscount($discountBalance); + } + + $netBalance = $newItem->getAmountNet() - $oldItem->getAmountNet(); + if ($netBalance !== 0) { + $this->addAmountTotalNet($netBalance); + } + + $vatBalance = $newItem->getAmountVat() - $oldItem->getAmountVat(); + if ($vatBalance !== 0) { + $this->addAmountTotalVat($vatBalance); + } + } + + /** + * Magic getter for properties. + * + * @param $name + * + * @return mixed + */ + public function __get($name) + { + if (property_exists($this, $name)) { + return $this->$name; + } + + return null; + } + + /** + * Magic setter in favor of parsing. + * + * @param $field + * @param $value + */ + public function __set($field, $value) + { + if (property_exists($this, $field)) { + $this->$field = $value; + } + } + + /** + * Isset implementation for the __set method + * + * @param $field + * + * @return bool + */ + public function __isset($field) + { + if (!property_exists($this, $field)) { + return false; + } + + return $this->$field !== null && !empty($this->$field); + } +} diff --git a/vendor/heidelpay/php-basket-api/lib/Object/BasketItem.php b/vendor/heidelpay/php-basket-api/lib/Object/BasketItem.php new file mode 100644 index 0000000..5fbfa74 --- /dev/null +++ b/vendor/heidelpay/php-basket-api/lib/Object/BasketItem.php @@ -0,0 +1,780 @@ + + * @author Stephano Vogel + * + * @package heidelpay\php-basket-api\Object + */ +class BasketItem extends AbstractObject +{ + /** + * @var int $position (optional) The position of the item in the Basket + */ + protected $position; + + /** + * @var string $basketItemReferenceId A unique reference id for the BasketItem with a maximum length of 255 + */ + protected $basketItemReferenceId; + + /** + * @var string $unit (optional) The unit description of the item e.g. "Stk." with a maximum length of 255 + */ + protected $unit; + + /** + * @var int $quantity The quantity of the basket item (mandatory) + */ + protected $quantity; + + /** + * @var int $amountDiscount The discount amount for the basket item (optinal) + */ + protected $amountDiscount; + + /** + * @var int $vat The vat value for the basket item in percent (conditional) + */ + protected $vat; + + /** + * @var int $amountGross The gross amount (conditional), means amountNet + amountVat. + */ + protected $amountGross; + + /** + * @var int $amountVat The vat amount, this value could be 0 if the vat value is 0 (conditional) + */ + protected $amountVat; + + /** + * @var int $amountPerUnit The amount per unit (mandatory) + */ + protected $amountPerUnit; + + /** + * @var int $amountNet This value could be the same value as the gross amount if the vat value is 0 + */ + protected $amountNet; + + /** + * @var string $articleId (optional) The shop article id for the basket item with a maximum length of 255 + */ + protected $articleId; + + /** + * @var string $type (optional) The type of the basket item, e.g. "goods", "shipment", "voucher" or "digital" with + * a maximum length of 255 + */ + protected $type; + + /** + * @var string $title The title of the BasketItem with a maximum length of 255 + */ + protected $title; + + /** + * @var string $description (optional) A description for the basket item with a maximum length of 255 + */ + protected $description; + + /** + * @var string $imageUrl (optional) An image url e.g. https://placehold.it/32x32 with a maximum length of 255 + */ + protected $imageUrl; + + /** + * @var string $channel (cond. mandatory) The booking channel on which the item has to be booked (Marketplace) + */ + protected $channel; + + /** + * @var string $transactionId (optional) A unique identifier with a maximum length of 255 + */ + protected $transactionId; + + /** + * @var string $usage (optional) A description for the BasketItem with a maximum length of 255 + */ + protected $usage; + + /** + * @var float $commissionRate (optional) The commission rate for the marketplace in % with 2 decimal places + */ + protected $commissionRate; + + /** + * @var int $voucherAmount (optional) Voucher amount to be applied on the current BasketItem + */ + protected $voucherAmount; + + /** + * @var string $voucherId (optional) Voucher ID for the current BasketItem with a maximum length of 255 + */ + protected $voucherId; + + /** + * @var string $articleCategory + */ + protected $articleCategory; + + /** + * @var array $mandatory An array containing attributes that are mandatory for every BasketItem + */ + protected static $mandatory = [ + 'basketitemReferenceId', + 'quantity', + 'amountPerUnit', + 'amountNet', + 'title' + ]; + + /** + * @var bool $isMarketplace If the BasketItem is used for a marketplace. + */ + private $isMarketplaceItem; + + /** + * BasketItem constructor. + * + * @param bool $isMarketplace Determines if the BasketItem is used for a marketplace + */ + public function __construct($isMarketplace = false) + { + $this->isMarketplaceItem = $isMarketplace; + } + + /** + * Sets the discount amount. + * + * @param int $value + * + * @return $this + */ + public function setAmountDiscount($value) + { + $this->amountDiscount = $value; + return $this; + } + + /** + * Sets the gross amount. + * + * @param int $value + * + * @return $this + */ + public function setAmountGross($value) + { + $this->amountGross = $value; + return $this; + } + + /** + * Sets the net amount. + * + * @param int $value + * + * @return $this + */ + public function setAmountNet($value) + { + $this->amountNet = $value; + return $this; + } + + /** + * Sets the amount per unit. + * + * @param int $value + * + * @return $this + */ + public function setAmountPerUnit($value) + { + $this->amountPerUnit = $value; + return $this; + } + + /** + * Sets the vat amount. + * + * @param int $value + * + * @return $this + */ + public function setAmountVat($value) + { + $this->amountVat = $value; + return $this; + } + + /** + * Sets the article id. + * + * @param string $value + * + * @return $this + */ + public function setArticleId($value) + { + $this->articleId = $value; + return $this; + } + + /** + * Sets the BasketItem reference id. + * + * @param string $value + * + * @return $this + */ + public function setBasketItemReferenceId($value) + { + $this->basketItemReferenceId = $value; + return $this; + } + + /** + * Sets the description. + * + * @param string $value + * + * @return $this + */ + public function setDescription($value) + { + $this->description = $value; + return $this; + } + + /** + * Image url setter + * + * If possible provide a https source - http images could be blocked due to + * browser securtiy restrictions. + * + * @param string $value + * + * @return $this + */ + public function setImageUrl($value) + { + $this->imageUrl = $value; + return $this; + } + + /** + * Sets the position. + * + * @param int $position + * + * @throws InvalidBasketitemPositionException + * + * @return $this + */ + public function setPosition($position) + { + if ($position <= 0) { + throw new InvalidBasketitemPositionException('BasketItem position cannot be equal or less than 0.'); + } + + $this->position = $position; + return $this; + } + + /** + * Sets the quantity. + * + * @param int $value + * + * @return $this + */ + public function setQuantity($value) + { + $this->quantity = $value; + return $this; + } + + /** + * Sets the title. + * + * @param string $value + * + * @return $this + */ + public function setTitle($value) + { + $this->title = $value; + return $this; + } + + /** + * Sets the type. + * + * @param string $value + * + * @return $this + */ + public function setType($value) + { + $this->type = $value; + return $this; + } + + /** + * Sets the unit. + * + * @param string $value + * + * @return $this + */ + public function setUnit($value) + { + $this->unit = $value; + return $this; + } + + /** + * Sets the vat. + * + * @param int $value + * + * @return $this + */ + public function setVat($value) + { + $this->vat = $value; + return $this; + } + + /** + * Sets the marketplace channel. + * + * @param string $channel + * + * @return $this + */ + public function setChannel($channel) + { + $this->channel = $channel; + return $this; + } + + /** + * Sets the transaction id. + * + * @param string $transactionId + * + * @return $this + */ + public function setTransactionId($transactionId) + { + $this->transactionId = $transactionId; + return $this; + } + + /** + * Sets the usage. + * + * @param string $usage + * + * @return $this + */ + public function setUsage($usage) + { + $this->usage = $usage; + return $this; + } + + /** + * Sets the commission rate. + * + * @param float $commissionRate + * + * @return $this + */ + public function setCommissionRate($commissionRate) + { + $this->commissionRate = $commissionRate; + return $this; + } + + /** + * Sets the voucher amount. + * + * @param int $voucherAmount + * + * @return $this + */ + public function setVoucherAmount($voucherAmount) + { + $this->voucherAmount = $voucherAmount; + return $this; + } + + /** + * Sets the voucher id. + * + * @param string $voucherId + * + * @return $this + */ + public function setVoucherId($voucherId) + { + $this->voucherId = $voucherId; + return $this; + } + + /** + * Returns the position. + * + * @return int + */ + public function getPosition() + { + return $this->position; + } + + /** + * Returns the reference id. + * + * @return string + */ + public function getReferenceId() + { + return $this->basketItemReferenceId; + } + + /** + * Returns the unit. + * + * @return string + */ + public function getUnit() + { + return $this->unit; + } + + /** + * @return int + */ + public function getQuantity() + { + return $this->quantity; + } + + /** + * Returns the discount amount. + * + * @return int + */ + public function getAmountDiscount() + { + return $this->amountDiscount; + } + + /** + * Returns the vat. + * + * @return int + */ + public function getVat() + { + return $this->vat; + } + + /** + * Returns the gross amount. + * + * @return int + */ + public function getAmountGross() + { + return $this->amountGross; + } + + /** + * Returns the vat amount. + * + * @return int + */ + public function getAmountVat() + { + return $this->amountVat; + } + + /** + * Returns the amount per unit. + * + * @return int + */ + public function getAmountPerUnit() + { + return $this->amountPerUnit; + } + + /** + * Returns the net amount. + * + * @return int + */ + public function getAmountNet() + { + return $this->amountNet; + } + + /** + * Returns the article id. + * + * @return string + */ + public function getArticleId() + { + return $this->articleId; + } + + /** + * Returns the type. + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Returns the title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Returns the description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Returns the image url. + * + * @return string + */ + public function getImageUrl() + { + return $this->imageUrl; + } + + /** + * Returns the marketplace channel. + * + * @return string + */ + public function getChannel() + { + return $this->channel; + } + + /** + * Returns the transaction id. + * + * @return string + */ + public function getTransactionId() + { + return $this->transactionId; + } + + /** + * Returns the usage. + * + * @return string + */ + public function getUsage() + { + return $this->usage; + } + + /** + * Returns the commission rate. + * + * @return float + */ + public function getCommissionRate() + { + return $this->commissionRate; + } + + /** + * Returns the voucher amount. + * + * @return int + */ + public function getVoucherAmount() + { + return $this->voucherAmount; + } + + /** + * Returns the voucher id. + * + * @return string + */ + public function getVoucherId() + { + return $this->voucherId; + } + + /** + * @todo property is yet undocumented in the Integration_Guide (v1.2)! + * + * @return string + */ + public function getArticleCategory() + { + return $this->articleCategory; + } + + /** + * @todo property is yet undocumented in the Integration_Guide (v1.2)! + * + * @param string $articleCategory + * + * @return $this + */ + public function setArticleCategory($articleCategory) + { + $this->articleCategory = $articleCategory; + return $this; + } + + /** + * Returns if the BasketItem is used for marketplace purposes. + * + * @return bool + */ + public function isMarketplaceItem() + { + return $this->isMarketplaceItem; + } + + /** + * Sets the boolean that determines if the BasketItem is used for a marketplace. + * + * @param bool $isMarketplaceItem + */ + public function setIsMarketplaceItem($isMarketplaceItem = true) + { + $this->isMarketplaceItem = $isMarketplaceItem; + } + + /** + * Returns an array that is used for the JSON representation when using json_encode or toJson(). + * + * @return array + */ + public function jsonSerialize() + { + // TODO: add articleCategory if documented and ready to release. + $result = [ + 'position' => $this->position, + 'basketItemReferenceId' => $this->basketItemReferenceId, + 'articleId' => $this->articleId, + 'title' => $this->title, + 'description' => $this->description, + 'amountGross' => $this->amountGross, + 'amountNet' => $this->amountNet, + 'amountPerUnit' => $this->amountPerUnit, + 'amountVat' => $this->amountVat, + 'amountDiscount' => $this->amountDiscount, + 'unit' => $this->unit, + 'quantity' => $this->quantity, + 'vat' => $this->vat, + 'type' => $this->type, + 'imageUrl' => $this->imageUrl, + 'voucherAmount' => $this->voucherAmount, + 'voucherId' => $this->voucherId, + ]; + + if ($this->isMarketplaceItem()) { + $result = array_merge($result, [ + 'channel' => $this->channel, + 'commissionRate' => $this->commissionRate, + 'transactionId' => $this->transactionId, + 'usage' => $this->usage, + ]); + } + + return $result; + } + + /** + * Magic getter for properties + * + * @param $field + * + * @return null + */ + public function __get($field) + { + if (property_exists($this, $field)) { + return $this->$field; + } + + return null; + } + + /** + * Magic setter in favor of parsing. + * + * @param $field + * @param $value + */ + public function __set($field, $value) + { + if (property_exists($this, $field)) { + $this->$field = $value; + } + } + + /** + * Isset implementation for the __set method + * + * @param $field + * + * @return bool + */ + public function __isset($field) + { + if (!property_exists($this, $field)) { + return false; + } + + return $this->$field !== null && !empty($this->$field); + } +} diff --git a/vendor/heidelpay/php-basket-api/lib/Request.php b/vendor/heidelpay/php-basket-api/lib/Request.php new file mode 100644 index 0000000..bfff3fd --- /dev/null +++ b/vendor/heidelpay/php-basket-api/lib/Request.php @@ -0,0 +1,219 @@ + + * @author Stephano Vogel + * + * @package heidelpay\php-basket-api\Interaction\Object + */ +class Request extends AbstractObject +{ + /** + * @var string URL for the test system + */ + const URL_TEST = 'https://test-heidelpay.hpcgw.net/ngw/basket/'; + + /** + * @var string URL for the live system + */ + const URL_LIVE = 'https://heidelpay.hpcgw.net/ngw/basket/'; + + /** + * @var Authentication $authentication The authentication instance + */ + protected $authentication; + + /** + * @var Basket $basket The basket object + */ + protected $basket; + + /** + * @var bool $isSandbox If the request is being sent to the test environment + */ + protected $isSandbox = true; + + /** + * @var AdapterInterface $adapter The adapter for sending requests to the API + */ + protected $adapter; + + /** + * Request class constructor + * + * @param Authentication|null $auth + * @param Basket|null $basket + */ + public function __construct(Authentication $auth = null, Basket $basket = null) + { + if ($auth !== null) { + $this->authentication = $auth; + } + + if ($basket !== null) { + $this->basket = $basket; + } + + $this->adapter = new CurlAdapter(); + } + + /** + * Enables or disables Sandbox mode. + * + * @param bool $isSandbox either if sandbox mode is enabled or not + * + * @return $this + */ + public function setIsSandboxMode($isSandbox) + { + $this->isSandbox = $isSandbox; + + return $this; + } + + /** + * Determines if the SDK runs in sandbox mode. + * + * @return bool + */ + public function isSandboxMode() + { + return $this->isSandbox; + } + + /** + * Sets the authentication object. + * + * @param string $login + * @param string $password + * @param string $senderId + * + * @return $this + */ + public function setAuthentication($login = null, $password = null, $senderId = null) + { + $this->authentication = new Authentication($login, $password, $senderId); + + return $this; + } + + /** + * Returns the Authentication object. + * + * @return Authentication + */ + public function getAuthentication() + { + if ($this->authentication === null) { + $this->authentication = new Authentication(); + } + + return $this->authentication; + } + + /** + * Sets the basket for the request. + * + * @param Basket $basket + * + * @return $this + */ + public function setBasket(Basket $basket) + { + $this->basket = $basket; + + return $this; + } + + /** + * Returns the Basket from the Request. + * + * @return Basket + */ + public function getBasket() + { + if ($this->basket === null) { + $this->basket = new Basket(); + } + + return $this->basket; + } + + /** + * Retrieves a basket by the given unique basket id. + * The Response is returned, not the Basket itself. + * + * @param string $basketId + * + * @return Response + */ + public function retrieveBasket($basketId) + { + return new Response($this->adapter->sendPost($this->generateUrl('get/' . $basketId), $this)); + } + + /** + * Submits a basket and returns a Response. + * + * @return Response + */ + public function addNewBasket() + { + return new Response($this->adapter->sendPost($this->generateUrl(), $this)); + } + + /** + * Submits the current Basket to overwrite/change the basket with the given $basketId, + * e.g. if the user added a voucher or shipping fees have changed. + * + * @param string $basketId + * + * @return Response + */ + public function overwriteBasket($basketId) + { + return new Response($this->adapter->sendPost($this->generateUrl($basketId), $this)); + } + + /** + * Generates a url for the request. + * + * @param string|null $suffix The url suffix + * + * @return string + */ + private function generateUrl($suffix = null) + { + $base = $this->isSandbox ? self::URL_TEST : self::URL_LIVE; + + return sprintf('%s%s', $base, $suffix); + } + + /** + * @return array + */ + public function jsonSerialize() + { + return [ + 'authentication' => $this->authentication, + 'basket' => $this->basket + ]; + } +} diff --git a/vendor/heidelpay/php-basket-api/lib/Response.php b/vendor/heidelpay/php-basket-api/lib/Response.php new file mode 100644 index 0000000..e6527a3 --- /dev/null +++ b/vendor/heidelpay/php-basket-api/lib/Response.php @@ -0,0 +1,393 @@ + + * + * @package heidelpay\php-basket-api\interaction\object + */ +class Response extends AbstractObject +{ + /** + * @var string The application name + */ + const APP_NAME = 'heidelpay Basket-API'; + + /** + * @var string ACK result code + */ + const RESULT_ACK = 'ACK'; + + /** + * @var string NOK result code + */ + const RESULT_NOK = 'NOK'; + + /** + * @var string API method name for adding a basket + */ + const METHOD_ADDNEWBASKET = 'addNewBasket'; + + /** + * @var string API method name for overwriting a basket + */ + const METHOD_OVERWRITEBASKET = 'overwriteBasket'; + + /** + * @var string API method name for getting a basket + */ + const METHOD_GETBASKET = 'getBasket'; + + /** + * @var string Response result (either "ACK" or "NOK") + */ + protected $result; + + /** + * @var string The Basket called method, e.g. 'addNewBasket', 'getBasket', 'overwriteBasket' + */ + protected $method; + + /** + * @var string Basket Id for reference in following transactions + */ + protected $basketId; + + /** + * @var Basket a basket object, if present in the response + */ + protected $basket; + + /** + * @var BasketError[] array of response errors + */ + protected $basketErrors = []; + + /** + * Response constructor. + * + * The response should be in json format (as a string), so it can + * be parsed correctly. + * + * @param string|null $content + */ + public function __construct($content = null) + { + if ($content !== null && is_string($content)) { + $this->parseResponse($content); + } + } + + /** + * Returns true, if the request results in a 'ACK' (acknowledged). + * + * @return bool + */ + public function isSuccess() + { + return $this->result === self::RESULT_ACK; + } + + /** + * Returns true, if the request results in a 'NOK' (not ok). + * + * @return bool + */ + public function isFailure() + { + return $this->result === self::RESULT_NOK; + } + + /** + * Returns the Response result, which is either 'ACK' or 'NOK'. + * + * @return string + */ + public function getResult() + { + return $this->result; + } + + /** + * @param string $result + * + * @return $this + */ + protected function setResult($result) + { + $this->result = $result; + return $this; + } + + /** + * @return string + */ + public function getMethod() + { + return $this->method; + } + + /** + * @param string $method + * + * @return $this + */ + protected function setMethod($method) + { + $this->method = $method; + return $this; + } + + /** + * @return string + */ + public function getBasketId() + { + return $this->basketId; + } + + /** + * @param string $basketId + * + * @return $this + */ + protected function setBasketId($basketId) + { + $this->basketId = $basketId; + return $this; + } + + /** + * @return Basket + */ + public function getBasket() + { + return $this->basket; + } + + /** + * @param Basket $basket + * + * @return $this + */ + protected function setBasket(Basket $basket) + { + $this->basket = $basket; + return $this; + } + + /** + * @return BasketError[] + */ + public function getBasketErrors() + { + return $this->basketErrors; + } + + /** + * @param BasketError $basketError + * + * @return $this + */ + private function addBasketError(BasketError $basketError) + { + $this->basketErrors[] = $basketError; + return $this; + } + + /** + * @return array + */ + public function jsonSerialize() + { + return [ + 'result' => $this->result, + 'method' => $this->method, + 'basket' => $this->basket, + 'basketId' => $this->basketId, + 'basketErrors' => array_values($this->basketErrors) + ]; + } + + /** + * Prints a formatted message of the Response, including the basket errors. + * + * @return string + */ + public function printMessage() + { + $messages = []; + + foreach ($this->basketErrors as $basketError) { + $messages[] = $basketError->printMessage(); + } + + if ($this->isSuccess()) { + return sprintf('%s - %s Request SUCCESS. %s', self::APP_NAME, $this->method, implode(', ', $messages)); + } + + return sprintf('%s - %s Request FAILURE. %s', self::APP_NAME, $this->method, implode(', ', $messages)); + } + + /** + * Parses a raw json response into a instance of this class. + * + * @param string $response a raw json response from a cURL request + * + * @throws BasketException + */ + private function parseResponse($response) + { + /** @var \stdClass $obj */ + // if the json cannot be parsed, do nothing. + if (!$obj = json_decode($response)) { + return; + } + + $this->setResponseParameters($obj); + + if (isset($obj->basket)) { + // instanciate a new Basket + $basket = new Basket(); + + // go through all properties of the parsed object and + // set the Basket's properties by their values. + $this->setBasketProperties($basket, $obj); + + // iterate through the basket items. + if (isset($obj->basket->basketItems) && !empty($obj->basket->basketItems)) { + sort($obj->basket->basketItems); + $this->setBasketItemProperties($basket, $obj->basket->basketItems); + } + + $this->setBasket($basket); + + if (isset($obj->basket->itemCount) && $this->basket->getItemCount() !== $obj->basket->itemCount) { + throw new BasketException( + 'Itemcount ' . $this->basket->getItemCount() . ' does not match ' . $obj->basket->itemCount . '!' + ); + } + } + + // iterate through all basket errors, create object instances + // of them and add them to the basketErrors array. + if (isset($obj->basketErrors) && is_array($obj->basketErrors)) { + $this->setBasketErrors($obj->basketErrors); + } + } + + /** + * Returns if the provided BasketItem uses Marketplace properties (that are not null) + * + * @param BasketItem $basketItem + * + * @return bool + */ + private function itemHasMarketplaceProperties(BasketItem $basketItem) + { + return $basketItem->getChannel() !== null + || $basketItem->getCommissionRate() !== null + || $basketItem->getTransactionId() !== null + || $basketItem->getUsage() !== null; + } + + /** + * Sets response parameters (result, request method &basket id) + * + * @param \stdClass $obj + */ + private function setResponseParameters(\stdClass $obj) + { + if (isset($obj->result)) { + $this->setResult($obj->result); + } + + if (isset($obj->method)) { + $this->setMethod($obj->method); + } + + if (isset($obj->basketId)) { + $this->setBasketId($obj->basketId); + } + } + + /** + * Sets the BasketErrors for the Reponse instance. + * + * @param array $basketErrors + */ + private function setBasketErrors($basketErrors) + { + foreach ($basketErrors as $basketError) { + $objErr = new BasketError(); + + if (isset($basketError->code)) { + $objErr->setCode($basketError->code); + } + + if (isset($basketError->message)) { + $objErr->setMessage($basketError->message); + } + + $this->addBasketError($objErr); + } + } + + /** + * Sets the Basket's properties. + * + * @param Basket $basket + * @param \stdClass $obj + */ + private function setBasketProperties(Basket $basket, \stdClass $obj) + { + foreach (get_object_vars($obj->basket) as $class_var => $value) { + if ($class_var !== 'basketItems') { + $basket->$class_var = $value; + } + } + } + + /** + * @param Basket $basket + * @param array $basketItems + * + * @throws BasketException + */ + private function setBasketItemProperties(Basket $basket, array $basketItems) + { + foreach ($basketItems as $basketItem) { + $item = new BasketItem(); + + foreach (get_object_vars($basketItem) as $class_var => $value) { + $item->$class_var = $value; + } + + // if marketplace parameters are provided, set the BasketItem's + // isMarketplaceItem property to 'true'. + if ($this->itemHasMarketplaceProperties($item)) { + $item->setIsMarketplaceItem(); + } + + try { + $basket->addBasketItem($item, $item->getPosition()); + } catch (InvalidBasketitemPositionException $e) { + throw new BasketException('Could not add BasketItem to Basket during parsing!'); + } + } + } +} diff --git a/vendor/heidelpay/php-basket-api/phpdoc.dist.xml b/vendor/heidelpay/php-basket-api/phpdoc.dist.xml new file mode 100644 index 0000000..67f537c --- /dev/null +++ b/vendor/heidelpay/php-basket-api/phpdoc.dist.xml @@ -0,0 +1,21 @@ + + + php-basket-api + + PHP Basket Api + ./docs/ + + + ./docs/ + + + . + vendor/* + + + + + +