-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v1.1.1 Adapted structure to fit Prestashop guidelines, setting module…
… name in payment options selection
- Loading branch information
PayXpert Integration
committed
Apr 24, 2018
1 parent
4a98fdd
commit eb7fb07
Showing
77 changed files
with
1,979 additions
and
1,648 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 |
---|---|---|
@@ -1 +1 @@ | ||
1.1.0 | ||
1.1.1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
/** | ||
* Copyright 2013-2018 PayXpert | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* @author Regis Vidal | ||
* @copyright 2013-2018 PayXpert | ||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 (the "License") | ||
*/ | ||
|
||
require_once dirname(__FILE__) . '/../../lib/Connect2PayClient.php'; | ||
|
||
/** | ||
* | ||
* @since 1.5.0 | ||
*/ | ||
class PayxpertIframeModuleFrontController extends ModuleFrontController | ||
{ | ||
public $ssl = true; | ||
public $display_column_left = false; | ||
|
||
/** | ||
* | ||
* @see FrontController::initContent() | ||
*/ | ||
public function initContent() | ||
{ | ||
parent::initContent(); | ||
$this->context->controller->addCSS(($this->module->getPath()) . 'views/css/iframe.css', 'all'); | ||
$cart = $this->context->cart; | ||
|
||
$params = array(); | ||
|
||
// These should be filled only with Prestashop >= 1.7 | ||
$paymentType = Tools::getValue('payment_type', null); | ||
$paymentProvider = Tools::getValue('payment_provider', null); | ||
|
||
if (version_compare(_PS_VERSION_, '1.7', '>=')) { | ||
if ($paymentType !== null && PayXpert\Connect2Pay\C2PValidate::isPayment($paymentType)) { | ||
$payment = $this->module->getPaymentClient($cart, $paymentType, $paymentProvider); | ||
|
||
if ($payment->preparePayment() == false) { | ||
$message = "PayXpert : can't prepare transaction - " . $payment->getClientErrorMessage(); | ||
$this->module->addLog($message, 3); | ||
Tools::redirect($this->module->getPageLinkCompat('order', true, null, "step=3")); | ||
} | ||
|
||
$src = $payment->getCustomerRedirectURL(); | ||
} | ||
} | ||
|
||
$this->context->smarty->assign( | ||
array(/* */ | ||
'src' => $src, /* */ | ||
'this_link_back' => $this->module->getPageLinkCompat('order', true, null, "step=3") | ||
) /* */ | ||
); | ||
|
||
$this->setTemplate('module:payxpert/views/templates/hook/iframe.tpl'); | ||
} | ||
} |
File renamed without changes.
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,103 @@ | ||
<?php | ||
/** | ||
* Copyright 2013-2018 PayXpert | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* @author Regis Vidal | ||
* @copyright 2013-2018 PayXpert | ||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 (the "License") | ||
*/ | ||
|
||
require_once dirname(__FILE__) . '/../../lib/Connect2PayClient.php'; | ||
|
||
/** | ||
* | ||
* @since 1.5.0 | ||
*/ | ||
class PayxpertPaymentModuleFrontController extends ModuleFrontController | ||
{ | ||
public $ssl = true; | ||
public $display_column_left = false; | ||
|
||
/** | ||
* | ||
* @see FrontController::initContent() | ||
*/ | ||
public function initContent() | ||
{ | ||
parent::initContent(); | ||
|
||
$cart = $this->context->cart; | ||
|
||
// Default value for Prestashop < 1.7 | ||
$template = 'payment_execution.tpl'; | ||
|
||
$params = array(); | ||
|
||
// These should be filled only with Prestashop >= 1.7 | ||
$paymentType = Tools::getValue('payment_type', null); | ||
$paymentProvider = Tools::getValue('payment_provider', null); | ||
|
||
if (version_compare(_PS_VERSION_, '1.7', '>=')) { | ||
if ($paymentType !== null && PayXpert\Connect2Pay\C2PValidate::isPayment($paymentType)) { | ||
$params['payment_type'] = $paymentType; | ||
|
||
if ($paymentProvider !== null && PayXpert\Connect2Pay\C2PValidate::isProvider($paymentProvider)) { | ||
$params['payment_provider'] = $paymentProvider; | ||
} | ||
|
||
switch ($paymentType) { | ||
case PayXpert\Connect2Pay\Connect2PayClient::_PAYMENT_TYPE_BANKTRANSFER: | ||
$template = 'module:' . $this->module->name . '/views/templates/front/payment_execution_bank_transfer.tpl'; | ||
|
||
if (isset($params['payment_provider'])) { | ||
switch ($params['payment_provider']) { | ||
case PayXpert\Connect2Pay\Connect2PayClient::_PAYMENT_PROVIDER_SOFORT: | ||
$paymentLogo = 'sofort'; | ||
break; | ||
case PayXpert\Connect2Pay\Connect2PayClient::_PAYMENT_PROVIDER_PRZELEWY24: | ||
$paymentLogo = 'przelewy24'; | ||
break; | ||
case PayXpert\Connect2Pay\Connect2PayClient::_PAYMENT_PROVIDER_IDEALKP: | ||
$paymentLogo = 'ideal'; | ||
break; | ||
} | ||
} | ||
break; | ||
default: | ||
// Default is Credit Card | ||
$template = 'module:' . $this->module->name . '/views/templates/front/payment_execution_credit_card.tpl'; | ||
$paymentLogo = 'creditcard'; | ||
break; | ||
} | ||
|
||
$this->context->smarty->assign("payment_logo", $paymentLogo); | ||
} | ||
} | ||
|
||
$this->context->smarty->assign( | ||
array(/* */ | ||
'nbProducts' => $cart->nbProducts(), /* */ | ||
'cust_currency' => (int)($cart->id_currency), /* */ | ||
'total' => $cart->getOrderTotal(true, Cart::BOTH), /* */ | ||
'isoCode' => $this->context->language->iso_code, /* */ | ||
'this_path' => $this->module->getPathUri(), /* */ | ||
'this_link' => $this->module->getModuleLinkCompat('payxpert', 'redirect', $params), /* */ | ||
'this_link_back' => $this->module->getPageLinkCompat('order', true, null, "step=3") /* */ | ||
) /* */ | ||
); | ||
|
||
$this->setTemplate($template); | ||
} | ||
} |
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,67 @@ | ||
<?php | ||
/** | ||
* Copyright 2013-2018 PayXpert | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* @author Regis Vidal | ||
* @copyright 2013-2018 PayXpert | ||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 (the "License") | ||
*/ | ||
|
||
/** | ||
* | ||
* @since 1.5.0 | ||
* | ||
*/ | ||
class PayxpertRedirectModuleFrontController extends ModuleFrontController | ||
{ | ||
public $ssl = true; | ||
|
||
/** | ||
* | ||
* @see FrontController::initContent() | ||
*/ | ||
public function initContent() | ||
{ | ||
if (!isset($this->context->cart)) { | ||
$this->context->cart = new Cart(); | ||
} | ||
|
||
$cart = $this->context->cart; | ||
|
||
// These should be filled only with Prestashop >= 1.7 | ||
$paymentType = Tools::getValue('payment_type', null); | ||
$paymentProvider = Tools::getValue('payment_provider', null); | ||
|
||
$errorMessage = $this->module->redirect($cart, $paymentType, $paymentProvider); | ||
|
||
$this->display_column_left = false; | ||
parent::initContent(); | ||
|
||
$this->context->smarty->assign( | ||
array(/* */ | ||
'errorMessage' => $errorMessage, /* */ | ||
'this_path' => $this->module->getPathUri(), /* */ | ||
'this_path_ssl' => Configuration::get('PS_SSL_ENABLED') ? 'https' : 'http' . '://' . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__ . 'modules/payxpert/', /* */ | ||
'this_link_back' => $this->module->getPageLinkCompat('order', true, null, "step=3") /* */ | ||
) /* */ | ||
); | ||
|
||
if (version_compare(_PS_VERSION_, '1.7', '>=')) { | ||
$this->setTemplate('module:' . $this->module->name . '/views/templates/front/payment_error17.tpl'); | ||
} else { | ||
$this->setTemplate('payment_error.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,57 @@ | ||
<?php | ||
/** | ||
* Copyright 2013-2018 PayXpert | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* @author Regis Vidal | ||
* @copyright 2013-2018 PayXpert | ||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 (the "License") | ||
*/ | ||
|
||
/** | ||
* | ||
* @since 1.5.0 | ||
* | ||
*/ | ||
class PayxpertReturnModuleFrontController extends ModuleFrontController | ||
{ | ||
public $ssl = true; | ||
|
||
/** | ||
* | ||
* @see FrontController::initContent() | ||
*/ | ||
public function initContent() | ||
{ | ||
if (!isset($this->context->cart)) { | ||
$this->context->cart = new Cart(); | ||
} | ||
|
||
$url = $this->module->getPageLinkCompat('order-confirmation'); | ||
|
||
$cart = $this->context->cart; | ||
$customer = new Customer((int) ($cart->id_customer)); | ||
$ctrlURLPrefix = Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://'; | ||
|
||
$url .= '?id_cart=' . (int)($cart->id) . '&id_module=' . (int)($this->module->id) . '&key=' . $customer->secure_key; | ||
|
||
$this->context->smarty->assign( | ||
array(/* */ | ||
'url' => $url | ||
) /* */ | ||
); | ||
|
||
$this->setTemplate('module:' . $this->module->name . '/views/templates/hook/return.tpl'); | ||
} | ||
} |
Oops, something went wrong.