-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
1,744 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
<?php | ||
class EPayApi extends PaymentModule | ||
{ | ||
public function _findTranslation() | ||
{ | ||
} | ||
|
||
public function capture($merchantnumber, $transactionid, $amount) | ||
{ | ||
$epay_params = array(); | ||
$epay_params['merchantnumber'] = $merchantnumber; | ||
$epay_params['transactionid'] = $transactionid; | ||
$epay_params['amount'] = $amount; | ||
$epay_params['pwd'] = strval(Configuration::get('EPAY_REMOTE_API_PASSWORD')); | ||
$epay_params['pbsResponse'] = "-1"; | ||
$epay_params['epayresponse'] = "-1"; | ||
|
||
$result = $this->_soapcall()->capture($epay_params); | ||
|
||
return $result; | ||
} | ||
|
||
public function moveascaptured($merchantnumber, $transactionid) | ||
{ | ||
$epay_params = array(); | ||
$epay_params['merchantnumber'] = $merchantnumber; | ||
$epay_params['transactionid'] = $transactionid; | ||
$epay_params['epayresponse'] = "-1"; | ||
$epay_params['pwd'] = strval(Configuration::get('EPAY_REMOTE_API_PASSWORD')); | ||
|
||
$result = $this->_soapcall()->move_as_captured($epay_params); | ||
|
||
return $result; | ||
} | ||
|
||
public function credit($merchantnumber, $transactionid, $amount) | ||
{ | ||
$epay_params = array(); | ||
$epay_params['merchantnumber'] = $merchantnumber; | ||
$epay_params['transactionid'] = $transactionid; | ||
$epay_params['amount'] = $amount; | ||
$epay_params['pwd'] = strval(Configuration::get('EPAY_REMOTE_API_PASSWORD')); | ||
$epay_params['epayresponse'] = "-1"; | ||
$epay_params['pbsresponse'] = "-1"; | ||
|
||
$result = $this->_soapcall()->credit($epay_params); | ||
|
||
return $result; | ||
} | ||
|
||
public function delete($merchantnumber, $transactionid) | ||
{ | ||
$epay_params = array(); | ||
$epay_params['merchantnumber'] = $merchantnumber; | ||
$epay_params['transactionid'] = $transactionid; | ||
$epay_params['pwd'] = strval(Configuration::get('EPAY_REMOTE_API_PASSWORD')); | ||
$epay_params['epayresponse'] = "-1"; | ||
|
||
$result = $this->_soapcall()->delete($epay_params); | ||
|
||
return $result; | ||
} | ||
|
||
public function getEpayError($merchantnumber, $epay_response_code) | ||
{ | ||
$epay_params = array(); | ||
$epay_params['merchantnumber'] = $merchantnumber; | ||
$epay_params['language'] = 2; | ||
$epay_params['epayresponsecode'] = $epay_response_code; | ||
$epay_params['epayresponse'] = "-1"; | ||
|
||
$result = $this->_soapcall()->getEpayError($epay_params); | ||
|
||
if ($result->getEpayErrorResult == "true") | ||
echo '<script>alert("'.PaymentModule::l('Failure:').' '.Tools::iconv('ISO-8859-15', 'UTF-8', $result->epayresponsestring).'");</script>'; | ||
|
||
return $result; | ||
} | ||
|
||
public function getPbsError($merchantnumber, $pbs_response_code) | ||
{ | ||
$epay_params = array(); | ||
$epay_params['merchantnumber'] = $merchantnumber; | ||
$epay_params['language'] = 2; | ||
$epay_params['pbsresponsecode'] = $pbs_response_code; | ||
$epay_params['pwd'] = strval(Configuration::get('EPAY_REMOTE_API_PASSWORD')); | ||
$epay_params['epayresponse'] = "-1"; | ||
|
||
$result = $this->_soapcall()->getPbsError($epay_params); | ||
|
||
if ($result->getPbsErrorResult == "true") | ||
echo '<script>alert("'.PaymentModule::l('Failure:').' '.Tools::iconv('ISO-8859-15', 'UTF-8', $result->pbsresponsestring).'");</script>'; | ||
|
||
return $result; | ||
} | ||
|
||
public function gettransaction($merchantnumber, $transactionid) | ||
{ | ||
$epay_params = array(); | ||
$epay_params['merchantnumber'] = $merchantnumber; | ||
$epay_params['transactionid'] = $transactionid; | ||
$epay_params['pwd'] = strval(Configuration::get('EPAY_REMOTE_API_PASSWORD')); | ||
$epay_params["epayresponse"] = "-1"; | ||
|
||
$result = $this->_soapcall()->gettransaction($epay_params); | ||
|
||
return $result; | ||
} | ||
|
||
public function gettransactionInformation($merchantnumber, $transactionid) | ||
{ | ||
$epay_params = array(); | ||
$epay_params['merchantnumber'] = $merchantnumber; | ||
$epay_params['transactionid'] = $transactionid; | ||
$epay_params['pwd'] = strval(Configuration::get('EPAY_REMOTE_API_PASSWORD')); | ||
$epay_params["epayresponse"] = "-1"; | ||
|
||
$result = $this->_soapcall()->gettransaction($epay_params); | ||
|
||
if ($result->gettransactionResult == true) | ||
return $result->transactionInformation; | ||
else | ||
return false; | ||
} | ||
|
||
public function getcardinfo($merchantnumber, $cardno_prefix, $amount, $currency, $acquirer) | ||
{ | ||
$epay_params = array(); | ||
$epay_params['merchantnumber'] = $merchantnumber; | ||
$epay_params['cardno_prefix'] = $cardno_prefix; | ||
$epay_params['amount'] = $amount; | ||
$epay_params['currency'] = $currency; | ||
$epay_params['acquirer'] = $acquirer; | ||
$epay_params['pwd'] = strval(Configuration::get('EPAY_REMOTE_API_PASSWORD')); | ||
$epay_params["epayresponse"] = "-1"; | ||
|
||
$result = $this->_soapcall()->getcardinfo($epay_params); | ||
|
||
return $result; | ||
} | ||
|
||
private function _soapcall() | ||
{ | ||
$client = new SoapClient('https://ssl.ditonlinebetalingssystem.dk/remote/payment.asmx?WSDL'); | ||
|
||
return $client; | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<module> | ||
<name>epay</name> | ||
<displayName><![CDATA[ePay]]></displayName> | ||
<version><![CDATA[4.7]]></version> | ||
<description><![CDATA[Accept Dankort, eDankort, VISA, Electron, MasterCard, Maestro, JCB, Diners, AMEX, Nordea and Danske Bank payments by ePay / Payment Solutions]]></description> | ||
<author><![CDATA[ePay - Michael Korsgaard]]></author> | ||
<tab><![CDATA[payments_gateways]]></tab> | ||
<is_configurable>1</is_configurable> | ||
<need_instance>1</need_instance> | ||
<limited_countries></limited_countries> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
/* | ||
* 2007-2013 PrestaShop | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Academic Free License (AFL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/afl-3.0.php | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to http://www.prestashop.com for more information. | ||
* | ||
* @author PrestaShop SA <[email protected]> | ||
* @copyright 2007-2013 PrestaShop SA | ||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) | ||
* International Registered Trademark & Property of PrestaShop SA | ||
*/ | ||
|
||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); | ||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); | ||
|
||
header("Cache-Control: no-store, no-cache, must-revalidate"); | ||
header("Cache-Control: post-check=0, pre-check=0", false); | ||
header("Pragma: no-cache"); | ||
|
||
header("Location: ../"); | ||
exit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<?php | ||
/* | ||
Copyright (c) 2010. All rights reserved ePay - www.epay.dk. | ||
This program is free software. You are allowed to use the software but NOT allowed to modify the software. | ||
It is also not legal to do any changes to the software and distribute it in your own name / brand. | ||
*/ | ||
|
||
class EPayValidationModuleFrontController extends ModuleFrontController | ||
{ | ||
public $ssl = true; | ||
public $display_column_left = false; | ||
|
||
public function postProcess() | ||
{ | ||
$amount = number_format(Tools::getValue('amount') / 100, 2, ".", ""); | ||
$id_cart = Tools::getValue('orderid'); | ||
$cart = new Cart($id_cart); | ||
$currency = Tools::getValue('currency'); | ||
$cardid = Tools::getValue('paymenttype'); | ||
$cardnopostfix = (isset($_GET['cardno']) ? substr($_GET['cardno'], - 4) : 0); | ||
$transfee = (isset($_GET['txnfee']) ? $_GET['txnfee'] : 0); | ||
$fraud = (isset($_GET['fraud']) ? $_GET['fraud'] : 0); | ||
|
||
$mailVars = array(); | ||
|
||
$params = $_GET; | ||
$var = ""; | ||
|
||
foreach($params as $key => $value) | ||
{ | ||
if($key != "hash" && $key != "controller") | ||
{ | ||
$mailVars['{epay_' . $key . '}'] = $value; | ||
$var .= $value; | ||
} | ||
} | ||
|
||
if(strlen(Configuration::get('EPAY_MD5KEY')) > 0) | ||
{ | ||
$genstamp = md5($var . Configuration::get('EPAY_MD5KEY')); | ||
|
||
if($genstamp != $_REQUEST["hash"]) | ||
die(Tools::displayError('Error in MD5 data! Please review your passwords in both ePay and your Prestashop admin!')); | ||
} | ||
|
||
$total = $cart->getOrderTotal(true, Cart::BOTH); | ||
|
||
if($cart->OrderExists() == 0) | ||
{ | ||
if($this->module->validateOrder((int)$id_cart, Configuration::get('PS_OS_PAYMENT'), $total, $this->module->displayName, null, $mailVars, null, false, $cart->secure_key)) | ||
{ | ||
$this->module->recordTransaction(null, $id_cart, $_GET["txnid"], $cardid, $cardnopostfix, $currency, Tools::getValue('amount'), $transfee, $fraud); | ||
|
||
$order = new Order($this->module->currentOrder); | ||
|
||
$payment = $order->getOrderPayments(); | ||
$payment[0]->transaction_id = Tools::getValue('txnid'); | ||
$payment[0]->amount = $amount; | ||
|
||
if($transfee > 0) | ||
{ | ||
$payment[0]->amount = $payment[0]->amount + number_format($transfee / 100, 2, ".", ""); | ||
|
||
if(Configuration::get('EPAY_ADDFEETOSHIPPING')) | ||
{ | ||
$order->total_paid = $order->total_paid + number_format($transfee / 100, 2, ".", ""); | ||
$order->total_paid_tax_incl = $order->total_paid_tax_incl + number_format($transfee / 100, 2, ".", ""); | ||
$order->total_paid_tax_excl = $order->total_paid_tax_excl + number_format($transfee / 100, 2, ".", ""); | ||
$order->total_paid_real = $order->total_paid_real + number_format($transfee / 100, 2, ".", ""); | ||
$order->total_shipping = $order->total_shipping + number_format($transfee / 100, 2, ".", ""); | ||
$order->total_shipping_tax_incl = $order->total_shipping_tax_incl + number_format($transfee / 100, 2, ".", ""); | ||
$order->total_shipping_tax_excl = $order->total_shipping_tax_excl + number_format($transfee / 100, 2, ".", ""); | ||
$order->save(); | ||
|
||
$invoice = $payment[0]->getOrderInvoice($epay->currentOrder); | ||
$invoice->total_paid_tax_incl = $invoice->total_paid_tax_incl + number_format($transfee / 100, 2, ".", ""); | ||
$invoice->total_paid_tax_excl = $invoice->total_paid_tax_excl + number_format($transfee / 100, 2, ".", ""); | ||
$invoice->total_shipping_tax_incl = $invoice->total_shipping_tax_incl + number_format($transfee / 100, 2, ".", ""); | ||
$invoice->total_shipping_tax_excl = $invoice->total_shipping_tax_excl + number_format($transfee / 100, 2, ".", ""); | ||
|
||
$invoice->save(); | ||
} | ||
|
||
$payment[0]->save(); | ||
} | ||
} | ||
} | ||
|
||
$id_order = Order::getOrderByCartId($id_cart); | ||
|
||
if(Tools::getValue('callback') != "1") | ||
Tools::redirectLink(__PS_BASE_URI__.'order-confirmation.php?key='.$cart->secure_key.'&id_cart='.(int)$cart->id.'&id_module='.(int)$this->module->id.'&id_order='.(int)$id_order); | ||
} | ||
|
||
/** | ||
* @see FrontController::initContent() | ||
*/ | ||
public function initContent() | ||
{ | ||
parent::initContent(); | ||
|
||
$this->context->smarty->assign(array( | ||
'total' => $this->context->cart->getOrderTotal(true, Cart::BOTH), | ||
'this_path' => $this->module->getPathUri(),//keep for retro compat | ||
'this_path_cod' => $this->module->getPathUri(), | ||
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->module->name.'/' | ||
)); | ||
|
||
$this->setTemplate('validation.tpl'); | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
/* | ||
* 2007-2013 PrestaShop | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Academic Free License (AFL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/afl-3.0.php | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to http://www.prestashop.com for more information. | ||
* | ||
* @author PrestaShop SA <[email protected]> | ||
* @copyright 2007-2013 PrestaShop SA | ||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) | ||
* International Registered Trademark & Property of PrestaShop SA | ||
*/ | ||
|
||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); | ||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); | ||
|
||
header("Cache-Control: no-store, no-cache, must-revalidate"); | ||
header("Cache-Control: post-check=0, pre-check=0", false); | ||
header("Pragma: no-cache"); | ||
|
||
header("Location: ../"); | ||
exit; |
Oops, something went wrong.