Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #100 from heidelpay/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Ryouzanpaku authored May 8, 2019
2 parents 05cd5d2 + 247558b commit 63770fc
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 17 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@

This project does not follow a versioning standard. Versions are crafted after the dates; for example, the version 17.7.25 was released on July, 25th in 2017

## 19.5.08
### Change
- improved status handling to ensure compatibility with magento 2.2.8
### Fixed
- An issue that prevented an invoice to be (partly) refunded twice.
- An issue where different currencies can cause that order is created in base currency.

### Changed
- Improved response handling if Post data is empty: Customer gets redirected to cart with an error message. Wording of
log entry was changed for a better understanding.
- Removed static version from composer command in installation manual.

## 19.1.30

### Fixed
Expand Down
10 changes: 6 additions & 4 deletions Controller/Adminhtml/Order/Shipment/Save.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,12 @@ public function beforeExecute()
$this->_redirect('*/*/new', ['order_id' => $this->getRequest()->getParam('order_id')]);
}

// set order status to "pending payment"
$order->setStatus(Order::STATE_PENDING_PAYMENT)
->addStatusHistoryComment('heidelpay - Finalizing Order', Order::STATE_PENDING_PAYMENT)
->save();
// set order state to "pending payment"
$state = Order::STATE_PENDING_PAYMENT;
$order->setState($state)
->addStatusHistoryComment('heidelpay - Finalizing Order', true);

$this->orderResository->save($order);

$this->messageManager->addSuccessMessage(__('Shipping Notification has been sent to Heidelpay.'));
}
Expand Down
20 changes: 14 additions & 6 deletions Controller/Index/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,20 @@ public function execute()
// the payment just wants a url as result, so we set the content to the redirectUrl.
$result->setContents($redirectUrl);

// if there is no post request, just do nothing and return the redirectUrl instantly, so an
// error message can be shown to the customer (which will be created in the redirect controller)
// if there is no post request, just redirect to the cart instantly and show an error message to the customer.
if (!$this->getRequest()->isPost()) {
$this->_logger->warning('Heidelpay - Response: Request is not POST.');
$this->_logger->warning(
'Heidelpay - Response: There has been an error fetching the redirect url by the payment API.'
. ' Please make sure the response url (' . $this->_url->getCurrentUrl()
. ') is accessible from the internet.'
);

// no further processing.
return $result;
$this->messageManager->addErrorMessage(
__('An unexpected error occurred. Please contact us to get further information.')
);

// no further processing and redirect.
return $this->_redirect('checkout/cart/', ['_secure' => true]);
}

// initialize the Response object with data from the request.
Expand Down Expand Up @@ -245,8 +252,9 @@ public function execute()
// get the quote by transactionid from the heidelpay response
/** @var Quote $quote */
$quote = $this->quoteRepository->get($this->heidelpayResponse->getIdentification()->getTransactionId());
$quote->collectTotals();

$quote->getStore()->setCurrentCurrencyCode($quote->getQuoteCurrencyCode());
$quote->collectTotals();
// in case of guest checkout, set some customer related data.
if ($this->getRequest()->getPost('CRITERION_GUEST') === 'true') {
$quote->setCustomerId(null)
Expand Down
6 changes: 4 additions & 2 deletions Model/Order/Payment/State/AuthorizeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ class AuthorizeCommand extends \Magento\Sales\Model\Order\Payment\State\Authoriz
*/
public function execute(OrderPaymentInterface $payment, $amount, OrderInterface $order)
{
$order->setStatus(Order::STATE_NEW)
->setState(Order::STATE_NEW)
$state = Order::STATE_NEW;
$status = $order->getConfig()->getStateDefaultStatus($state);
$order->setStatus($status)
->setState($state)
->setIsCustomerNotified(false);

return __('heidelpay - Saving order');
Expand Down
2 changes: 1 addition & 1 deletion PaymentMethods/HeidelpayAbstractPaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ public function refund(\Magento\Payment\Model\InfoInterface $payment, $amount)
$collection = $this->transactionCollectionFactory->create();

/** @var \Heidelpay\Gateway\Model\Transaction $transactionInfo */
$transactionInfo = $collection->loadByTransactionId($payment->getLastTransId());
$transactionInfo = $collection->loadByTransactionId($payment->getParentTransactionId());

// if there is no heidelpay transaction, something went wrong.
if ($transactionInfo === null || $transactionInfo->isEmpty()) {
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ All versions greater than 18.3.1 are based on the heidelpay php-payment-api. (ht

### Install the heidelpay Magento 2 composer package

```composer require "heidelpay/magento2:17.10.12"```
```composer require "heidelpay/magento2"```

### Enable the extension in Magento 2

Expand Down Expand Up @@ -76,4 +76,4 @@ support@heidelpay.com
+49 (0)6221/6471-100

#### Twitter
@devHeidelpay
@devHeidelpay
4 changes: 2 additions & 2 deletions etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Heidelpay_Gateway" schema_version="19.1.30" setup_version="19.1.30">
<module name="Heidelpay_Gateway" schema_version="19.5.8" setup_version="19.5.8">
<sequence>
<module name="Magento_Sales" />
<module name="Magento_Payment" />
<module name="Magento_Directory" />
<module name="Magento_Config" />
</sequence>
</module>
</config>
</config>

0 comments on commit 63770fc

Please sign in to comment.