Initial Commit
This commit is contained in:
130
local/modules/Paypal/Classes/API/PaypalApiCredentials.php
Normal file
130
local/modules/Paypal/Classes/API/PaypalApiCredentials.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Paypal\Classes\API;
|
||||
|
||||
use Paypal\Paypal;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
class PaypalApiCredentials
|
||||
{
|
||||
|
||||
/** @var string PayPal API username */
|
||||
protected $apiUsername = null;
|
||||
|
||||
/** @var string PayPal API password */
|
||||
protected $apiPassword = null;
|
||||
|
||||
/** @var string PayPal API signature (Three Token Authentication) */
|
||||
protected $apiSignature = null;
|
||||
|
||||
/**
|
||||
* Create a NVP Credentials
|
||||
*
|
||||
* @param string $user PayPal API username
|
||||
* @param string $password PayPal API password
|
||||
* @param string $signature PayPal API signature (3T)
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct($user = null, $password = null, $signature = null)
|
||||
{
|
||||
if ($user === null && $password === null && $signature === null) {
|
||||
$this->setDefaultCredentials();
|
||||
} else {
|
||||
if (empty($user) || empty($password) || empty($signature)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'PaypalApiCredentials : Missing Argument'
|
||||
);
|
||||
}
|
||||
$this->apiPassword = $password;
|
||||
$this->apiSignature = $signature;
|
||||
$this->apiUsername = $user;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set credentials from database according to SandBox Mode
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function setDefaultCredentials()
|
||||
{
|
||||
$paypalApiManager = new PaypalApiManager();
|
||||
|
||||
if ($paypalApiManager->isModeSandbox()) {
|
||||
$username = Paypal::getConfigValue('sandbox_login', '');
|
||||
$password = Paypal::getConfigValue('sandbox_password', '');
|
||||
$signature = Paypal::getConfigValue('sandbox_signature', '');
|
||||
} else {
|
||||
$username = Paypal::getConfigValue('login', '');
|
||||
$password = Paypal::getConfigValue('password', '');
|
||||
$signature = Paypal::getConfigValue('signature', '');
|
||||
}
|
||||
|
||||
if (empty($username)) {
|
||||
throw new \InvalidArgumentException(Translator::getInstance()->trans('The username option must be set.'));
|
||||
}
|
||||
if (empty($password)) {
|
||||
throw new \InvalidArgumentException(Translator::getInstance()->trans('The password option must be set.'));
|
||||
}
|
||||
if (empty($signature)) {
|
||||
throw new \InvalidArgumentException(Translator::getInstance()->trans('The signature option must be set.'));
|
||||
}
|
||||
|
||||
$this->apiUsername = $username;
|
||||
$this->apiPassword = $password;
|
||||
$this->apiSignature = $signature;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return API password
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getApiPassword()
|
||||
{
|
||||
return $this->apiPassword;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return API signature
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getApiSignature()
|
||||
{
|
||||
return $this->apiSignature;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return API username
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getApiUsername()
|
||||
{
|
||||
return $this->apiUsername;
|
||||
}
|
||||
}
|
||||
92
local/modules/Paypal/Classes/API/PaypalApiLogManager.php
Normal file
92
local/modules/Paypal/Classes/API/PaypalApiLogManager.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Paypal\Classes\API;
|
||||
|
||||
use Thelia\Log\Tlog;
|
||||
|
||||
/**
|
||||
* Class PaypalApiLogManager
|
||||
* This class is the Paypal logger
|
||||
* Logged actions: transaction
|
||||
*/
|
||||
class PaypalApiLogManager
|
||||
{
|
||||
/** @var Tlog $log */
|
||||
protected static $logger;
|
||||
|
||||
/**
|
||||
* Parse and log the return of the Paypal NVP API
|
||||
*
|
||||
* @param string $transaction A special string returned by the NVP API
|
||||
*/
|
||||
public function logTransaction($parsedTransaction)
|
||||
{
|
||||
if ($parsedTransaction) {
|
||||
/*
|
||||
* Then write
|
||||
*/
|
||||
$logLine = '';
|
||||
$date = new \DateTime($parsedTransaction['TIMESTAMP']);
|
||||
|
||||
$logLine .= $date->format('Y-m-d H:i:s') . ' ';
|
||||
$logLine .= 'Transaction ' . $parsedTransaction['ACK'] . ' ';
|
||||
$logLine .= 'correlationId: ' . $parsedTransaction['CORRELATIONID'] . ' ';
|
||||
|
||||
if ($parsedTransaction !== null && array_key_exists('L_ERRORCODE0', $parsedTransaction)) {
|
||||
$logLine .= 'error: ';
|
||||
$logLine .= '[' . $parsedTransaction['L_ERRORCODE0'] . '] ';
|
||||
$logLine .= '<' . $parsedTransaction['L_SHORTMESSAGE0'] . '> ';
|
||||
$logLine .= $parsedTransaction['L_LONGMESSAGE0'] . ' ';
|
||||
}
|
||||
|
||||
$this->getLogger()->info($logLine);
|
||||
} else {
|
||||
$this->getLogger()->info('No transaction was created.');
|
||||
}
|
||||
}
|
||||
|
||||
public static function getLogFilePath()
|
||||
{
|
||||
return THELIA_LOG_DIR . DS . "log-paypal.txt";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Tlog
|
||||
*/
|
||||
public function getLogger()
|
||||
{
|
||||
if (self::$logger == null) {
|
||||
self::$logger = Tlog::getNewInstance();
|
||||
|
||||
$logFilePath = self::getLogFilePath();
|
||||
|
||||
self::$logger->setPrefix("#LEVEL: #DATE #HOUR: ");
|
||||
self::$logger->setDestinations("\\Thelia\\Log\\Destination\\TlogDestinationRotatingFile");
|
||||
self::$logger->setConfig("\\Thelia\\Log\\Destination\\TlogDestinationRotatingFile", 0, $logFilePath);
|
||||
self::$logger->setLevel(Tlog::INFO);
|
||||
}
|
||||
|
||||
return self::$logger;
|
||||
}
|
||||
}
|
||||
199
local/modules/Paypal/Classes/API/PaypalApiManager.php
Normal file
199
local/modules/Paypal/Classes/API/PaypalApiManager.php
Normal file
@@ -0,0 +1,199 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Paypal\Classes\API;
|
||||
|
||||
use Paypal\Classes\PaypalResources;
|
||||
use Paypal\Classes\vendor\MobileDetect\MobileDetect;
|
||||
use Paypal\Paypal;
|
||||
|
||||
/**
|
||||
* Class PaypalApiManager
|
||||
* Assist in helping managing API
|
||||
*/
|
||||
class PaypalApiManager
|
||||
{
|
||||
/** Live API */
|
||||
const DEFAULT_NVP_3T_API_URL_LIVE = 'https://api-3t.paypal.com/nvp';
|
||||
|
||||
/** SandBox API */
|
||||
const DEFAULT_NVP_3T_API_URL_SANDBOX = 'https://api-3t.sandbox.paypal.com/nvp';
|
||||
|
||||
/** Button Source - Identification code for third-party applications */
|
||||
const BUTTON_SOURCE = 'Thelia_Cart';
|
||||
|
||||
/** API Version */
|
||||
const API_VERSION = '108.0';
|
||||
|
||||
const PAYMENT_TYPE_ORDER = 'Order';
|
||||
const PAYMENT_TYPE_SALE = 'Sale';
|
||||
const PAYMENT_TYPE_AUTHORIZATION = 'Authorization';
|
||||
|
||||
/** @var bool if SandBox mode is enabled or not */
|
||||
protected $isModeSandbox = true;
|
||||
|
||||
protected $config=null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->isModeSandbox = Paypal::isSandboxMode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get if SandBox is enabled or not
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isModeSandbox()
|
||||
{
|
||||
return $this->isModeSandbox;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert NVP string to array
|
||||
*
|
||||
* @param string $nvpstr NVP string
|
||||
*
|
||||
* @return array parameters
|
||||
*/
|
||||
public static function nvpToArray($nvpstr)
|
||||
{
|
||||
$paypalResponse = array();
|
||||
parse_str($nvpstr, $paypalResponse);
|
||||
|
||||
$cleanedArray = array();
|
||||
$previousKey = reset($paypalResponse);
|
||||
foreach ($paypalResponse as $key => $value) {
|
||||
if (1 === preg_match('#^([A-Z0-9_]+)$#', $key)) {
|
||||
$cleanedArray[$key] = $value;
|
||||
$previousKey = $key;
|
||||
} else {
|
||||
$cleanedArray[$previousKey] .= '&' . $key . '=' . $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $cleanedArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert array to NVP string
|
||||
*
|
||||
* @param $data
|
||||
* @param \stdClass|null $ret
|
||||
* @param null $construct_scheme
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function arrayToNvp($data, \stdClass $ret = null, $construct_scheme = null)
|
||||
{
|
||||
if ($ret===null) {
|
||||
$ret = new \stdClass();
|
||||
$ret->value="";
|
||||
}
|
||||
if (is_array($data)) {
|
||||
foreach ($data as $key => $value) {
|
||||
self::arrayToNvp($value, $ret, $construct_scheme===null?$key:$construct_scheme."_".$key);
|
||||
}
|
||||
} else {
|
||||
$ret->value .= $construct_scheme."=".$data."&";
|
||||
}
|
||||
|
||||
return substr($ret->value, 0, strlen($ret->value)-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect if user is using a mobile
|
||||
* Used in Express Checkout Mobile
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isMobile()
|
||||
{
|
||||
$detect = new MobileDetect();
|
||||
|
||||
return $detect->isMobile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Express checkout URL
|
||||
* Check itself if mobile or not
|
||||
*
|
||||
* @param string $token Paypal API token
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExpressCheckoutUrl($token)
|
||||
{
|
||||
if ($this->isMobile()) {
|
||||
$cmd = PaypalResources::CMD_EXPRESS_CHECKOUT_MOBILE_KEY;
|
||||
} else {
|
||||
$cmd = PaypalResources::CMD_EXPRESS_CHECKOUT_KEY;
|
||||
}
|
||||
|
||||
return $this->getPaypalUrl() .'?cmd=' . $cmd . '&token=' . $token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return relevant PayPal redirect URL
|
||||
* According to SandBox Mode on or not
|
||||
*
|
||||
* @return string URL
|
||||
*/
|
||||
public function getPaypalUrl()
|
||||
{
|
||||
$url = PaypalResources::PAYPAL_REDIRECT_SANDBOX_URL;
|
||||
|
||||
if (!$this->isModeSandbox()) {
|
||||
$url = PaypalResources::PAYPAL_REDIRECT_NORMAL_URL;
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert float into NVP number
|
||||
*
|
||||
* @param string $number number
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function convertFloatToNvpFormat($number)
|
||||
{
|
||||
return number_format($number, 2, '.', '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return API Url (sandbox or live)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getApiUrl()
|
||||
{
|
||||
$url = self::DEFAULT_NVP_3T_API_URL_SANDBOX;
|
||||
if (!$this->isModeSandbox) {
|
||||
$url = self::DEFAULT_NVP_3T_API_URL_LIVE;
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Paypal\Classes\NVP\Operations;
|
||||
|
||||
/**
|
||||
* Class NvpOperationInterface
|
||||
*/
|
||||
interface PaypalNvpOperationInterface
|
||||
{
|
||||
/**
|
||||
* Generate NVP request message
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRequest();
|
||||
|
||||
/**
|
||||
* Get Operation Name
|
||||
*
|
||||
* @return string Operation name
|
||||
*/
|
||||
public function getOperationName();
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
* Date: 8/12/13
|
||||
* Time: 2:17 PM
|
||||
*
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*/
|
||||
namespace Paypal\Classes\NVP\Operations;
|
||||
|
||||
use Paypal\Classes\API\PaypalApiManager;
|
||||
|
||||
abstract class PaypalNvpOperationsBase implements PaypalNvpOperationInterface
|
||||
{
|
||||
/** @var \Paypal\Classes\API\PaypalApiCredentials API Credentials (3T) */
|
||||
protected $credentials = null;
|
||||
|
||||
/** @var string operation name */
|
||||
protected $operationName = null;
|
||||
|
||||
/** @var array Payload with optional parameters */
|
||||
protected $payload = null;
|
||||
|
||||
/**
|
||||
* Generate NVP request message
|
||||
*
|
||||
* @return string NVP string
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
$request = 'METHOD=' . $this->operationName;
|
||||
$request .= '&VERSION=' . PaypalApiManager::API_VERSION;
|
||||
$request .= '&USER=' . urlencode($this->credentials->getApiUsername());
|
||||
$request .= '&PWD=' . urlencode($this->credentials->getApiPassword());
|
||||
$request .= '&SIGNATURE=' . urlencode($this->credentials->getApiSignature());
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Operation Name
|
||||
*
|
||||
* @return string Operation name
|
||||
*/
|
||||
public function getOperationName()
|
||||
{
|
||||
return $this->operationName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Paypal\Classes\NVP\Operations;
|
||||
|
||||
use Paypal\Classes\API\PaypalApiCredentials;
|
||||
|
||||
/**
|
||||
* Class PaypalNvpOperationsDoExpressCheckoutPayment
|
||||
* Manage NVP DoExpressCheckoutPayment Operation
|
||||
*/
|
||||
class PaypalNvpOperationsDoExpressCheckoutPayment extends PaypalNvpOperationsBase
|
||||
{
|
||||
/** @var string Payer ID returned by PayPal when it redirects the buyer's browser to your site */
|
||||
protected $payerId = null;
|
||||
|
||||
/** @var string SetExpressCheckout API Token */
|
||||
protected $token = null;
|
||||
|
||||
/** @var string Transaction amount
|
||||
* Must be specified as 2000.00 or 2,000.00.
|
||||
* The specified amount cannot exceed USD $10,000.00, regardless of the currency used.
|
||||
*/
|
||||
protected $amount = null;
|
||||
|
||||
/** @var string Currency id ex: EUR */
|
||||
protected $currencyId = null;
|
||||
|
||||
/** @var string Payment action ex: sale/order */
|
||||
protected $paymentAction = null;
|
||||
|
||||
/** @var string URL IPN listener */
|
||||
protected $ipnListenerUrl = null;
|
||||
|
||||
/** @var string Button Source for Thelia_Cart */
|
||||
protected $buttonSource;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param PaypalApiCredentials $credentials API Credentials (3T)
|
||||
* @param string $amount Transaction amount. Must be specified as 2000.00 or 2,000.00. The specified amount cannot exceed USD $10,000.00, regardless of the currency used.
|
||||
* @param string $currencyId Currency id ex: EUR
|
||||
* @param string $payerId Payer ID returned by PayPal when it redirects the buyer's browser to your site
|
||||
* @param string $paymentAction Payment action ex: sale/order
|
||||
* @param string $token Token returned by PayPal SetExpressCheckout API when it redirects the buyer's browser to your site.
|
||||
* @param string $ipnListenerUrl Url Paypal will call in order to confirm payment
|
||||
* @param $buttonSource
|
||||
*/
|
||||
public function __construct(
|
||||
PaypalApiCredentials $credentials,
|
||||
$amount,
|
||||
$currencyId,
|
||||
$payerId,
|
||||
$paymentAction,
|
||||
$token,
|
||||
$ipnListenerUrl,
|
||||
$buttonSource = null
|
||||
) {
|
||||
$this->operationName = 'DoExpressCheckoutPayment';
|
||||
$this->token = $token;
|
||||
$this->amount = $amount;
|
||||
$this->payerId = $payerId;
|
||||
$this->credentials = $credentials;
|
||||
$this->currencyId = $currencyId;
|
||||
$this->paymentAction = $paymentAction;
|
||||
$this->ipnListenerUrl = $ipnListenerUrl;
|
||||
$this->buttonSource = $buttonSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
$request = parent::getRequest();
|
||||
$request .= '&TOKEN=' . $this->token;
|
||||
$request .= '&PAYERID=' . $this->payerId;
|
||||
$request .= '&PAYMENTREQUEST_0_AMT=' . $this->amount;
|
||||
$request .= '&PAYMENTREQUEST_0_CURRENCYCODE=' . $this->currencyId;
|
||||
$request .= '&PAYMENTREQUEST_0_PAYMENTACTION=' . $this->paymentAction;
|
||||
if (null !== $this->buttonSource) {
|
||||
$request .='&BUTTONSOURCE=' . $this->buttonSource;
|
||||
}
|
||||
|
||||
return $request;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Paypal\Classes\NVP\Operations;
|
||||
|
||||
use Paypal\Classes\API\PaypalApiCredentials;
|
||||
|
||||
/**
|
||||
* Class GetExpressCheckoutDetails
|
||||
* Manage NVP GetExpressCheckoutDetails Operation
|
||||
*/
|
||||
class PaypalNvpOperationsGetExpressCheckoutDetails extends PaypalNvpOperationsBase
|
||||
{
|
||||
/** @var string SetExpressCheckout API Token */
|
||||
protected $token = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param PaypalApiCredentials $credentials API Credentials (3T)
|
||||
* @param string $token Token from SetExpressCheckout API
|
||||
*/
|
||||
public function __construct(PaypalApiCredentials $credentials, $token)
|
||||
{
|
||||
$this->operationName = 'GetExpressCheckoutDetails';
|
||||
$this->credentials = $credentials;
|
||||
$this->token = $token;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc }
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
$request = parent::getRequest();
|
||||
$request .= '&TOKEN=' . $this->token;
|
||||
|
||||
return $request;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Paypal\Classes\NVP\Operations;
|
||||
|
||||
use Paypal\Classes\API\PaypalApiCredentials;
|
||||
use Paypal\Classes\API\PaypalApiManager;
|
||||
|
||||
/**
|
||||
* Class PaypalNvpOperationsSetExpressCheckout
|
||||
* Manage NVP SetExpressCheckout Operation
|
||||
*/
|
||||
class PaypalNvpOperationsSetExpressCheckout extends PaypalNvpOperationsBase
|
||||
{
|
||||
/** @var string Transaction amount
|
||||
* Must be specified as 2000.00 or 2,000.00.
|
||||
* The specified amount cannot exceed USD $10,000.00, regardless of the currency used.
|
||||
*/
|
||||
protected $amount = null;
|
||||
|
||||
/** @var string Currency id ex: EUR */
|
||||
protected $currencyId = null;
|
||||
|
||||
/** @var string URL when operation is successful */
|
||||
protected $returnUrl = null;
|
||||
|
||||
/** @var string URL when operation is cancelled */
|
||||
protected $cancelUrl = null;
|
||||
|
||||
/** @var string allowing the shortcut transaction */
|
||||
protected $billingAgreement = null;
|
||||
|
||||
/** @var bool If Paypal has to use Thelia Customer Address */
|
||||
protected $isPaypalAddressOverrided = false;
|
||||
|
||||
/** @var string Delivery Address */
|
||||
protected $name = null;
|
||||
/** @var string Delivery Address */
|
||||
protected $street = null;
|
||||
/** @var string Delivery Address */
|
||||
protected $street2 = null;
|
||||
/** @var string Delivery Address */
|
||||
protected $city = null;
|
||||
/** @var string Delivery Address */
|
||||
protected $state = null;
|
||||
/** @var string Delivery Address */
|
||||
protected $zip = null;
|
||||
/** @var string Delivery Address */
|
||||
protected $countryCode = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param PaypalApiCredentials $credentials API Credentials (3T)
|
||||
* @param string $amount Transaction amount (<USD $10,000.00)
|
||||
* @param string $currencyId Currency id ex: EUR
|
||||
* @param string $returnUrl URL when operation is successful
|
||||
* @param string $cancelUrl URL when operation is cancelled
|
||||
* @param int $billingAgreement Billing agreement allowing reference transaction
|
||||
* @param array $payload Operation extra args
|
||||
*/
|
||||
public function __construct(
|
||||
PaypalApiCredentials $credentials,
|
||||
$amount,
|
||||
$currencyId,
|
||||
$returnUrl,
|
||||
$cancelUrl,
|
||||
$billingAgreement = 0,
|
||||
array $payload = null
|
||||
) {
|
||||
$this->operationName = 'SetExpressCheckout';
|
||||
$this->credentials = $credentials;
|
||||
|
||||
$this->amount = $amount;
|
||||
$this->cancelUrl = $cancelUrl;
|
||||
$this->currencyId = $currencyId;
|
||||
$this->returnUrl = $returnUrl;
|
||||
|
||||
$this->billingAgreement = $billingAgreement;
|
||||
|
||||
$this->payload = $payload;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set customer delivery address
|
||||
*
|
||||
* @param string $name Name
|
||||
* @param string $street Street
|
||||
* @param string $street2 Street 2
|
||||
* @param string $city City
|
||||
* @param string $state State
|
||||
* @param string $zip Zip
|
||||
* @param string $countryCode CountryCode FR|US|UK
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCustomerDeliveryAddress($name, $street, $street2, $city, $state, $zip, $countryCode)
|
||||
{
|
||||
$this->isPaypalAddressOverrided = true;
|
||||
$this->name = $name;
|
||||
$this->street = $street;
|
||||
$this->street2 = $street2;
|
||||
$this->city = $city;
|
||||
$this->state = $state;
|
||||
$this->zip = $zip;
|
||||
$this->countryCode = $countryCode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc }
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
$request = parent::getRequest();
|
||||
$request .= '&PAYMENTREQUEST_0_AMT=' . urlencode(PaypalApiManager::convertFloatToNvpFormat($this->amount));
|
||||
$request .= '&PAYMENTREQUEST_0_CURRENCYCODE=' . urlencode($this->currencyId);
|
||||
$request .= '&RETURNURL=' . urlencode($this->returnUrl);
|
||||
$request .= '&CANCELURL=' . urlencode($this->cancelUrl);
|
||||
|
||||
if ($this->isPaypalAddressOverrided) {
|
||||
$request .= '&ADDROVERRIDE=1';
|
||||
$request .= '&PAYMENTREQUEST_0_SHIPTONAME=' . urlencode($this->name);
|
||||
$request .= '&PAYMENTREQUEST_0_SHIPTOSTREET=' . urlencode($this->street);
|
||||
$request .= '&PAYMENTREQUEST_0_SHIPTOSTREET2=' . urlencode($this->street2);
|
||||
$request .= '&PAYMENTREQUEST_0_SHIPTOCITY=' . urlencode($this->city);
|
||||
$request .= '&PAYMENTREQUEST_0_SHIPTOSTATE=' . urlencode($this->state);
|
||||
$request .= '&PAYMENTREQUEST_0_SHIPTOZIP=' . urlencode($this->zip);
|
||||
$request .= '&PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE=' . urlencode($this->countryCode);
|
||||
}
|
||||
|
||||
if ($this->billingAgreement != 0) {
|
||||
$request .= '&L_BILLINGTYPE0=MerchantInitiatedBillingSingleAgreement';
|
||||
}
|
||||
|
||||
if (!empty($this->payload)) {
|
||||
$request .= '&' . PaypalApiManager::arrayToNvp($this->payload);
|
||||
}
|
||||
|
||||
return $request;
|
||||
}
|
||||
}
|
||||
92
local/modules/Paypal/Classes/NVP/PaypalNvpMessageSender.php
Normal file
92
local/modules/Paypal/Classes/NVP/PaypalNvpMessageSender.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Paypal\Classes\NVP;
|
||||
|
||||
use Paypal\Classes\API\PaypalApiManager;
|
||||
use Paypal\Classes\NVP\Operations\PaypalNvpOperationInterface;
|
||||
|
||||
/**
|
||||
* Class PaypalNvpMessageSender
|
||||
*
|
||||
* Send NVP requests via Curl
|
||||
*
|
||||
* Example for the API SetExpressCheckout call on the SandBox:
|
||||
* $paypal = new Paypal();
|
||||
* $nvpSetExpressCheckout = new PaypalNvpOperationsSetExpressCheckout(
|
||||
* new PaypalApiCredentials(new PayPalVariableRepository($paypal->link)),
|
||||
* $amount,
|
||||
* $currencyID,
|
||||
* $return_url,
|
||||
* $cancel_url,
|
||||
* );
|
||||
* $nvpMessageSender = new PaypalNvpMessageSender($nvpSetExpressCheckout, true);
|
||||
* $response = $nvpMessageSender->send();
|
||||
*/
|
||||
class PaypalNvpMessageSender
|
||||
{
|
||||
/** @var string message to send */
|
||||
protected $message = null;
|
||||
|
||||
/** @var bool if sandbox mode is enabled */
|
||||
protected $isSandbox = true;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param PaypalNvpOperationInterface $nvpMessage NVP message to send
|
||||
* @param bool $isSandbox if sandbox mode enabled
|
||||
*/
|
||||
public function __construct(PaypalNvpOperationInterface $nvpMessage, $isSandbox = true)
|
||||
{
|
||||
$this->isSandbox = $isSandbox;
|
||||
$this->message = $nvpMessage->getRequest();
|
||||
}
|
||||
|
||||
/**
|
||||
* Send request via Curl
|
||||
*
|
||||
* @return string APÏ response
|
||||
*/
|
||||
public function send()
|
||||
{
|
||||
$paypalApiManager = new PaypalApiManager();
|
||||
|
||||
$url = $paypalApiManager->getApiUrl();
|
||||
|
||||
$ch = curl_init($url);
|
||||
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->message);
|
||||
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
36
local/modules/Paypal/Classes/PaypalResources.php
Normal file
36
local/modules/Paypal/Classes/PaypalResources.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Paypal\Classes;
|
||||
|
||||
class PaypalResources
|
||||
{
|
||||
const LOGO_NORMAL_URL = 'https://www.paypalobjects.com/webstatic/mktg/logo/pp_cc_mark_37x23.jpg';
|
||||
const LOGO_PAIEMENT_CARDS_URL = 'https://www.paypalobjects.com/webstatic/mktg/logo-center/logo_paypal_moyens_paiement_fr.jpg';
|
||||
|
||||
const PAYPAL_REDIRECT_NORMAL_URL = 'https://www.paypal.com/cgi-bin/webscr';
|
||||
const PAYPAL_REDIRECT_SANDBOX_URL = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
|
||||
|
||||
const CMD_EXPRESS_CHECKOUT_KEY = '_express-checkout';
|
||||
const CMD_EXPRESS_CHECKOUT_MOBILE_KEY = '_express-checkout-mobile';
|
||||
}
|
||||
1024
local/modules/Paypal/Classes/vendor/MobileDetect/MobileDetect.php
vendored
Normal file
1024
local/modules/Paypal/Classes/vendor/MobileDetect/MobileDetect.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
23
local/modules/Paypal/Config/config.xml
Normal file
23
local/modules/Paypal/Config/config.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<config xmlns="http://thelia.net/schema/dic/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
<forms>
|
||||
<form name="paypal.form.configure" class="Paypal\Form\ConfigurationForm" />
|
||||
</forms>
|
||||
|
||||
<services>
|
||||
<service id="paypal.mail.listener" class="Paypal\Listener\SendConfirmationEmail" scope="request">
|
||||
<argument type="service" id="mailer"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
<hooks>
|
||||
<hook id="paypal.configuration.hook" class="Paypal\Hook\HookManager" scope="request">
|
||||
<tag name="hook.event_listener" event="module.configuration" type="back" method="onModuleConfigure" />
|
||||
</hook>
|
||||
</hooks>
|
||||
</config>
|
||||
24
local/modules/Paypal/Config/module.xml
Normal file
24
local/modules/Paypal/Config/module.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module xmlns="http://thelia.net/schema/dic/module"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_1.xsd">
|
||||
<fullnamespace>Paypal\Paypal</fullnamespace>
|
||||
<descriptive locale="en_US">
|
||||
<title>Pay with Paypal</title>
|
||||
</descriptive>
|
||||
<descriptive locale="fr_FR">
|
||||
<title>Paiement avec Paypal</title>
|
||||
</descriptive>
|
||||
<languages>
|
||||
<language>en_US</language>
|
||||
<language>fr_FR</language>
|
||||
</languages>
|
||||
<version>2.1.3</version>
|
||||
<author>
|
||||
<name>Thelia</name>
|
||||
<email>info@thelia.net</email>
|
||||
</author>
|
||||
<type>payment</type>
|
||||
<thelia>2.1.0</thelia>
|
||||
<stability>prod</stability>
|
||||
</module>
|
||||
22
local/modules/Paypal/Config/routing.xml
Normal file
22
local/modules/Paypal/Config/routing.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="paypal.configure" path="/admin/module/paypal/configure" methods="post">
|
||||
<default key="_controller">Paypal\Controller\ConfigurationController::configure</default>
|
||||
</route>
|
||||
|
||||
<route id="paypal.download.log" path="/admin/module/paypal/log">
|
||||
<default key="_controller">Paypal\Controller\ConfigurationController::downloadLog</default>
|
||||
</route>
|
||||
|
||||
<route id="paypal.cancel" path="/module/paypal/cancel/{order_id}" methods="get">
|
||||
<default key="_controller">Paypal\Controller\PaypalResponse::cancel</default>
|
||||
<requirement key="order_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="paypal.ok" path="/module/paypal/ok/{order_id}" methods="get">
|
||||
<default key="_controller">Paypal\Controller\PaypalResponse::ok</default>
|
||||
<requirement key="order_id">\d+</requirement>
|
||||
</route>
|
||||
</routes>
|
||||
123
local/modules/Paypal/Controller/ConfigurationController.php
Normal file
123
local/modules/Paypal/Controller/ConfigurationController.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Paypal\Controller;
|
||||
|
||||
use Paypal\Classes\API\PaypalApiLogManager;
|
||||
use Paypal\Paypal;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Thelia;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Tools\Version\Version;
|
||||
|
||||
/**
|
||||
* Class ConfigurePaypal
|
||||
* @package Paypal\Controller
|
||||
* @author Thelia <info@thelia.net>
|
||||
*/
|
||||
class ConfigurationController extends BaseAdminController
|
||||
{
|
||||
|
||||
public function downloadLog()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'atos', AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$logFilePath = PaypalApiLogManager::getLogFilePath();
|
||||
|
||||
return Response::create(
|
||||
@file_get_contents($logFilePath),
|
||||
200,
|
||||
array(
|
||||
'Content-type' => "text/plain",
|
||||
'Content-Disposition' => sprintf('Attachment;filename=paypal-log.txt')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks paypal.configure || paypal.configure.sandbox form and save config into json file
|
||||
*/
|
||||
public function configure()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'Paypal', AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$configurationForm = $this->createForm('paypal.form.configure');
|
||||
|
||||
try {
|
||||
$form = $this->validateForm($configurationForm, "POST");
|
||||
|
||||
// Get the form field values
|
||||
$data = $form->getData();
|
||||
|
||||
foreach ($data as $name => $value) {
|
||||
if (is_array($value)) {
|
||||
$value = implode(';', $value);
|
||||
}
|
||||
|
||||
Paypal::setConfigValue($name, $value);
|
||||
}
|
||||
|
||||
$this->adminLogAppend(
|
||||
"paypal.configuration.message",
|
||||
AccessManager::UPDATE,
|
||||
sprintf("Paypal configuration updated")
|
||||
);
|
||||
|
||||
if ($this->getRequest()->get('save_mode') == 'stay') {
|
||||
// If we have to stay on the same page, redisplay the configuration page/
|
||||
$url = '/admin/module/Paypal';
|
||||
} else {
|
||||
// If we have to close the page, go back to the module back-office page.
|
||||
$url = '/admin/modules';
|
||||
}
|
||||
|
||||
return $this->generateRedirect(URL::getInstance()->absoluteUrl($url));
|
||||
} catch (FormValidationException $ex) {
|
||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||
} catch (\Exception $ex) {
|
||||
$error_msg = $ex->getMessage();
|
||||
}
|
||||
|
||||
$this->setupFormErrorContext(
|
||||
$this->getTranslator()->trans("Paypal configuration", [], Paypal::DOMAIN),
|
||||
$error_msg,
|
||||
$configurationForm,
|
||||
$ex
|
||||
);
|
||||
|
||||
// Before 2.2, the errored form is not stored in session
|
||||
if (Version::test(Thelia::THELIA_VERSION, '2.2', false, "<")) {
|
||||
return $this->render('module-configure', [ 'module_code' => 'Paypal' ]);
|
||||
} else {
|
||||
return $this->generateRedirect(URL::getInstance()->absoluteUrl('/admin/module/Paypal'));
|
||||
}
|
||||
}
|
||||
}
|
||||
253
local/modules/Paypal/Controller/PaypalResponse.php
Normal file
253
local/modules/Paypal/Controller/PaypalResponse.php
Normal file
@@ -0,0 +1,253 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Paypal\Controller;
|
||||
|
||||
use Paypal\Classes\API\PaypalApiCredentials;
|
||||
use Paypal\Classes\API\PaypalApiLogManager;
|
||||
use Paypal\Classes\API\PaypalApiManager;
|
||||
use Paypal\Classes\NVP\Operations\PaypalNvpOperationsDoExpressCheckoutPayment;
|
||||
use Paypal\Classes\NVP\Operations\PaypalNvpOperationsGetExpressCheckoutDetails;
|
||||
use Paypal\Classes\NVP\PaypalNvpMessageSender;
|
||||
use Paypal\Paypal;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\HttpKernel\Exception\RedirectException;
|
||||
use Thelia\Model\Base\OrderQuery;
|
||||
use Thelia\Model\OrderStatus;
|
||||
use Thelia\Model\OrderStatusQuery;
|
||||
use Thelia\Module\BasePaymentModuleController;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
/**
|
||||
* Class PaypalResponse
|
||||
* @package Paypal\Controller
|
||||
* @author Thelia <info@thelia.net>
|
||||
*/
|
||||
class PaypalResponse extends BasePaymentModuleController
|
||||
{
|
||||
/** @var PaypalApiLogManager */
|
||||
private $logger;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->logger = new PaypalApiLogManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $order_id
|
||||
* @return \Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function ok($order_id)
|
||||
{
|
||||
$token = null;
|
||||
|
||||
$message = '';
|
||||
|
||||
try {
|
||||
$order = $this->checkorder($order_id, $token);
|
||||
/*
|
||||
* $payerid string value returned by paypal
|
||||
* $logger PaypalApiLogManager used to log transctions with paypal
|
||||
*/
|
||||
$payerid = $this->getRequest()->get('PayerID');
|
||||
|
||||
if (! empty($payerid)) {
|
||||
/*
|
||||
* $config ConfigInterface Object that contains configuration
|
||||
* $api PaypalApiCredentials Class used by the library to store and use 3T login(username, password, signature)
|
||||
* $sandbox bool true if sandbox is enabled
|
||||
*/
|
||||
$api = new PaypalApiCredentials();
|
||||
$sandbox = Paypal::isSandboxMode();
|
||||
/*
|
||||
* Send getExpressCheckout & doExpressCheckout
|
||||
* empty cart
|
||||
*/
|
||||
$getExpressCheckout = new PaypalNvpOperationsGetExpressCheckoutDetails(
|
||||
$api,
|
||||
$token
|
||||
);
|
||||
|
||||
$request = new PaypalNvpMessageSender($getExpressCheckout, $sandbox);
|
||||
$response = PaypalApiManager::nvpToArray($request->send());
|
||||
|
||||
$this->logger->logTransaction($response);
|
||||
|
||||
if (isset($response['ACK']) && $response['ACK'] === 'Success' &&
|
||||
isset($response['PAYERID']) && $response['PAYERID'] === $payerid &&
|
||||
isset($response['TOKEN']) && $response['TOKEN'] === $token
|
||||
) {
|
||||
$doExpressCheckout = new PaypalNvpOperationsDoExpressCheckoutPayment(
|
||||
$api,
|
||||
round($order->getTotalAmount(), 2),
|
||||
$order->getCurrency()->getCode(),
|
||||
$payerid,
|
||||
PaypalApiManager::PAYMENT_TYPE_SALE,
|
||||
$token,
|
||||
// FIXME This URL is not used in PaypalNvpOperationsDoExpressCheckoutPayment, and has no defined route
|
||||
URL::getInstance()->absoluteUrl("/module/paypal/listen"),
|
||||
PaypalApiManager::BUTTON_SOURCE
|
||||
);
|
||||
|
||||
$request = new PaypalNvpMessageSender($doExpressCheckout, $token);
|
||||
$response = PaypalApiManager::nvpToArray($request->send());
|
||||
|
||||
$this->logger->logTransaction($response);
|
||||
|
||||
// Store correlation ID in the order
|
||||
if (isset($response['CORRELATIONID'])) {
|
||||
$order
|
||||
->setTransactionRef($response['CORRELATIONID'])
|
||||
->save();
|
||||
;
|
||||
}
|
||||
|
||||
// In case of pending status, log the reason to get usefull information (multi-currency problem, ...)
|
||||
if (isset($response['ACK']) && $response['ACK'] === "Success" &&
|
||||
isset($response['PAYMENTINFO_0_PAYMENTSTATUS']) && $response['PAYMENTINFO_0_PAYMENTSTATUS'] === "Pending") {
|
||||
$message = $this->getTranslator()->trans(
|
||||
"Paypal transaction is pending. Reason: %reason",
|
||||
[ 'reason' => $response['PAYMENTINFO_0_PENDINGREASON'] ],
|
||||
Paypal::DOMAIN
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* In case of success, go to success page
|
||||
* In case of error, show it
|
||||
*/
|
||||
if (isset($response['ACK']) && $response['ACK'] === "Success"
|
||||
&& isset($response['PAYMENTINFO_0_PAYMENTSTATUS']) && $response['PAYMENTINFO_0_PAYMENTSTATUS'] === "Completed"
|
||||
&& isset($response['TOKEN']) && $response['TOKEN'] === $token
|
||||
) {
|
||||
/*
|
||||
* Set order status as paid
|
||||
*/
|
||||
$event = new OrderEvent($order);
|
||||
$event->setStatus(OrderStatusQuery::getPaidStatus()->getId());
|
||||
$this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
|
||||
|
||||
$this->redirectToSuccessPage($order_id);
|
||||
} else {
|
||||
$message = $this->getTranslator()->trans("Failed to validate your payment", [], Paypal::DOMAIN);
|
||||
}
|
||||
} else {
|
||||
$message = $this->getTranslator()->trans("Failed to validate payment parameters", [], Paypal::DOMAIN);
|
||||
}
|
||||
} else {
|
||||
$message = $this->getTranslator()->trans("Failed to find PayerID", [], Paypal::DOMAIN);
|
||||
}
|
||||
|
||||
$this->logger->getLogger()->info("Order [" . $order_id . "] : " . $message);
|
||||
} catch (RedirectException $ex) {
|
||||
throw $ex;
|
||||
} catch (\Exception $ex) {
|
||||
$this->logger->getLogger()->error("Error occured while processing express checkout : " . $ex->getMessage());
|
||||
|
||||
$message = $this->getTranslator()->trans(
|
||||
"Unexpected error: %mesg",
|
||||
[ '%mesg' => $ex->getMessage()],
|
||||
Paypal::DOMAIN
|
||||
);
|
||||
}
|
||||
|
||||
$this->redirectToFailurePage($order_id, $message);
|
||||
}
|
||||
|
||||
/*
|
||||
* @param $order_id int
|
||||
* @return \Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function cancel($order_id)
|
||||
{
|
||||
$token = null;
|
||||
|
||||
try {
|
||||
$order = $this->checkorder($order_id, $token);
|
||||
|
||||
$logger = new PaypalApiLogManager();
|
||||
$logger->getLogger()->warning("User canceled payment of order ".$order->getRef());
|
||||
|
||||
$event = new OrderEvent($order);
|
||||
$event->setStatus(OrderStatusQuery::create()->findOneByCode(OrderStatus::CODE_CANCELED)->getId());
|
||||
$this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
|
||||
|
||||
$message = $this->getTranslator()->trans("You canceled your payment", [], Paypal::DOMAIN);
|
||||
} catch (\Exception $ex) {
|
||||
$this->logger->getLogger()->error("Error occured while canceling express checkout : " . $ex->getMessage());
|
||||
|
||||
$message = $this->getTranslator()->trans(
|
||||
"Unexpected error: %mesg",
|
||||
[ '%mesg' => $ex->getMessage()],
|
||||
Paypal::DOMAIN
|
||||
);
|
||||
}
|
||||
|
||||
$this->redirectToFailurePage($order_id, $message);
|
||||
}
|
||||
|
||||
/*
|
||||
* @param $order_id int
|
||||
* @param &$token string|null
|
||||
* @throws \Exception
|
||||
* @return \Thelia\Model\Order
|
||||
*/
|
||||
public function checkorder($order_id, &$token)
|
||||
{
|
||||
$token = $this->getRequest()->getSession()->get('Paypal.token');
|
||||
|
||||
if ($token !== $this->getRequest()->get('token')) {
|
||||
throw new \Exception(
|
||||
$this->getTranslator()->trans(
|
||||
"Invalid Paypal token. Please try again.",
|
||||
[],
|
||||
Paypal::DOMAIN
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (null === $order = OrderQuery::create()->findPk($order_id)) {
|
||||
throw new \Exception(
|
||||
$this->getTranslator()->trans(
|
||||
"Invalid order ID. This order doesn't exists or doesn't belong to you.",
|
||||
[],
|
||||
Paypal::DOMAIN
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a module identifier used to calculate the name of the log file,
|
||||
* and in the log messages.
|
||||
*
|
||||
* @return string the module code
|
||||
*/
|
||||
protected function getModuleCode()
|
||||
{
|
||||
return "Paypal";
|
||||
}
|
||||
}
|
||||
248
local/modules/Paypal/Form/ConfigurationForm.php
Normal file
248
local/modules/Paypal/Form/ConfigurationForm.php
Normal file
@@ -0,0 +1,248 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Paypal\Form;
|
||||
|
||||
use Paypal\Paypal;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
/**
|
||||
* Class ConfigurePaypal
|
||||
* @package Paypal\Form
|
||||
* @author Thelia <info@thelia.net>
|
||||
*/
|
||||
class ConfigurationForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
'login',
|
||||
'text',
|
||||
[
|
||||
'constraints' => [ new NotBlank() ],
|
||||
'label' => $this->translator->trans('login', [], Paypal::DOMAIN),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans('Your Paypal login', [], Paypal::DOMAIN)
|
||||
]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'password',
|
||||
'text',
|
||||
[
|
||||
'constraints' => [ new NotBlank() ],
|
||||
'label' => $this->translator->trans('password', [], Paypal::DOMAIN),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans('Your Paypal password', [], Paypal::DOMAIN)
|
||||
]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'signature',
|
||||
'text',
|
||||
[
|
||||
'constraints' => [ new NotBlank() ],
|
||||
'label' => $this->translator->trans('signature', [], Paypal::DOMAIN),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans('The Paypal signature', [], Paypal::DOMAIN)
|
||||
]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'sandbox',
|
||||
'checkbox',
|
||||
[
|
||||
'value' => 1,
|
||||
'required' => false,
|
||||
'label' => $this->translator->trans('Activate sandbox mode', [], Paypal::DOMAIN),
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'sandbox_login',
|
||||
'text',
|
||||
[
|
||||
'required' => false,
|
||||
'label' => $this->translator->trans('login', [], Paypal::DOMAIN),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans('Your Paypal sandbox login', [], Paypal::DOMAIN)
|
||||
]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'sandbox_password',
|
||||
'text',
|
||||
[
|
||||
'required' => false,
|
||||
'label' => $this->translator->trans('password', [], Paypal::DOMAIN),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans('Your Paypal sandbox password', [], Paypal::DOMAIN)
|
||||
]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'sandbox_signature',
|
||||
'text',
|
||||
[
|
||||
'required' => false,
|
||||
'label' => $this->translator->trans('signature', [], Paypal::DOMAIN),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans('The Paypal sandbox signature', [], Paypal::DOMAIN)
|
||||
]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'allowed_ip_list',
|
||||
'textarea',
|
||||
[
|
||||
'required' => false,
|
||||
'label' => $this->translator->trans('Allowed IPs in test mode', [], Paypal::DOMAIN),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans(
|
||||
'List of IP addresses allowed to use this payment on the front-office when in test mode (your current IP is %ip). One address per line',
|
||||
[ '%ip' => $this->getRequest()->getClientIp() ],
|
||||
Paypal::DOMAIN
|
||||
)
|
||||
],
|
||||
'attr' => [
|
||||
'rows' => 3
|
||||
]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'minimum_amount',
|
||||
'text',
|
||||
[
|
||||
'constraints' => [
|
||||
new NotBlank(),
|
||||
new GreaterThanOrEqual(array('value' => 0))
|
||||
],
|
||||
'required' => false,
|
||||
'label' => $this->translator->trans('Minimum order total', [], Paypal::DOMAIN),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans(
|
||||
'Minimum order total in the default currency for which this payment method is available. Enter 0 for no minimum',
|
||||
[],
|
||||
Paypal::DOMAIN
|
||||
)
|
||||
]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'maximum_amount',
|
||||
'text',
|
||||
[
|
||||
'constraints' => [
|
||||
new NotBlank(),
|
||||
new GreaterThanOrEqual(array('value' => 0))
|
||||
],
|
||||
'required' => false,
|
||||
'label' => $this->translator->trans('Maximum order total', [], Paypal::DOMAIN),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans(
|
||||
'Maximum order total in the default currency for which this payment method is available. Enter 0 for no maximum',
|
||||
[],
|
||||
Paypal::DOMAIN
|
||||
)
|
||||
]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'cart_item_count',
|
||||
'text',
|
||||
[
|
||||
'constraints' => [
|
||||
new NotBlank(),
|
||||
new GreaterThanOrEqual(array('value' => 0))
|
||||
],
|
||||
'required' => false,
|
||||
'label' => $this->translator->trans('Maximum items in cart', [], Paypal::DOMAIN),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans(
|
||||
'Maximum number of items in the customer cart for which this payment method is available.',
|
||||
[],
|
||||
Paypal::DOMAIN
|
||||
)
|
||||
]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'send_confirmation_message_only_if_paid',
|
||||
'checkbox',
|
||||
[
|
||||
'value' => 1,
|
||||
'required' => false,
|
||||
'label' => $this->translator->trans('Send order confirmation on payment success', [], Paypal::DOMAIN),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans(
|
||||
'If checked, the order confirmation message is sent to the customer only when the payment is successful. The order notification is always sent to the shop administrator',
|
||||
[],
|
||||
Paypal::DOMAIN
|
||||
)
|
||||
]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'send_payment_confirmation_message',
|
||||
'checkbox',
|
||||
[
|
||||
'value' => 1,
|
||||
'required' => false,
|
||||
'label' => $this->translator->trans('Send a payment confirmation e-mail', [], Paypal::DOMAIN),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans(
|
||||
'If checked, a payment confirmation e-mail is sent to the customer.',
|
||||
[],
|
||||
Paypal::DOMAIN
|
||||
)
|
||||
]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'send_cart_detail',
|
||||
'checkbox',
|
||||
[
|
||||
'value' => 1,
|
||||
'required' => false,
|
||||
'label' => $this->translator->trans('Send details of all products to Paypal', [], Paypal::DOMAIN),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans(
|
||||
'If checked, all products will be sent to Paypal.',
|
||||
[],
|
||||
Paypal::DOMAIN
|
||||
)
|
||||
]
|
||||
]
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the name of your form. This name must be unique
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "configurepaypalform";
|
||||
}
|
||||
}
|
||||
81
local/modules/Paypal/Hook/HookManager.php
Normal file
81
local/modules/Paypal/Hook/HookManager.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
/**
|
||||
* Created by Franck Allimant, CQFDev <franck@cqfdev.fr>
|
||||
* Date: 11/01/2016 11:57
|
||||
*/
|
||||
|
||||
namespace Paypal\Hook;
|
||||
|
||||
use Paypal\Classes\API\PaypalApiLogManager;
|
||||
use Paypal\Paypal;
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
use Thelia\Model\ModuleConfig;
|
||||
use Thelia\Model\ModuleConfigQuery;
|
||||
|
||||
class HookManager extends BaseHook
|
||||
{
|
||||
const MAX_TRACE_SIZE_IN_BYTES = 40000;
|
||||
|
||||
public function onModuleConfigure(HookRenderEvent $event)
|
||||
{
|
||||
$logFilePath = PaypalApiLogManager::getLogFilePath();
|
||||
|
||||
$traces = @file_get_contents($logFilePath);
|
||||
|
||||
if (false === $traces) {
|
||||
$traces = $this->translator->trans("The log file doesn't exists yet.", [], Paypal::DOMAIN);
|
||||
} elseif (empty($traces)) {
|
||||
$traces = $this->translator->trans("The log file is empty.", [], Paypal::DOMAIN);
|
||||
} else {
|
||||
// Limiter la taille des traces à 1MO
|
||||
if (strlen($traces) > self::MAX_TRACE_SIZE_IN_BYTES) {
|
||||
$traces = substr($traces, strlen($traces) - self::MAX_TRACE_SIZE_IN_BYTES);
|
||||
// Cut a first line break;
|
||||
if (false !== $lineBreakPos = strpos($traces, "\n")) {
|
||||
$traces = substr($traces, $lineBreakPos+1);
|
||||
}
|
||||
|
||||
$traces = $this->translator->trans(
|
||||
"(Previous log is in %file file.)\n",
|
||||
[ '%file' => sprintf("log".DS."%s.log", Paypal::DOMAIN) ],
|
||||
Paypal::DOMAIN
|
||||
) . $traces;
|
||||
}
|
||||
}
|
||||
|
||||
$vars = ['trace_content' => nl2br($traces) ];
|
||||
|
||||
if (null !== $params = ModuleConfigQuery::create()->findByModuleId(Paypal::getModuleId())) {
|
||||
/** @var ModuleConfig $param */
|
||||
foreach ($params as $param) {
|
||||
$vars[ $param->getName() ] = $param->getValue();
|
||||
}
|
||||
}
|
||||
|
||||
$event->add(
|
||||
$this->render('paypal/module-configuration.html', $vars)
|
||||
);
|
||||
}
|
||||
}
|
||||
11
local/modules/Paypal/I18n/backOffice/default/en_US.php
Normal file
11
local/modules/Paypal/I18n/backOffice/default/en_US.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Download full log' => 'Download full log',
|
||||
'Payment configuration' => 'Payment configuration',
|
||||
'Paypal Configuration' => 'Paypal Configuration',
|
||||
'Paypal Production parameters' => 'Paypal Production parameters',
|
||||
'Paypal Sandbox parameters' => 'Paypal Sandbox parameters',
|
||||
'Paypal responses history' => 'Paypal responses history',
|
||||
'You can <a href="%url">edit the payment confirmation email</a> sent to the customer after a successful payment.' => 'You can <a href="%url">edit the payment confirmation email</a> sent to the customer after a successful payment.',
|
||||
);
|
||||
11
local/modules/Paypal/I18n/backOffice/default/fr_FR.php
Normal file
11
local/modules/Paypal/I18n/backOffice/default/fr_FR.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Download full log' => 'Télécharger l\'historique complet',
|
||||
'Payment configuration' => 'Configuration du paiement',
|
||||
'Paypal Configuration' => 'Configuration Paypal',
|
||||
'Paypal Production parameters' => 'Paramètre de production',
|
||||
'Paypal Sandbox parameters' => 'Paramètres sandbox',
|
||||
'Paypal responses history' => 'Log des échanges avec la plate-forme Paypal',
|
||||
'You can <a href="%url">edit the payment confirmation email</a> sent to the customer after a successful payment.' => 'Vous pouvez <a href="%url">modifier le mail de confirmation de paiement</a> envoyé au client.',
|
||||
);
|
||||
12
local/modules/Paypal/I18n/email/default/en_US.php
Normal file
12
local/modules/Paypal/I18n/email/default/en_US.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Dear customer' => 'Dear customer',
|
||||
'Payment of your order %ref' => 'Payment of your order %ref',
|
||||
'Thank you again for your purchase.' => 'Thank you again for your purchase.',
|
||||
'The %store_name team.' => 'The %store_name team.',
|
||||
'The payment of your order %ref is confirmed' => 'The payment of your order %ref is confirmed',
|
||||
'This is a confirmation of the payment of your order %ref via Paypal on our shop.' => 'This is a confirmation of the payment of your order %ref via Paypal on our shop.',
|
||||
'View this order in your account at %shop_name' => 'View this order in your account at %shop_name',
|
||||
'Your invoice is now available in your customer account at %url.' => 'Your invoice is now available in your customer account at %url.',
|
||||
);
|
||||
12
local/modules/Paypal/I18n/email/default/fr_FR.php
Normal file
12
local/modules/Paypal/I18n/email/default/fr_FR.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Dear customer' => 'Cher client',
|
||||
'Payment of your order %ref' => 'Paiement de votre commande %ref',
|
||||
'Thank you again for your purchase.' => 'Merci encore pour votre commande.',
|
||||
'The %store_name team.' => 'L\'équipe %store_name',
|
||||
'The payment of your order %ref is confirmed' => 'Le paiement Paypal de votre commande %ref est confirmé.',
|
||||
'This is a confirmation of the payment of your order %ref via Paypal on our shop.' => 'Ceci est une confirmation du paiement Paypal de votre commande %ref.',
|
||||
'View this order in your account at %shop_name' => 'Les détails de cette commande sont disponibles dans votre compte client sur %shop_name',
|
||||
'Your invoice is now available in your customer account at %url.' => 'Les détails de cette commande sont disponibles dans votre compte client sur %url',
|
||||
);
|
||||
45
local/modules/Paypal/I18n/en_US.php
Normal file
45
local/modules/Paypal/I18n/en_US.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'(Previous log is in %file file.)\n' => '(Previous log is in %file file.)\n',
|
||||
'Activate sandbox mode' => 'Activate sandbox mode',
|
||||
'Allowed IPs in test mode' => 'Allowed IPs in test mode',
|
||||
'Discount' => 'Discount',
|
||||
'Failed to find PayerID' => 'Failed to find PayerID',
|
||||
'Failed to get a valid Paypal response. Please try again' => 'Failed to get a valid Paypal response. Please try again',
|
||||
'Failed to get customer delivery address' => 'Failed to get customer delivery address',
|
||||
'Failed to validate payment parameters' => 'Failed to validate payment parameters',
|
||||
'Failed to validate your payment' => 'Failed to validate your payment',
|
||||
'If checked, a payment confirmation e-mail is sent to the customer.' => 'If checked, a payment confirmation e-mail is sent to the customer.',
|
||||
'If checked, the order confirmation message is sent to the customer only when the payment is successful. The order notification is always sent to the shop administrator' => 'If checked, the order confirmation message is sent to the customer only when the payment is successful. The order notification is always sent to the shop administrator',
|
||||
'Invalid Paypal token. Please try again.' => 'Invalid Paypal token. Please try again.',
|
||||
'Invalid order ID. This order doesn\'t exists or doesn\'t belong to you.' => 'Invalid order ID. This order doesn\'t exists or doesn\'t belong to you.',
|
||||
'List of IP addresses allowed to use this payment on the front-office when in test mode (your current IP is %ip). One address per line' => 'List of IP addresses allowed to use this payment on the front-office when in test mode (your current IP is %ip). One address per line',
|
||||
'Maximum items in cart' => 'Maximum items in cart',
|
||||
'Maximum number of items in the customer cart for which this payment method is available.' => 'Maximum number of items in the customer cart for which this payment method is available.',
|
||||
'Maximum order total' => 'Maximum order total',
|
||||
'Maximum order total in the default currency for which this payment method is available. Enter 0 for no maximum' => 'Maximum order total in the default currency for which this payment method is available. Enter 0 for no maximum',
|
||||
'Minimum order total' => 'Minimum order total',
|
||||
'Minimum order total in the default currency for which this payment method is available. Enter 0 for no minimum' => 'Minimum order total in the default currency for which this payment method is available. Enter 0 for no minimum',
|
||||
'Paypal configuration' => 'Paypal configuration',
|
||||
'Paypal transaction is pending. Reason: %reason' => 'Paypal transaction is pending. Reason: %reason',
|
||||
'Send a payment confirmation e-mail' => 'Send a payment confirmation e-mail',
|
||||
'Send order confirmation on payment success' => 'Send order confirmation on payment success',
|
||||
'Sorry, something did not worked with Paypal. Please try again, or use another payment type' => 'Sorry, something did not worked with Paypal. Please try again, or use another payment type',
|
||||
'The Paypal sandbox signature' => 'The Paypal sandbox signature',
|
||||
'The Paypal signature' => 'The Paypal signature',
|
||||
'The log file doesn\'t exists yet.' => 'The log file doesn\'t exists yet.',
|
||||
'The log file is empty.' => 'The log file is empty.',
|
||||
'The password option must be set.' => 'The password option must be set.',
|
||||
'The signature option must be set.' => 'The signature option must be set.',
|
||||
'The username option must be set.' => 'The username option must be set.',
|
||||
'Unexpected error: %mesg' => 'Unexpected error: %mesg',
|
||||
'You canceled your payment' => 'You canceled your payment',
|
||||
'Your Paypal login' => 'Your Paypal login',
|
||||
'Your Paypal password' => 'Your Paypal password',
|
||||
'Your Paypal sandbox login' => 'Your Paypal sandbox login',
|
||||
'Your Paypal sandbox password' => 'Your Paypal sandbox password',
|
||||
'login' => 'username',
|
||||
'password' => 'password',
|
||||
'signature' => 'signature',
|
||||
);
|
||||
48
local/modules/Paypal/I18n/fr_FR.php
Normal file
48
local/modules/Paypal/I18n/fr_FR.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'(Previous log is in %file file.)\n' => '(L\'historique précédent est dans %file file.)\n',
|
||||
'Activate sandbox mode' => 'Activer la sandbox ( mode de test )',
|
||||
'Allowed IPs in test mode' => 'Adresse IP autorisées en mode sandbox',
|
||||
'Discount' => 'Remise',
|
||||
'Failed to find PayerID' => 'Ne peut obtenir le PayerID',
|
||||
'Failed to get a valid Paypal response. Please try again' => 'Ne peut obtenir la réponse de Paypal',
|
||||
'Failed to get customer delivery address' => 'Ne peut obtenir l\'adresse de livraison du client',
|
||||
'Failed to validate payment parameters' => 'La validation des paramètres de paiement a échoué',
|
||||
'Failed to validate your payment' => 'La validation du paiement a échoué',
|
||||
'If checked, a payment confirmation e-mail is sent to the customer.' => 'Si cette case est cochée, un mail de confirmation de paiement sera envoyé au client.',
|
||||
'If checked, all products will be sent to Paypal.' => 'Si cette case est cochée, tout les produits seront envoyé à Paypal.',
|
||||
'If checked, the order confirmation message is sent to the customer only when the payment is successful. The order notification is always sent to the shop administrator' => 'Si cette case est cochée, le mail de confirmation de commande sera envoyé au client seulement si son paiement est validé.',
|
||||
'Invalid Paypal token. Please try again.' => 'Le token Paypal est invalide. Merci de ré-essayer',
|
||||
'Invalid order ID. This order doesn\'t exists or doesn\'t belong to you.' => 'ID de commande invalide',
|
||||
'List of IP addresses allowed to use this payment on the front-office when in test mode (your current IP is %ip). One address per line' => 'En mode sandbox, liste des adresses IP autorisées à utiliser le module de paiement en front office. Indiquer une adresse par ligne. Votre IP actuelle est %ip',
|
||||
'Maximum items in cart' => 'Nombre maximum d\'éléments dans le panier',
|
||||
'Maximum number of items in the customer cart for which this payment method is available.' => 'Nombre d\'éléments dans le panier au delà duquel ce paiement n\'est plus disponible.',
|
||||
'Maximum order total' => 'Montant de commande maximum',
|
||||
'Maximum order total in the default currency for which this payment method is available. Enter 0 for no maximum' => 'Montant de commande maximum dans la devise par défaut au delà duquel ce paiement n\'est plus disponible. 0 = pas de maximum',
|
||||
'Minimum order total' => 'Montant de commande minimum',
|
||||
'Minimum order total in the default currency for which this payment method is available. Enter 0 for no minimum' => 'Montant de commande minimum dans la devise par défaut à partir duquel ce paiement devient disponible. 0 = pas de minimum',
|
||||
'Order' => 'Commande',
|
||||
'Paypal configuration' => 'Configuration Paypal',
|
||||
'Paypal transaction is pending. Reason: %reason' => 'La transaction Paypal est suspendue: %reason',
|
||||
'Send a payment confirmation e-mail' => 'Envoyer une confirmation de paiement',
|
||||
'Send details of all products to Paypal' => 'Envoyer les détails de tout les produits à Paypal',
|
||||
'Send order confirmation on payment success' => 'Confirmation de commande si le paiement réussit',
|
||||
'Sorry, something did not worked with Paypal. Please try again, or use another payment type' => 'Désolé, quelque chose n\'a pas marché avec Paypal',
|
||||
'The Paypal sandbox signature' => 'Le mot de passe de votre compte sandbox Paypal',
|
||||
'The Paypal signature' => 'La signature associée à votre compte.',
|
||||
'The log file doesn\'t exists yet.' => 'Le fichier de log n\'existe pas encore.',
|
||||
'The log file is empty.' => 'Le fichier de log est vide.',
|
||||
'The password option must be set.' => 'Veuillez indiquer le mot de passe',
|
||||
'The signature option must be set.' => 'Veuillez indiquer la signature',
|
||||
'The username option must be set.' => 'Veuillez indiquer le nom d\'utilisateur',
|
||||
'Unexpected error: %mesg' => 'Erreur inattendue: %mesg',
|
||||
'You canceled your payment' => 'Vous avez annulé votre demande de paiement',
|
||||
'Your Paypal login' => 'Le login de votre compte Paypal',
|
||||
'Your Paypal password' => 'Le mot de passe de votre compte Paypal',
|
||||
'Your Paypal sandbox login' => 'Le login de votre compte sandbox Paypal',
|
||||
'Your Paypal sandbox password' => 'Le mot de passe de votre compte sandbox Paypal',
|
||||
'login' => 'Nom d\'utilisateur',
|
||||
'password' => 'Mot de passe',
|
||||
'signature' => 'Signature',
|
||||
);
|
||||
674
local/modules/Paypal/LICENSE.txt
Normal file
674
local/modules/Paypal/LICENSE.txt
Normal file
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
101
local/modules/Paypal/Listener/SendConfirmationEmail.php
Normal file
101
local/modules/Paypal/Listener/SendConfirmationEmail.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Paypal\Listener;
|
||||
|
||||
use Paypal\Paypal;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Action\BaseAction;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Mailer\MailerFactory;
|
||||
|
||||
/**
|
||||
* Class SendEMail
|
||||
* @package IciRelais\Listener
|
||||
* @author Thelia <info@thelia.net>
|
||||
*/
|
||||
class SendConfirmationEmail extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
/**
|
||||
* @var MailerFactory
|
||||
*/
|
||||
protected $mailer;
|
||||
|
||||
public function __construct(MailerFactory $mailer)
|
||||
{
|
||||
$this->mailer = $mailer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OrderEvent $event
|
||||
*
|
||||
* @throws \Exception if the message cannot be loaded.
|
||||
*/
|
||||
public function sendConfirmationEmail(OrderEvent $event)
|
||||
{
|
||||
if (Paypal::getConfigValue('send_confirmation_message_only_if_paid')) {
|
||||
// We send the order confirmation email only if the order is paid
|
||||
$order = $event->getOrder();
|
||||
|
||||
if (! $order->isPaid() && $order->getPaymentModuleId() == Paypal::getModuleId()) {
|
||||
$event->stopPropagation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @params OrderEvent $order
|
||||
* Checks if order payment module is paypal and if order new status is paid, send an email to the customer.
|
||||
*/
|
||||
public function updateStatus(OrderEvent $event)
|
||||
{
|
||||
$order = $event->getOrder();
|
||||
|
||||
if ($order->isPaid() && $order->getPaymentModuleId() === Paypal::getModuleId()) {
|
||||
if (Paypal::getConfigValue('send_payment_confirmation_message')) {
|
||||
$this->mailer->sendEmailToCustomer(
|
||||
Paypal::CONFIRMATION_MESSAGE_NAME,
|
||||
$order->getCustomer(),
|
||||
[
|
||||
'order_id' => $order->getId(),
|
||||
'order_ref' => $order->getRef()
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// Send confirmation email if required.
|
||||
if (Paypal::getConfigValue('send_confirmation_message_only_if_paid')) {
|
||||
$event->getDispatcher()->dispatch(TheliaEvents::ORDER_SEND_CONFIRMATION_EMAIL, $event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
TheliaEvents::ORDER_UPDATE_STATUS => array("updateStatus", 128),
|
||||
TheliaEvents::ORDER_SEND_CONFIRMATION_EMAIL => array("sendConfirmationEmail", 129)
|
||||
);
|
||||
}
|
||||
}
|
||||
353
local/modules/Paypal/Paypal.php
Normal file
353
local/modules/Paypal/Paypal.php
Normal file
@@ -0,0 +1,353 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Paypal;
|
||||
|
||||
use Paypal\Classes\API\PaypalApiCredentials;
|
||||
use Paypal\Classes\API\PaypalApiLogManager;
|
||||
use Paypal\Classes\API\PaypalApiManager;
|
||||
use Paypal\Classes\NVP\Operations\PaypalNvpOperationsSetExpressCheckout;
|
||||
use Paypal\Classes\NVP\PaypalNvpMessageSender;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Install\Database;
|
||||
use Thelia\Model\CountryQuery;
|
||||
use Thelia\Model\Message;
|
||||
use Thelia\Model\MessageQuery;
|
||||
use Thelia\Model\ModuleImageQuery;
|
||||
use Thelia\Model\Order;
|
||||
use Thelia\Model\OrderAddressQuery;
|
||||
use Thelia\Model\OrderQuery;
|
||||
use Thelia\Module\AbstractPaymentModule;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
/**
|
||||
* Class Paypal
|
||||
* @package Paypal
|
||||
* @author Thelia <info@thelia.net>
|
||||
*/
|
||||
class Paypal extends AbstractPaymentModule
|
||||
{
|
||||
const DOMAIN = 'paypal';
|
||||
|
||||
/**
|
||||
* The confirmation message identifier
|
||||
*/
|
||||
const CONFIRMATION_MESSAGE_NAME = 'paypal_payment_confirmation';
|
||||
|
||||
public function pay(Order $order)
|
||||
{
|
||||
$orderId = $order->getId();
|
||||
|
||||
/** @var Router $router */
|
||||
$router = $this->getContainer()->get('router.paypal');
|
||||
|
||||
$successUrl = URL::getInstance()->absoluteUrl(
|
||||
$router->generate('paypal.ok', ['order_id' => $order->getId()])
|
||||
);
|
||||
|
||||
$cancelUrl = URL::getInstance()->absoluteUrl(
|
||||
$router->generate('paypal.cancel', ['order_id' => $order->getId()])
|
||||
);
|
||||
|
||||
$order = OrderQuery::create()->findPk($orderId);
|
||||
|
||||
$api = new PaypalApiCredentials();
|
||||
$redirect_api = new PaypalApiManager();
|
||||
$products = array(array());
|
||||
$itemIndex = 0;
|
||||
$logger = new PaypalApiLogManager();
|
||||
|
||||
$send_cart_detail = (int) Paypal::getConfigValue('send_cart_detail', 0);
|
||||
|
||||
if ($send_cart_detail == 1) {
|
||||
|
||||
/*
|
||||
* Store products into 2d array $products
|
||||
*/
|
||||
$products_amount = 0;
|
||||
|
||||
foreach ($order->getOrderProducts() as $product) {
|
||||
if ($product !== null) {
|
||||
$amount = floatval($product->getWasInPromo() ? $product->getPromoPrice() : $product->getPrice());
|
||||
foreach ($product->getOrderProductTaxes() as $tax) {
|
||||
$amount += $product->getWasInPromo() ? $tax->getPromoAmount() : $tax->getAmount();
|
||||
}
|
||||
$rounded_amounts = round($amount, 2);
|
||||
$products_amount += $rounded_amounts * $product->getQuantity();
|
||||
$products[0][ "NAME" . $itemIndex ] = urlencode($product->getTitle());
|
||||
$products[0][ "AMT" . $itemIndex ] = urlencode($rounded_amounts);
|
||||
$products[0][ "QTY" . $itemIndex ] = urlencode($product->getQuantity());
|
||||
$itemIndex ++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute difference between prodcts total and cart amount
|
||||
* -> get Coupons.
|
||||
*/
|
||||
$delta = round($products_amount - $order->getTotalAmount($useless, false), 2);
|
||||
|
||||
if ($delta > 0) {
|
||||
$products[0][ "NAME" . $itemIndex ] = Translator::getInstance()->trans("Discount");
|
||||
$products[0][ "AMT" . $itemIndex ] = - $delta;
|
||||
$products[0][ "QTY" . $itemIndex ] = 1;
|
||||
}
|
||||
} else {
|
||||
$products[0]["NAME" . $itemIndex] = urlencode(Translator::getInstance()->trans("Order").' '.$orderId);
|
||||
$products[0]["AMT" . $itemIndex] = round($order->getTotalAmount($useless, false),2);
|
||||
$products[0]["QTY" . $itemIndex] = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create setExpressCheckout request
|
||||
*/
|
||||
$setExpressCheckout = new PaypalNvpOperationsSetExpressCheckout(
|
||||
$api,
|
||||
round($order->getTotalAmount(), 2),
|
||||
$order->getCurrency()->getCode(),
|
||||
$successUrl,
|
||||
$cancelUrl,
|
||||
0,
|
||||
array(
|
||||
"L_PAYMENTREQUEST" => $products,
|
||||
"PAYMENTREQUEST" => array(
|
||||
array(
|
||||
"SHIPPINGAMT" => round($order->getPostage(), 2),
|
||||
"ITEMAMT" => round($order->getTotalAmount($useless, false), 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
* Try to get customer's delivery address
|
||||
*/
|
||||
if (null !== $address = OrderAddressQuery::create()->findPk($order->getDeliveryOrderAddressId())) {
|
||||
/*
|
||||
* If address is found, set address in setExpressCheckout request
|
||||
*/
|
||||
$setExpressCheckout->setCustomerDeliveryAddress(
|
||||
$address->getLastname(),
|
||||
$address->getAddress1(),
|
||||
$address->getAddress2(),
|
||||
$address->getCity(),
|
||||
"", // State
|
||||
$address->getZipcode(),
|
||||
CountryQuery::create()->findPk($address->getCountryId())->getIsoalpha2()
|
||||
);
|
||||
|
||||
/*
|
||||
* $sender PaypalNvpMessageSender Instance of the class that sends requests
|
||||
* $response string NVP response of paypal for setExpressCheckout request
|
||||
* $req array array cast of NVP response
|
||||
*/
|
||||
$sender = new PaypalNvpMessageSender($setExpressCheckout, self::isSandboxMode());
|
||||
|
||||
$response = $sender->send();
|
||||
|
||||
if ($response) {
|
||||
$responseData = PaypalApiManager::nvpToArray($response);
|
||||
|
||||
$logger->logTransaction($responseData);
|
||||
/*
|
||||
* if setExpressCheckout is correct, store values in the session & redirect to paypal checkout page
|
||||
* else print error. ( return $this->render ... )
|
||||
*/
|
||||
if (isset($responseData['ACK']) && $responseData['ACK'] === "Success"
|
||||
&&
|
||||
isset($responseData['TOKEN']) && ! empty($responseData['TOKEN'])
|
||||
) {
|
||||
$sess = $this->getRequest()->getSession();
|
||||
$sess->set("Paypal.token", $responseData['TOKEN']);
|
||||
|
||||
return new RedirectResponse(
|
||||
$redirect_api->getExpressCheckoutUrl($responseData['TOKEN'])
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$logger->getLogger()->error(
|
||||
Translator::getInstance()->trans(
|
||||
"Failed to get a valid Paypal response. Please try again",
|
||||
[],
|
||||
self::DOMAIN
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$logger->getLogger()->error(
|
||||
Translator::getInstance()->trans(
|
||||
"Failed to get customer delivery address",
|
||||
[],
|
||||
self::DOMAIN
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Failure !
|
||||
return new RedirectResponse(
|
||||
$this->getPaymentFailurePageUrl(
|
||||
$orderId,
|
||||
// Pas de point final, sinon 404 !
|
||||
Translator::getInstance()->trans(
|
||||
"Sorry, something did not worked with Paypal. Please try again, or use another payment type",
|
||||
[],
|
||||
self::DOMAIN
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function isValidPayment()
|
||||
{
|
||||
$valid = false;
|
||||
|
||||
// Check if total order amount is within the module's limits
|
||||
$order_total = $this->getCurrentOrderTotalAmount();
|
||||
|
||||
$min_amount = Paypal::getConfigValue('minimum_amount', 0);
|
||||
$max_amount = Paypal::getConfigValue('maximum_amount', 0);
|
||||
|
||||
if (
|
||||
($order_total > 0)
|
||||
&&
|
||||
($min_amount <= 0 || $order_total >= $min_amount)
|
||||
&&
|
||||
($max_amount <= 0 || $order_total <= $max_amount)
|
||||
) {
|
||||
// Check cart item count
|
||||
$cartItemCount = $this->getRequest()->getSession()->getSessionCart($this->getDispatcher())->countCartItems();
|
||||
|
||||
if ($cartItemCount <= Paypal::getConfigValue('cart_item_count', 9)) {
|
||||
$valid = true;
|
||||
|
||||
if (Paypal::isSandboxMode()) {
|
||||
// In sandbox mode, check the current IP
|
||||
$raw_ips = explode("\n", Paypal::getConfigValue('allowed_ip_list', ''));
|
||||
|
||||
$allowed_client_ips = array();
|
||||
|
||||
foreach ($raw_ips as $ip) {
|
||||
$allowed_client_ips[] = trim($ip);
|
||||
}
|
||||
|
||||
$client_ip = $this->getRequest()->getClientIp();
|
||||
|
||||
$valid = in_array($client_ip, $allowed_client_ips);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $valid;
|
||||
}
|
||||
|
||||
public function postActivation(ConnectionInterface $con = null)
|
||||
{
|
||||
// Setup some default values at first install
|
||||
if (null === self::getConfigValue('minimum_amount', null)) {
|
||||
self::setConfigValue('minimum_amount', 0);
|
||||
self::setConfigValue('maximum_amount', 0);
|
||||
self::setConfigValue('send_payment_confirmation_message', 1);
|
||||
}
|
||||
|
||||
if (null === MessageQuery::create()->findOneByName(self::CONFIRMATION_MESSAGE_NAME)) {
|
||||
$message = new Message();
|
||||
|
||||
$message
|
||||
->setName(self::CONFIRMATION_MESSAGE_NAME)
|
||||
->setHtmlTemplateFileName('paypal-payment-confirmation.html')
|
||||
->setTextTemplateFileName('paypal-payment-confirmation.txt')
|
||||
->setLocale('en_US')
|
||||
->setTitle('Paypal payment confirmation')
|
||||
->setSubject('Payment of order {$order_ref}')
|
||||
->setLocale('fr_FR')
|
||||
->setTitle('Confirmation de paiement par Paypal')
|
||||
->setSubject('Confirmation du paiement de votre commande {$order_ref}')
|
||||
->save()
|
||||
;
|
||||
}
|
||||
|
||||
/* Deploy the module's image */
|
||||
$module = $this->getModuleModel();
|
||||
|
||||
if (ModuleImageQuery::create()->filterByModule($module)->count() == 0) {
|
||||
$this->deployImageFolder($module, sprintf('%s/images', __DIR__), $con);
|
||||
}
|
||||
}
|
||||
|
||||
public function update($currentVersion, $newVersion, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === self::getConfigValue('login', null)) {
|
||||
$database = new Database($con);
|
||||
|
||||
$statement = $database->execute('select * from paypal_config');
|
||||
|
||||
while ($statement && $config = $statement->fetchObject()) {
|
||||
switch($config->name) {
|
||||
case 'login_sandbox':
|
||||
Paypal::setConfigValue('sandbox_login', $config->value);
|
||||
break;
|
||||
|
||||
case 'password_sandbox':
|
||||
Paypal::setConfigValue('sandbox_password', $config->value);
|
||||
break;
|
||||
|
||||
case 'signature_sandbox':
|
||||
Paypal::setConfigValue('sandbox_signature', $config->value);
|
||||
break;
|
||||
|
||||
default:
|
||||
Paypal::setConfigValue($config->name, $config->value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parent::update($currentVersion, $newVersion, $con);
|
||||
}
|
||||
|
||||
public static function isSandboxMode()
|
||||
{
|
||||
return 1 == intval(self::getConfigValue('sandbox'));
|
||||
}
|
||||
|
||||
public function destroy(ConnectionInterface $con = null, $deleteModuleData = false)
|
||||
{
|
||||
if ($deleteModuleData) {
|
||||
MessageQuery::create()->findOneByName(self::CONFIRMATION_MESSAGE_NAME)->delete();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* if you want, you can manage stock in your module instead of order process.
|
||||
* Return false to decrease the stock when order status switch to pay
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function manageStockOnCreation()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
32
local/modules/Paypal/README.md
Normal file
32
local/modules/Paypal/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# PayPal
|
||||
|
||||
* I) <a href="#i--installation-1">Install notes</a>
|
||||
* II) <a href="#ii-how-to-use">How to use</a>
|
||||
* III) <a href="#iii-integration">Integration</a>
|
||||
|
||||
## I) Installation
|
||||
|
||||
### Manually
|
||||
|
||||
* Copy the module into ```<thelia_root>/local/modules/``` directory and be sure that the name of the module is ```Paypal```.
|
||||
* Activate it in your thelia administration panel
|
||||
|
||||
### Composer
|
||||
|
||||
Add it in your main thelia composer.json file
|
||||
|
||||
```
|
||||
composer require thelia/paypal-module:~2.0.0
|
||||
```
|
||||
|
||||
## II) How to use
|
||||
|
||||
To use the module, you first need to activate it in the back-office, tab Modules, and click on "Configure" on the line
|
||||
of paypal module. Enter your paypal login informations and save.
|
||||
Don't forget to do some fake orders in sandbox mode ( check "Active sandbox mode" box in tab Configure sandbox in the
|
||||
configuration page, and save ).
|
||||
|
||||
## III) Integration
|
||||
|
||||
There is an integration example in the directory <module path>/templates/frontOffice/deufault
|
||||
You must do a page containing a internal error message called gotopaypalfail.html and a order cancel page called ordercanacled.html
|
||||
19
local/modules/Paypal/composer.json
Normal file
19
local/modules/Paypal/composer.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "thelia/paypal-module",
|
||||
"type": "thelia-module",
|
||||
"license": "LGPL V3",
|
||||
"description": "Paypal module for Thelia ecommerce solution",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Thelia",
|
||||
"email": "info@thelia.net",
|
||||
"homepage": "https://github.com/thelia-modules"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"thelia/installer": "~1.0"
|
||||
},
|
||||
"extra": {
|
||||
"installer-name": "Paypal"
|
||||
}
|
||||
}
|
||||
BIN
local/modules/Paypal/images/logo.png
Normal file
BIN
local/modules/Paypal/images/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
@@ -0,0 +1,120 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12 general-block-decorator">
|
||||
<div class="row">
|
||||
<div class="col-md-12 title title-without-tabs">
|
||||
{intl d='paypal.bo.default' l="Paypal Configuration"}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{form name="paypal.form.configure"}
|
||||
<form action="{url path="/admin/module/paypal/configure"}" method="post">
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{include file = "includes/inner-form-toolbar.html"
|
||||
hide_flags = true
|
||||
page_url = "{url path='/admin/module/Paypal'}"
|
||||
close_url = "{url path='/admin/modules'}"
|
||||
}
|
||||
|
||||
{if $form_error}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-danger">{$form_error_message}</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<p class="title title-without-tabs">{intl d='paypal.bo.default' l="Paypal Production parameters"}</p>
|
||||
|
||||
{render_form_field form=$form field="login" value=$login}
|
||||
{render_form_field form=$form field="password" value=$password}
|
||||
{render_form_field form=$form field="signature" value=$signature}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<p class="title title-without-tabs">{intl d='paypal.bo.default' l="Paypal Sandbox parameters"}</p>
|
||||
|
||||
{custom_render_form_field form=$form field="sandbox"}
|
||||
<input type="checkbox" {form_field_attributes form=$form field="sandbox"} {if $sandbox}checked{/if}>
|
||||
{$label}
|
||||
{/custom_render_form_field}
|
||||
|
||||
{render_form_field form=$form field="sandbox_login" value=$sandbox_login}
|
||||
{render_form_field form=$form field="sandbox_password" value=$sandbox_password}
|
||||
{render_form_field form=$form field="sandbox_signature" value=$sandbox_signature}
|
||||
|
||||
{render_form_field form=$form field="allowed_ip_list" value=$allowed_ip_list}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<p class="title title-without-tabs">{intl d='paypal.bo.default' l="Payment configuration"}</p>
|
||||
|
||||
{custom_render_form_field form=$form field="send_confirmation_message_only_if_paid"}
|
||||
<input type="checkbox" {form_field_attributes form=$form field="send_confirmation_message_only_if_paid"} {if $send_confirmation_message_only_if_paid}checked{/if}>
|
||||
{$label}
|
||||
{/custom_render_form_field}
|
||||
|
||||
{custom_render_form_field form=$form field="send_payment_confirmation_message"}
|
||||
<input type="checkbox" {form_field_attributes form=$form field="send_payment_confirmation_message"} {if $send_payment_confirmation_message}checked{/if}>
|
||||
{$label}
|
||||
{/custom_render_form_field}
|
||||
|
||||
<div class="well well-sm">
|
||||
<span class="glyphicon glyphicon-info-sign"></span>
|
||||
{intl d='paypal.bo.default' l='You can <a href="%url">edit the payment confirmation email</a> sent to the customer after a successful payment.' url={url path="/admin/configuration/messages"}}
|
||||
</div>
|
||||
|
||||
{custom_render_form_field form=$form field="minimum_amount"}
|
||||
<div class="input-group">
|
||||
<input type="text" {form_field_attributes form=$form field="minimum_amount" value=$minimum_amount}>
|
||||
<span class="input-group-addon">{currency attr='symbol'}</span>
|
||||
</div>
|
||||
{/custom_render_form_field}
|
||||
|
||||
{custom_render_form_field form=$form field="maximum_amount"}
|
||||
<div class="input-group">
|
||||
<input type="text" {form_field_attributes form=$form field="maximum_amount" value=$maximum_amount}>
|
||||
<span class="input-group-addon">{currency attr='symbol'}</span>
|
||||
</div>
|
||||
{/custom_render_form_field}
|
||||
|
||||
{render_form_field form=$form field="cart_item_count" value=$cart_item_count}
|
||||
|
||||
{custom_render_form_field form=$form field="send_cart_detail"}
|
||||
<input type="checkbox" {form_field_attributes form=$form field="send_cart_detail"} {if $send_cart_detail}checked{/if}>
|
||||
{$label}
|
||||
{/custom_render_form_field}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">
|
||||
<span class="glyphicon glyphicon-cog"></span>
|
||||
{intl d='paypal.bo.default' l="Paypal responses history"}
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div id="log-container" style="font-family: monospace; font-size: 12px; max-height: 400px; overflow-y: scroll">
|
||||
{$trace_content nofilter}
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<a href="{url path='/admin/module/paypal/log'}" class="btn btn-sm btn-primary">
|
||||
<span class="glyphicon glyphicon-download-alt"></span>
|
||||
{intl d='paypal.bo.default' l="Download full log"}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,23 @@
|
||||
{extends file="email-layout.tpl"}
|
||||
|
||||
{* Do not provide a "Open in browser" link *}
|
||||
{block name="browser"}{/block}
|
||||
{* No pre-header *}
|
||||
{block name="pre-header"}{/block}
|
||||
|
||||
{* Subject *}
|
||||
{block name="email-subject"}{intl d='paypal.email.default' l="Payment of your order %ref" ref={$order_ref}}{/block}
|
||||
|
||||
{* Title *}
|
||||
{block name="email-title"}{intl d='paypal.email.default' l="The payment of your order %ref is confirmed" ref={$order_ref}}{/block}
|
||||
|
||||
{* Content *}
|
||||
{block name="email-content"}
|
||||
<p>
|
||||
<a href="{url path="/account"}">
|
||||
{intl d='paypal.email.default' l="View this order in your account at %shop_name" shop_name={config key="store_name"}}
|
||||
</a>
|
||||
</p>
|
||||
<p>{intl d='paypal.email.default' l='Thank you again for your purchase.'}</p>
|
||||
<p>{intl d='paypal.email.default' l='The %store_name team.' store_name={config key="store_name"}}</p>
|
||||
{/block}
|
||||
@@ -0,0 +1,9 @@
|
||||
{intl d='paypal.email.default' l='Dear customer'},
|
||||
<br>
|
||||
{intl d='paypal.email.default' l='This is a confirmation of the payment of your order %ref via Paypal on our shop.' ref=$order_ref}
|
||||
<br>
|
||||
{intl d='paypal.email.default' l='Your invoice is now available in your customer account at %url.'} url={config key="url_site"}}
|
||||
<br>
|
||||
{intl d='paypal.email.default' l='Thank you again for your purchase.'}
|
||||
<br>
|
||||
{intl d='paypal.email.default' l='The %store_name team.' store_name={config key="store_name"}}
|
||||
Reference in New Issue
Block a user