feat : ajout modules magento
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Block\Payment;
|
||||
|
||||
/**
|
||||
* Description of SealedForm
|
||||
*/
|
||||
class SealedForm extends \Magento\Framework\View\Element\Template
|
||||
{
|
||||
/**
|
||||
* @var \Blackbird\Monetico\Helper\DataSealedForm
|
||||
*/
|
||||
protected $_dataSealedFormHelper;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_template = 'Blackbird_Monetico::payment/sealed-form.phtml';
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\View\Element\Template\Context $context
|
||||
* @param \Blackbird\Monetico\Helper\DataSealedForm $dataSealedFormHelper
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\View\Element\Template\Context $context,
|
||||
\Blackbird\Monetico\Helper\DataSealedForm $dataSealedFormHelper,
|
||||
array $data = []
|
||||
) {
|
||||
$this->_dataSealedFormHelper = $dataSealedFormHelper;
|
||||
parent::__construct($context, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function _construct()
|
||||
{
|
||||
parent::_construct();
|
||||
|
||||
$this->_dataSealedFormHelper->init($this->getMethodCode(), $this->getOrder());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getSealedFormData()
|
||||
{
|
||||
return $this->_dataSealedFormHelper->getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isPaymentMethodIntegrated()
|
||||
{
|
||||
return $this->_dataSealedFormHelper->isPaymentMethodIntegrated();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPaymentFormAction()
|
||||
{
|
||||
return $this->_dataSealedFormHelper->getPaymentFormAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPaymentFormActionUrlEncoded()
|
||||
{
|
||||
$url = '?';
|
||||
|
||||
foreach ($this->_dataSealedFormHelper->getData() as $key => $value) {
|
||||
$url .= urlencode($key) . '=' . urlencode($value) . '&';
|
||||
}
|
||||
|
||||
$url .= 'mode_affichage=iframe';
|
||||
|
||||
return $this->getPaymentFormAction() . $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getServiceName()
|
||||
{
|
||||
return $this->_dataSealedFormHelper->getServiceName();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Controller;
|
||||
|
||||
abstract class Payment extends \Magento\Framework\App\Action\Action
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Checkout\Model\Session
|
||||
*/
|
||||
protected $_checkoutSession;
|
||||
|
||||
/**
|
||||
* @var \Magento\Sales\Model\OrderRepository
|
||||
*/
|
||||
protected $_orderRepository;
|
||||
|
||||
/**
|
||||
* @var \Blackbird\Monetico\Model\ConfigProvider
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\App\Action\Context $context
|
||||
* @param \Magento\Checkout\Model\Session $checkoutSession
|
||||
* @param \Magento\Sales\Api\OrderRepositoryInterface $orderRepository
|
||||
* @param \Blackbird\Monetico\Model\ConfigProvider $configProvider
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\App\Action\Context $context,
|
||||
\Magento\Checkout\Model\Session $checkoutSession,
|
||||
\Magento\Sales\Api\OrderRepositoryInterface $orderRepository,
|
||||
\Blackbird\Monetico\Model\ConfigProvider $configProvider
|
||||
) {
|
||||
$this->_checkoutSession = $checkoutSession;
|
||||
$this->_orderRepository = $orderRepository;
|
||||
$this->_config = $configProvider;
|
||||
parent::__construct($context);
|
||||
$this->_construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sub construct
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
abstract protected function _construct();
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Controller\Payment;
|
||||
|
||||
use Magento\Framework\Exception\LocalizedException;
|
||||
use Magento\Sales\Model\Order;
|
||||
|
||||
class Failure extends \Blackbird\Monetico\Controller\Payment
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function _construct()
|
||||
{
|
||||
$this->_config->setMethodCode('monetico');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$resultRedirect = $this->resultRedirectFactory->create()->setPath('checkout/onepage/failure');
|
||||
$order = $this->_checkoutSession->getLastRealOrder();
|
||||
|
||||
if ($order && $order->getPayment()) {
|
||||
$status = $this->getConfigOrderCancelStatus($order);
|
||||
|
||||
try {
|
||||
if ($status === Order::STATE_CANCELED && $order->canCancel()) {
|
||||
$order->cancel();
|
||||
} elseif ($status === Order::STATE_HOLDED && $order->canHold()) {
|
||||
$order->hold();
|
||||
}
|
||||
|
||||
$order->addStatusToHistory($status, __('The order has been canceled by the customer.'));
|
||||
$this->_orderRepository->save($order);
|
||||
} catch (LocalizedException $e) {
|
||||
$this->messageManager->addExceptionMessage($e, __('An error has occurred during the cancellation.'));
|
||||
} catch (\Exception $e) {
|
||||
$this->messageManager->addExceptionMessage($e, $e->getMessage());
|
||||
}
|
||||
|
||||
if ($this->_config->getSystemConfigValue('canceled_empty_cart')) {
|
||||
$this->emptyCart();
|
||||
} else {
|
||||
$this->fillCart();
|
||||
}
|
||||
|
||||
if ($this->_config->getSystemConfigValue('canceled_redirect_cart')) {
|
||||
$resultRedirect->setPath('checkout/cart/');
|
||||
} else {
|
||||
// todo update the cart section
|
||||
$message = $this->_config->getSystemConfigValue('canceled_error_message');
|
||||
|
||||
if (!empty($message)) {
|
||||
$this->_checkoutSession->setErrorMessage($message);
|
||||
} else {
|
||||
$this->_checkoutSession->setErrorMessage(__('Your order has been canceled.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $resultRedirect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the cancel status configured for the method of the order
|
||||
*
|
||||
* @param Order $order
|
||||
* @return string
|
||||
*/
|
||||
protected function getConfigOrderCancelStatus(Order $order)
|
||||
{
|
||||
$commonCode = $this->_config->getMethodCode();
|
||||
$this->_config->setMethodCode($order->getPayment()->getMethod());
|
||||
$status = $this->_config->getSystemConfigValue('order_status_payment_canceled');
|
||||
$this->_config->setMethodCode($commonCode);
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset et restore the cart
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function fillCart()
|
||||
{
|
||||
$this->_checkoutSession->restoreQuote();
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty and reset the cart
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function emptyCart()
|
||||
{
|
||||
$this->_checkoutSession->clearQuote();
|
||||
$this->_checkoutSession->clearStorage();
|
||||
$this->_checkoutSession->clearHelperData();
|
||||
$this->_checkoutSession->resetCheckout();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,370 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Controller\Payment;
|
||||
|
||||
use Magento\Framework\App\Action\Context;
|
||||
use Magento\Framework\Controller\Result\RawFactory;
|
||||
use Magento\Sales\Model\Order;
|
||||
use Blackbird\Monetico\Model\ConfigProvider;
|
||||
use Blackbird\Monetico\Model\Config\Source\PostDataKey;
|
||||
use Blackbird\Monetico\Model\MoneticoFactory;
|
||||
use Blackbird\Monetico\Model\Monetico;
|
||||
use Blackbird\Monetico\Model\Debug as DebugLog;
|
||||
|
||||
class Notify extends \Magento\Framework\App\Action\Action
|
||||
{
|
||||
/**
|
||||
* @var RawFactory
|
||||
*/
|
||||
protected $resultRawFactory;
|
||||
|
||||
/**
|
||||
* @var ConfigProvider
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* @var PostDataKey
|
||||
*/
|
||||
protected $_moneticoNotifyPostDataKey;
|
||||
|
||||
/**
|
||||
* @var Monetico
|
||||
*/
|
||||
protected $_monetico;
|
||||
|
||||
/**
|
||||
* @var DebugLog
|
||||
*/
|
||||
protected $_debugLog;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $moneticoPostValues = [];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $notifyResponse;
|
||||
|
||||
/**
|
||||
* @param Context $context
|
||||
* @param RawFactory $resultRawFactory
|
||||
* @param ConfigProvider $config
|
||||
* @param PostDataKey $postDataKey
|
||||
* @param MoneticoFactory $monetico
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
RawFactory $resultRawFactory,
|
||||
ConfigProvider $config,
|
||||
PostDataKey $postDataKey,
|
||||
MoneticoFactory $monetico,
|
||||
DebugLog $debugLog
|
||||
) {
|
||||
$this->resultRawFactory = $resultRawFactory;
|
||||
$this->_config = $config;
|
||||
$this->_moneticoNotifyPostDataKey = $postDataKey;
|
||||
$this->_monetico = $monetico->create();
|
||||
$this->_debugLog = $debugLog;
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Monetico response : payment result
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
try {
|
||||
if ($this->getRequest()->isPost()) {
|
||||
$this->notifyAction();
|
||||
} else {
|
||||
return $this->resultRedirectFactory->create()->setPath('/');
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->_debugLog->addDebugMessage($e->getMessage(), $e->getTrace());
|
||||
$this->generateErrorResponse();
|
||||
}
|
||||
|
||||
/** @var \Magento\Framework\Controller\Result\Raw $resultRaw */
|
||||
$resultRaw = $this->resultRawFactory->create();
|
||||
|
||||
return $resultRaw->setContents($this->notifyResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
* Monetico response : payment result
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function notifyAction()
|
||||
{
|
||||
// Initialize data
|
||||
$this->moneticoPostValues = $this->getMoneticoPostValues();
|
||||
|
||||
if (!$this->hasRequiredRequestData()) {
|
||||
$this->_debugLog->addDebugMessage(__('Some required parameters are missing.'));
|
||||
|
||||
return $this->generateErrorResponse();
|
||||
}
|
||||
|
||||
// Load and continue the order process
|
||||
if (!$this->_monetico->loadOrder($this->getMoneticoPostValue('reference'))) {
|
||||
$this->_debugLog->addDebugMessage(__('The order %1 does not exists.', $this->getMoneticoPostValue('reference')));
|
||||
|
||||
return $this->generateErrorResponse();
|
||||
}
|
||||
|
||||
if ($this->isValidMAC()) {
|
||||
$this->_config->setMethodCode($this->_monetico->getOrderMethod());
|
||||
$this->_debugLog->addDebugMessage(__('The order %1 has a valid MAC.', $this->getMoneticoPostValue('reference')));
|
||||
|
||||
// Payment has been accepted
|
||||
if ($this->isPaymentSucceed()) {
|
||||
$this->_monetico->unholdOrder();
|
||||
$this->_debugLog->addDebugMessage(__('The payment of the order %1 has been validated.', $this->getMoneticoPostValue('reference')));
|
||||
$createInvoice = (bool)$this->_config->getSystemConfigValue('create_invoice');
|
||||
|
||||
if ($this->_monetico->isOrderProcessing()) {
|
||||
if ($createInvoice) {
|
||||
$this->_monetico->saveInvoice();
|
||||
}
|
||||
$status = Order::STATE_PROCESSING;
|
||||
} elseif ($this->_monetico->isOrderComplete()) {
|
||||
$this->_monetico->saveInvoice();
|
||||
$this->_monetico->saveShipment();
|
||||
$status = Order::STATE_COMPLETE;
|
||||
} else {
|
||||
if ($createInvoice) {
|
||||
$this->_monetico->saveInvoice();
|
||||
}
|
||||
if (($status = $this->_config->getSystemConfigValue('order_status_payment_accepted')) === null) {
|
||||
$status = $this->_monetico->getOrderStatus();
|
||||
};
|
||||
}
|
||||
|
||||
$this->_monetico->updateOrder($this->getSuccessfulPaymentMessage(), $status, true);
|
||||
$this->_debugLog->addDebugMessage(__('The status of the order %1 is %2.', $this->getMoneticoPostValue('reference'), $status));
|
||||
|
||||
// Response success curl
|
||||
return $this->generateSuccessResponse();
|
||||
|
||||
// Payment has been rejected
|
||||
} elseif ($this->isPaymentRefused()) {
|
||||
$this->_monetico->unholdOrder();
|
||||
$this->_debugLog->addDebugMessage(__('The payment has been refused. Order: %1', $this->getMoneticoPostValue('reference')));
|
||||
|
||||
if (($status = $this->_config->getSystemConfigValue('order_status_payment_refused')) === null) {
|
||||
$status = $this->_monetico->getOrderStatus();
|
||||
};
|
||||
|
||||
$this->_monetico->holdOrCancelOrder($status);
|
||||
$this->_monetico->updateOrder($this->getRefusedPaymentMessage());
|
||||
$this->_debugLog->addDebugMessage(__('The order %1 has been canceled or held.', $this->getMoneticoPostValue('reference')));
|
||||
}
|
||||
|
||||
// Suspect fraud
|
||||
} else {
|
||||
$this->_monetico->cancelOrder();
|
||||
$this->_monetico->updateOrder(__('Returned MAC is invalid. Order canceled.'));
|
||||
$this->_debugLog->addDebugMessage(__('Returned MAC is invalid. Order %1 canceled.', $this->getMoneticoPostValue('reference')));
|
||||
}
|
||||
|
||||
// Response failure curl
|
||||
return $this->generateErrorResponse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the succeed payment message
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getSuccessfulPaymentMessage()
|
||||
{
|
||||
$msg = __('Payment accepted by Monetico');
|
||||
$msg .= '<br />' . __('Used payment method: %1', $this->getMoneticoPostValue('modepaiement'));
|
||||
$msg .= '<br />' . __(
|
||||
'Captured amount: %1',
|
||||
!empty($this->getMoneticoPostValue('montantech')) ?
|
||||
$this->getMoneticoPostValue('montantech') : $this->getMoneticoPostValue('montant')
|
||||
);
|
||||
$msg .= '<br />' . __('Authorization number: %1', $this->getMoneticoPostValue('numauto'));
|
||||
$msg .= '<br />' . __(
|
||||
'3D secure status: %1',
|
||||
$this->_monetico->getStatus3dsTranslate($this->getMoneticoPostValue('status3ds'))
|
||||
);
|
||||
$msg .= '<br />' . __(
|
||||
'The visual cryptogram has been seized: %1',
|
||||
$this->_monetico->getCvxTranslate($this->getMoneticoPostValue('cvx'))
|
||||
);
|
||||
$msg .= '<br />' . __('CC validity: %1', $this->getMoneticoPostValue('vld'));
|
||||
$msg .= '<br />' . __('CC type: %1', $this->_monetico->getBrandTranslate($this->getMoneticoPostValue('brand')));
|
||||
$msg .= '<br />' . __('Country code from the CC: %1', $this->getMoneticoPostValue('originecb'));
|
||||
$msg .= '<br />' . __('BIN code: %1', $this->getMoneticoPostValue('bincb'));
|
||||
|
||||
return $msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the refused payment message
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getRefusedPaymentMessage()
|
||||
{
|
||||
$msg = __('Payment refused by Monetico');
|
||||
$msg .= '<br />' . __('Used payment method: %1', $this->getMoneticoPostValue('modepaiement'));
|
||||
$msg .= '<br />' . __(
|
||||
'Captured amount: %1',
|
||||
!empty($this->getMoneticoPostValue('montantech')) ?
|
||||
$this->getMoneticoPostValue('montantech') : $this->getMoneticoPostValue('montant')
|
||||
);
|
||||
$msg .= '<br />' . __(
|
||||
'Refusal reason: %1',
|
||||
$this->_monetico->getRefusalTranslate($this->getMoneticoPostValue('motifrefus'))
|
||||
);
|
||||
$msg .= '<br />' . __(
|
||||
'3D secure status: %1',
|
||||
$this->_monetico->getStatus3dsTranslate($this->getMoneticoPostValue('status3ds'))
|
||||
);
|
||||
$msg .= '<br />' . __(
|
||||
'The visual cryptogram has been seized: %1',
|
||||
$this->_monetico->getCvxTranslate($this->getMoneticoPostValue('cvx'))
|
||||
);
|
||||
$msg .= '<br />' . __('CC validity: %1', $this->getMoneticoPostValue('vld'));
|
||||
$msg .= '<br />' . __('CC type: %1', $this->_monetico->getBrandTranslate($this->getMoneticoPostValue('brand')));
|
||||
$msg .= '<br />' . __('Country code from the CC: %1', $this->getMoneticoPostValue('originecb'));
|
||||
$msg .= '<br />' . __('BIN code: %1', $this->getMoneticoPostValue('bincb'));
|
||||
|
||||
return $msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the Success Response
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function generateSuccessResponse()
|
||||
{
|
||||
$this->notifyResponse = implode("\n", ['version=2', 'cdr=0']) . "\n";
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the Error Response
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function generateErrorResponse()
|
||||
{
|
||||
$this->notifyResponse = implode("\n", ['version=2', 'cdr=1']) . "\n";
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current MAC, and returned by Monetico, are equals
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isValidMAC()
|
||||
{
|
||||
return $this->getMoneticoPostValue('MAC') === $this->_monetico->getOrderResponseMAC($this->getMoneticoPostValues());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current payment is succeed
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isPaymentSucceed()
|
||||
{
|
||||
$status = $this->getMoneticoPostValue('code-retour');
|
||||
|
||||
if ($this->_config->isSandbox()) {
|
||||
$success = $this->_monetico->isPaymentTest($status);
|
||||
} else {
|
||||
$success = $this->_monetico->isPaymentSucceed($status);
|
||||
}
|
||||
|
||||
return $success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current payment is refused
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isPaymentRefused()
|
||||
{
|
||||
return $this->_monetico->isPaymentCanceled($this->getMoneticoPostValue('code-retour'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get param value from key
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getMoneticoPostValue($key, $default = '')
|
||||
{
|
||||
$value = $default;
|
||||
|
||||
if (isset($this->moneticoPostValues[$key])) {
|
||||
$value = $this->moneticoPostValues[$key];
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if all required data exists
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function hasRequiredRequestData()
|
||||
{
|
||||
return (!empty($this->getMoneticoPostValue('reference')) && !empty($this->getMoneticoPostValue('MAC')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the available request param values for Monetico
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getMoneticoPostValues()
|
||||
{
|
||||
if (!$this->moneticoPostValues) {
|
||||
$values = [];
|
||||
|
||||
foreach ($this->_moneticoNotifyPostDataKey->getOptions() as $key) {
|
||||
if (!is_null($this->getRequest()->getPostValue($key))) {
|
||||
$values[$key] = $this->getRequest()->getPost($key);
|
||||
}
|
||||
}
|
||||
|
||||
$this->moneticoPostValues = $values;
|
||||
}
|
||||
|
||||
return $this->moneticoPostValues;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Controller\Payment;
|
||||
|
||||
class SealedForm extends \Blackbird\Monetico\Controller\Payment
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Framework\Controller\Result\RawFactory
|
||||
*/
|
||||
protected $_resultRawFactory;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\View\LayoutFactory
|
||||
*/
|
||||
protected $_layoutFactory;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\App\Action\Context $context
|
||||
* @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
|
||||
* @param \Magento\Framework\View\LayoutFactory $layoutFactory
|
||||
* @param \Magento\Checkout\Model\Session $checkoutSession
|
||||
* @param \Magento\Sales\Model\OrderRepository $orderRepository
|
||||
* @param \Blackbird\Monetico\Model\ConfigProvider $configProvider
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\App\Action\Context $context,
|
||||
\Magento\Framework\Controller\Result\RawFactory $resultRawFactory,
|
||||
\Magento\Framework\View\LayoutFactory $layoutFactory,
|
||||
\Magento\Checkout\Model\Session $checkoutSession,
|
||||
\Magento\Sales\Model\OrderRepository $orderRepository,
|
||||
\Blackbird\Monetico\Model\ConfigProvider $configProvider
|
||||
) {
|
||||
$this->_resultRawFactory = $resultRawFactory;
|
||||
$this->_layoutFactory = $layoutFactory;
|
||||
parent::__construct($context, $checkoutSession, $orderRepository, $configProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function _construct()
|
||||
{
|
||||
// Silence is golden
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$code = $this->getRequest()->getParam('method_code');
|
||||
$orderId = $this->getRequest()->getParam('order_id');
|
||||
$order = $this->_orderRepository->get($orderId);
|
||||
|
||||
$block = $this->_layoutFactory->create()->createBlock(
|
||||
\Blackbird\Monetico\Block\Payment\SealedForm::class,
|
||||
'sealed_form',
|
||||
[
|
||||
'data' => [
|
||||
'order_id' => $orderId,
|
||||
'order' => $order,
|
||||
'method_code' => $code,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
/** @var \Magento\Framework\Controller\Result\Raw $resultRaw */
|
||||
$resultRaw = $this->_resultRawFactory->create();
|
||||
|
||||
return $resultRaw->setContents($block->toHtml());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Controller\Payment;
|
||||
|
||||
class Success extends \Blackbird\Monetico\Controller\Payment
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function _construct()
|
||||
{
|
||||
$this->_config->setMethodCode('monetico');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$resultRedirect = $this->resultRedirectFactory->create();
|
||||
|
||||
if ($this->_checkoutSession->getLastRealOrder()) {
|
||||
$resultRedirect->setPath('checkout/onepage/success');
|
||||
} else {
|
||||
$resultRedirect->setPath('/');
|
||||
}
|
||||
|
||||
return $resultRedirect;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Cron;
|
||||
|
||||
use Magento\Sales\Model\Order;
|
||||
|
||||
class CancelOrderTask
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface
|
||||
*/
|
||||
protected $_localeDate;
|
||||
|
||||
/**
|
||||
* @var \Magento\Sales\Model\ResourceModel\Order\CollectionFactory
|
||||
*/
|
||||
protected $_orderCollectionFactory;
|
||||
|
||||
/**
|
||||
* @var \Magento\Sales\Api\OrderRepositoryInterface
|
||||
*/
|
||||
protected $_orderRepository;
|
||||
|
||||
/**
|
||||
* @var \Blackbird\Monetico\Model\ConfigProvider
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* @var \Blackbird\Monetico\Model\Config\Source\PaymentMethod
|
||||
*/
|
||||
protected $_moneticoPaymentSource;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $newOrderStatusByMethod;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $cancelOrderStatusByMethod;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
|
||||
* @param \Magento\Sales\Model\ResourceModel\Order\CollectionFactory $orderCollectionFactory
|
||||
* @param \Magento\Sales\Api\OrderRepositoryInterface $orderRepository
|
||||
* @param \Blackbird\Monetico\Model\ConfigProvider $configProvider
|
||||
* @param \Blackbird\Monetico\Model\Config\Source\PaymentMethod $paymentMethodSource
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
|
||||
\Magento\Sales\Model\ResourceModel\Order\CollectionFactory $orderCollectionFactory,
|
||||
\Magento\Sales\Api\OrderRepositoryInterface $orderRepository,
|
||||
\Blackbird\Monetico\Model\ConfigProvider $configProvider,
|
||||
\Blackbird\Monetico\Model\Config\Source\PaymentMethod $paymentMethodSource
|
||||
) {
|
||||
$this->_localeDate = $localeDate;
|
||||
$this->_orderCollectionFactory = $orderCollectionFactory;
|
||||
$this->_orderRepository = $orderRepository;
|
||||
$this->_config = $configProvider;
|
||||
$this->_moneticoPaymentSource = $paymentMethodSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the Cancel Order Task
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$this->_config->setMethodCode('monetico');
|
||||
|
||||
if ($this->_config->getSystemConfigValue('use_cron_cancel')) {
|
||||
$this->processCancelOrders();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve orders older than the configured delay
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function processCancelOrders()
|
||||
{
|
||||
// Init Data
|
||||
$this->_config->setMethodCode('monetico');
|
||||
$availablePaymentMethods = $this->_moneticoPaymentSource->getAvailablePaymentMethods();
|
||||
$orderNewStatus = $this->getNewStatusByMethod();
|
||||
|
||||
// Build the Order Collection
|
||||
|
||||
$orderCollection = $this->_orderCollectionFactory->create()->join(
|
||||
['pay' => 'sales_order_payment'],
|
||||
'pay.parent_id = main_table.entity_id',
|
||||
['method_code' => 'pay.method']
|
||||
);
|
||||
|
||||
$connection = $orderCollection->getSelect()->getConnection();
|
||||
|
||||
foreach ($availablePaymentMethods as $paymentMethod) {
|
||||
if (isset($orderNewStatus[$paymentMethod])) {
|
||||
$orderCollection->getSelect()->orWhere(
|
||||
'(' . $connection->quoteInto('pay.method = ?', $paymentMethod) . ' AND ' .
|
||||
$connection->quoteInto('main_table.status = ?', $orderNewStatus[$paymentMethod]) . ')'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->cancelOldOrders($orderCollection);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel orders older than the configured delay
|
||||
*
|
||||
* @param \Magento\Sales\Model\ResourceModel\Order\Collection $orderCollection
|
||||
* @return $this
|
||||
*/
|
||||
protected function cancelOldOrders(\Magento\Sales\Model\ResourceModel\Order\Collection $orderCollection)
|
||||
{
|
||||
// Init Data
|
||||
$this->_config->setMethodCode('monetico');
|
||||
$cancelDelay = $this->_config->getSystemConfigValue('cancel_delay');
|
||||
$orderCancelStatus = $this->getCancelStatusByMethod();
|
||||
|
||||
/** @var \Magento\Sales\Model\Order $order */
|
||||
foreach ($orderCollection as $order) {
|
||||
$orderDate = new \DateTime($order->getCreatedAt());
|
||||
$status = $orderCancelStatus[$order->getData('method_code')];
|
||||
|
||||
if (($orderDate->getTimestamp() + $cancelDelay) < $this->_localeDate->date()->getTimestamp()) {
|
||||
|
||||
if ($status === Order::STATE_HOLDED && $order->canHold()) {
|
||||
$order->hold();
|
||||
} elseif ($status === Order::STATE_CANCELED && $order->canCancel()) {
|
||||
$order->cancel();
|
||||
}
|
||||
|
||||
$this->_orderRepository->save($order);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the cancel status for orders by method
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getCancelStatusByMethod()
|
||||
{
|
||||
if (!$this->cancelOrderStatusByMethod) {
|
||||
$cancelStatus = [];
|
||||
$previousMethod = $this->_config->getMethodCode();
|
||||
|
||||
foreach ($this->_moneticoPaymentSource->getAvailablePaymentMethods() as $paymentMethod) {
|
||||
$this->_config->setMethodCode($paymentMethod);
|
||||
$cancelStatus[$paymentMethod] = $this->_config->getSystemConfigValue('order_status_payment_canceled');
|
||||
}
|
||||
|
||||
$this->_config->setMethodCode($previousMethod);
|
||||
$this->cancelOrderStatusByMethod = $cancelStatus;
|
||||
}
|
||||
|
||||
return $this->cancelOrderStatusByMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the new order status by method
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getNewStatusByMethod()
|
||||
{
|
||||
if (!$this->newOrderStatusByMethod) {
|
||||
$newStatus = [];
|
||||
$previousMethod = $this->_config->getMethodCode();
|
||||
|
||||
foreach ($this->_moneticoPaymentSource->getAvailablePaymentMethods() as $paymentMethod) {
|
||||
$this->_config->setMethodCode($paymentMethod);
|
||||
$newStatus[$paymentMethod] = $this->_config->getSystemConfigValue('order_status');
|
||||
}
|
||||
|
||||
$this->_config->setMethodCode($previousMethod);
|
||||
$this->newOrderStatusByMethod = $newStatus;
|
||||
}
|
||||
|
||||
return $this->newOrderStatusByMethod;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,554 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Helper;
|
||||
|
||||
use Blackbird\Monetico\Model\Method\Onetime;
|
||||
use Blackbird\Monetico\Model\Method\Multitime;
|
||||
use Blackbird\Monetico\Model\Method\CofidisEuro;
|
||||
use Blackbird\Monetico\Model\Method\CofidisTxcb;
|
||||
use Blackbird\Monetico\Model\Method\CofidisFxcb;
|
||||
use Blackbird\Monetico\Model\Method\PayPal;
|
||||
|
||||
/**
|
||||
* Generate the MAC for the sealed form
|
||||
*/
|
||||
class DataSealedForm
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Framework\Escaper
|
||||
*/
|
||||
protected $_escaper;
|
||||
|
||||
/**
|
||||
* @var \Magento\Config\Model\Config\Backend\Encrypted
|
||||
*/
|
||||
protected $_backendEncrypt;
|
||||
|
||||
/**
|
||||
* @var \Magento\Customer\Model\Session
|
||||
*/
|
||||
protected $_customerSession;
|
||||
|
||||
/**
|
||||
* @var \Blackbird\Monetico\Model\ConfigProvider
|
||||
*/
|
||||
protected $_configProvider;
|
||||
|
||||
/**
|
||||
* @var \Blackbird\Monetico\Model\Config\Source\PaymentMethod
|
||||
*/
|
||||
protected $_paymentMethodSource;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $data = [];
|
||||
|
||||
/**
|
||||
* @var null
|
||||
*/
|
||||
protected $methodCode = null;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\Escaper $escaper
|
||||
* @param \Magento\Config\Model\Config\Backend\Encrypted $encrypted
|
||||
* @param \Magento\Customer\Model\Session $customerSession
|
||||
* @param \Blackbird\Monetico\Model\ConfigProvider $configProvider
|
||||
* @param \Blackbird\Monetico\Model\Config\Source\PaymentMethod $paymentMethodSource
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\Escaper $escaper,
|
||||
\Magento\Config\Model\Config\Backend\Encrypted $encrypted,
|
||||
\Magento\Customer\Model\Session $customerSession,
|
||||
\Blackbird\Monetico\Model\ConfigProvider $configProvider,
|
||||
\Blackbird\Monetico\Model\Config\Source\PaymentMethod $paymentMethodSource
|
||||
) {
|
||||
$this->_escaper = $escaper;
|
||||
$this->_backendEncrypt = $encrypted;
|
||||
$this->_customerSession = $customerSession;
|
||||
$this->_configProvider = $configProvider;
|
||||
$this->_paymentMethodSource = $paymentMethodSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init the data of the sealed form
|
||||
*
|
||||
* @param string $methodCode
|
||||
* @param \Magento\Sales\Model\Order $order
|
||||
* @return $this
|
||||
*/
|
||||
public function init($methodCode, \Magento\Sales\Model\Order $order)
|
||||
{
|
||||
$this->reset();
|
||||
$this->setMethod($methodCode);
|
||||
$this->fillData($order);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the data sealed form helper
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
$this->setMethod(null);
|
||||
$this->data = [];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the service name for the current payment method
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getServiceName()
|
||||
{
|
||||
return $this->_paymentMethodSource->getServiceName($this->methodCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isPaymentMethodIntegrated()
|
||||
{
|
||||
return (bool)$this->_configProvider->getSystemConfigValue('use_iframe');
|
||||
}
|
||||
|
||||
/**
|
||||
* "<TPE>*<date>*<montant>*<reference>*<texte-libre>*
|
||||
* <version>*<coderetour>*<cvx>*<vld>*<brand>*<status3ds>*
|
||||
* <numauto>*<motifrefus>*<originecb>*<bincb>*<hpancb>*
|
||||
* <ipclient>*<originetr>*<veres>*<pares>*"
|
||||
*
|
||||
* @param array $data
|
||||
* @return string
|
||||
*/
|
||||
public function getResponseMAC(array $data)
|
||||
{
|
||||
$mac = '';
|
||||
$data = array_merge($this->getData(), $data);
|
||||
|
||||
foreach ($this->getRequiredResponseKeysMAC() as $key) {
|
||||
$value = isset($data[$key]) ? $data[$key] : '';
|
||||
$mac .= $value . '*';
|
||||
}
|
||||
|
||||
// (by Monetico)
|
||||
return strtoupper(hash_hmac('sha1', $mac, $this->_getUsableKey()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPaymentFormAction()
|
||||
{
|
||||
return $this->_configProvider->getPaymentFormAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill the sealed form data
|
||||
*
|
||||
* @param \Magento\Sales\Model\Order $order
|
||||
* @return $this
|
||||
*/
|
||||
protected function fillData(\Magento\Sales\Model\Order $order)
|
||||
{
|
||||
$config = $this->_configProvider->getConfig();
|
||||
$config = $config['payment']['monetico'];
|
||||
$date = new \DateTime($order->getCreatedAt());
|
||||
$date->setTimezone(new \DateTimeZone('Europe/Paris'));
|
||||
|
||||
// Init the common data
|
||||
$this->data = [
|
||||
'version' => $this->_configProvider->getVersion(),
|
||||
'TPE' => $config['TPE'],
|
||||
'date' => $date->format('d/m/Y:H:i:s'),
|
||||
'montant' => sprintf('%.2f', $order->getGrandTotal()) . $order->getOrderCurrencyCode(),
|
||||
'reference' => $order->getIncrementId(),
|
||||
'texte-libre' => $this->getTransactionText($order, $config),
|
||||
'mail' => $order->getCustomerEmail(),
|
||||
'lgue' => $config['locale'],
|
||||
'societe' => $config['societe'],
|
||||
'url_retour' => $config['redirectUrl']['back'],
|
||||
'url_retour_ok' => $config['redirectUrl']['success'],
|
||||
'url_retour_err' => $config['redirectUrl']['failure'],
|
||||
];
|
||||
|
||||
// Add specific param by payment method
|
||||
$this->fillDataByMethod($order);
|
||||
|
||||
// Generate the MAC
|
||||
$this->data['MAC'] = $this->generateMAC();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add data by payment method type
|
||||
*
|
||||
* @param \Magento\Sales\Model\Order $order
|
||||
* @return $this
|
||||
*/
|
||||
protected function fillDataByMethod(\Magento\Sales\Model\Order $order)
|
||||
{
|
||||
switch ($this->methodCode) {
|
||||
case Onetime::METHOD_CODE:
|
||||
$this->fillDataOptions($order);
|
||||
case Multitime::METHOD_CODE:
|
||||
$this->fillDataSeveralPayments($order);
|
||||
$this->fillDataOptions($order);
|
||||
break;
|
||||
case CofidisEuro::METHOD_CODE:
|
||||
$this->data['protocole'] = '1euro';
|
||||
break;
|
||||
case CofidisTxcb::METHOD_CODE:
|
||||
$this->fillDataCofidisOptions($order);
|
||||
$this->data['protocole'] = '3xcb';
|
||||
break;
|
||||
case CofidisFxcb::METHOD_CODE:
|
||||
$this->fillDataCofidisOptions($order);
|
||||
$this->data['protocole'] = '4xcb';
|
||||
break;
|
||||
case PayPal::METHOD_CODE:
|
||||
$this->data['protocole'] = 'paypal';
|
||||
break;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the pre-configured customer data
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function fillDataCofidisOptions(\Magento\Sales\Model\Order $order)
|
||||
{
|
||||
// Init Data
|
||||
$options = '';
|
||||
$billingAddress = $order->getBillingAddress();
|
||||
$street = $billingAddress->getStreet();
|
||||
// Split the address in two: main and extra street
|
||||
if (isset($street[0])) {
|
||||
$firstStreet = $street[0];
|
||||
unset($street[0]);
|
||||
} else {
|
||||
$firstStreet = '';
|
||||
}
|
||||
$extraStreet = implode(' ', $street);
|
||||
|
||||
// Build the Customer Data
|
||||
$customerData = [
|
||||
'nomclient' => $billingAddress->getLastname(),
|
||||
'prenomclient' => $billingAddress->getFirstname(),
|
||||
'adresseclient' => $firstStreet,
|
||||
'codepostalclient' => $billingAddress->getPostcode(),
|
||||
'villeclient' => strtoupper($billingAddress->getCity()),
|
||||
'paysclient' => $billingAddress->getCountryId(),
|
||||
//'prescore' => '', //todo need further info (doc)
|
||||
];
|
||||
|
||||
if (!empty($extraStreet)) {
|
||||
$customerData['complementadresseclient'] = $extraStreet;
|
||||
}
|
||||
|
||||
if (!empty($billingAddress->getTelephone())) {
|
||||
if (preg_match('/^(\+33|0)(6|7)/', $billingAddress->getTelephone())) {
|
||||
$customerData['telephonemobileclient'] = $billingAddress->getTelephone();
|
||||
} else {
|
||||
$customerData['telephonefixeclient'] = $billingAddress->getTelephone();
|
||||
}
|
||||
}
|
||||
|
||||
// If customer has extra useful data
|
||||
if ($this->_customerSession->isLoggedIn()) {
|
||||
$customer = $this->_customerSession->getCustomer();
|
||||
|
||||
if (!empty($customer->getData('gender'))) {
|
||||
$customerData['civiliteclient'] = $customer->getData('gender');
|
||||
}
|
||||
|
||||
if (!empty($customer->getData('dob'))) {
|
||||
$dob = new \DateTime($customer->getData('dob'));
|
||||
$customerData['datenaissanceclient'] = $dob->format('Ymd');
|
||||
}
|
||||
}
|
||||
|
||||
// Convert all values to hex
|
||||
foreach ($customerData as $key => $value) {
|
||||
$valHex = unpack('H*', $this->_escaper->escapeXssInUrl($value));
|
||||
$options .= $key . '=' . array_shift($valHex) . '&';
|
||||
}
|
||||
|
||||
$this->addOptionData(rtrim($options, '&'));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the param for the options
|
||||
*
|
||||
* @param \Magento\Sales\Model\Order $order
|
||||
* @return $this
|
||||
*/
|
||||
protected function fillDataOptions(\Magento\Sales\Model\Order $order)
|
||||
{
|
||||
// Enable the payment express option
|
||||
if ($this->_configProvider->isPaymentExpressEnabled() && $this->_customerSession->isLoggedIn()) {
|
||||
$this->addOptionData('aliascb=' . $this->_customerSession->getCustomer()->getId());
|
||||
$this->addOptionData('forcesaisiecb=' . $this->_configProvider->getSystemConfigValue('force_cb'));
|
||||
}
|
||||
|
||||
// Disable the 3D secure
|
||||
if ($this->_configProvider->is3DSecureDisabled($order->getTotalDue())) {
|
||||
$this->addOptionData('3dsdebrayable=1');
|
||||
}
|
||||
|
||||
// Disable payment methods
|
||||
if ($this->_configProvider->hasDisabledOptions()) {
|
||||
$this->addOptionData(
|
||||
'desactivemoyenpaiement=' . $this->_configProvider->getSystemConfigValue('disabled_options')
|
||||
);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an option to the options var
|
||||
*
|
||||
* @param string $optionData
|
||||
* @return $this
|
||||
*/
|
||||
protected function addOptionData($optionData)
|
||||
{
|
||||
if (empty($this->data['options'])) {
|
||||
$this->data['options'] = $optionData;
|
||||
} else {
|
||||
$this->data['options'] .= '&' . $optionData;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the param for the several payments method
|
||||
*
|
||||
* @param \Magento\Sales\Model\Order $order
|
||||
* @return $this
|
||||
*/
|
||||
protected function fillDataSeveralPayments(\Magento\Sales\Model\Order $order)
|
||||
{
|
||||
$nbTerms = $this->_configProvider->getNumberOfTerms();
|
||||
|
||||
if ($nbTerms > 1 && $nbTerms < 5) {
|
||||
$this->data['nbrech'] = $nbTerms;
|
||||
$date = new \DateTime($order->getCreatedAt());
|
||||
$totalAmount = 0;
|
||||
|
||||
for ($i = 1; $i <= $nbTerms; $i++) {
|
||||
if ($this->_configProvider->isTermsRateValid()) {
|
||||
$termAmount = sprintf('%.2f', $order->getGrandTotal() * $this->_configProvider->getMultiplierTermRate($i));
|
||||
} else {
|
||||
$termAmount = sprintf('%.2f', $order->getGrandTotal() / $nbTerms);
|
||||
}
|
||||
|
||||
$this->data['dateech' . $i] = $date->format('d/m/Y');
|
||||
$this->data['montantech' . $i] = $termAmount . $order->getOrderCurrencyCode();
|
||||
$totalAmount += $termAmount;
|
||||
|
||||
$date = $date->add($this->getIntervalNextMonth($date));
|
||||
}
|
||||
|
||||
$due = $termAmount + ($order->getGrandTotal() - $totalAmount);
|
||||
$this->data['montantech' . --$i] = sprintf('%.2f', $due) . $order->getOrderCurrencyCode();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* "<TPE>*<date>*<montant>*<reference>*<texte-libre>*
|
||||
* <version>*<lgue>*<societe>*<mail>*<nbrech>*<dateech1>*
|
||||
* <montantech1>*<dateech2>*<montantech2>*<dateech3>*
|
||||
* <montantech3>*<dateech4>*<montantech4>*<options>"
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function generateMAC()
|
||||
{
|
||||
$mac = '';
|
||||
|
||||
foreach ($this->getRequiredKeysMAC() as $key) {
|
||||
$value = isset($this->data[$key]) ? $this->data[$key] : '';
|
||||
$mac .= $value . '*';
|
||||
}
|
||||
|
||||
// (by Monetico)
|
||||
$mac = hash_hmac('sha1', substr($mac, 0, -1), $this->_getUsableKey());
|
||||
|
||||
return strtolower($mac);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getRequiredKeysMAC()
|
||||
{
|
||||
return [
|
||||
'TPE',
|
||||
'date',
|
||||
'montant',
|
||||
'reference',
|
||||
'texte-libre',
|
||||
'version',
|
||||
'lgue',
|
||||
'societe',
|
||||
'mail',
|
||||
'nbrech',
|
||||
'dateech1',
|
||||
'montantech1',
|
||||
'dateech2',
|
||||
'montantech2',
|
||||
'dateech3',
|
||||
'montantech3',
|
||||
'dateech4',
|
||||
'montantech4',
|
||||
'options',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getRequiredResponseKeysMAC()
|
||||
{
|
||||
return [
|
||||
'TPE',
|
||||
'date',
|
||||
'montant',
|
||||
'reference',
|
||||
'texte-libre',
|
||||
'version',
|
||||
'code-retour',
|
||||
'cvx',
|
||||
'vld',
|
||||
'brand',
|
||||
'status3ds',
|
||||
'numauto',
|
||||
'motifrefus',
|
||||
'originecb',
|
||||
'bincb',
|
||||
'hpancb',
|
||||
'ipclient',
|
||||
'originetr',
|
||||
'veres',
|
||||
'pares',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the key to be used in the hmac function (by Monetico)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function _getUsableKey()
|
||||
{
|
||||
$key = $this->_backendEncrypt->processValue($this->_configProvider->getSystemConfigValue('private_key'));
|
||||
|
||||
$hexStrKey = substr($key, 0, 38);
|
||||
$hexFinal = "" . substr($key, 38, 2) . "00";
|
||||
|
||||
$cca0 = ord($hexFinal);
|
||||
|
||||
if ($cca0 > 70 && $cca0 < 97) {
|
||||
$hexStrKey .= chr($cca0 - 23) . substr($hexFinal, 1, 1);
|
||||
} else {
|
||||
if (substr($hexFinal, 1, 1) == "M") {
|
||||
$hexStrKey .= substr($hexFinal, 0, 1) . "0";
|
||||
} else {
|
||||
$hexStrKey .= substr($hexFinal, 0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
return pack("H*", $hexStrKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Magento\Sales\Model\Order $order
|
||||
* @return string
|
||||
*/
|
||||
protected function getTransactionText(\Magento\Sales\Model\Order $order)
|
||||
{
|
||||
$text = $this->_configProvider->getTransferDescription();
|
||||
|
||||
$text = str_replace('%order_id%', $order->getRealOrderId(), $text);
|
||||
$text = str_replace(
|
||||
'%payment_method%',
|
||||
$this->_paymentMethodSource->getPaymentMethodTranslation($this->methodCode),
|
||||
$text
|
||||
);
|
||||
$text = str_replace('%code_societe%', $this->_configProvider->getSystemConfigValue('site_code'), $text);
|
||||
|
||||
return substr($this->_escaper->escapeXssInUrl($text), 0, 3200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the method code
|
||||
*
|
||||
* @param string $methodCode
|
||||
* @return $this
|
||||
*/
|
||||
protected function setMethod($methodCode)
|
||||
{
|
||||
$this->methodCode = $methodCode;
|
||||
$this->_configProvider->setMethodCode($methodCode);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the interval for the next month datetime
|
||||
*
|
||||
* @param \DateTime $dateTime
|
||||
* @return \DateInterval
|
||||
*/
|
||||
protected function getIntervalNextMonth(\DateTime $dateTime)
|
||||
{
|
||||
$diff = clone $dateTime;
|
||||
$diff->modify('last day of next month');
|
||||
|
||||
if ($dateTime->format('d') > $diff->format('d')) {
|
||||
$interval = $dateTime->diff($diff);
|
||||
} else {
|
||||
$interval = new \DateInterval('P1M');
|
||||
}
|
||||
|
||||
return $interval;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Blackbird\Monetico\Logger\Handler;
|
||||
|
||||
use Monolog\Logger;
|
||||
use Magento\Framework\Logger\Handler\Base;
|
||||
|
||||
class Monetico extends Base
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $fileName = '/var/log/monetico.log';
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $loggerType = Logger::DEBUG;
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model;
|
||||
|
||||
/**
|
||||
* Class AbstractMethod
|
||||
*
|
||||
* @package Blackbird\Monetico\Model
|
||||
*/
|
||||
abstract class AbstractMethod extends \Magento\Payment\Model\Method\AbstractMethod
|
||||
//class Onetime extends \Magento\Payment\Model\Method\Adapter //todo refactoring
|
||||
{
|
||||
const CAPTURE_ON_INVOICE = 'invoice';
|
||||
const CAPTURE_ON_SHIPMENT = 'shipment';
|
||||
const CHANNEL_NAME = 'Blackbird';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_canAuthorize = true;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_canCapture = true;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_isInitializeNeeded = true;
|
||||
|
||||
/**
|
||||
* @var \Blackbird\Monetico\Model\Config
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\Model\Context $context
|
||||
* @param \Magento\Framework\Registry $registry
|
||||
* @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory
|
||||
* @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory
|
||||
* @param \Magento\Payment\Helper\Data $paymentData
|
||||
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
|
||||
* @param \Magento\Payment\Model\Method\Logger $logger
|
||||
* @param \Blackbird\Monetico\Model\Config $config
|
||||
* @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
|
||||
* @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\Model\Context $context,
|
||||
\Magento\Framework\Registry $registry,
|
||||
\Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
|
||||
\Magento\Framework\Api\AttributeValueFactory $customAttributeFactory,
|
||||
\Magento\Payment\Helper\Data $paymentData,
|
||||
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
|
||||
\Magento\Payment\Model\Method\Logger $logger,
|
||||
\Blackbird\Monetico\Model\Config $config,
|
||||
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
|
||||
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
|
||||
array $data = []
|
||||
) {
|
||||
$this->_config = $config;
|
||||
parent::__construct(
|
||||
$context,
|
||||
$registry,
|
||||
$extensionFactory,
|
||||
$customAttributeFactory,
|
||||
$paymentData,
|
||||
$scopeConfig,
|
||||
$logger,
|
||||
$resource,
|
||||
$resourceCollection,
|
||||
$data
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve information from payment configuration
|
||||
*
|
||||
* @param string $field
|
||||
* @param int|string|null|\Magento\Store\Model\Store $storeId
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getConfigData($field, $storeId = null)
|
||||
{
|
||||
$value = $this->_config->getValue($field, $storeId);
|
||||
|
||||
if (empty($value)) {
|
||||
$value = parent::getConfigData($field, $storeId);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model;
|
||||
|
||||
/**
|
||||
* Class AbstractSplitedMethod
|
||||
*
|
||||
* @package Blackbird\Monetico\Model
|
||||
*/
|
||||
abstract class AbstractSplitedMethod extends AbstractMethod
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Checkout\Model\Session
|
||||
*/
|
||||
protected $_checkoutSession;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\Model\Context $context
|
||||
* @param \Magento\Framework\Registry $registry
|
||||
* @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory
|
||||
* @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory
|
||||
* @param \Magento\Payment\Helper\Data $paymentData
|
||||
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
|
||||
* @param \Magento\Payment\Model\Method\Logger $logger
|
||||
* @param \Blackbird\Monetico\Model\Config $config
|
||||
* @param \Magento\Checkout\Model\Session $checkoutSession
|
||||
* @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
|
||||
* @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\Model\Context $context,
|
||||
\Magento\Framework\Registry $registry,
|
||||
\Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
|
||||
\Magento\Framework\Api\AttributeValueFactory $customAttributeFactory,
|
||||
\Magento\Payment\Helper\Data $paymentData,
|
||||
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
|
||||
\Magento\Payment\Model\Method\Logger $logger,
|
||||
\Blackbird\Monetico\Model\Config $config,
|
||||
\Magento\Checkout\Model\Session $checkoutSession,
|
||||
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
|
||||
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
|
||||
array $data = []
|
||||
) {
|
||||
$this->_checkoutSession = $checkoutSession;
|
||||
parent::__construct(
|
||||
$context,
|
||||
$registry,
|
||||
$extensionFactory,
|
||||
$customAttributeFactory,
|
||||
$paymentData,
|
||||
$scopeConfig,
|
||||
$logger,
|
||||
$config,
|
||||
$resource,
|
||||
$resourceCollection,
|
||||
$data
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
|
||||
{
|
||||
$isAvailable = parent::isAvailable($quote);
|
||||
|
||||
if ($isAvailable) {
|
||||
if (is_null($quote)) {
|
||||
$quote = $this->_checkoutSession->getQuote();
|
||||
}
|
||||
|
||||
$minAmount = $this->getConfigData('amount_min');
|
||||
$maxAmount = $this->getConfigData('amount_max');
|
||||
$isAvailable = ($minAmount >= 0 && $maxAmount > 0 && $minAmount < $maxAmount);
|
||||
|
||||
if ($isAvailable) {
|
||||
$isAvailable = ($quote->getGrandTotal() >= $minAmount && $quote->getGrandTotal() <= $maxAmount);
|
||||
}
|
||||
}
|
||||
|
||||
return $isAvailable;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model;
|
||||
|
||||
use Magento\Payment\Model\Method\ConfigInterface;
|
||||
use Magento\Payment\Model\MethodInterface;
|
||||
use Magento\Store\Model\ScopeInterface;
|
||||
use Blackbird\Monetico\Model\Method\Onetime;
|
||||
use Blackbird\Monetico\Model\Method\CofidisEuro;
|
||||
use Blackbird\Monetico\Model\Method\CofidisTxcb;
|
||||
use Blackbird\Monetico\Model\Method\CofidisFxcb;
|
||||
use Blackbird\Monetico\Model\Method\PayPal;
|
||||
|
||||
class Config implements ConfigInterface
|
||||
{
|
||||
/**
|
||||
* @var MethodInterface
|
||||
*/
|
||||
protected $methodInstance;
|
||||
|
||||
/**
|
||||
* Current payment method code
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_methodCode;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\App\Config\ScopeConfigInterface
|
||||
*/
|
||||
protected $_scopeConfig;
|
||||
|
||||
/**
|
||||
* @var \Blackbird\Monetico\Model\Config\Source\AvailableLocales
|
||||
*/
|
||||
protected $_availableLocales;
|
||||
|
||||
/**
|
||||
* Current store id
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_storeId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $pathPattern;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
|
||||
* @param Config\Source\AvailableLocales $availableLocales
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
|
||||
\Blackbird\Monetico\Model\Config\Source\AvailableLocales $availableLocales
|
||||
) {
|
||||
$this->_scopeConfig = $scopeConfig;
|
||||
$this->_availableLocales = $availableLocales;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets method instance used for retrieving method specific data
|
||||
*
|
||||
* @param MethodInterface $method
|
||||
* @return $this
|
||||
*/
|
||||
public function setMethodInstance($method)
|
||||
{
|
||||
$this->methodInstance = $method;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets method code
|
||||
*
|
||||
* @param string $methodCode
|
||||
* @return void
|
||||
*/
|
||||
public function setMethodCode($methodCode)
|
||||
{
|
||||
switch ($methodCode) {
|
||||
case CofidisEuro::METHOD_CODE:
|
||||
case CofidisTxcb::METHOD_CODE:
|
||||
case CofidisFxcb::METHOD_CODE:
|
||||
case PayPal::METHOD_CODE:
|
||||
$methodCode = Onetime::METHOD_CODE;
|
||||
break;
|
||||
}
|
||||
|
||||
$this->_methodCode = $methodCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method code setter
|
||||
*
|
||||
* @param string|MethodInterface $method
|
||||
* @return $this
|
||||
*/
|
||||
public function setMethod($method)
|
||||
{
|
||||
if ($method instanceof MethodInterface) {
|
||||
$this->_methodCode = $method->getCode();
|
||||
} elseif (is_string($method)) {
|
||||
$this->_methodCode = $method;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment method instance code getter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMethodCode()
|
||||
{
|
||||
return $this->_methodCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store ID setter
|
||||
*
|
||||
* @param int $storeId
|
||||
* @return $this
|
||||
*/
|
||||
public function setStoreId($storeId)
|
||||
{
|
||||
$this->_storeId = (int)$storeId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets path pattern
|
||||
*
|
||||
* @param string $pathPattern
|
||||
* @return void
|
||||
*/
|
||||
public function setPathPattern($pathPattern)
|
||||
{
|
||||
$this->pathPattern = $pathPattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns payment configuration value
|
||||
*
|
||||
* @param string $key
|
||||
* @param null $storeId
|
||||
* @return null|string
|
||||
*/
|
||||
public function getValue($key, $storeId = null)
|
||||
{
|
||||
$underscored = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $key));
|
||||
$path = $this->_getSpecificConfigPath($underscored);
|
||||
if ($path !== null) {
|
||||
$value = $this->_scopeConfig->getValue(
|
||||
$path,
|
||||
ScopeInterface::SCOPE_STORE,
|
||||
!is_null($storeId) ? $storeId : $this->_storeId
|
||||
);
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return $this->getValue('version');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDebugModeEnabled()
|
||||
{
|
||||
return (bool)$this->_scopeConfig->getValue(
|
||||
'payment/monetico/debug_mode',
|
||||
ScopeInterface::SCOPE_STORE,
|
||||
$this->_storeId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLocale()
|
||||
{
|
||||
$locale = strtoupper(substr($this->_scopeConfig->getValue(
|
||||
'general/locale/code',
|
||||
ScopeInterface::SCOPE_STORE,
|
||||
$this->_storeId
|
||||
), 0, 2));
|
||||
|
||||
if (!in_array($locale, $this->_availableLocales->getAllowedLocales())) {
|
||||
$locale = $this->getValue('locale');
|
||||
}
|
||||
|
||||
return $locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map any supported payment method into a config path by specified field name
|
||||
*
|
||||
* @param string $fieldName
|
||||
* @return string|null
|
||||
*/
|
||||
protected function _getSpecificConfigPath($fieldName)
|
||||
{
|
||||
if ($this->pathPattern) {
|
||||
return sprintf($this->pathPattern, $this->_methodCode, $fieldName);
|
||||
}
|
||||
|
||||
return "payment/{$this->_methodCode}/{$fieldName}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model\Config\Source;
|
||||
|
||||
use Magento\Framework\Locale\Bundle\LanguageBundle;
|
||||
|
||||
class AvailableLocales implements \Magento\Framework\Data\OptionSourceInterface
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Framework\Locale\ResolverInterface
|
||||
*/
|
||||
protected $localeResolver;
|
||||
|
||||
/**
|
||||
* Allowed countries
|
||||
*/
|
||||
protected $allowedLocales = [
|
||||
'DE',
|
||||
'EN',
|
||||
'ES',
|
||||
'FR',
|
||||
'IT',
|
||||
'JA',
|
||||
'NL',
|
||||
'PT',
|
||||
'SV',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\Locale\ResolverInterface $localeResolver
|
||||
* @param string $locale
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\Locale\ResolverInterface $localeResolver,
|
||||
$locale = null
|
||||
) {
|
||||
$this->localeResolver = $localeResolver;
|
||||
if ($locale !== null) {
|
||||
$this->localeResolver->setLocale($locale);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toOptionArray()
|
||||
{
|
||||
return $this->getOptionLocales();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the allowed locales
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAllowedLocales()
|
||||
{
|
||||
return $this->allowedLocales;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptionLocales()
|
||||
{
|
||||
$currentLocale = $this->localeResolver->getLocale();
|
||||
$locales = \ResourceBundle::getLocales('') ?: [];
|
||||
$languages = (new LanguageBundle())->get($currentLocale)['Languages'];
|
||||
|
||||
$options = [];
|
||||
$processed = [];
|
||||
|
||||
foreach ($locales as $locale) {
|
||||
$langValue = strtoupper(substr($locale, 0, 2));
|
||||
|
||||
if (!in_array($langValue, $this->getAllowedLocales()) || in_array($langValue, $processed)) {
|
||||
continue;
|
||||
}
|
||||
$language = \Locale::getPrimaryLanguage($locale);
|
||||
if (!$languages[$language]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$options[] = [
|
||||
'value' => $langValue,
|
||||
'label' => ucwords(\Locale::getDisplayLanguage($locale, $locale)) . ' / ' . $languages[$language],
|
||||
];
|
||||
|
||||
$processed[] = $langValue;
|
||||
}
|
||||
|
||||
return $this->_sortOptionArray($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $option
|
||||
* @return array
|
||||
*/
|
||||
protected function _sortOptionArray($option)
|
||||
{
|
||||
$data = [];
|
||||
foreach ($option as $item) {
|
||||
$data[$item['value']] = $item['label'];
|
||||
}
|
||||
asort($data);
|
||||
$option = [];
|
||||
foreach ($data as $key => $label) {
|
||||
$option[] = ['value' => $key, 'label' => $label];
|
||||
}
|
||||
|
||||
return $option;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model\Config\Source;
|
||||
|
||||
use Blackbird\Monetico\Model\Method\Onetime;
|
||||
|
||||
/**
|
||||
* @todo next release (deferral payment)
|
||||
*/
|
||||
class CaptureAction implements \Magento\Framework\Data\OptionSourceInterface
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toOptionArray()
|
||||
{
|
||||
return [
|
||||
[
|
||||
'value' => Onetime::CAPTURE_ON_INVOICE,
|
||||
'label' => __('Invoice'),
|
||||
],
|
||||
[
|
||||
'value' => Onetime::CAPTURE_ON_SHIPMENT,
|
||||
'label' => __('Shipment'),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model\Config\Source;
|
||||
|
||||
class Environment implements \Magento\Framework\Data\OptionSourceInterface
|
||||
{
|
||||
const ENVIRONMENT_PRODUCTION = 'production';
|
||||
const ENVIRONMENT_SANDBOX = 'sandbox';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toOptionArray()
|
||||
{
|
||||
return [
|
||||
[
|
||||
'value' => self::ENVIRONMENT_SANDBOX,
|
||||
'label' => 'Sandbox',
|
||||
],
|
||||
[
|
||||
'value' => self::ENVIRONMENT_PRODUCTION,
|
||||
'label' => 'Production',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model\Config\Source;
|
||||
|
||||
class OptionPayment implements \Magento\Framework\Data\OptionSourceInterface
|
||||
{
|
||||
const COFIDIS_EURO = '1euro';
|
||||
const COFIDIS_TXCB = '3xcb';
|
||||
const COFIDIS_FXCB = '4xcb';
|
||||
const PAYPAL = 'paypal';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $options;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toOptionArray()
|
||||
{
|
||||
if (!$this->options) {
|
||||
$options = [];
|
||||
$paymentMethods = $this->getOptions();
|
||||
|
||||
foreach ($paymentMethods as $value => $label) {
|
||||
$options[] = [
|
||||
'value' => $value,
|
||||
'label' => $label,
|
||||
];
|
||||
}
|
||||
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of the available payment methods
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
return [
|
||||
self::COFIDIS_EURO => __('Cofidis 1euro Payment'),
|
||||
self::COFIDIS_TXCB => __('Cofidis 3xCB Payment'),
|
||||
self::COFIDIS_FXCB => __('Cofidis 4xCB Payment'),
|
||||
self::PAYPAL => __('PayPal Payment'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model\Config\Source\Order\Status;
|
||||
|
||||
/**
|
||||
* Order Statuses source model
|
||||
*/
|
||||
class Canceled extends \Magento\Sales\Model\Config\Source\Order\Status
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_stateStatuses = [
|
||||
\Magento\Sales\Model\Order::STATE_CANCELED,
|
||||
\Magento\Sales\Model\Order::STATE_HOLDED,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model\Config\Source\Order\Status;
|
||||
|
||||
/**
|
||||
* Order Statuses source model
|
||||
*/
|
||||
class Refused extends \Magento\Sales\Model\Config\Source\Order\Status
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_stateStatuses = \Magento\Sales\Model\Order::STATE_HOLDED;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model\Config\Source;
|
||||
|
||||
use Magento\Payment\Model\Method\AbstractMethod;
|
||||
|
||||
/**
|
||||
* @todo next release (deferral payment)
|
||||
*/
|
||||
class PaymentAction implements \Magento\Framework\Data\OptionSourceInterface
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toOptionArray()
|
||||
{
|
||||
return [
|
||||
[
|
||||
'value' => AbstractMethod::ACTION_AUTHORIZE,
|
||||
'label' => __('Authorize'),
|
||||
],
|
||||
[
|
||||
'value' => AbstractMethod::ACTION_AUTHORIZE_CAPTURE,
|
||||
'label' => __('Authorize and Capture'),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model\Config\Source;
|
||||
|
||||
use Blackbird\Monetico\Model\Method\Onetime;
|
||||
use Blackbird\Monetico\Model\Method\Multitime;
|
||||
use Blackbird\Monetico\Model\Method\CofidisEuro;
|
||||
use Blackbird\Monetico\Model\Method\CofidisTxcb;
|
||||
use Blackbird\Monetico\Model\Method\CofidisFxcb;
|
||||
use Blackbird\Monetico\Model\Method\PayPal;
|
||||
|
||||
class PaymentMethod implements \Magento\Framework\Data\OptionSourceInterface
|
||||
{
|
||||
const ONETIME = Onetime::METHOD_CODE;
|
||||
const MULTITIME = Multitime::METHOD_CODE;
|
||||
const COFIDIS_EURO = CofidisEuro::METHOD_CODE;
|
||||
const COFIDIS_TXCB = CofidisTxcb::METHOD_CODE;
|
||||
const COFIDIS_FXCB = CofidisFxcb::METHOD_CODE;
|
||||
const PAYPAL = PayPal::METHOD_CODE;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $options;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toOptionArray()
|
||||
{
|
||||
if (!$this->options) {
|
||||
$options = [];
|
||||
$paymentMethods = $this->getOptions();
|
||||
|
||||
foreach ($paymentMethods as $value => $label) {
|
||||
$options[] = [
|
||||
'value' => $value,
|
||||
'label' => $label,
|
||||
];
|
||||
}
|
||||
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of the available payment methods
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
return [
|
||||
self::ONETIME => __('Onetime Payment'),
|
||||
self::MULTITIME => __('Multi-time Payment'),
|
||||
self::COFIDIS_EURO => __('Cofidis 1euro Payment'),
|
||||
self::COFIDIS_TXCB => __('Cofidis 3xCB Payment'),
|
||||
self::COFIDIS_FXCB => __('Cofidis 4xCB Payment'),
|
||||
self::PAYPAL => __('PayPal Payment'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the service name for the payment method
|
||||
*
|
||||
* @param string $method
|
||||
* @return string
|
||||
*/
|
||||
public function getServiceName($method)
|
||||
{
|
||||
$serviceName = 'Monetico';
|
||||
|
||||
switch ($method) {
|
||||
case self::ONETIME:
|
||||
case self::MULTITIME:
|
||||
$serviceName = 'CM-CIC';
|
||||
break;
|
||||
case self::COFIDIS_EURO:
|
||||
case self::COFIDIS_TXCB:
|
||||
case self::COFIDIS_FXCB:
|
||||
$serviceName = 'Cofidis';
|
||||
break;
|
||||
case self::PAYPAL:
|
||||
$serviceName = 'PayPal';
|
||||
break;
|
||||
}
|
||||
|
||||
return $serviceName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the available payment methods codes
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAvailablePaymentMethods()
|
||||
{
|
||||
return array_keys($this->getOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the translation for a payment method code
|
||||
*
|
||||
* @param $methodCode
|
||||
* @return bool|mixed
|
||||
*/
|
||||
public function getPaymentMethodTranslation($methodCode)
|
||||
{
|
||||
$options = $this->getOptions();
|
||||
|
||||
return isset($options[$methodCode]) ? $options[$methodCode] : false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model\Config\Source;
|
||||
|
||||
class PaymentTerms implements \Magento\Framework\Data\OptionSourceInterface
|
||||
{
|
||||
const TWO_TERMS = '2';
|
||||
const THREE_TERMS = '3';
|
||||
const FOUR_TERMS = '4';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toOptionArray()
|
||||
{
|
||||
return [
|
||||
[
|
||||
'value' => self::TWO_TERMS,
|
||||
'label' => __('%1', self::TWO_TERMS),
|
||||
],
|
||||
[
|
||||
'value' => self::THREE_TERMS,
|
||||
'label' => __('%1', self::THREE_TERMS),
|
||||
],
|
||||
[
|
||||
'value' => self::FOUR_TERMS,
|
||||
'label' => __('%1', self::FOUR_TERMS),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model\Config\Source;
|
||||
|
||||
class PostDataKey implements \Magento\Framework\Data\OptionSourceInterface
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $array = [];
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function toOptionArray()
|
||||
{
|
||||
if (empty($array)) {
|
||||
$array = [];
|
||||
|
||||
foreach ($this->getOptions() as $option) {
|
||||
$array[] = [
|
||||
'label' => $option,
|
||||
'value' => $option,
|
||||
];
|
||||
}
|
||||
|
||||
$this->array = $array;
|
||||
}
|
||||
|
||||
return $this->array;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
return [
|
||||
'MAC',
|
||||
'date',
|
||||
'TPE',
|
||||
'montant',
|
||||
'reference',
|
||||
'texte-libre',
|
||||
'code-retour',
|
||||
'cvx',
|
||||
'vld',
|
||||
'brand',
|
||||
'status3ds',
|
||||
'numauto',
|
||||
'motifrefus',
|
||||
'originecb',
|
||||
'bincb',
|
||||
'hpancb',
|
||||
'ipclient',
|
||||
'originetr',
|
||||
'veres',
|
||||
'pares',
|
||||
'montantech',
|
||||
'filtragecause',
|
||||
'filtragevaleur',
|
||||
'cbenregistree',
|
||||
'cbmasquee',
|
||||
'modepaiement',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model\Config\Source;
|
||||
|
||||
class Version implements \Magento\Framework\Data\OptionSourceInterface
|
||||
{
|
||||
const V_1_2 = '1.2';
|
||||
const V_3_0 = '3.0';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toOptionArray()
|
||||
{
|
||||
return [
|
||||
[
|
||||
'value' => self::V_3_0,
|
||||
'label' => __('Version %1', self::V_3_0),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,321 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model;
|
||||
|
||||
use Magento\Framework\UrlInterface;
|
||||
use Magento\Checkout\Model\ConfigProviderInterface;
|
||||
use Blackbird\Monetico\Model\Config\Source\Environment;
|
||||
|
||||
class ConfigProvider implements ConfigProviderInterface
|
||||
{
|
||||
/**
|
||||
* @var Config
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @var UrlInterface
|
||||
*/
|
||||
protected $_urlBuilder;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_configData = [];
|
||||
|
||||
/**
|
||||
* @param \Blackbird\Monetico\Model\ConfigFactory $configFactory
|
||||
* @param UrlInterface $urlBuilder
|
||||
*/
|
||||
public function __construct(
|
||||
ConfigFactory $configFactory,
|
||||
UrlInterface $urlBuilder
|
||||
) {
|
||||
$this->config = $configFactory->create();
|
||||
$this->_urlBuilder = $urlBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMethodCode()
|
||||
{
|
||||
return $this->config->getMethodCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $methodCode
|
||||
* @return $this
|
||||
*/
|
||||
public function setMethodCode($methodCode)
|
||||
{
|
||||
$this->config->setMethodCode($methodCode);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param int $storeId
|
||||
* @return string
|
||||
*/
|
||||
public function getSystemConfigValue($key, $storeId = null)
|
||||
{
|
||||
return $this->config->getValue($key, $storeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
if (empty($this->_configData)) {
|
||||
$config = [
|
||||
'payment' => [
|
||||
'monetico' => [
|
||||
'redirectUrl' => [
|
||||
'back' => $this->getBackRedirectUrl(),
|
||||
'success' => $this->getSuccessRedirectUrl(),
|
||||
'failure' => $this->getFailureRedirectUrl(),
|
||||
],
|
||||
'paymentUrl' => $this->getPaymentFormAction(),
|
||||
'capturePaymentUrl' => $this->getCapturePaymentFormAction(),
|
||||
'refundPaymentUrl' => $this->getRefundPaymentFormAction(),
|
||||
'TPE' => $this->config->getValue('tpe_number'),
|
||||
'societe' => $this->config->getValue('site_code'),
|
||||
'locale' => $this->config->getLocale(),
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$this->_configData = $config;
|
||||
}
|
||||
|
||||
return $this->_configData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return $this->config->getVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDebugModeEnabled()
|
||||
{
|
||||
return $this->config->isDebugModeEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isPaymentExpressEnabled()
|
||||
{
|
||||
return (bool)$this->config->getValue('payment_express');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $amount
|
||||
* @return bool
|
||||
*/
|
||||
public function is3DSecureDisabled($amount)
|
||||
{
|
||||
$bool = (bool)$this->config->getValue('verify_3dsecure');
|
||||
$bool = $bool && !empty($this->getMaximumAmount3DSecure());
|
||||
$bool = $bool && $this->getMaximumAmount3DSecure() <= $amount;
|
||||
|
||||
return $bool;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $amount
|
||||
* @return bool
|
||||
*/
|
||||
public function is3DSecureEnabled($amount)
|
||||
{
|
||||
return !$this->is3DSecureDisabled($amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasDisabledOptions()
|
||||
{
|
||||
return !(bool)$this->config->getValue('allow_options');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getDisabledOptions()
|
||||
{
|
||||
return explode(',', $this->config->getValue('disabled_options'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getNumberOfTerms()
|
||||
{
|
||||
return (int)$this->config->getValue('number_terms');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $term
|
||||
* @return int
|
||||
*/
|
||||
public function getTermRate($term)
|
||||
{
|
||||
return (int)$this->config->getValue('term_rate_' . $term);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $term
|
||||
* @return int
|
||||
*/
|
||||
public function getMultiplierTermRate($term)
|
||||
{
|
||||
return $this->getTermRate($term) / 100;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isTermsRateValid()
|
||||
{
|
||||
$totalRate = 0;
|
||||
|
||||
for ($i = 1; $i <= $this->getNumberOfTerms(); $i++) {
|
||||
$totalRate += $this->getTermRate('term_rate_' . $i);
|
||||
}
|
||||
|
||||
return ($totalRate == 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMaximumAmount3DSecure()
|
||||
{
|
||||
return $this->config->getValue('verify_3dsecure_max_amount');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTransferDescription()
|
||||
{
|
||||
$text = trim($this->config->getValue('transaction_description'));
|
||||
|
||||
if (empty($text)) {
|
||||
$text = __('Payment from %code_societe% through %payment_method% for the Order n°%order_id%');
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the payment URL
|
||||
*
|
||||
* @param array $params
|
||||
* @return string
|
||||
*/
|
||||
public function getPaymentFormAction(array $params = [])
|
||||
{
|
||||
return sprintf(
|
||||
'https://p.monetico-services.com/%spaiement.cgi%s',
|
||||
$this->isSandbox() ? 'test/' : '',
|
||||
$params ? '?' . http_build_query($params) : ''
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the capture payment URL
|
||||
*
|
||||
* @todo use next release
|
||||
* @param array $params
|
||||
* @return string
|
||||
*/
|
||||
public function getCapturePaymentFormAction(array $params = [])
|
||||
{
|
||||
return sprintf(
|
||||
'https://p.monetico-services.com/%scapture_paiement.cgi%s',
|
||||
$this->isSandbox() ? 'test/' : '',
|
||||
$params ? '?' . http_build_query($params) : ''
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the refund payment URL
|
||||
*
|
||||
* @todo use next release
|
||||
* @param array $params
|
||||
* @return string
|
||||
*/
|
||||
public function getRefundPaymentFormAction(array $params = [])
|
||||
{
|
||||
return sprintf(
|
||||
'https://p.monetico-services.com/%srecredit_paiement.cgi%s',
|
||||
$this->isSandbox() ? 'test/' : '',
|
||||
$params ? '?' . http_build_query($params) : ''
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the payment module is in sandbox mode
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSandbox()
|
||||
{
|
||||
return ($this->config->getValue('environment') === Environment::ENVIRONMENT_SANDBOX);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the back redirect URL
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getBackRedirectUrl()
|
||||
{
|
||||
return $this->_urlBuilder->getDirectUrl('checkout/cart');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the success redirect URL
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getSuccessRedirectUrl()
|
||||
{
|
||||
return $this->_urlBuilder->getDirectUrl('monetico/payment/success');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the failure redirect URL
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getFailureRedirectUrl()
|
||||
{
|
||||
return $this->_urlBuilder->getDirectUrl('monetico/payment/failure');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Blackbird\Monetico\Model;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Debug implements DebugInterface
|
||||
{
|
||||
/**
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
protected $_logger;
|
||||
|
||||
/**
|
||||
* @var ConfigProvider
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* @param LoggerInterface $logger
|
||||
* @param ConfigProvider $configProvider
|
||||
*/
|
||||
public function __construct(
|
||||
LoggerInterface $logger,
|
||||
ConfigProvider $configProvider
|
||||
) {
|
||||
$this->_logger = $logger;
|
||||
$this->_config = $configProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function addDebugMessage($message, $context = [])
|
||||
{
|
||||
if ($this->_config->isDebugModeEnabled()) {
|
||||
$this->_logger->debug($message, $context);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Blackbird\Monetico\Model;
|
||||
|
||||
interface DebugInterface
|
||||
{
|
||||
/**
|
||||
* Add a record in the monetico logs if the debug mode is enabled
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @return $this
|
||||
*/
|
||||
public function addDebugMessage($message, $context = []);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model\Method;
|
||||
|
||||
/**
|
||||
* Class CofidisEuro
|
||||
*
|
||||
* @package Blackbird\Monetico\Model\Method
|
||||
*/
|
||||
class CofidisEuro extends \Blackbird\Monetico\Model\AbstractMethod
|
||||
{
|
||||
const METHOD_CODE = 'monetico_1euro';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_code = self::METHOD_CODE;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model\Method;
|
||||
|
||||
/**
|
||||
* Class CofidisFxcb
|
||||
*
|
||||
* @package Blackbird\Monetico\Model\Method
|
||||
*/
|
||||
class CofidisFxcb extends \Blackbird\Monetico\Model\AbstractSplitedMethod
|
||||
{
|
||||
const METHOD_CODE = 'monetico_4xcb';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_code = self::METHOD_CODE;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model\Method;
|
||||
|
||||
/**
|
||||
* Class CofidisTxcb
|
||||
*
|
||||
* @package Blackbird\Monetico\Model\Method
|
||||
*/
|
||||
class CofidisTxcb extends \Blackbird\Monetico\Model\AbstractSplitedMethod
|
||||
{
|
||||
const METHOD_CODE = 'monetico_3xcb';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_code = self::METHOD_CODE;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model\Method;
|
||||
|
||||
/**
|
||||
* Class Multitime
|
||||
*
|
||||
* @package Blackbird\Monetico\Model\Method
|
||||
*/
|
||||
class Multitime extends \Blackbird\Monetico\Model\AbstractSplitedMethod
|
||||
{
|
||||
const METHOD_CODE = 'monetico_multitime';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_code = self::METHOD_CODE;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model\Method;
|
||||
|
||||
/**
|
||||
* Class Onetime
|
||||
*
|
||||
* @package Blackbird\Monetico\Model\Method
|
||||
*/
|
||||
class Onetime extends \Blackbird\Monetico\Model\AbstractMethod
|
||||
{
|
||||
const METHOD_CODE = 'monetico_onetime';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_code = self::METHOD_CODE;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model\Method;
|
||||
|
||||
/**
|
||||
* Class PayPal
|
||||
*
|
||||
* @package Blackbird\Monetico\Model\Method
|
||||
*/
|
||||
class PayPal extends \Blackbird\Monetico\Model\AbstractMethod
|
||||
{
|
||||
const METHOD_CODE = 'monetico_paypal';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_code = self::METHOD_CODE;
|
||||
}
|
||||
@@ -0,0 +1,480 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Model;
|
||||
|
||||
use Magento\Sales\Model\OrderFactory;
|
||||
use Magento\Sales\Model\Order;
|
||||
use Magento\Sales\Model\Order\Email\Sender\OrderSender;
|
||||
use Magento\Sales\Model\Service\InvoiceService;
|
||||
use Magento\Sales\Model\Service\ShipmentService;
|
||||
use Magento\Sales\Model\Convert\OrderFactory as ConvertOrderFactory;
|
||||
use Blackbird\Monetico\Helper\DataSealedForm;
|
||||
|
||||
class Monetico
|
||||
{
|
||||
/**
|
||||
* CODE-RETOUR
|
||||
*/
|
||||
const PAYTEST = 'payetest';
|
||||
const PAIEMENT = 'paiement';
|
||||
const ANNULATION = 'Annulation';
|
||||
|
||||
/**
|
||||
* CVX
|
||||
*/
|
||||
const OUI = 'oui';
|
||||
const NON = 'non';
|
||||
|
||||
/**
|
||||
* BRAND
|
||||
*/
|
||||
const AMERICAN_EXPRESS = 'AM';
|
||||
const GIE_CB = 'CB';
|
||||
const MASTERCARD = 'MC';
|
||||
const VISA = 'VI';
|
||||
const UNAVAILABLE = 'na';
|
||||
|
||||
/**
|
||||
* STATUS 3DS
|
||||
*/
|
||||
const NO_SECURE = -1;
|
||||
const LOW_RISK = 1;
|
||||
const UNABLE_BUT_AUTHENTICATE = 2;
|
||||
const HIGH_RISK = 3;
|
||||
const CRITIC_RISK = 4;
|
||||
|
||||
/**
|
||||
* MOTIF REFUS
|
||||
*/
|
||||
const NEED_INFO = 'Appel Phonie';
|
||||
const REFUSED = 'Refus';
|
||||
const FORBIDDEN = 'Interdit';
|
||||
const BLOCKED_FRAUD_FILTER = 'filtrage';
|
||||
const BLOCKED_FRAUD_SCORING = 'scoring';
|
||||
const FAIL_AUTHENTICATE = '3DSecure';
|
||||
|
||||
/**
|
||||
* @var Order
|
||||
*/
|
||||
protected $_orderModel;
|
||||
|
||||
/**
|
||||
* @var OrderSender
|
||||
*/
|
||||
protected $_orderSender;
|
||||
|
||||
/**
|
||||
* @var InvoiceService
|
||||
*/
|
||||
protected $_invoiceService;
|
||||
|
||||
/**
|
||||
* @var ShipmentService
|
||||
*/
|
||||
protected $_shipmentService;
|
||||
|
||||
/**
|
||||
* @var ConvertOrderFactory
|
||||
*/
|
||||
protected $_convertOrder;
|
||||
|
||||
/**
|
||||
* @var DataSealedForm
|
||||
*/
|
||||
protected $_dataSealedFormHelper;
|
||||
|
||||
/**
|
||||
* @param OrderFactory $orderFactory
|
||||
* @param OrderSender $orderSender
|
||||
* @param InvoiceService $invoiceService
|
||||
* @param ShipmentService $shipmentService
|
||||
* @param ConvertOrderFactory $convertOrderFactory
|
||||
* @param DataSealedForm $dataSealedForm
|
||||
*/
|
||||
public function __construct(
|
||||
OrderFactory $orderFactory,
|
||||
OrderSender $orderSender,
|
||||
InvoiceService $invoiceService,
|
||||
ShipmentService $shipmentService,
|
||||
ConvertOrderFactory $convertOrderFactory,
|
||||
DataSealedForm $dataSealedForm
|
||||
) {
|
||||
$this->_orderModel = $orderFactory->create();
|
||||
$this->_orderSender = $orderSender;
|
||||
$this->_invoiceService = $invoiceService;
|
||||
$this->_shipmentService = $shipmentService;
|
||||
$this->_convertOrder = $convertOrderFactory->create();
|
||||
$this->_dataSealedFormHelper = $dataSealedForm;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $incrementId
|
||||
* @return $this
|
||||
*/
|
||||
public function loadOrder($incrementId)
|
||||
{
|
||||
$this->_orderModel->loadByIncrementId($incrementId);
|
||||
$this->_dataSealedFormHelper->init($this->_orderModel->getPayment()->getMethod(), $this->_orderModel);
|
||||
|
||||
return $this->_orderModel->getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Order
|
||||
*/
|
||||
public function getOrderMethod()
|
||||
{
|
||||
return $this->_orderModel->getPayment()->getMethod();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isOrderComplete()
|
||||
{
|
||||
return $this->_orderModel->getState() === Order::STATE_COMPLETE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isOrderProcessing()
|
||||
{
|
||||
return $this->_orderModel->getState() === Order::STATE_PROCESSING;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function unholdOrder()
|
||||
{
|
||||
if ($this->_orderModel->canUnhold()) {
|
||||
$this->_orderModel->unhold();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
* @param string $status
|
||||
* @param bool $sendNewEmail
|
||||
* @return $this
|
||||
*/
|
||||
public function updateOrder($message, $status = null, $sendNewEmail = false)
|
||||
{
|
||||
if (!empty($status)) {
|
||||
$this->_orderModel->setState($status);
|
||||
$this->_orderModel->addStatusToHistory($status, $message, true);
|
||||
} else {
|
||||
$this->_orderModel->addStatusHistoryComment($message);
|
||||
}
|
||||
|
||||
if ($sendNewEmail === true && $this->_orderModel->getCanSendNewEmailFlag()) {
|
||||
$this->_orderSender->send($this->_orderModel);
|
||||
}
|
||||
|
||||
$this->_orderModel->save();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function saveInvoice()
|
||||
{
|
||||
$status = false;
|
||||
|
||||
if ($this->_orderModel->canInvoice()) {
|
||||
$invoice = $this->_invoiceService->prepareInvoice($this->_orderModel)->register();
|
||||
|
||||
if ($invoice->canCapture()) {
|
||||
$invoice->capture();
|
||||
}
|
||||
|
||||
$invoice->save();
|
||||
$status = true;
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function saveShipment()
|
||||
{
|
||||
$status = false;
|
||||
|
||||
if ($this->_orderModel->canShip()) {
|
||||
$shipment = $this->_convertOrder->toShipment($this->_orderModel);
|
||||
|
||||
foreach ($this->_orderModel->getAllItems() as $item) {
|
||||
if (!$item->getQtyToShip() || $item->getIsVirtual()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$shipmentItem = $this->_convertOrder->itemToShipmentItem($item)->setQty($item->getQtyToShip());
|
||||
$shipment->addItem($shipmentItem);
|
||||
}
|
||||
|
||||
$shipment->register();
|
||||
$shipment->save();
|
||||
$this->_shipmentService->notify($shipment->getId());
|
||||
$status = true;
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function holdOrCancelOrder($status)
|
||||
{
|
||||
$canceled = false;
|
||||
|
||||
if ($status === Order::STATE_HOLDED && $this->_orderModel->canHold()) {
|
||||
$this->_orderModel->hold();
|
||||
} elseif ($status === Order::STATE_CANCELED) {
|
||||
$this->cancelOrder();
|
||||
$canceled = true;
|
||||
}
|
||||
|
||||
return $canceled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function cancelOrder()
|
||||
{
|
||||
if ($this->_orderModel->canCancel()) {
|
||||
$this->_orderModel->cancel();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @return string
|
||||
*/
|
||||
public function getOrderResponseMAC(array $data)
|
||||
{
|
||||
return $this->_dataSealedFormHelper->getResponseMAC($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOrderMAC()
|
||||
{
|
||||
$mac = '';
|
||||
$data = $this->_dataSealedFormHelper->getData();
|
||||
|
||||
if (isset($data['MAC'])) {
|
||||
$mac = $data['MAC'];
|
||||
}
|
||||
|
||||
return $mac;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOrderStatus()
|
||||
{
|
||||
return $this->_orderModel->getStatus();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getBackCodes()
|
||||
{
|
||||
return [
|
||||
self::PAYTEST,
|
||||
self::PAIEMENT,
|
||||
self::ANNULATION,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getCvx()
|
||||
{
|
||||
return [
|
||||
self::OUI => __('Yes'),
|
||||
self::NON => __('No'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $code
|
||||
* @return string
|
||||
*/
|
||||
public function getCvxTranslate($code)
|
||||
{
|
||||
$cvxs = $this->getCvx();
|
||||
$cvx = '';
|
||||
|
||||
if (isset($cvxs[$code])) {
|
||||
$cvx = $cvxs[$code];
|
||||
}
|
||||
|
||||
return $cvx;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getBrands()
|
||||
{
|
||||
return [
|
||||
self::AMERICAN_EXPRESS => __('American Express'),
|
||||
self::GIE_CB => __('Credit Card CB'),
|
||||
self::MASTERCARD => __('Mastercard'),
|
||||
self::VISA => __('VISA'),
|
||||
self::UNAVAILABLE => __('n/a'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $code
|
||||
* @return string
|
||||
*/
|
||||
public function getBrandTranslate($code)
|
||||
{
|
||||
$brands = $this->getBrands();
|
||||
$brand = '';
|
||||
|
||||
if (isset($brands[$code])) {
|
||||
$brand = $brands[$code];
|
||||
}
|
||||
|
||||
return $brand;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getStatus3ds()
|
||||
{
|
||||
return [
|
||||
self::NO_SECURE => __('No Secure'),
|
||||
self::LOW_RISK => __('Low Risk'),
|
||||
self::UNABLE_BUT_AUTHENTICATE => __('Unable but Authenticate'),
|
||||
self::HIGH_RISK => __('High Risk'),
|
||||
self::CRITIC_RISK => __('Critical Risk'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $code
|
||||
* @return string
|
||||
*/
|
||||
public function getStatus3dsTranslate($code)
|
||||
{
|
||||
$status = $this->getStatus3ds();
|
||||
$state = '';
|
||||
|
||||
if (isset($status[$code])) {
|
||||
$state = $status[$code];
|
||||
}
|
||||
|
||||
return $state;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getRefusals()
|
||||
{
|
||||
return [
|
||||
self::NEED_INFO => __('Need Infos'),
|
||||
self::REFUSED => __('Refused'),
|
||||
self::FORBIDDEN => __('Forbidden'),
|
||||
self::BLOCKED_FRAUD_FILTER => __('Blocked by the Fraud Filter'),
|
||||
self::BLOCKED_FRAUD_SCORING => __('Blocked by the Fraud Scoring'),
|
||||
self::FAIL_AUTHENTICATE => __('Failed to Authenticate'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $code
|
||||
* @return string
|
||||
*/
|
||||
public function getRefusalTranslate($code)
|
||||
{
|
||||
$refusals = $this->getRefusals();
|
||||
$refusal = '';
|
||||
|
||||
if (isset($refusals[$code])) {
|
||||
$refusal = $refusals[$code];
|
||||
}
|
||||
|
||||
return $refusal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*/
|
||||
public function isCryptoGiven($value)
|
||||
{
|
||||
return self::OUI === $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @return bool
|
||||
*/
|
||||
public function isAllowedBrand($value)
|
||||
{
|
||||
return array_key_exists($value, $this->getBrands());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*/
|
||||
public function isPaymentCanceled($value)
|
||||
{
|
||||
return self::ANNULATION === $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*/
|
||||
public function isPaymentTest($value)
|
||||
{
|
||||
return self::PAYTEST === $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*/
|
||||
public function isPaymentSucceed($value)
|
||||
{
|
||||
return self::PAIEMENT === $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
namespace Blackbird\Monetico\Observer\Webapi;
|
||||
|
||||
use Magento\Framework\Event\ObserverInterface;
|
||||
use Magento\Framework\Event\Observer;
|
||||
|
||||
class PlaceObserver implements ObserverInterface
|
||||
{
|
||||
/**
|
||||
* @var \Blackbird\Monetico\Model\Config\Source\PaymentMethod
|
||||
*/
|
||||
protected $_methodSource;
|
||||
|
||||
/**
|
||||
* @param \Blackbird\Monetico\Model\Config\Source\PaymentMethod $paymentMethod
|
||||
*/
|
||||
public function __construct(
|
||||
\Blackbird\Monetico\Model\Config\Source\PaymentMethod $paymentMethod
|
||||
) {
|
||||
$this->_methodSource = $paymentMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\Event\Observer $observer
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute(Observer $observer)
|
||||
{
|
||||
/** @var \Magento\Sales\Model\Order\Payment $payment */
|
||||
$payment = $observer->getEvent()->getPayment();
|
||||
|
||||
if (in_array($payment->getMethod(), $this->_methodSource->getAvailablePaymentMethods())) {
|
||||
$payment->getOrder()->setCanSendNewEmailFlag(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "blackbird/monetico",
|
||||
"description": "Monetico (CMCIC payment method)",
|
||||
"require": {
|
||||
"php": "~5.5.0|~5.6.0|~7.0.0",
|
||||
"magento/module-sales": "100.*.*",
|
||||
"magento/module-payment": "100.*.*",
|
||||
"magento/module-directory": "100.*.*",
|
||||
"magento/module-config": "100.*.*"
|
||||
},
|
||||
"type": "magento2-module",
|
||||
"version": "100.1.1",
|
||||
"license": [
|
||||
"http://store.bird.eu/license/"
|
||||
],
|
||||
"autoload": {
|
||||
"files": [
|
||||
"registration.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Blackbird\\Monetico\\": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,595 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
|
||||
<system>
|
||||
<section id="payment">
|
||||
<group id="monetico_section" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Monetico CM-CIC Desjardins Payment</label>
|
||||
<comment><![CDATA[<p>Accept credit/debit cards with Monetico (CM-CIC & Desjardins) in your Magento store.</p><p><a href="https://www.monetico-services.com/fr/identification/authentification.html" target="_blank">Click here to login to your existing Monetico account</a>. Or to setup a new account and accept payments on your website, <a href="https://www.monetico-paiement.fr/fr/contact.html" target="_blank">click here to signup for a Monetico account</a>.</p>]]></comment>
|
||||
<attribute type="expanded">1</attribute>
|
||||
<fieldset_css>complex monetico-section</fieldset_css>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
|
||||
<!-- GENERAL SETTINGS -->
|
||||
<group id="monetico_settings" translate="label comment" showInDefault="1" showInWebsite="1" sortOrder="10">
|
||||
<label>Common Settings</label>
|
||||
<comment>These data are common for all payment methods through Monetico.</comment>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<field id="canceled_empty_cart" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Empty the Cart after Cancellation</label>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico/canceled_empty_cart</config_path>
|
||||
</field>
|
||||
<field id="canceled_redirect_cart" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Redirect to the Cart after Cancellation</label>
|
||||
<comment>We will redirect the customer to the default failure page if the redirect option is disabled.</comment>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico/canceled_redirect_cart</config_path>
|
||||
<depends><field id="canceled_empty_cart">0</field></depends>
|
||||
</field>
|
||||
<field id="canceled_error_message" translate="label comment" type="textarea" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Cancellation Message</label>
|
||||
<comment>We will replace the default message on the failure page by this one.</comment>
|
||||
<config_path>payment/monetico/canceled_error_message</config_path>
|
||||
</field>
|
||||
<field id="use_cron_cancel" translate="label comment" type="select" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0">
|
||||
<label>Enable Automatic Cancellation</label>
|
||||
<comment>We will run a cron to cancel orders, in new status, older than the value you have configured.</comment>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico/use_cron_cancel</config_path>
|
||||
</field>
|
||||
<field id="cancel_delay" translate="label comment" type="text" sortOrder="50" showInDefault="1" showInWebsite="0" showInStore="0">
|
||||
<label>Delay Before Cancellation</label>
|
||||
<comment>The cancel delay in seconds. If field is empty default value 2700 will be saved.</comment>
|
||||
<validate>validate-zero-or-greater</validate>
|
||||
<config_path>payment/monetico/cancel_delay</config_path>
|
||||
<depends><field id="use_cron_cancel">1</field></depends>
|
||||
</field>
|
||||
<field id="debug_mode" translate="label comment" type="select" sortOrder="50" showInDefault="1" showInWebsite="0" showInStore="0">
|
||||
<label>Enable Debug Mode</label>
|
||||
<comment>We will trace the events in the /var/log/monetico.log file.</comment>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico/debug_mode</config_path>
|
||||
</field>
|
||||
</group>
|
||||
|
||||
<!-- Monetico Onetime -->
|
||||
|
||||
<group id="monetico_onetime" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>One-time Payment</label>
|
||||
<comment>The purchases are fully paid in one time.</comment>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<attribute type="activity_path">payment/monetico_onetime/active</attribute>
|
||||
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Enable this Solution</label>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico_onetime/active</config_path>
|
||||
<requires><group id="monetico_required"/></requires>
|
||||
</field>
|
||||
<field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Title</label>
|
||||
<config_path>payment/monetico_onetime/title</config_path>
|
||||
</field>
|
||||
<field id="sort_order" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Sort Order</label>
|
||||
<validate>validate-number</validate>
|
||||
<config_path>payment/monetico_onetime/sort_order</config_path>
|
||||
</field>
|
||||
<!-- API CONFIGURATION -->
|
||||
<group id="monetico_required" translate="label comment" showInDefault="1" showInWebsite="1" sortOrder="40">
|
||||
<label>API Monetico Settings</label>
|
||||
<comment>These information are available in your Monetico account.</comment>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<field id="version" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Version</label>
|
||||
<source_model>Blackbird\Monetico\Model\Config\Source\Version</source_model>
|
||||
<config_path>payment/monetico_onetime/version</config_path>
|
||||
</field>
|
||||
<field id="environment" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Environment</label>
|
||||
<source_model>Blackbird\Monetico\Model\Config\Source\Environment</source_model>
|
||||
<config_path>payment/monetico_onetime/environment</config_path>
|
||||
</field>
|
||||
<field id="tpe_number" translate="label" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>TPE Number</label>
|
||||
<config_path>payment/monetico_onetime/tpe_number</config_path>
|
||||
</field>
|
||||
<field id="site_code" translate="label" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Site Code</label>
|
||||
<config_path>payment/monetico_onetime/site_code</config_path>
|
||||
</field>
|
||||
<field id="private_key" translate="label" type="obscure" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Security Hash Key</label>
|
||||
<config_path>payment/monetico_onetime/private_key</config_path>
|
||||
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
|
||||
</field>
|
||||
</group>
|
||||
<!-- CONFIGURE ORDER STATUS -->
|
||||
<group id="monetico_status" translate="label" showInDefault="1" showInWebsite="1" sortOrder="50">
|
||||
<label>Order Status Settings</label>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<field id="order_status" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>New Order Status</label>
|
||||
<source_model>Magento\Sales\Model\Config\Source\Order\Status\Newprocessing</source_model>
|
||||
<config_path>payment/monetico_onetime/order_status</config_path>
|
||||
</field>
|
||||
<field id="order_status_payment_accepted" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Payment Validated Order Status</label>
|
||||
<source_model>Magento\Sales\Model\Config\Source\Order\Status\Processing</source_model>
|
||||
<config_path>payment/monetico_onetime/order_status_payment_accepted</config_path>
|
||||
</field>
|
||||
<field id="order_status_payment_refused" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Payment Refused Order Status</label>
|
||||
<source_model>Blackbird\Monetico\Model\Config\Source\Order\Status\Canceled</source_model>
|
||||
<config_path>payment/monetico_onetime/order_status_payment_refused</config_path>
|
||||
</field>
|
||||
<field id="order_status_payment_canceled" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Payment Canceled Order status</label>
|
||||
<source_model>Blackbird\Monetico\Model\Config\Source\Order\Status\Canceled</source_model>
|
||||
<config_path>payment/monetico_onetime/order_status_payment_canceled</config_path>
|
||||
</field>
|
||||
<field id="create_invoice" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Create Invoice</label>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico_onetime/create_invoice</config_path>
|
||||
</field>
|
||||
</group>
|
||||
<!-- ADVANCED OPTIONS -->
|
||||
<group id="monetico_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="60">
|
||||
<label>Country Specific Settings</label>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Payment from Applicable Countries</label>
|
||||
<source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model>
|
||||
<config_path>payment/monetico_onetime/allowspecific</config_path>
|
||||
</field>
|
||||
<field id="specificcountry" translate="label" type="multiselect" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Payment from Specific Countries</label>
|
||||
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
|
||||
<can_be_empty>1</can_be_empty>
|
||||
<config_path>payment/monetico_onetime/specificcountry</config_path>
|
||||
</field>
|
||||
</group>
|
||||
<group id="monetico_3dsecure" translate="label" showInDefault="1" showInWebsite="1" sortOrder="70">
|
||||
<label>3D Secure Verification Settings</label>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<field id="verify_3dsecure" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Enable 3DSecure Verification</label>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico_onetime/verify_3dsecure</config_path>
|
||||
</field>
|
||||
<field id="verify_3dsecure_min_amount" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Maximum Amount before 3D-Secure</label>
|
||||
<validate>validate-zero-or-greater</validate>
|
||||
<config_path>payment/monetico_onetime/max_amount</config_path>
|
||||
<depends><field id="verify_3dsecure">0</field></depends>
|
||||
</field>
|
||||
</group>
|
||||
<group id="monetico_interface" translate="label" showInDefault="1" showInWebsite="1" sortOrder="80">
|
||||
<label>Monetico Interface Settings</label>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<field id="use_iframe" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Include in Iframe</label>
|
||||
<comment>You should have signed the option in your Monetico contract.</comment>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico_onetime/use_iframe</config_path>
|
||||
</field>
|
||||
<field id="locale" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Locale Configuration</label>
|
||||
<comment>We will use the current store language in preference.</comment>
|
||||
<source_model>Blackbird\Monetico\Model\Config\Source\AvailableLocales</source_model>
|
||||
<config_path>payment/monetico_onetime/locale</config_path>
|
||||
</field>
|
||||
</group>
|
||||
<group id="monetico_transaction" translate="label comment" showInDefault="1" showInWebsite="1" sortOrder="90">
|
||||
<label>Transaction Description</label>
|
||||
<comment><![CDATA[
|
||||
<p>You can customize the transaction description, these variables can be used:<p>
|
||||
<ul class="monetico-variable-list">
|
||||
<li class="monetico-variable"><strong>%order_id%</strong><span>Order ID number</span></li>
|
||||
<li class="monetico-variable"><strong>%payment_method%</strong><span>Payment Method name</span></li>
|
||||
<li class="monetico-variable"><strong>%code_societe%</strong><span>Store Code Name</span></li>
|
||||
</ul>
|
||||
]]></comment>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<field id="transaction_description" translate="label comment" type="textarea" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Transaction Message</label>
|
||||
<comment>We will set a default message if the value is empty.</comment>
|
||||
<config_path>payment/monetico_onetime/transaction_description</config_path>
|
||||
</field>
|
||||
</group>
|
||||
<group id="monetico_options" translate="label comment" showInDefault="1" showInWebsite="1" sortOrder="100">
|
||||
<label>Options Settings</label>
|
||||
<comment>Enable or disable Monetico options and configure them.</comment>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<field id="payment_express" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Enable the Payment Express Option</label>
|
||||
<comment>You should have signed the option in your Monetico contract.</comment>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico_onetime/payment_express</config_path>
|
||||
</field>
|
||||
<field id="force_cb" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Force the Credit Card Input</label>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico_onetime/force_cb</config_path>
|
||||
<depends><field id="payment_express">1</field></depends>
|
||||
</field>
|
||||
<field id="allow_options" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Enable all Payment Options</label>
|
||||
<comment>We will display the payment options on the Monetico payment page, from your settings.</comment>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico_onetime/allow_options</config_path>
|
||||
</field>
|
||||
<field id="disabled_options" translate="label" type="multiselect" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Disable Specific Payment Options</label>
|
||||
<validate>validate-no-empty</validate>
|
||||
<source_model>Blackbird\Monetico\Model\Config\Source\OptionPayment</source_model>
|
||||
<config_path>payment/monetico_onetime/disabled_options</config_path>
|
||||
<depends><field id="allow_options">0</field></depends>
|
||||
</field>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<!-- Monetico Multitime -->
|
||||
|
||||
<group id="monetico_multitime" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Multi-time Payment</label>
|
||||
<comment>The purchases are paid in several times.</comment>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<attribute type="activity_path">payment/monetico_multitime/active</attribute>
|
||||
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Enable this Solution</label>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico_multitime/active</config_path>
|
||||
<requires><group id="monetico_required"/></requires>
|
||||
</field>
|
||||
<field id="amount_min" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Minimum Amount</label>
|
||||
<validate>validate-zero-or-greater</validate>
|
||||
<config_path>payment/monetico_multitime/amount_min</config_path>
|
||||
<depends><field id="active">1</field></depends>
|
||||
</field>
|
||||
<field id="amount_max" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Maximum Amount</label>
|
||||
<validate>validate-zero-or-greater</validate>
|
||||
<config_path>payment/monetico_multitime/amount_max</config_path>
|
||||
<depends><field id="active">1</field></depends>
|
||||
</field>
|
||||
<field id="title" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Title</label>
|
||||
<config_path>payment/monetico_multitime/title</config_path>
|
||||
</field>
|
||||
<field id="sort_order" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Sort Order</label>
|
||||
<validate>validate-number</validate>
|
||||
<config_path>payment/monetico_multitime/sort_order</config_path>
|
||||
</field>
|
||||
<!-- API CONFIGURATION -->
|
||||
<group id="monetico_required" translate="label comment" showInDefault="1" showInWebsite="1" sortOrder="60">
|
||||
<label>API Monetico Settings</label>
|
||||
<comment>These information are available in your Monetico account.</comment>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<field id="version" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Version</label>
|
||||
<source_model>Blackbird\Monetico\Model\Config\Source\Version</source_model>
|
||||
<config_path>payment/monetico_multitime/version</config_path>
|
||||
</field>
|
||||
<field id="environment" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Environment</label>
|
||||
<source_model>Blackbird\Monetico\Model\Config\Source\Environment</source_model>
|
||||
<config_path>payment/monetico_multitime/environment</config_path>
|
||||
</field>
|
||||
<field id="tpe_number" translate="label" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>TPE Number</label>
|
||||
<config_path>payment/monetico_multitime/tpe_number</config_path>
|
||||
</field>
|
||||
<field id="site_code" translate="label" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Site Code</label>
|
||||
<config_path>payment/monetico_multitime/site_code</config_path>
|
||||
</field>
|
||||
<field id="private_key" translate="label" type="obscure" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Security Hash Key</label>
|
||||
<config_path>payment/monetico_multitime/private_key</config_path>
|
||||
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
|
||||
</field>
|
||||
</group>
|
||||
<!-- CONFIGURE ORDER STATUS -->
|
||||
<group id="monetico_status" translate="label" showInDefault="1" showInWebsite="1" sortOrder="70">
|
||||
<label>Order Status Settings</label>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<field id="order_status" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>New Order Status</label>
|
||||
<source_model>Magento\Sales\Model\Config\Source\Order\Status\Newprocessing</source_model>
|
||||
<config_path>payment/monetico_multitime/order_status</config_path>
|
||||
</field>
|
||||
<field id="order_status_payment_accepted" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Payment Validated Order Status</label>
|
||||
<source_model>Magento\Sales\Model\Config\Source\Order\Status\Processing</source_model>
|
||||
<config_path>payment/monetico_multitime/order_status_payment_accepted</config_path>
|
||||
</field>
|
||||
<field id="order_status_payment_refused" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Payment Refused Order Status</label>
|
||||
<source_model>Blackbird\Monetico\Model\Config\Source\Order\Status\Canceled</source_model>
|
||||
<config_path>payment/monetico_multitime/order_status_payment_refused</config_path>
|
||||
</field>
|
||||
<field id="order_status_payment_canceled" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Payment Canceled Order status</label>
|
||||
<source_model>Blackbird\Monetico\Model\Config\Source\Order\Status\Canceled</source_model>
|
||||
<config_path>payment/monetico_multitime/order_status_payment_canceled</config_path>
|
||||
</field>
|
||||
<field id="create_invoice" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Create Invoice</label>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico_multitime/create_invoice</config_path>
|
||||
</field>
|
||||
</group>
|
||||
<group id="monetico_several_payment" translate="label comment" showInDefault="1" showInWebsite="1" sortOrder="80">
|
||||
<label>Several Payment Configuration</label>
|
||||
<comment>We will split equally the payment in many capture amount if the values are empty. The total terms rate should be equal to 100%.</comment>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<field id="number_terms" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Number of Payment Terms</label>
|
||||
<comment>We will process the payment in many several monthly captures.</comment>
|
||||
<source_model>Blackbird\Monetico\Model\Config\Source\PaymentTerms</source_model>
|
||||
<config_path>payment/monetico_multitime/number_terms</config_path>
|
||||
</field>
|
||||
<field id="term_rate_1" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>1st Rate Term (%)</label>
|
||||
<comment>We will capture this order rate amount on the first term.</comment>
|
||||
<validate>validate-greater-than-zero</validate>
|
||||
<config_path>payment/monetico_multitime/term_rate_1</config_path>
|
||||
</field>
|
||||
<field id="term_rate_2" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>2nd Rate Term (%)</label>
|
||||
<comment>We will capture this order rate amount on the second term.</comment>
|
||||
<validate>validate-greater-than-zero</validate>
|
||||
<config_path>payment/monetico_multitime/term_rate_2</config_path>
|
||||
</field>
|
||||
<field id="term_rate_3" translate="label comment" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>3rd Rate Term (%)</label>
|
||||
<comment>We will capture this order rate amount on the third term.</comment>
|
||||
<validate>validate-greater-than-zero</validate>
|
||||
<config_path>payment/monetico_multitime/term_rate_3</config_path>
|
||||
<depends><field id="number_terms" negative="1">2</field></depends>
|
||||
</field>
|
||||
<field id="term_rate_4" translate="label comment" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>4th Rate Term (%)</label>
|
||||
<comment>We will capture this order rate amount on the fourth term.</comment>
|
||||
<validate>validate-greater-than-zero</validate>
|
||||
<config_path>payment/monetico_multitime/term_rate_4</config_path>
|
||||
<depends><field id="number_terms">4</field></depends>
|
||||
</field>
|
||||
</group>
|
||||
<group id="monetico_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="90">
|
||||
<label>Country Specific Settings</label>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Payment from Applicable Countries</label>
|
||||
<source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model>
|
||||
<config_path>payment/monetico_multitime/allowspecific</config_path>
|
||||
</field>
|
||||
<field id="specificcountry" translate="label" type="multiselect" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Payment from Specific Countries</label>
|
||||
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
|
||||
<can_be_empty>1</can_be_empty>
|
||||
<config_path>payment/monetico_multitime/specificcountry</config_path>
|
||||
</field>
|
||||
</group>
|
||||
<group id="monetico_3dsecure" translate="label" showInDefault="1" showInWebsite="1" sortOrder="100">
|
||||
<label>3D Secure Verification Settings</label>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<field id="verify_3dsecure" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>3D Secure Verification</label>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico_multitime/verify_3dsecure</config_path>
|
||||
</field>
|
||||
<field id="verify_3dsecure_min_amount" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Maximum Amount before 3D-Secure</label>
|
||||
<validate>validate-zero-or-greater</validate>
|
||||
<config_path>payment/monetico_multitime/max_amount</config_path>
|
||||
<depends><field id="verify_3dsecure">0</field></depends>
|
||||
</field>
|
||||
</group>
|
||||
<group id="monetico_interface" translate="label" showInDefault="1" showInWebsite="1" sortOrder="110">
|
||||
<label>Monetico Interface Settings</label>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<field id="use_iframe" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Include in Iframe</label>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico_multitime/use_iframe</config_path>
|
||||
</field>
|
||||
<field id="locale" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Locale Configuration</label>
|
||||
<comment>We will use the current store language in preference.</comment>
|
||||
<source_model>Blackbird\Monetico\Model\Config\Source\AvailableLocales</source_model>
|
||||
<config_path>payment/monetico_multitime/locale</config_path>
|
||||
</field>
|
||||
</group>
|
||||
<group id="monetico_transaction" translate="label comment" showInDefault="1" showInWebsite="1" sortOrder="120">
|
||||
<label>Transaction Description</label>
|
||||
<comment><![CDATA[
|
||||
<p>You can customize the transaction description, these variables can be used:<p>
|
||||
<ul class="monetico-variable-list">
|
||||
<li class="monetico-variable"><strong>%order_id%</strong><span>Order ID number</span></li>
|
||||
<li class="monetico-variable"><strong>%payment_method%</strong><span>Payment Method name</span></li>
|
||||
<li class="monetico-variable"><strong>%code_societe%</strong><span>Store Code Name</span></li>
|
||||
</ul>
|
||||
]]></comment>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<field id="transaction_description" translate="label comment" type="textarea" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Transaction Message</label>
|
||||
<comment>We will set a default message if the value is empty.</comment>
|
||||
<config_path>payment/monetico_multitime/transaction_description</config_path>
|
||||
</field>
|
||||
</group>
|
||||
<group id="monetico_options" translate="label comment" showInDefault="1" showInWebsite="1" sortOrder="130">
|
||||
<label>Options Settings</label>
|
||||
<comment>Enable or disable Monetico options and configure them.</comment>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<field id="payment_express" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Enable the Payment Express Option</label>
|
||||
<comment>You should have signed the option in your Monetico contract.</comment>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico_multitime/payment_express</config_path>
|
||||
</field>
|
||||
<field id="force_cb" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Force the Credit Card Input</label>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico_multitime/force_cb</config_path>
|
||||
<depends><field id="payment_express">1</field></depends>
|
||||
</field>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<!-- Monetico Cofidis 1euro -->
|
||||
|
||||
<group id="monetico_1euro" translate="label comment" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Cofidis 1euro Payment</label>
|
||||
<comment>The purchases are paid in 3, 5, 10, 20 times or small amounts by the customer, but the merchant is paid in one time.</comment>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<attribute type="activity_path">payment/monetico_1euro/active</attribute>
|
||||
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Enable this Solution</label>
|
||||
<comment>
|
||||
<![CDATA[You should have signed the option in your Monetico contract.
|
||||
<br />The One-time payment method should be configured.]]>
|
||||
</comment>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico_1euro/active</config_path>
|
||||
<requires><group id="monetico_required"/></requires>
|
||||
</field>
|
||||
<field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Title</label>
|
||||
<config_path>payment/monetico_1euro/title</config_path>
|
||||
</field>
|
||||
<field id="sort_order" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Sort Order</label>
|
||||
<validate>validate-number</validate>
|
||||
<config_path>payment/monetico_1euro/sort_order</config_path>
|
||||
</field>
|
||||
</group>
|
||||
|
||||
<!-- Monetico Cofidis 3xCB -->
|
||||
|
||||
<group id="monetico_3xcb" translate="label comment" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Cofidis 3xCB Payment</label>
|
||||
<comment>The purchases are paid in 3 times by the customer, but the merchant is paid in one time.</comment>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<attribute type="activity_path">payment/monetico_3xcb/active</attribute>
|
||||
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Enable this Solution</label>
|
||||
<comment>
|
||||
<![CDATA[You should have signed the option in your Monetico contract.
|
||||
<br />The One-time payment method should be configured.]]>
|
||||
</comment>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico_3xcb/active</config_path>
|
||||
<requires><group id="monetico_required"/></requires>
|
||||
</field>
|
||||
<field id="amount_min" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Minimum Amount</label>
|
||||
<validate>validate-zero-or-greater</validate>
|
||||
<config_path>payment/monetico_3xcb/amount_min</config_path>
|
||||
<depends><field id="active">1</field></depends>
|
||||
</field>
|
||||
<field id="amount_max" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Maximum Amount</label>
|
||||
<validate>validate-zero-or-greater</validate>
|
||||
<config_path>payment/monetico_3xcb/amount_max</config_path>
|
||||
<depends><field id="active">1</field></depends>
|
||||
</field>
|
||||
<field id="title" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Title</label>
|
||||
<config_path>payment/monetico_3xcb/title</config_path>
|
||||
</field>
|
||||
<field id="sort_order" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Sort Order</label>
|
||||
<validate>validate-number</validate>
|
||||
<config_path>payment/monetico_3xcb/sort_order</config_path>
|
||||
</field>
|
||||
</group>
|
||||
|
||||
<!-- Monetico Cofidis 4xCB -->
|
||||
|
||||
<group id="monetico_4xcb" translate="label comment" type="text" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Cofidis 4xCB Payment</label>
|
||||
<comment>The purchases are paid in 4 times by the customer, but the merchant is paid in one time.</comment>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<attribute type="activity_path">payment/monetico_4xcb/active</attribute>
|
||||
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Enable this Solution</label>
|
||||
<comment>
|
||||
<![CDATA[You should have signed the option in your Monetico contract.
|
||||
<br />The One-time payment method should be configured.]]>
|
||||
</comment>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico_4xcb/active</config_path>
|
||||
<requires><group id="monetico_required"/></requires>
|
||||
</field>
|
||||
<field id="amount_min" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Minimum Amount</label>
|
||||
<validate>validate-zero-or-greater</validate>
|
||||
<config_path>payment/monetico_4xcb/amount_min</config_path>
|
||||
<depends><field id="active">1</field></depends>
|
||||
</field>
|
||||
<field id="amount_max" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Maximum Amount</label>
|
||||
<validate>validate-zero-or-greater</validate>
|
||||
<config_path>payment/monetico_4xcb/amount_max</config_path>
|
||||
<depends><field id="active">1</field></depends>
|
||||
</field>
|
||||
<field id="title" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Title</label>
|
||||
<config_path>payment/monetico_4xcb/title</config_path>
|
||||
</field>
|
||||
<field id="sort_order" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Sort Order</label>
|
||||
<validate>validate-number</validate>
|
||||
<config_path>payment/monetico_4xcb/sort_order</config_path>
|
||||
</field>
|
||||
</group>
|
||||
|
||||
<!-- Monetico PayPal -->
|
||||
|
||||
<group id="monetico_paypal" translate="label comment" type="text" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>PayPal Payment</label>
|
||||
<comment>PayPal is a worldwide payment method.</comment>
|
||||
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
|
||||
<attribute type="activity_path">payment/monetico_paypal/active</attribute>
|
||||
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Enable this Solution</label>
|
||||
<comment><![CDATA[You should have signed the option in your Monetico contract.<br />The One-time payment method should be configured.]]></comment>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<config_path>payment/monetico_paypal/active</config_path>
|
||||
<requires><group id="monetico_required"/></requires>
|
||||
</field>
|
||||
<field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Title</label>
|
||||
<config_path>payment/monetico_paypal/title</config_path>
|
||||
</field>
|
||||
<field id="sort_order" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
|
||||
<label>Sort Order</label>
|
||||
<validate>validate-number</validate>
|
||||
<config_path>payment/monetico_paypal/sort_order</config_path>
|
||||
</field>
|
||||
</group>
|
||||
</group>
|
||||
</section>
|
||||
</system>
|
||||
</config>
|
||||
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
|
||||
<default>
|
||||
<payment>
|
||||
<monetico_onetime>
|
||||
<active>0</active>
|
||||
<title>Monetico One-time Payment Method</title>
|
||||
<version>3.0</version>
|
||||
<environment>sandbox</environment>
|
||||
<order_status>pending</order_status>
|
||||
<order_status_payment_accepted>processing</order_status_payment_accepted>
|
||||
<order_status_payment_refused>holded</order_status_payment_refused>
|
||||
<order_status_payment_canceled>canceled</order_status_payment_canceled>
|
||||
<create_invoice>1</create_invoice>
|
||||
<allowspecific>0</allowspecific>
|
||||
<verify_3dsecure>1</verify_3dsecure>
|
||||
<use_iframe>0</use_iframe>
|
||||
<locale>EN</locale>
|
||||
<transaction_description>Payment from %code_societe% through Monetico %payment_method% for the Order %order_id%</transaction_description>
|
||||
<allow_options>1</allow_options>
|
||||
<group>monetico</group>
|
||||
<model>Blackbird\Monetico\Model\Method\Onetime</model>
|
||||
</monetico_onetime>
|
||||
<monetico_multitime>
|
||||
<active>0</active>
|
||||
<amount_min>100</amount_min>
|
||||
<amount_max>1000</amount_max>
|
||||
<title>Monetico Multi-time Payment Method</title>
|
||||
<version>3.0</version>
|
||||
<environment>sandbox</environment>
|
||||
<order_status>pending</order_status>
|
||||
<order_status_payment_accepted>processing</order_status_payment_accepted>
|
||||
<order_status_payment_refused>holded</order_status_payment_refused>
|
||||
<order_status_payment_canceled>canceled</order_status_payment_canceled>
|
||||
<create_invoice>1</create_invoice>
|
||||
<number_terms>3</number_terms>
|
||||
<term_rate_1>34</term_rate_1>
|
||||
<term_rate_2>33</term_rate_2>
|
||||
<term_rate_3>33</term_rate_3>
|
||||
<allowspecific>0</allowspecific>
|
||||
<verify_3dsecure>1</verify_3dsecure>
|
||||
<use_iframe>0</use_iframe>
|
||||
<locale>EN</locale>
|
||||
<transaction_description>Payment from %code_societe% through Monetico %payment_method% for the Order %order_id%</transaction_description>
|
||||
<allow_options>1</allow_options>
|
||||
<disabled_options>1euro,3xcb,4xcb,paypal</disabled_options>
|
||||
<group>monetico</group>
|
||||
<model>Blackbird\Monetico\Model\Method\Multitime</model>
|
||||
</monetico_multitime>
|
||||
<monetico_1euro>
|
||||
<active>0</active>
|
||||
<title>Monetico Cofidis 1euro Payment Method</title>
|
||||
<model>Blackbird\Monetico\Model\Method\CofidisEuro</model>
|
||||
</monetico_1euro>
|
||||
<monetico_3xcb>
|
||||
<active>0</active>
|
||||
<amount_min>100</amount_min>
|
||||
<amount_max>1000</amount_max>
|
||||
<title>Monetico Cofidis 3xCB Payment Method</title>
|
||||
<model>Blackbird\Monetico\Model\Method\CofidisTxcb</model>
|
||||
</monetico_3xcb>
|
||||
<monetico_4xcb>
|
||||
<active>0</active>
|
||||
<amount_min>100</amount_min>
|
||||
<amount_max>1000</amount_max>
|
||||
<title>Monetico Cofidis 4xCB Payment Method</title>
|
||||
<model>Blackbird\Monetico\Model\Method\CofidisFxcb</model>
|
||||
</monetico_4xcb>
|
||||
<monetico_paypal>
|
||||
<active>0</active>
|
||||
<title>Monetico PayPal Payment Method</title>
|
||||
<model>Blackbird\Monetico\Model\Method\PayPal</model>
|
||||
</monetico_paypal>
|
||||
</payment>
|
||||
</default>
|
||||
</config>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
|
||||
<group id="default">
|
||||
<job name="monetico_cron_cancel_order" instance="Blackbird\Monetico\Cron\CancelOrderTask" method="execute">
|
||||
<schedule>* * * * *</schedule>
|
||||
</job>
|
||||
</group>
|
||||
</config>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
|
||||
<virtualType name="moneticoLogger" type="Magento\Framework\Logger\Monolog">
|
||||
<arguments>
|
||||
<argument name="name" xsi:type="string">monetico</argument>
|
||||
<argument name="handlers" xsi:type="array">
|
||||
<item name="debug" xsi:type="object">Blackbird\Monetico\Logger\Handler\Monetico</item>
|
||||
</argument>
|
||||
</arguments>
|
||||
</virtualType>
|
||||
<type name="Blackbird\Monetico\Model\Debug">
|
||||
<arguments>
|
||||
<argument name="logger" xsi:type="object">moneticoLogger</argument>
|
||||
</arguments>
|
||||
</type>
|
||||
</config>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
|
||||
<type name="Magento\Checkout\Model\CompositeConfigProvider">
|
||||
<arguments>
|
||||
<argument name="configProviders" xsi:type="array">
|
||||
<item name="monetico_config_provider" xsi:type="object">Blackbird\Monetico\Model\ConfigProvider</item>
|
||||
</argument>
|
||||
</arguments>
|
||||
</type>
|
||||
</config>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
|
||||
<router id="standard">
|
||||
<route id="monetico" frontName="monetico">
|
||||
<module name="Blackbird_Monetico" />
|
||||
</route>
|
||||
</router>
|
||||
</config>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Blackbird_Monetico" setup_version="2.1.1">
|
||||
<sequence>
|
||||
<module name="Magento_Checkout"/>
|
||||
<module name="Magento_Config"/>
|
||||
<module name="Magento_Directory"/>
|
||||
<module name="Magento_Payment"/>
|
||||
<module name="Magento_Sales"/>
|
||||
</sequence>
|
||||
</module>
|
||||
</config>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
-->
|
||||
<payment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Payment/etc/payment.xsd">
|
||||
<groups>
|
||||
<group id="monetico">
|
||||
<label>Monetico Payment Methods</label>
|
||||
</group>
|
||||
</groups>
|
||||
<methods>
|
||||
<method name="monetico_onetime">
|
||||
<allow_multiple_address>1</allow_multiple_address>
|
||||
</method>
|
||||
<method name="monetico_multitime">
|
||||
<allow_multiple_address>1</allow_multiple_address>
|
||||
</method>
|
||||
<method name="monetico_1euro">
|
||||
<allow_multiple_address>1</allow_multiple_address>
|
||||
</method>
|
||||
<method name="monetico_3xcb">
|
||||
<allow_multiple_address>1</allow_multiple_address>
|
||||
</method>
|
||||
<method name="monetico_4xcb">
|
||||
<allow_multiple_address>1</allow_multiple_address>
|
||||
</method>
|
||||
<method name="monetico_paypal">
|
||||
<allow_multiple_address>1</allow_multiple_address>
|
||||
</method>
|
||||
</methods>
|
||||
</payment>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
|
||||
<event name="sales_order_payment_place_start">
|
||||
<observer name="sendEmail" instance="Blackbird\Monetico\Observer\Webapi\PlaceObserver" />
|
||||
</event>
|
||||
</config>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
|
||||
<event name="sales_order_payment_place_start">
|
||||
<observer name="sendEmail" instance="Blackbird\Monetico\Observer\Webapi\PlaceObserver" />
|
||||
</event>
|
||||
</config>
|
||||
@@ -0,0 +1,132 @@
|
||||
"The order has been canceled by the customer.","La commande a été annulée par le client."
|
||||
"An error has occurred during the cancellation.","Une erreur a eu lieu lors de l'annulation de la commande."
|
||||
"Your order has been canceled.","Votre commande a été annulée."
|
||||
"Some required parameters are missing.","Tous les paramètres requis ne sont pas présents."
|
||||
"The order %1 does not exists.","La commande %1 n'existe pas."
|
||||
"The order %1 has a valid MAC.","La commande %1 a un MAC valide."
|
||||
"The payment of the order %1 has been validated.","Le paiement de la commande %1 a été validé."
|
||||
"The status of the order %1 is %2.","Statut de la commande %1 : %2."
|
||||
"The payment has been refused. Order: %1","Paiement refusé pour la commande %1."
|
||||
"The order %1 has been canceled or held.","La commande %1 a été annulée ou suspendue."
|
||||
"Returned MAC is invalid. Order canceled.","Le MAC retourné est invalide. La commande est annulée."
|
||||
"Returned MAC is invalid. Order %1 canceled.","Le MAC retourné est invalide. La commande %1 est annulée."
|
||||
"Payment accepted by Monetico","Paiement accepté par Monetico"
|
||||
"Used payment method: %1","Méthode de paiement utilisée : %1"
|
||||
"Captured amount: %1","Montant capturé : %1"
|
||||
"Authorization number: %1","Numéro de l'autorisation : %1"
|
||||
"3D secure status: %1","Statut du 3DSecure : %1"
|
||||
"The visual cryptogram has been seized: %1","Le cryptogramme a été saisi : %1"
|
||||
"CC validity: %1","Date de validité de la carte : %1"
|
||||
"CC type: %1","Type de carte : %1"
|
||||
"Country code from the CC: %1","Code pays de la carte bancaire : %1"
|
||||
"BIN code: %1","Code BIN : %1"
|
||||
"Refusal reason: %1","Motif du refus : %1"
|
||||
"Payment from %code_societe% through %payment_method% for the Order n°%order_id%","Paiement depuis %code_societe% avec %payment_method% pour la commande n°%order_id%"
|
||||
"Yes","Oui"
|
||||
"No","Non"
|
||||
"American Express","American Express"
|
||||
"Credit Card CB","Carte de crédit CB"
|
||||
"Mastercard","Mastercard"
|
||||
"VISA","VISA"
|
||||
"n/a","Non disponible"
|
||||
"No Secure","La transaction ne s’est pas faite selon le protocole 3DSecure."
|
||||
"Low Risk","La transaction s’est faite selon le protocole 3DS et le niveau de risque est faible."
|
||||
"Unable but Authenticate","La transaction ne peut pas se faire selon le protocole 3DSecure, le porteur a cependant été authentifié par le biais de 3DSecure."
|
||||
"High Risk","La transaction s’est faite selon le protocole 3DS et le niveau de risque est élevé."
|
||||
"Critical Risk","La transaction s’est faite selon le protocole 3DS et le niveau de risque est très élevé."
|
||||
"Need Infos","La banque du client demande des informations complémentaires."
|
||||
"Refused","La banque du client refuse d'accorder l'autorisation."
|
||||
"Forbidden","La banque du client interdit d'accorder l'autorisation."
|
||||
"Blocked by the Fraud Filter","Le paiement a été bloqué par le filtrage du Module Prévention Fraude."
|
||||
"Blocked by the Fraud Scoring","Le paiement a été bloqué par le scoring du Module Prévention Fraude."
|
||||
"Failed to Authenticate","Le paiement a été refusé en raison du statut 3DSecure."
|
||||
"Invoice","Facture"
|
||||
"Shipment","Livraison"
|
||||
"Onetime Payment","Paiement en une seule fois"
|
||||
"Multi-time Payment","Paiement fractionné"
|
||||
"Cofidis 1euro Payment","Paiement par Cofidis avec 1euro"
|
||||
"Cofidis 3xCB Payment","Paiement par Cofidis en 3xCB"
|
||||
"Cofidis 4xCB Payment","Paiement par Cofidis en 4xCB"
|
||||
"PayPal Payment","Paiement par PayPal"
|
||||
"Authorize","Autorisation uniquement"
|
||||
"Authorize and Capture","Autorisation et capture"
|
||||
"Version %1","Version %1"
|
||||
"Place Payment","Effectuez le Paiement"
|
||||
"You will be redirected to %1 in a few seconds.","Vous allez être redirigé vers %1 dans un instant."
|
||||
"Monetico CM-CIC Desjardins Payment","Monetico CM-CIC Desjardins Paiement"
|
||||
"Common Settings","Paramètres globaux"
|
||||
"These data are common for all payment methods through Monetico.","Ces données sont communes à toutes les méthodes de paiement de Monetico."
|
||||
"Empty the Cart after Cancellation","Réinitialiser le panier après l'annulation"
|
||||
"Redirect to the Cart after Cancellation","Rediriger vers le panier après l'annulation"
|
||||
"We will redirect the customer to the default failure page if the redirect option is disabled.","Nous allons rediriger le client vers la page d'échec par défaut si l'option de redirection est désactivé."
|
||||
"Cancellation Message","Message d'annulation"
|
||||
"We will replace the default message on the failure page by this one.","Nous allons remplacer le message de la page d'échec par celui-ci."
|
||||
"Enable Automatic Cancellation","Activer l'anullation automatique"
|
||||
"We will run a cron to cancel orders, in new status, older than the value you have configured.","Nous allons lancer un cron pour annuler les commandes en attente, antérieures à la valeur configurée."
|
||||
"Delay Before Cancellation","Délai avant l'annulation"
|
||||
"The cancel delay in seconds. If field is empty default value 2700 will be saved.","Le délai d'annulation est en secondes. Si le champ est vide, la valeur 2700 sera sauvegardée par défaut."
|
||||
"Enable Debug Mode","Activer le mode de débogage"
|
||||
"We will trace the events in the /var/log/monetico.log file.","Nous allons reporter tous les évènements dans le fichier /var/log/monetico.log à la racine de Magento."
|
||||
"Enable this Solution","Activer la solution"
|
||||
"Title","Titre"
|
||||
"Sort Order","Ordre de tri"
|
||||
"API Monetico Settings","Paramètres de l'API Monetico"
|
||||
"These information are available in your Monetico account.","Ces informations sont disponibles dans votre compte Monetico."
|
||||
"Version","Version"
|
||||
"Environment","Environnement"
|
||||
"TPE Number","Numéro du TPE"
|
||||
"Site Code","Code société"
|
||||
"Security Hash Key","Clé de sécurité"
|
||||
"Order Status Settings","Paramètres des statuts de commande"
|
||||
"New Order Status","Statut d'une nouvelle commande"
|
||||
"Payment Validated Order Status","Statut d'une commande avec un paiement validé"
|
||||
"Payment Refused Order Status","Statut d'une commande avec un paiement refusé "
|
||||
"Payment Canceled Order status","Statut d'une commande avec un paiement annulé"
|
||||
"Create Invoice","Créer une facture"
|
||||
"Country Specific Settings","Paramètres spécifiques des pays"
|
||||
"Payment from Applicable Countries","Mode de paiement autorisé pour les pays applicables"
|
||||
"Payment from Specific Countries","Mode de paiement autorisé pour les pays spécifiques"
|
||||
"3D Secure Verification Settings","Paramètres du 3DSecure"
|
||||
"Enable 3DSecure Verification","Activer la vérification 3DSecure"
|
||||
"Maximum Amount before 3D-Secure","Montant maximum avant l'activation du 3DSecure"
|
||||
"Monetico Interface Settings","Paramètres de l'interface de Monetico"
|
||||
"Include in Iframe","Intégration dans un Iframe"
|
||||
"You should have signed the option in your Monetico contract.","Vous devez avoir signé cette option dans votre contrat Monetico."
|
||||
"Locale Configuration","Configuration de la langue"
|
||||
"We will use the current store language in preference.","Nous allons utiliser la langue courante du client en préférence."
|
||||
"Transaction Description","Description de la transaction"
|
||||
"Transaction Message","Message de la transaction"
|
||||
"We will set a default message if the value is empty.","Un message par défaut sera mis en place si la valeur est vide."
|
||||
"Options Settings","Paramètres des options"
|
||||
"Enable or disable Monetico options and configure them.","Activer ou désactiver les options Monetico et les configurer."
|
||||
"Enable the Payment Express Option","Activer l'option Paiement Express"
|
||||
"Force the Credit Card Input","Forcer l'autocomplétion de la carte de crédit."
|
||||
"Enable all Payment Options","Activer toutes les options de paiement."
|
||||
"We will display the payment options on the Monetico payment page, from your settings.","Nous allons afficher toutes les options de paiement sur la page de paiement Monetico."
|
||||
"Disable Specific Payment Options","Désactiver certaines options de paiement"
|
||||
"One-time Payment","Paiement en une seule fois"
|
||||
"The purchases are fully paid in one time.","Les achats sont réglés en une fois."
|
||||
"Multi-time Payment","Paiement fractionné"
|
||||
"The purchases are paid in several times.","Les achats sont réglés en plusieurs fois."
|
||||
"Minimum Amount","Montant minimum"
|
||||
"Maximum Amount","Montant maximum"
|
||||
"Several Payment Configuration","Configuration du paiement fractionné"
|
||||
"We will split equally the payment in many capture amount if the values are empty. The total terms rate should be equal to 100%.","Nous allons éclater le paiement en plusieurs captures si les valeurs sont vides. Le total des échéances doit être égal à 100%."
|
||||
"Number of Payment Terms","Nombre d'échéances de paiement"
|
||||
"We will process the payment in many several monthly captures.","Nous allons effectuer les paiements en plusieurs captures mensuelles."
|
||||
"1st Rate Term (%)","Part de la 1ère échéance (%)"
|
||||
"2nd Rate Term (%)","Part de la 2ème échéance (%)"
|
||||
"3rd Rate Term (%)","Part de la 3ème échéance (%)"
|
||||
"4th Rate Term (%)","Part de la 4ème échéance (%)"
|
||||
"We will capture this order rate amount on the first term.","Nous allons capturer cette part du montant de la commande pour la première échéance."
|
||||
"We will capture this order rate amount on the second term.","Nous allons capturer cette part du montant de la commande pour la deuxième échéance."
|
||||
"We will capture this order rate amount on the third term.","Nous allons capturer cette part du montant de la commande pour la troisième échéance."
|
||||
"We will capture this order rate amount on the fourth term.","Nous allons capturer cette part du montant de la commande pour la quatrième échéance."
|
||||
"Cofidis 1euro Payment","Paiement par Cofidis avec 1euro"
|
||||
"The purchases are paid in 3, 5, 10, 20 times or small amounts by the customer, but the merchant is paid in one time.","Les achats sont réglés en 3, 5, 10, 20 fois ou par petits montants par le client, mais le marchand est payé en une seule fois."
|
||||
"Cofidis 3xCB Payment","Paiement par Cofidis avec 3xCB"
|
||||
"The purchases are paid in 3 times by the customer, but the merchant is paid in one time.","Les achats sont réglés en 3 fois par le client, mais le marchand est payé en une seule fois."
|
||||
"Cofidis 4xCB Payment","Paiement par Cofidis avec 4xCB"
|
||||
"The purchases are paid in 4 times by the customer, but the merchant is paid in one time.","Les achats sont réglés en 4 fois par le client, mais le marchand est payé en une seule fois."
|
||||
"PayPal Payment","Paiement par PayPal"
|
||||
"PayPal is a worldwide payment method.","PayPal est une méthode de paiement international."
|
||||
|
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
\Magento\Framework\Component\ComponentRegistrar::register(
|
||||
\Magento\Framework\Component\ComponentRegistrar::MODULE,
|
||||
'Blackbird_Monetico',
|
||||
__DIR__
|
||||
);
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
-->
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<head>
|
||||
<css src="Blackbird_Monetico::css/styles.css"/>
|
||||
</head>
|
||||
</page>
|
||||
@@ -0,0 +1,39 @@
|
||||
@charset "utf-8";
|
||||
|
||||
.monetico-section > .config > .comment:before {
|
||||
display: block;
|
||||
content: '';
|
||||
background: url('../images/monetico-logo.png') no-repeat 0 0 / 455px auto;
|
||||
height: 60px;
|
||||
width: 600px;
|
||||
}
|
||||
.monetico-section > .entry-edit-head > a:after {
|
||||
display: block;
|
||||
content: '';
|
||||
background: url('../images/mastervisa.png') no-repeat 0 0 / 36% auto;
|
||||
float: right;
|
||||
height: 35px;
|
||||
width: 280px;
|
||||
}
|
||||
.monetico-section .monetico-variable-list {
|
||||
padding-left: 2rem;
|
||||
list-style-type: none;
|
||||
}
|
||||
.monetico-section .monetico-variable-list .monetico-variable:before {
|
||||
display: inline-block;
|
||||
content: '-';
|
||||
font-weight: 700;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
.monetico-section .monetico-variable-list .monetico-variable {
|
||||
margin: 0.5rem 0.5rem;
|
||||
}
|
||||
.monetico-section .monetico-variable-list .monetico-variable > strong {
|
||||
display: inline-block;
|
||||
width: 160px;
|
||||
}
|
||||
.monetico-section .monetico-variable-list .monetico-variable > span:before {
|
||||
display: inline-block;
|
||||
content: ':';
|
||||
margin: 0 1rem;
|
||||
}
|
||||
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
-->
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<head>
|
||||
<css src="Blackbird_Monetico::css/monetico.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<referenceBlock name="checkout.root">
|
||||
<arguments>
|
||||
<argument name="jsLayout" xsi:type="array">
|
||||
<item name="components" xsi:type="array">
|
||||
<item name="checkout" xsi:type="array">
|
||||
<item name="children" xsi:type="array">
|
||||
<item name="steps" xsi:type="array">
|
||||
<item name="children" xsi:type="array">
|
||||
<item name="billing-step" xsi:type="array">
|
||||
<item name="children" xsi:type="array">
|
||||
<item name="payment" xsi:type="array">
|
||||
<item name="children" xsi:type="array">
|
||||
<item name="renders" xsi:type="array">
|
||||
<!-- merge payment method renders here -->
|
||||
<item name="children" xsi:type="array">
|
||||
<item name="monetico" xsi:type="array">
|
||||
<item name="component" xsi:type="string">Blackbird_Monetico/js/view/payment/monetico-payments</item>
|
||||
<item name="methods" xsi:type="array">
|
||||
<item name="monetico_onetime" xsi:type="array">
|
||||
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
|
||||
</item>
|
||||
<item name="monetico_multitime" xsi:type="array">
|
||||
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
|
||||
</item>
|
||||
<item name="monetico_1euro" xsi:type="array">
|
||||
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
|
||||
</item>
|
||||
<item name="monetico_3xcb" xsi:type="array">
|
||||
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
|
||||
</item>
|
||||
<item name="monetico_4xcb" xsi:type="array">
|
||||
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
|
||||
</item>
|
||||
<item name="monetico_paypal" xsi:type="array">
|
||||
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
|
||||
</item>
|
||||
</item>
|
||||
</item>
|
||||
</item>
|
||||
</item>
|
||||
</item>
|
||||
</item>
|
||||
</item>
|
||||
</item>
|
||||
</item>
|
||||
</item>
|
||||
</item>
|
||||
</item>
|
||||
</item>
|
||||
</argument>
|
||||
</arguments>
|
||||
</referenceBlock>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* @var \Blackbird\Monetico\Block\Payment\SealedForm $block
|
||||
* @see \Blackbird\Monetico\Block\Payment\SealedForm
|
||||
*/
|
||||
?>
|
||||
<?php if ($block->isPaymentMethodIntegrated()): ?>
|
||||
<iframe class="sealed-form" name="monetico-iframe" src="<?php /* @escapeNotVerified */ echo $block->getPaymentFormActionUrlEncoded() ?>">
|
||||
<?php endif; ?>
|
||||
<div class="sealed-form" id="cmcic-sealed-form">
|
||||
<div class="message info">
|
||||
<span>
|
||||
<?php /* @escapeNotVerified */ echo __('You will be redirected to %1 in a few seconds.', $block->getServiceName()) ?>
|
||||
</span>
|
||||
</div>
|
||||
<form method="POST"
|
||||
action="<?php /* @escapeNotVerified */ echo $block->getPaymentFormAction() ?>"
|
||||
target="_top"
|
||||
name="monetico_payment_checkout"
|
||||
id="monetico_payment_checkout">
|
||||
<fieldset class="fieldset payment">
|
||||
<?php foreach ($block->getSealedFormData() as $key => $value): ?>
|
||||
<input name="<?= /* @escapeNotVerified */ $key ?>" type="hidden" value="<?php /* @escapeNotVerified */ echo $value ?>" />
|
||||
<?php endforeach; ?>
|
||||
</fieldset>
|
||||
<div class="actions-toolbar">
|
||||
<div class="primary">
|
||||
<button type="submit" class="action pay primary" title="<?php /* @escapeNotVerified */ echo __('Place Payment') ?>">
|
||||
<span><?php /* @escapeNotVerified */ echo __('Place Payment') ?></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php if ($block->isPaymentMethodIntegrated()): ?>
|
||||
</iframe>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,105 @@
|
||||
@charset "utf-8";
|
||||
|
||||
/** Iframe style */
|
||||
iframe.sealed-form {
|
||||
width: 622px;
|
||||
height: 270px;
|
||||
border: none;
|
||||
}
|
||||
iframe#cmcic-sealed-form.sealed-form body {
|
||||
zoom: 0.5;
|
||||
}
|
||||
/** Payment Method icons */
|
||||
.payment-method .payment-method-title .label .allowed-payment-icon {
|
||||
display: inline-block;
|
||||
float: right;
|
||||
margin-top: -5px;
|
||||
}
|
||||
.payment-method .payment-method-title .label .allowed-payment-icon .payment-icon.payment_method_monetico_cb {
|
||||
width: 40px;
|
||||
height: 28px;
|
||||
content: url(../images/media/cb.gif);
|
||||
background: url(../images/media/cb.gif) no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
.payment-method .payment-method-title .label .allowed-payment-icon .payment-icon.payment_method_monetico_master {
|
||||
width: 44px;
|
||||
height: 28px;
|
||||
content: url(../images/media/master.gif);
|
||||
background: url(../images/media/master.gif) no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
.payment-method .payment-method-title .label .allowed-payment-icon .payment-icon.payment_method_monetico_visa {
|
||||
width: 45px;
|
||||
height: 28px;
|
||||
content: url(../images/media/visa.gif);
|
||||
background: url(../images/media/visa.gif) no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
.payment-method .payment-method-title .label .allowed-payment-icon .payment-icon.payment_method_monetico_1euro {
|
||||
width: 59px;
|
||||
height: 28px;
|
||||
content: url(../images/media/1euro.png);
|
||||
background: url(../images/media/1euro.png) no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
.payment-method .payment-method-title .label .allowed-payment-icon .payment-icon.payment_method_monetico_3xcb {
|
||||
width: 47px;
|
||||
height: 28px;
|
||||
content: url(../images/media/3xcb.png);
|
||||
background: url(../images/media/3xcb.png) no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
.payment-method .payment-method-title .label .allowed-payment-icon .payment-icon.payment_method_monetico_4xcb {
|
||||
width: 47px;
|
||||
height: 28px;
|
||||
content: url(../images/media/4xcb.png);
|
||||
background: url(../images/media/4xcb.png) no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
.payment-method .payment-method-title .label .allowed-payment-icon .payment-icon.payment_method_monetico_paypal {
|
||||
width: 45px;
|
||||
height: 28px;
|
||||
content: url(../images/media/paypal.jpg);
|
||||
background: url(../images/media/paypal.jpg) no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
/** Payment Method Service icons */
|
||||
.payment-method .payment-method-content .fieldset .payment-method-icon .payment-method-bank-icon {
|
||||
display: inline-block;
|
||||
margin: 1rem;
|
||||
height: 5rem;
|
||||
width: auto;
|
||||
}
|
||||
.payment-method .payment-method-content .fieldset .payment-method-icon .payment_method_monetico_cic
|
||||
{
|
||||
width: 110px;
|
||||
height: 50px;
|
||||
content: url(../images/cic.jpg);
|
||||
background: url(../images/cic.jpg) no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
.payment-method .payment-method-content .fieldset .payment-method-icon .payment_method_monetico_cm
|
||||
{
|
||||
width: 250px;
|
||||
height: 50px;
|
||||
content: url(../images/credit-mutuel.jpg);
|
||||
background: url(../images/credit-mutuel.jpg) no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
.payment-method .payment-method-content .fieldset .payment-method-icon .payment_method_monetico_cofidis
|
||||
{
|
||||
width: 75px;
|
||||
height: 50px;
|
||||
content: url(../images/cofidis.png);
|
||||
background: url(../images/cofidis.png) no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
.payment-method .payment-method-content .fieldset .payment-method-icon .payment_method_monetico_paypal
|
||||
{
|
||||
width: 150px;
|
||||
height: 50px;
|
||||
content: url(../images/paypal.png);
|
||||
background: url(../images/paypal.png) no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Copyright © 2016 Magento. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
define(
|
||||
[
|
||||
'Magento_Checkout/js/model/quote',
|
||||
'Magento_Checkout/js/model/url-builder',
|
||||
'Magento_Customer/js/model/customer',
|
||||
'Blackbird_Monetico/js/model/place-order'
|
||||
],
|
||||
function (quote, urlBuilder, customer, placeOrderService) {
|
||||
'use strict';
|
||||
|
||||
return function (paymentData, messageContainer) {
|
||||
var serviceUrl, payload;
|
||||
|
||||
payload = {
|
||||
cartId: quote.getQuoteId(),
|
||||
billingAddress: quote.billingAddress(),
|
||||
paymentMethod: paymentData
|
||||
};
|
||||
|
||||
if (customer.isLoggedIn()) {
|
||||
serviceUrl = urlBuilder.createUrl('/carts/mine/payment-information', {});
|
||||
} else {
|
||||
serviceUrl = urlBuilder.createUrl('/guest-carts/:quoteId/payment-information', {
|
||||
quoteId: quote.getQuoteId()
|
||||
});
|
||||
payload.email = quote.guestEmail;
|
||||
}
|
||||
|
||||
return placeOrderService(serviceUrl, payload, messageContainer);
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
/*browser:true*/
|
||||
/*global define*/
|
||||
define(
|
||||
[
|
||||
'jquery',
|
||||
'mage/url',
|
||||
'Magento_Checkout/js/model/full-screen-loader',
|
||||
'Magento_Checkout/js/model/error-processor'
|
||||
],
|
||||
function (
|
||||
$,
|
||||
urlBuilder,
|
||||
fullScreenLoader,
|
||||
errorProcessor
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
return function (orderId, methodCode, containerId) {
|
||||
var serviceUrl = urlBuilder.build('monetico/payment/sealedform/order_id/' + orderId + '/method_code/' + methodCode),
|
||||
params = {};
|
||||
|
||||
var request = $.ajax({
|
||||
url: serviceUrl,
|
||||
data: params,
|
||||
type: 'POST'
|
||||
});
|
||||
|
||||
request.done(function (data) {
|
||||
var container = $('#' + containerId);
|
||||
|
||||
container.html(data);
|
||||
|
||||
var sealedForm = container.find('#monetico_payment_checkout');
|
||||
|
||||
if (sealedForm.length) {
|
||||
try {
|
||||
sealedForm.submit();
|
||||
} catch (e) {
|
||||
fullScreenLoader.stopLoader();
|
||||
console.log('Please, copy paste the following error message and contact us: ' + e.message);
|
||||
}
|
||||
} else {
|
||||
fullScreenLoader.stopLoader();
|
||||
}
|
||||
});
|
||||
|
||||
request.fail(function (response) {
|
||||
errorProcessor.process(response, $('#', containerId));
|
||||
fullScreenLoader.stopLoader();
|
||||
});
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
/*browser:true*/
|
||||
/*global define*/
|
||||
define(
|
||||
[
|
||||
'jquery',
|
||||
'Magento_Checkout/js/model/quote',
|
||||
'Magento_Checkout/js/model/url-builder',
|
||||
'mage/storage',
|
||||
'mage/url',
|
||||
'Magento_Checkout/js/model/error-processor',
|
||||
'Magento_Customer/js/model/customer',
|
||||
'Magento_Checkout/js/model/full-screen-loader'
|
||||
],
|
||||
function ($, quote, urlBuilder, storage, url, errorProcessor, customer, fullScreenLoader) {
|
||||
'use strict';
|
||||
|
||||
return function (messageContainer) {
|
||||
var serviceUrl,
|
||||
payload,
|
||||
paymentData = quote.paymentMethod();
|
||||
|
||||
/**
|
||||
* Checkout for guest and registered customer.
|
||||
*/
|
||||
if (!customer.isLoggedIn()) {
|
||||
serviceUrl = urlBuilder.createUrl('/guest-carts/:quoteId/payment-information', {
|
||||
quoteId: quote.getQuoteId()
|
||||
});
|
||||
payload = {
|
||||
cartId: quote.getQuoteId(),
|
||||
email: quote.guestEmail,
|
||||
paymentMethod: paymentData,
|
||||
billingAddress: quote.billingAddress()
|
||||
};
|
||||
} else {
|
||||
serviceUrl = urlBuilder.createUrl('/carts/mine/payment-information', {});
|
||||
payload = {
|
||||
cartId: quote.getQuoteId(),
|
||||
paymentMethod: paymentData,
|
||||
billingAddress: quote.billingAddress()
|
||||
};
|
||||
}
|
||||
fullScreenLoader.startLoader();
|
||||
|
||||
return storage.post(
|
||||
serviceUrl, JSON.stringify(payload)
|
||||
).done(
|
||||
function () {
|
||||
/* Silence is golden */
|
||||
}
|
||||
).fail(
|
||||
function (response) {
|
||||
errorProcessor.process(response, messageContainer);
|
||||
fullScreenLoader.stopLoader();
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright © 2016 Magento. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
define(
|
||||
[
|
||||
'mage/storage',
|
||||
'Magento_Checkout/js/model/error-processor',
|
||||
'Magento_Checkout/js/model/full-screen-loader'
|
||||
],
|
||||
function (storage, errorProcessor, fullScreenLoader) {
|
||||
'use strict';
|
||||
|
||||
return function (serviceUrl, payload, messageContainer) {
|
||||
fullScreenLoader.startLoader();
|
||||
|
||||
return storage.post(
|
||||
serviceUrl, JSON.stringify(payload)
|
||||
).fail(
|
||||
function (response) {
|
||||
errorProcessor.process(response, messageContainer);
|
||||
fullScreenLoader.stopLoader();
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,123 @@
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
/*browser:true*/
|
||||
/*global define*/
|
||||
define(
|
||||
[
|
||||
'jquery',
|
||||
'Magento_Checkout/js/view/payment/default',
|
||||
'Magento_Checkout/js/model/payment/additional-validators',
|
||||
'Magento_Checkout/js/model/full-screen-loader',
|
||||
'Blackbird_Monetico/js/action/set-payment-method',
|
||||
'Blackbird_Monetico/js/action/process-sealed-form',
|
||||
'Blackbird_Monetico/js/action/place-order'
|
||||
],
|
||||
function (
|
||||
$,
|
||||
Component,
|
||||
additionalValidators,
|
||||
fullScreenLoader,
|
||||
setPaymentMethod,
|
||||
processSealedForm,
|
||||
placeOrderAction
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
return Component.extend({
|
||||
placeOrderHandler: null,
|
||||
validateHandler: null,
|
||||
|
||||
initialize: function () {
|
||||
this._super();
|
||||
this.redirectAfterPlaceOrder = false;
|
||||
return this;
|
||||
},
|
||||
|
||||
setPlaceOrderHandler: function(handler) {
|
||||
this.placeOrderHandler = handler;
|
||||
},
|
||||
|
||||
setValidateHandler: function(handler) {
|
||||
this.validateHandler = handler;
|
||||
},
|
||||
|
||||
context: function() {
|
||||
return this;
|
||||
},
|
||||
|
||||
isActive: function() {
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Process Monetico
|
||||
*
|
||||
* @override
|
||||
*/
|
||||
continueToMonetico: function () {
|
||||
fullScreenLoader.startLoader();
|
||||
this.placeOrder();
|
||||
fullScreenLoader.stopLoader();
|
||||
},
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
getPlaceOrderDeferredObject: function () {
|
||||
return $.when(
|
||||
placeOrderAction(this.getData(), this.messageContainer)
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Place order.
|
||||
*/
|
||||
placeOrder: function (data, event) {
|
||||
var self = this;
|
||||
|
||||
if (event) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (this.validate() && additionalValidators.validate()) {
|
||||
this.isPlaceOrderActionAllowed(false);
|
||||
|
||||
this.getPlaceOrderDeferredObject()
|
||||
.fail(
|
||||
function () {
|
||||
self.isPlaceOrderActionAllowed(true);
|
||||
}
|
||||
).done(
|
||||
function (orderId) {
|
||||
self.afterPlaceOrder(orderId);
|
||||
}
|
||||
);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Call the form with ajax
|
||||
*
|
||||
* @override
|
||||
*/
|
||||
afterPlaceOrder: function (orderId) {
|
||||
$.when(processSealedForm(orderId, this.getCode(), 'checkout-step-payment'));
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
/*browser:true*/
|
||||
/*global define*/
|
||||
define(
|
||||
[
|
||||
'jquery',
|
||||
'Blackbird_Monetico/js/view/payment/default',
|
||||
],
|
||||
function (
|
||||
$,
|
||||
Component
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
return Component.extend({
|
||||
defaults: {
|
||||
template: 'Blackbird_Monetico/payment/monetico-euro'
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
/*browser:true*/
|
||||
/*global define*/
|
||||
define(
|
||||
[
|
||||
'jquery',
|
||||
'Blackbird_Monetico/js/view/payment/default',
|
||||
],
|
||||
function (
|
||||
$,
|
||||
Component
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
return Component.extend({
|
||||
defaults: {
|
||||
template: 'Blackbird_Monetico/payment/monetico-3xcb'
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
/*browser:true*/
|
||||
/*global define*/
|
||||
define(
|
||||
[
|
||||
'jquery',
|
||||
'Blackbird_Monetico/js/view/payment/default',
|
||||
],
|
||||
function (
|
||||
$,
|
||||
Component
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
return Component.extend({
|
||||
defaults: {
|
||||
template: 'Blackbird_Monetico/payment/monetico-4xcb'
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
/*browser:true*/
|
||||
/*global define*/
|
||||
define(
|
||||
[
|
||||
'jquery',
|
||||
'Blackbird_Monetico/js/view/payment/default',
|
||||
],
|
||||
function (
|
||||
$,
|
||||
Component
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
return Component.extend({
|
||||
defaults: {
|
||||
template: 'Blackbird_Monetico/payment/monetico-multitime'
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
/*browser:true*/
|
||||
/*global define*/
|
||||
define(
|
||||
[
|
||||
'jquery',
|
||||
'Blackbird_Monetico/js/view/payment/default',
|
||||
],
|
||||
function (
|
||||
$,
|
||||
Component
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
return Component.extend({
|
||||
defaults: {
|
||||
template: 'Blackbird_Monetico/payment/monetico-onetime'
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
/*browser:true*/
|
||||
/*global define*/
|
||||
define(
|
||||
[
|
||||
'jquery',
|
||||
'Blackbird_Monetico/js/view/payment/default',
|
||||
],
|
||||
function (
|
||||
$,
|
||||
Component
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
return Component.extend({
|
||||
defaults: {
|
||||
template: 'Blackbird_Monetico/payment/monetico-paypal'
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
/*browser:true*/
|
||||
/*global define*/
|
||||
define(
|
||||
[
|
||||
'uiComponent',
|
||||
'Magento_Checkout/js/model/payment/renderer-list'
|
||||
],
|
||||
function (
|
||||
Component,
|
||||
rendererList
|
||||
) {
|
||||
'use strict';
|
||||
rendererList.push(
|
||||
{
|
||||
type: 'monetico_onetime',
|
||||
component: 'Blackbird_Monetico/js/view/payment/method-renderer/monetico-onetime'
|
||||
},
|
||||
{
|
||||
type: 'monetico_multitime',
|
||||
component: 'Blackbird_Monetico/js/view/payment/method-renderer/monetico-multitime'
|
||||
},
|
||||
{
|
||||
type: 'monetico_1euro',
|
||||
component: 'Blackbird_Monetico/js/view/payment/method-renderer/monetico-1euro'
|
||||
},
|
||||
{
|
||||
type: 'monetico_3xcb',
|
||||
component: 'Blackbird_Monetico/js/view/payment/method-renderer/monetico-3xcb'
|
||||
},
|
||||
{
|
||||
type: 'monetico_4xcb',
|
||||
component: 'Blackbird_Monetico/js/view/payment/method-renderer/monetico-4xcb'
|
||||
},
|
||||
{
|
||||
type: 'monetico_paypal',
|
||||
component: 'Blackbird_Monetico/js/view/payment/method-renderer/monetico-paypal'
|
||||
}
|
||||
);
|
||||
|
||||
/** Add view logic here if needed */
|
||||
return Component.extend({});
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,71 @@
|
||||
<!--
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
-->
|
||||
<div class="payment-method" data-bind="css: {'_active': (getCode() == isChecked())}">
|
||||
<div class="payment-method-title field choice">
|
||||
<input type="radio"
|
||||
name="payment[method]"
|
||||
class="radio"
|
||||
data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()" />
|
||||
<label data-bind="attr: {'for': getCode()}" class="label">
|
||||
<div class="allowed-payment-icon">
|
||||
<div class="payment-icon payment_method_monetico_3xcb"></div>
|
||||
</div>
|
||||
<span data-bind="text: getTitle()"></span>
|
||||
<!-- <a data-bind="attr: {href: getPaymentAcceptanceMarkHref()}, click: showAcceptanceWindow" class="action action-help">--><!--</a> -->
|
||||
</label>
|
||||
</div>
|
||||
<div class="payment-method-content">
|
||||
<!-- ko foreach: getRegion('messages') -->
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<!--/ko-->
|
||||
<div class="payment-method-billing-address">
|
||||
<!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<!--/ko-->
|
||||
</div>
|
||||
<br>
|
||||
<fieldset class="fieldset" data-bind='attr: {id: "payment_form_" + getCode()}'>
|
||||
<div class="payment-method-note">
|
||||
<!-- ko i18n: 'Payment through the Cofidis service.' --><!-- /ko -->
|
||||
</div>
|
||||
<div class="payment-method-icon">
|
||||
<div class="payment-method-bank-icon payment_method_monetico_cofidis"></div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="checkout-agreements-block">
|
||||
<!-- ko foreach: $parent.getRegion('before-place-order') -->
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<!--/ko-->
|
||||
</div>
|
||||
<div class="actions-toolbar">
|
||||
<div class="primary">
|
||||
<button class="action primary checkout"
|
||||
type="submit"
|
||||
data-bind="
|
||||
click: continueToMonetico,
|
||||
title: {title: $t('Place Order')},
|
||||
css: {disabled: !isPlaceOrderActionAllowed()},
|
||||
enable: (getCode() == isChecked())
|
||||
"
|
||||
disabled>
|
||||
<span data-bind="i18n: 'Place Order'"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,71 @@
|
||||
<!--
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
-->
|
||||
<div class="payment-method" data-bind="css: {'_active': (getCode() == isChecked())}">
|
||||
<div class="payment-method-title field choice">
|
||||
<input type="radio"
|
||||
name="payment[method]"
|
||||
class="radio"
|
||||
data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()" />
|
||||
<label data-bind="attr: {'for': getCode()}" class="label">
|
||||
<div class="allowed-payment-icon">
|
||||
<div class="payment-icon payment_method_monetico_4xcb"></div>
|
||||
</div>
|
||||
<span data-bind="text: getTitle()"></span>
|
||||
<!-- <a data-bind="attr: {href: getPaymentAcceptanceMarkHref()}, click: showAcceptanceWindow" class="action action-help">--><!--</a> -->
|
||||
</label>
|
||||
</div>
|
||||
<div class="payment-method-content">
|
||||
<!-- ko foreach: getRegion('messages') -->
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<!--/ko-->
|
||||
<div class="payment-method-billing-address">
|
||||
<!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<!--/ko-->
|
||||
</div>
|
||||
<br>
|
||||
<fieldset class="fieldset" data-bind='attr: {id: "payment_form_" + getCode()}'>
|
||||
<div class="payment-method-note">
|
||||
<!-- ko i18n: 'Payment through the Cofidis service.' --><!-- /ko -->
|
||||
</div>
|
||||
<div class="payment-method-icon">
|
||||
<div class="payment-method-bank-icon payment_method_monetico_cofidis"></div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="checkout-agreements-block">
|
||||
<!-- ko foreach: $parent.getRegion('before-place-order') -->
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<!--/ko-->
|
||||
</div>
|
||||
<div class="actions-toolbar">
|
||||
<div class="primary">
|
||||
<button class="action primary checkout"
|
||||
type="submit"
|
||||
data-bind="
|
||||
click: continueToMonetico,
|
||||
title: {title: $t('Place Order')},
|
||||
css: {disabled: !isPlaceOrderActionAllowed()},
|
||||
enable: (getCode() == isChecked())
|
||||
"
|
||||
disabled>
|
||||
<span data-bind="i18n: 'Place Order'"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,71 @@
|
||||
<!--
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
-->
|
||||
<div class="payment-method" data-bind="css: {'_active': (getCode() == isChecked())}">
|
||||
<div class="payment-method-title field choice">
|
||||
<input type="radio"
|
||||
name="payment[method]"
|
||||
class="radio"
|
||||
data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()" />
|
||||
<label data-bind="attr: {'for': getCode()}" class="label">
|
||||
<div class="allowed-payment-icon">
|
||||
<div class="payment-icon payment_method_monetico_1euro"></div>
|
||||
</div>
|
||||
<span data-bind="text: getTitle()"></span>
|
||||
<!-- <a data-bind="attr: {href: getPaymentAcceptanceMarkHref()}, click: showAcceptanceWindow" class="action action-help">--><!--</a> -->
|
||||
</label>
|
||||
</div>
|
||||
<div class="payment-method-content">
|
||||
<!-- ko foreach: getRegion('messages') -->
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<!--/ko-->
|
||||
<div class="payment-method-billing-address">
|
||||
<!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<!--/ko-->
|
||||
</div>
|
||||
<br>
|
||||
<fieldset class="fieldset" data-bind='attr: {id: "payment_form_" + getCode()}'>
|
||||
<div class="payment-method-note">
|
||||
<!-- ko i18n: 'Payment through the Cofidis service.' --><!-- /ko -->
|
||||
</div>
|
||||
<div class="payment-method-icon">
|
||||
<div class="payment-method-bank-icon payment_method_monetico_cofidis"></div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="checkout-agreements-block">
|
||||
<!-- ko foreach: $parent.getRegion('before-place-order') -->
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<!--/ko-->
|
||||
</div>
|
||||
<div class="actions-toolbar">
|
||||
<div class="primary">
|
||||
<button class="action primary checkout"
|
||||
type="submit"
|
||||
data-bind="
|
||||
click: continueToMonetico,
|
||||
title: {title: $t('Place Order')},
|
||||
css: {disabled: !isPlaceOrderActionAllowed()},
|
||||
enable: (getCode() == isChecked())
|
||||
"
|
||||
disabled>
|
||||
<span data-bind="i18n: 'Place Order'"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,74 @@
|
||||
<!--
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
-->
|
||||
<div class="payment-method" data-bind="css: {'_active': (getCode() == isChecked())}">
|
||||
<div class="payment-method-title field choice">
|
||||
<input type="radio"
|
||||
name="payment[method]"
|
||||
class="radio"
|
||||
data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()" />
|
||||
<label data-bind="attr: {'for': getCode()}" class="label">
|
||||
<div class="allowed-payment-icon">
|
||||
<div class="payment-icon payment_method_monetico_cb"></div>
|
||||
<div class="payment-icon payment_method_monetico_master"></div>
|
||||
<div class="payment-icon payment_method_monetico_visa"></div>
|
||||
</div>
|
||||
<span data-bind="text: getTitle()"></span>
|
||||
<!-- <a data-bind="attr: {href: getPaymentAcceptanceMarkHref()}, click: showAcceptanceWindow" class="action action-help">--><!--</a> -->
|
||||
</label>
|
||||
</div>
|
||||
<div class="payment-method-content">
|
||||
<!-- ko foreach: getRegion('messages') -->
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<!--/ko-->
|
||||
<div class="payment-method-billing-address">
|
||||
<!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<!--/ko-->
|
||||
</div>
|
||||
<br>
|
||||
<fieldset class="fieldset" data-bind='attr: {id: "payment_form_" + getCode()}'>
|
||||
<div class="payment-method-note">
|
||||
<!-- ko i18n: 'Payment through the CM-CIC service.' --><!-- /ko -->
|
||||
</div>
|
||||
<div class="payment-method-icon">
|
||||
<div class="payment-method-bank-icon payment_method_monetico_cic"></div>
|
||||
<div class="payment-method-bank-icon payment_method_monetico_cm"></div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="checkout-agreements-block">
|
||||
<!-- ko foreach: $parent.getRegion('before-place-order') -->
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<!--/ko-->
|
||||
</div>
|
||||
<div class="actions-toolbar">
|
||||
<div class="primary">
|
||||
<button class="action primary checkout"
|
||||
type="submit"
|
||||
data-bind="
|
||||
click: continueToMonetico,
|
||||
title: {title: $t('Place Order')},
|
||||
css: {disabled: !isPlaceOrderActionAllowed()},
|
||||
enable: (getCode() == isChecked())
|
||||
"
|
||||
disabled>
|
||||
<span data-bind="i18n: 'Place Order'"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,74 @@
|
||||
<!--
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
-->
|
||||
<div class="payment-method" data-bind="css: {'_active': (getCode() == isChecked())}">
|
||||
<div class="payment-method-title field choice">
|
||||
<input type="radio"
|
||||
name="payment[method]"
|
||||
class="radio"
|
||||
data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()" />
|
||||
<label data-bind="attr: {'for': getCode()}" class="label">
|
||||
<div class="allowed-payment-icon">
|
||||
<div class="payment-icon payment_method_monetico_cb"></div>
|
||||
<div class="payment-icon payment_method_monetico_master"></div>
|
||||
<div class="payment-icon payment_method_monetico_visa"></div>
|
||||
</div>
|
||||
<span data-bind="text: getTitle()"></span>
|
||||
<!-- <a data-bind="attr: {href: getPaymentAcceptanceMarkHref()}, click: showAcceptanceWindow" class="action action-help">--><!--</a> -->
|
||||
</label>
|
||||
</div>
|
||||
<div class="payment-method-content">
|
||||
<!-- ko foreach: getRegion('messages') -->
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<!--/ko-->
|
||||
<div class="payment-method-billing-address">
|
||||
<!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<!--/ko-->
|
||||
</div>
|
||||
<br>
|
||||
<fieldset class="fieldset" data-bind='attr: {id: "payment_form_" + getCode()}'>
|
||||
<div class="payment-method-note">
|
||||
<!-- ko i18n: 'Payment through the CM-CIC service.' --><!-- /ko -->
|
||||
</div>
|
||||
<div class="payment-method-icon">
|
||||
<div class="payment-method-bank-icon payment_method_monetico_cic"></div>
|
||||
<div class="payment-method-bank-icon payment_method_monetico_cm"></div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="checkout-agreements-block">
|
||||
<!-- ko foreach: $parent.getRegion('before-place-order') -->
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<!--/ko-->
|
||||
</div>
|
||||
<div class="actions-toolbar">
|
||||
<div class="primary">
|
||||
<button class="action primary checkout"
|
||||
type="submit"
|
||||
data-bind="
|
||||
click: continueToMonetico,
|
||||
title: {title: $t('Place Order')},
|
||||
css: {disabled: !isPlaceOrderActionAllowed()},
|
||||
enable: (getCode() == isChecked())
|
||||
"
|
||||
disabled>
|
||||
<span data-bind="i18n: 'Place Order'"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,71 @@
|
||||
<!--
|
||||
/**
|
||||
* Blackbird Monetico Module
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to contact@bird.eu so we can send you a copy immediately.
|
||||
*
|
||||
* @category Blackbird
|
||||
* @package Blackbird_Monetico
|
||||
* @copyright Copyright (c) 2017 Blackbird (https://black.bird.eu)
|
||||
* @author Blackbird Team
|
||||
* @license https://store.bird.eu/license/
|
||||
* @support help@bird.eu
|
||||
*/
|
||||
-->
|
||||
<div class="payment-method" data-bind="css: {'_active': (getCode() == isChecked())}">
|
||||
<div class="payment-method-title field choice">
|
||||
<input type="radio"
|
||||
name="payment[method]"
|
||||
class="radio"
|
||||
data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()" />
|
||||
<label data-bind="attr: {'for': getCode()}" class="label">
|
||||
<div class="allowed-payment-icon">
|
||||
<div class="payment-icon payment_method_monetico_paypal"></div>
|
||||
</div>
|
||||
<span data-bind="text: getTitle()"></span>
|
||||
<!-- <a data-bind="attr: {href: getPaymentAcceptanceMarkHref()}, click: showAcceptanceWindow" class="action action-help">--><!--</a> -->
|
||||
</label>
|
||||
</div>
|
||||
<div class="payment-method-content">
|
||||
<!-- ko foreach: getRegion('messages') -->
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<!--/ko-->
|
||||
<div class="payment-method-billing-address">
|
||||
<!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<!--/ko-->
|
||||
</div>
|
||||
<br>
|
||||
<fieldset class="fieldset" data-bind='attr: {id: "payment_form_" + getCode()}'>
|
||||
<div class="payment-method-note">
|
||||
<!-- ko i18n: 'Payment through the PayPal service.' --><!-- /ko -->
|
||||
</div>
|
||||
<div class="payment-method-icon">
|
||||
<div class="payment-method-bank-icon payment_method_monetico_paypal"></div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="checkout-agreements-block">
|
||||
<!-- ko foreach: $parent.getRegion('before-place-order') -->
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<!--/ko-->
|
||||
</div>
|
||||
<div class="actions-toolbar">
|
||||
<div class="primary">
|
||||
<button class="action primary checkout"
|
||||
type="submit"
|
||||
data-bind="
|
||||
click: continueToMonetico,
|
||||
title: {title: $t('Place Order')},
|
||||
css: {disabled: !isPlaceOrderActionAllowed()},
|
||||
enable: (getCode() == isChecked())
|
||||
"
|
||||
disabled>
|
||||
<span data-bind="i18n: 'Place Order'"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Edeclic\Catalog\Block\Product;
|
||||
|
||||
class View extends \Magento\Catalog\Block\Product\View
|
||||
{
|
||||
public function getValeurNutritionnelle()
|
||||
{
|
||||
return $this->getProduct()->getValeurNutritionnelle();
|
||||
}
|
||||
|
||||
public function getPoidsNet()
|
||||
{
|
||||
return $this->getProduct()->getSku();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Edeclic_Catalog" setup_version="1.0.0">
|
||||
</module>
|
||||
</config>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
\Magento\Framework\Component\ComponentRegistrar::register(
|
||||
\Magento\Framework\Component\ComponentRegistrar::MODULE,
|
||||
'Edeclic_Catalog',
|
||||
__DIR__
|
||||
);
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<body>
|
||||
<referenceBlock name="product.info.details">
|
||||
<block class="Edeclic\Catalog\Block\Product\View" name="listeingredient.tab" as="listeingredient" template="listeingredient.phtml" group="detailed_info" >
|
||||
<arguments>
|
||||
<argument translate="true" name="title" xsi:type="string">Liste des ingrédients</argument>
|
||||
</arguments>
|
||||
</block>
|
||||
<block class="Edeclic\Catalog\Block\Product\View" name="valeurnutritionnelle.tab" as="valeurnutritionnelle" template="valeurnutritionnelle.phtml" group="detailed_info" >
|
||||
<arguments>
|
||||
<argument translate="true" name="title" xsi:type="string">Valeurs nutritionnelles</argument>
|
||||
</arguments>
|
||||
</block>
|
||||
<block class="Edeclic\Catalog\Block\Product\View" name="ideerecette.tab" as="ideerecette" template="ideerecette.phtml" group="detailed_info" >
|
||||
<arguments>
|
||||
<argument translate="true" name="title" xsi:type="string">Idée recette</argument>
|
||||
</arguments>
|
||||
</block>
|
||||
</referenceBlock>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1 @@
|
||||
<?= $this->getIdeeRecette(); ?>
|
||||
@@ -0,0 +1 @@
|
||||
<?= $this->getListeDesIngredients(); ?>
|
||||
@@ -0,0 +1 @@
|
||||
<?= $this->getValeurNutrionnelle(); ?>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Edeclic\Customer\Block\Form;
|
||||
|
||||
class Login extends \Magento\Customer\Block\Form\Login
|
||||
{
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
protected function _prepareLayout()
|
||||
{
|
||||
$this->pageConfig->getTitle()->set(__('My Account'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Edeclic\Customer\Block\Form;
|
||||
|
||||
class Register extends \Magento\Customer\Block\Form\Register
|
||||
{
|
||||
/**
|
||||
* Retrieve form data
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getFormData()
|
||||
{
|
||||
$data = $this->getData('form_data');
|
||||
if ($data === null) {
|
||||
$formData = $this->_customerSession->getCustomerFormData(true);
|
||||
$data = new \Magento\Framework\DataObject();
|
||||
if ($formData) {
|
||||
$data->addData($formData);
|
||||
$data->setCustomerData(1);
|
||||
}
|
||||
if (isset($data['region_id'])) {
|
||||
$data['region_id'] = (int)$data['region_id'];
|
||||
}
|
||||
$this->setData('form_data', $data);
|
||||
}
|
||||
if(!$data->getEmail()){
|
||||
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
|
||||
$session = $objectManager->get('\Magento\Customer\Model\Session');
|
||||
$data->setEmail($session->getData('email'));
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||