Skip to content

Commit

Permalink
Merge pull request #2 from wirecard/dupicateRequestCheckDisable
Browse files Browse the repository at this point in the history
#1 Remove duplicate request check
  • Loading branch information
rinnhofer authored Apr 6, 2017
2 parents a7c9c2a + 39e09d0 commit 923d6c8
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 72 deletions.
67 changes: 12 additions & 55 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
class Data extends \Magento\Framework\App\Helper\AbstractHelper
{

protected $_pluginVersion = '1.0.0';
protected $_pluginVersion = '1.0.2';
protected $_pluginName = 'Wirecard/CheckoutSeamless';

/**
Expand Down Expand Up @@ -267,7 +267,17 @@ public function getUserAgent()
*/
public function getClientIp()
{
return $this->_request->getClientIp();
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) and $_SERVER['HTTP_X_FORWARDED_FOR']) {
if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')) {
$ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);

return $ips[0];
} else {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
}

return $_SERVER['REMOTE_ADDR'];
}

/**
Expand Down Expand Up @@ -406,57 +416,4 @@ public function getFinancialInstitutions($paymentType)
return [];
}
}

public function initDataStorage()
{
$dataStorageInit = new \WirecardCEE_QMore_DataStorageClient($this->getConfigArray());

$dataStorageInit->setReturnUrl(Mage::getUrl('wirecard_checkoutseamless/processing/storereturn',
array('_secure' => true)));
$dataStorageInit->setOrderIdent(Mage::getSingleton('checkout/session')->getQuote()->getId());

$response = null;
if ($this->getConfigData('ccard/pci3_dss_saq_a_enable')) {
$dataStorageInit->setJavascriptScriptVersion('pci3');

if (strlen(trim($this->getConfigData('ccard/iframe_css_url')))) {
$dataStorageInit->setIframeCssUrl(trim($this->getConfigData('ccard/iframe_css_url')));
}

$dataStorageInit->setCreditCardCardholderNameField($this->getConfigData('ccard/showcardholder'));
$dataStorageInit->setCreditCardShowCvcField($this->getConfigData('ccard/showcvc'));
$dataStorageInit->setCreditCardShowIssueDateField($this->getConfigData('ccard/showissuedate'));
$dataStorageInit->setCreditCardShowIssueNumberField($this->getConfigData('ccard/showissuenumber'));
}

$this->_logger->debug(__METHOD__ . ':' . print_r($dataStorageInit->getRequestData(), true));

try {
$response = $dataStorageInit->initiate();

if (!$response->hasFailed()) {

Mage::getSingleton('checkout/session')->setWirecardCheckoutSeamlessStorageId($response->getStorageId());
$this->log(__METHOD__ . ':storageid:' . $response->getStorageId(), Zend_Log::DEBUG);

return $response;

} else {

$dsErrors = $response->getErrors();

foreach ($dsErrors as $error) {
$this->log(__METHOD__ . ':' . $error->getMessage());
}

return false;
}
} catch (\Exception $e) {

//communication with dataStorage failed. we choose a none dataStorage fallback
$this->_logger->debug(__METHOD__ . ':' . $e->getMessage());

return false;
}
}
}
6 changes: 1 addition & 5 deletions Model/AbstractPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function initPaymentByCart(CheckoutCart $cart, $urls, \Magento\Framework\
$quote->save();

$orderId = $quote->getReservedOrderId();
$init->setOrderReference(sprintf('%010d', $orderId));
$init->setOrderReference(sprintf('%010s', substr($orderId, -10)));

$returnUrl = $urls['return'];
$returnUrl .= strpos($urls['return'], '?') ? '&' : '?';
Expand Down Expand Up @@ -261,10 +261,6 @@ public function initPaymentByCart(CheckoutCart $cart, $urls, \Magento\Framework\
$init->setFinancialInstitution($data->getData('financialInstitution'));
}

if ($this->_dataHelper->getConfigData('options/duplicaterequestcheck')) {
$init->setDuplicateRequestCheck($this->_dataHelper->getConfigData('options/duplicaterequestcheck'));
}

$init->quoteHash = $this->_dataHelper->calculateQuoteChecksum($quote);

$this->setAdditionalRequestData($init, $cart);
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Wirecard Checkout Seamless extension for Magento 2

[![License](https://img.shields.io/badge/license-GPLv2-blue.svg)](https://raw.githubusercontent.com/wirecard/Magento2-WCP/master/LICENSE)
[![PHP v5.5](https://img.shields.io/badge/php-v5.5-yellow.svg)](http://www.php.net)
[![PHP v5.6](https://img.shields.io/badge/php-v5.5-yellow.svg)](http://www.php.net)
[![PHP v7.0](https://img.shields.io/badge/php-v7.0-yellow.svg)](http://www.php.net)
[![Magento v2.1.4](https://img.shields.io/badge/magento-v2.1.4-green.svg)](https://magento.com/)

Wirecard Checkout Seamless extension for Magento 2.
Expand All @@ -23,4 +24,3 @@ Wirecard Checkout Seamless offers:
- Web interface for managing payments (approvals, cancelations, credits, etc.).
- Benefit from Wirecard Bank´s license to conclude credit card acceptance contracts (acquiring) and issue credit cards.
- With Wirecard Collecting only a single contract is required for payouts within various payment methods.
- Support of recurring payments (subscriptions, one-click checkout).
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "wirecard/magento2-wcs",
"description": "Wirecard Checkout Seamless",
"type": "magento2-module",
"version": "1.0.0",
"version": "1.0.2",
"license": [
"MIT"
],
Expand Down
8 changes: 0 additions & 8 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,6 @@
Forwarding basket data to the respective financial service provider.
]]></comment>
</field>

<field id="duplicaterequestcheck" translate="label comment" type="select" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="100">
<label>Check for duplicate requests</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment><![CDATA[
Check for duplicate requests done by your consumer. <a href="https://guides.wirecard.at/request_parameters#duplicaterequestcheck" target="_blank">More information.</a>
]]></comment>
</field>
</group>

<group id="ccard" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
Expand Down
1 change: 0 additions & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
<order_creation>after</order_creation>
<sendbillingdata>1</sendbillingdata>
<sendshippingdata>1</sendshippingdata>
<duplicaterequestcheck>1</duplicaterequestcheck>
</options>
<ccard>
<displaycardholder>1</displaycardholder>
Expand Down

0 comments on commit 923d6c8

Please sign in to comment.