Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
Release 1.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Schurter committed Sep 20, 2018
1 parent c93a46a commit 055ccb7
Show file tree
Hide file tree
Showing 13 changed files with 141 additions and 14 deletions.
7 changes: 7 additions & 0 deletions Controller/Adminhtml/Order/Refund.php
Expand Up @@ -94,6 +94,13 @@ public function execute()
} else {
$this->messageManager->addSuccessMessage(\__('Successfully refunded.'));
}
} catch (\Wallee\Sdk\ApiException $e) {
if ($e->getResponseObject() instanceof \Wallee\Sdk\Model\ClientError) {
$this->messageManager->addErrorMessage($e->getResponseObject()->getMessage());
} else {
$this->messageManager->addErrorMessage(
\__('There has been an error while sending the refund to the gateway.'));
}
} catch (\Exception $e) {
$this->messageManager->addErrorMessage(
\__('There has been an error while sending the refund to the gateway.'));
Expand Down
84 changes: 84 additions & 0 deletions Cron/Refund.php
@@ -0,0 +1,84 @@
<?php
/**
* wallee Magento 2
*
* This Magento 2 extension enables to process payments with wallee (https://www.wallee.com/).
*
* @package Wallee_Payment
* @author customweb GmbH (http://www.customweb.com/)
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Software License (ASL 2.0)
*/
namespace Wallee\Payment\Cron;

use Magento\Framework\Api\SearchCriteriaBuilder;
use Psr\Log\LoggerInterface;
use Wallee\Payment\Api\RefundJobRepositoryInterface;
use Wallee\Payment\Model\ApiClient;
use Wallee\Sdk\Service\RefundService;

/**
* Class to handle pending refund jobs.
*/
class Refund
{

/**
*
* @var LoggerInterface
*/
protected $_logger;

/**
*
* @var RefundJobRepositoryInterface
*/
protected $_refundJobRepository;

/**
*
* @var SearchCriteriaBuilder
*/
protected $_searchCriteriaBuilder;

/**
*
* @var ApiClient
*/
protected $_apiClient;

/**
*
* @param LoggerInterface $logger
* @param RefundJobRepositoryInterface $refundJobRepository
* @param SearchCriteriaBuilder $searchCriteriaBuilder
* @param ApiClient $apiClient
*/
public function __construct(LoggerInterface $logger, RefundJobRepositoryInterface $refundJobRepository,
SearchCriteriaBuilder $searchCriteriaBuilder, ApiClient $apiClient)
{
$this->_logger = $logger;
$this->_refundJobRepository = $refundJobRepository;
$this->_searchCriteriaBuilder = $searchCriteriaBuilder;
$this->_apiClient = $apiClient;
}

public function execute()
{
$searchCriteria = $this->_searchCriteriaBuilder->setPageSize(100)->create();
$refundJobs = $this->_refundJobRepository->getList($searchCriteria)->getItems();
foreach ($refundJobs as $refundJob) {
try {
$this->_apiClient->getService(RefundService::class)->refund($refundJob->getSpaceId(),
$refundJob->getRefund());
} catch (\Wallee\Sdk\ApiException $e) {
if ($e->getResponseObject() instanceof \Wallee\Sdk\Model\ClientError) {
$this->_refundJobRepository->delete($refundJob);
} else {
$this->_logger->critical($e);
}
} catch (\Exception $e) {
$this->_logger->critical($e);
}
}
}
}
18 changes: 13 additions & 5 deletions Gateway/Command/RefundCommand.php
Expand Up @@ -86,8 +86,6 @@ public function __construct(LoggerInterface $logger, LocaleHelper $localeHelper,

public function execute(array $commandSubject)
{
$amount = SubjectReader::readAmount($commandSubject);

/** @var \Magento\Sales\Model\Order\Payment $payment */
$payment = SubjectReader::readPayment($commandSubject)->getPayment();
$creditmemo = $payment->getCreditmemo();
Expand All @@ -99,6 +97,17 @@ public function execute(array $commandSubject)
$refund = $this->_apiClient->getService(RefundService::class)->refund(
$creditmemo->getOrder()
->getWalleeSpaceId(), $refundJob->getRefund());
} catch (\Wallee\Sdk\ApiException $e) {
if ($e->getResponseObject() instanceof \Wallee\Sdk\Model\ClientError) {
$this->_refundJobRepository->delete($refundJob);
throw new \Magento\Framework\Exception\LocalizedException(
\__($e->getResponseObject()->getMessage()));
} else {
$creditmemo->setWalleeKeepRefundJob(true);
$this->_logger->critical($e);
throw new \Magento\Framework\Exception\LocalizedException(
\__('There has been an error while sending the refund to the gateway.'));
}
} catch (\Exception $e) {
$creditmemo->setWalleeKeepRefundJob(true);
$this->_logger->critical($e);
Expand All @@ -108,9 +117,8 @@ public function execute(array $commandSubject)

if ($refund->getState() == RefundState::FAILED) {
throw new \Magento\Framework\Exception\LocalizedException(
$this->_localeHelper->translate(
$refund->getFailureReason()
->getDescription()));
$this->_localeHelper->translate($refund->getFailureReason()
->getDescription()));
} elseif ($refund->getState() == RefundState::PENDING || $refund->getState() == RefundState::MANUAL_CHECK) {
$creditmemo->setWalleeKeepRefundJob(true);
throw new \Magento\Framework\Exception\LocalizedException(
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -10,8 +10,8 @@ This repository contains the Magento 2 extension that enables to process payment

## Documentation

* [Documentation](https://plugin-documentation.wallee.com/wallee-payment/magento-2/1.0.6/docs/en/documentation.html)
* [Documentation](https://plugin-documentation.wallee.com/wallee-payment/magento-2/1.0.7/docs/en/documentation.html)

## License

Please see the [license file](https://github.com/wallee-payment/magento-2/blob/1.0.6/LICENSE) for more information.
Please see the [license file](https://github.com/wallee-payment/magento-2/blob/1.0.7/LICENSE) for more information.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -17,7 +17,7 @@
}
],
"type" : "magento2-module",
"version" : "1.0.6",
"version" : "1.0.7",
"require" : {
"php" : "7.*",
"wallee/sdk": "1.1.9"
Expand Down
2 changes: 1 addition & 1 deletion docs/en/documentation.html
Expand Up @@ -21,7 +21,7 @@ <h2>Documentation</h2> </div>
</a>
</li>
<li>
<a href="https://github.com/wallee-payment/magento-2/releases/tag/1.0.6/">
<a href="https://github.com/wallee-payment/magento-2/releases/tag/1.0.7/">
Source
</a>
</li>
Expand Down
3 changes: 2 additions & 1 deletion etc/adminhtml/system.xml
Expand Up @@ -18,7 +18,7 @@
<resource>Wallee_Payment::config</resource>
<group id="information" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Information</label>
<comment><![CDATA[If you need help setting up the wallee extension, check out the <a href="https://plugin-documentation.wallee.com/wallee-payment/magento-2/1.0.6/docs/en/documentation.html" target="_blank">documentation</a>.]]></comment>
<comment><![CDATA[If you need help setting up the wallee extension, check out the <a href="https://plugin-documentation.wallee.com/wallee-payment/magento-2/1.0.7/docs/en/documentation.html" target="_blank">documentation</a>.]]></comment>
<field id="version" translate="label" type="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Module Version</label>
</field>
Expand All @@ -42,6 +42,7 @@
</field>
<field id="space_view_id" translate="label" type="text" sortOrder="40" showInDefault="0" showInWebsite="1" showInStore="1">
<label>Space View Id</label>
<comment>The Space View Id allows to control the styling of the payment form and the payment page. It allows in multistore setups to adapt the payment form to different styling per substore without requiring a dedicated space.</comment>
</field>
</group>
<group id="email" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
Expand Down
2 changes: 1 addition & 1 deletion etc/config.xml
Expand Up @@ -14,7 +14,7 @@
<default>
<wallee_payment>
<information>
<version>1.0.6</version>
<version>1.0.7</version>
<sdk_version>1.1.9</sdk_version>
</information>
<general>
Expand Down
19 changes: 19 additions & 0 deletions etc/crontab.xml
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<!--
/**
* wallee Magento 2
*
* This Magento 2 extension enables to process payments with wallee (https://www.wallee.com/).
*
* @package Wallee_Payment
* @author customweb GmbH (http://www.customweb.com/)
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Software License (ASL 2.0)
*/
-->
<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="wallee_cron_refund_jobs" instance="Wallee\Payment\Cron\Refund" method="execute">
<schedule>*/10 * * * *</schedule>
</job>
</group>
</config>
2 changes: 1 addition & 1 deletion etc/module.xml
Expand Up @@ -11,7 +11,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Wallee_Payment" setup_version="1.0.6">
<module name="Wallee_Payment" setup_version="1.0.7">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Payment"/>
Expand Down
3 changes: 2 additions & 1 deletion i18n/de_DE.csv
Expand Up @@ -42,7 +42,7 @@
"General","Allgemein"
"Hold Delivery","Lieferung halten"
"ID required","ID erforderlich"
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/1.0.6/docs/en/documentation.html"" target=""_blank"">documentation</a>.","Falls Sie Hilfe benötigen beim Einrichten der wallee-Erweiterung, sehen Sie sich die <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/1.0.6/docs/en/documentation.html"" target=""_blank"">Dokumentation</a> an."
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/1.0.7/docs/en/documentation.html"" target=""_blank"">documentation</a>.","Falls Sie Hilfe benötigen beim Einrichten der wallee-Erweiterung, sehen Sie sich die <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/1.0.7/docs/en/documentation.html"" target=""_blank"">Dokumentation</a> an."
"Inactive","Inaktiv"
"Information","Informationen"
"Invoice","Rechnung"
Expand Down Expand Up @@ -87,6 +87,7 @@
"The payment process could not have been finished successfully.","Der Zahlungsprozess konnte nicht erfolgreich abgeschlossen werden."
"The refund of %1 failed on the gateway: %2","Die Rückerstattung von %1 schlug auf dem Gateway fehl: %2"
"The refund was requested successfully, but is still pending on the gateway.","Die Rückerstattung wurde erfolgreich angefordert, ist aber immer noch hängig beim Gateway."
"The Space View Id allows to control the styling of the payment form and the payment page. It allows in multistore setups to adapt the payment form to different styling per substore without requiring a dedicated space.","Mit der Space View-ID können Sie das Styling des Zahlungsformulars und der Bezahlseite steuern. In Multistore-Setups erlaubt dies das Anpassen des Bezahlformulars an die verschiedenen Styles der Substores, ohne mehrere Spaces erstellen zu müssen."
"The void of the payment failed on the gateway: %1","Die Stornierung ist beim Gateway fehlgeschlagen: %1"
"There are <a href=""%1"" target=""_blank"">%2 manual tasks</a> that need your attention.","Es gibt <a href=""%1"" target=""_blank"">%2 manuelle Aufgaben</a>, die Ihre Aufmerksamkeit benötigen."
"There has been an error while sending the refund to the gateway.","Es gab einen Fehler beim Senden der Rückerstattung an das Gateway."
Expand Down
3 changes: 2 additions & 1 deletion i18n/en_US.csv
Expand Up @@ -42,7 +42,7 @@
"General","General"
"Hold Delivery","Hold Delivery"
"ID required","ID required"
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/1.0.6/docs/en/documentation.html"" target=""_blank"">documentation</a>.","If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/1.0.6/docs/en/documentation.html"" target=""_blank"">documentation</a>."
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/1.0.7/docs/en/documentation.html"" target=""_blank"">documentation</a>.","If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/1.0.7/docs/en/documentation.html"" target=""_blank"">documentation</a>."
"Inactive","Inactive"
"Information","Information"
"Invoice","Invoice"
Expand Down Expand Up @@ -87,6 +87,7 @@
"The payment process could not have been finished successfully.","The payment process could not have been finished successfully."
"The refund of %1 failed on the gateway: %2","The refund of %1 failed on the gateway: %2"
"The refund was requested successfully, but is still pending on the gateway.","The refund was requested successfully, but is still pending on the gateway."
"The Space View Id allows to control the styling of the payment form and the payment page. It allows in multistore setups to adapt the payment form to different styling per substore without requiring a dedicated space.","The Space View Id allows to control the styling of the payment form and the payment page. It allows in multistore setups to adapt the payment form to different styling per substore without requiring a dedicated space."
"The void of the payment failed on the gateway: %1","The void of the payment failed on the gateway: %1"
"There are <a href=""%1"" target=""_blank"">%2 manual tasks</a> that need your attention.","There are <a href=""%1"" target=""_blank"">%2 manual tasks</a> that need your attention."
"There has been an error while sending the refund to the gateway.","There has been an error while sending the refund to the gateway."
Expand Down
Expand Up @@ -52,6 +52,12 @@ define([
if (typeof window.IframeCheckoutHandler != 'undefined') {
fullScreenLoader.startLoader();
this.handler = window.IframeCheckoutHandler(this.getConfigurationId());
this.handler.setEnableSubmitCallback(function(){
$('button.checkout').prop('disabled', false);
});
this.handler.setDisableSubmitCallback(function(){
$('button.checkout').prop('disabled', true);
});
this.handler.create(this.getFormId(), (function(validationResult){
if (validationResult.success) {
this.placeOrder();
Expand Down

0 comments on commit 055ccb7

Please sign in to comment.