-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin'
- Loading branch information
Showing
12 changed files
with
267 additions
and
8 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
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
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
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
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
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
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
214 changes: 214 additions & 0 deletions
214
modules/cardgateonlineueberweisen/cardgateonlineueberweisen.php
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,214 @@ | ||
<?php | ||
|
||
use PrestaShop\PrestaShop\Core\Payment\PaymentOption; | ||
|
||
if ( file_exists( dirname( __FILE__ ) . '/../cardgate/cardgate.php') ) { | ||
require_once dirname( __FILE__ ) . '/../cardgate/cardgate.php'; | ||
} else { | ||
$GLOBALS['CARDGATENOTFOUND']=1; | ||
if (!class_exists('CardgatePayment')) { class CardgatePayment extends PaymentModule { function get_url(){} } } | ||
} | ||
|
||
/** | ||
* CardGate - Prestashop | ||
* | ||
* 2010-11-09 (LL) Version 1.00 | ||
* Initial release | ||
* | ||
* 2011-04-18 (BZ) Version 1.01 | ||
* Added PayPal, updated countries for payment options | ||
* | ||
* Data for langiange translations | ||
* | ||
* $this->l('Pay with') | ||
*/ | ||
class Cardgateonlineueberweisen extends PaymentModule { | ||
|
||
var $tab = 'payments_gateways'; | ||
var $author = 'CardGate'; | ||
var $shop_version = _PS_VERSION_; | ||
var $currencies = true; | ||
var $currencies_mode = 'radio'; | ||
var $_html = ''; | ||
var $extra_cost = ''; | ||
protected $_paymentHookTpl = ''; | ||
|
||
private $_postErrors = array(); | ||
protected $_childClassFile = __FILE__; | ||
|
||
/** | ||
* Available payment methods setup | ||
*/ | ||
public function __construct() { | ||
global $cookie, $order; | ||
|
||
$this->name = 'cardgateonlineueberweisen'; | ||
$this->paymentcode = 'onlineueberweisen'; | ||
$this->ps_versions_compliancy = array('min' => '1.7.1.0', 'max' => _PS_VERSION_ ); | ||
$this->paymentname = 'OnlineÜberweisen'; | ||
$this->logoname = 'onlineueberweisen'; | ||
$this->version = Configuration::get('CARDGATE_MODULE_VERSION'); | ||
$this->imageurl = 'https://gateway.cardgateplus.com/images/logo' . $this->paymentcode . '.gif'; | ||
$this->extra_cost = Configuration::get('CARDGATE_' . strtoupper( $this->paymentcode ) . '_EXTRACOST'); | ||
$this->controllers = array('validation'); | ||
$this->is_eu_compatible = 1; | ||
$this->currencies = true; | ||
$this->currencies_mode = 'checkbox'; | ||
$this->bootstrap = true; | ||
|
||
parent::__construct(); | ||
$this->page = basename( __FILE__, '.php'); | ||
$this->displayName = $this->l('CardGate OnlineÜberweisen'); | ||
$this->description = $this->l('Accepts payments with CardGate OnlineÜberweisen.'); | ||
$this->confirmUninstall = $this->l('Are you sure you want to delete your details?'); | ||
|
||
if ( !count( Currency::checkPaymentCurrencies( $this->id ) ) ) { | ||
$this->warning = $this->l('No currency has been set for this module.'); | ||
} | ||
|
||
$total = 0; | ||
$rate = 'EUR'; | ||
|
||
if ( isset( $GLOBALS['cart'] ) && $GLOBALS['cart']->id_currency > 0 ) { | ||
$currency = new Currency( $GLOBALS['cart']->id_currency ); | ||
$total = round( Tools::convertPrice( $GLOBALS['cart']->getOrderTotal( true, 3 ), $currency ), 2 ); | ||
$rate = $currency->iso_code; | ||
} | ||
$id_lang = (!isset( $cookie ) OR ! is_object( $cookie )) ? intval( Configuration::get('PS_LANG_DEFAULT') ) : intval( $cookie->id_lang ); | ||
|
||
if ( isset( $GLOBALS['CARDGATENOTFOUND'] ) ) | ||
$this->warning = $this->l('The CardGate module is not found.'); | ||
} | ||
|
||
public function install() { | ||
|
||
if ( !parent::install() || !$this->registerHook('paymentOptions') || !$this->registerHook('paymentReturn') ) { | ||
return false; | ||
} | ||
return true; | ||
|
||
$payment = strtoupper( $this->paymentcode ); | ||
|
||
if ( !parent::install() OR ! $this->registerHook('payment') ) | ||
return false; | ||
return true; | ||
} | ||
|
||
public function uninstall() { | ||
|
||
$paymentcode = $this->paymentcode; | ||
|
||
if ( $paymentcode == '') | ||
return false; | ||
|
||
$paymentcode = strtoupper( $paymentcode ); | ||
|
||
if ( !parent::uninstall() ) | ||
return false; | ||
return true; | ||
} | ||
|
||
public function hookPaymentOptions( $params ) { | ||
|
||
if ( !$this->active ) { | ||
return; | ||
} | ||
if ( !$this->checkCurrency( $params['cart'] ) ) { | ||
return; | ||
} | ||
|
||
if (isset($_COOKIE['issuer'])){ | ||
$issuer = $_COOKIE['issuer']; | ||
} else { | ||
$issuer = 0; | ||
} | ||
|
||
$paymentOption = new PaymentOption(); | ||
|
||
$costText = ''; | ||
$extraCosts = floatval(Configuration::get( 'CARDGATE_'.strtoupper( $this->paymentcode).'_EXTRACOST' )); | ||
|
||
if ($extraCosts > 0 ){ | ||
$oCurrency = new Currency( $params['cart']->id_currency ); | ||
$costText .= ' + '.$oCurrency->sign.' '.number_format($extraCosts, 2); | ||
} | ||
|
||
if ($this->paymentcode == 'ideal'){ | ||
$this->smarty->assign(['issuers'=>$this->getBanks(),'selected'=>$issuer]); | ||
$additionalInformation = $this->fetch('module:cardgateideal/views/templates/front/payment_infos.tpl'); | ||
} else { | ||
$additionalInformation = null; | ||
} | ||
|
||
$display = Configuration::get('CARDGATE_PAYMENT_DISPLAY'); | ||
|
||
if ($display == 'textandlogo' || $display == 'textonly'){ | ||
$actionText = $this->l('Pay with').' '.$this->paymentname . $costText; | ||
} else { | ||
$actionText = null; | ||
} | ||
|
||
if ($display == 'textandlogo' || $display == 'logoonly' ){ | ||
$logo = Media::getMediaPath(_PS_MODULE_DIR_.$this->name.'/logo.gif'); | ||
} else { | ||
$logo = null; | ||
} | ||
$paymentOption->setCallToActionText($actionText ) | ||
->setAction($this->context->link->getModuleLink('cardgate', 'validation', array(), true)) | ||
->setInputs( $this->paymentData() ) | ||
->setAdditionalInformation($additionalInformation) | ||
->setLogo($logo); | ||
|
||
$payment_options = [ | ||
$paymentOption | ||
]; | ||
return $payment_options; | ||
} | ||
|
||
public function checkCurrency( $cart ) { | ||
$currency_order = new Currency( $cart->id_currency ); | ||
$currencies_module = $this->getCurrency( $cart->id_currency ); | ||
if ( is_array( $currencies_module ) ) { | ||
foreach ( $currencies_module as $currency_module ) { | ||
if ( $currency_order->id == $currency_module['id_currency'] ) { | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
public function displayConf() { | ||
|
||
$this->_html = $this->displayConfirmation( $this->l('Settings updated') ); | ||
} | ||
|
||
public function paymentData() { | ||
$data = [ | ||
'option' => [ | ||
'name' => 'option', | ||
'type' => 'hidden', | ||
'value' => $this->paymentcode, | ||
] | ||
]; | ||
|
||
return $data; | ||
} | ||
|
||
public function extraCosts( $extra_cost ) { | ||
$cart = $this->context->cart; | ||
$total = number_format( ($cart->getOrderTotal( true, Cart::BOTH ) ), 2, '.', ''); | ||
if ( $extra_cost == 0 || $extra_cost == '') { | ||
return 0; | ||
} | ||
if ( strstr( $extra_cost, '%') ) { | ||
$percentage = str_replace('%', '', $extra_cost ); | ||
return round( ($total * $percentage / 100 ), 2 ); | ||
} | ||
if ( is_numeric( $extra_cost ) ) { | ||
return round( $extra_cost, 2 ); | ||
} | ||
} | ||
} | ||
|
||
?> |
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,13 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<module> | ||
<name>cardgateonlineueberweisen</name> | ||
<displayName><![CDATA[CardGate OnlineÜberweisen]]></displayName> | ||
<version><![CDATA[1.7.0]]></version> | ||
<description><![CDATA[Accepts payments with CardGate OnlineÜberweisen.]]></description> | ||
<author><![CDATA[Richard Schoots]]></author> | ||
<tab><![CDATA[payments_gateways]]></tab> | ||
<confirmUninstall><![CDATA[Are you sure you want to delete your details?]]></confirmUninstall> | ||
<is_configurable>0</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,13 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<module> | ||
<name>cardgateonlineueberweisen</name> | ||
<displayName><![CDATA[CardGate OnlineÜberweisen]]></displayName> | ||
<version><![CDATA[1.7.0]]></version> | ||
<description><![CDATA[Accepteert betalingen met CardGate OnlineÜberweisen]]></description> | ||
<author><![CDATA[CardGate]]></author> | ||
<tab><![CDATA[payments_gateways]]></tab> | ||
<confirmUninstall><![CDATA[Weet u zeker dat u uw details wilt verwijderen?]]></confirmUninstall> | ||
<is_configurable>0</is_configurable> | ||
<need_instance>1</need_instance> | ||
<limited_countries></limited_countries> | ||
</module> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,18 @@ | ||
<?php | ||
|
||
include(dirname( __FILE__ ) . '/../../config/config.inc.php'); | ||
|
||
define( 'LOGER_TRANSACTIONS', false ); // true ou false, write log of response or not | ||
define( 'FICHIER_LOG', 'dialxs.log' ); // File for testing response answer | ||
define( 'EMAIL_DE_NOTIFICATION', '' ); // Email | ||
// add Link Object to Context if is does not exist yet | ||
//fixes bug when member function getPageLink() is called | ||
|
||
if ( !is_object( Context::getContext()->link ) ) { | ||
Context::getContext()->link = new Link(); | ||
} | ||
|
||
if ( isset( $_GET['extra'] ) && isset( $_GET['status'] ) ) { | ||
header( 'Location: ' . Tools::getHttpHost( true, true ) . __PS_BASE_URI__ . 'order-confirmation.php' ); | ||
} | ||
?> |