Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamara committed Jan 25, 2024
2 parents 0301e27 + 2beebb7 commit 1bcee2f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## [Unreleased](https://github.com/Adyen/adyen-php-plugin-core/compare/main...dev)

## [1.1.5 - 1.1.6](https://github.com/Adyen/adyen-php-plugin-core/compare/1.1.5...1.1.6) - 20204-01-22
- Set default value for default payment link expiration time.
- Fix amount comparisons - switch to comparing in minor units.

## [1.1.4 - 1.1.5](https://github.com/Adyen/adyen-php-plugin-core/compare/1.1.4...1.1.5) - 2024-01-11
- Fix webhook test request body
- Add method for checking if payment response is in pending status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function inflate(array $data): void
self::getDataValue($generalSettings, 'retentionPeriod'),
self::getDataValue($generalSettings, 'enablePayByLink'),
self::getDataValue($generalSettings, 'payByLinkTitle'),
self::getDataValue($generalSettings, 'defaultLinkExpirationTime')
self::getDataValue($generalSettings, 'defaultLinkExpirationTime', 7)
);
}

Expand Down
10 changes: 4 additions & 6 deletions src/BusinessLogic/Webhook/Services/OrderStatusMappingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ public function getNewPaymentState(Webhook $webhook, TransactionHistory $transac
{
$lastTransactionHistoryItem = $transactionHistory->collection()->last();
$previousPaymentState = $lastTransactionHistoryItem ? $lastTransactionHistoryItem->getPaymentState() : '';
$capturedAmount = $transactionHistory->getCapturedAmount()->getPriceInCurrencyUnits();
$refundedAmount = $transactionHistory->getTotalAmountForEventCode(EventCodes::REFUND)->getPriceInCurrencyUnits(
);
$capturedAmount = $transactionHistory->getCapturedAmount();
$refundedAmount = $transactionHistory->getTotalAmountForEventCode(EventCodes::REFUND);

if (empty($previousPaymentState)) {
$previousPaymentState = PaymentStates::STATE_NEW;
Expand All @@ -128,9 +127,8 @@ public function getNewPaymentState(Webhook $webhook, TransactionHistory $transac
$newState = PaymentStates::STATE_CANCELLED;
}

if ($webhook->isSuccess() && $webhook->getEventCode(
) === EventCodes::REFUND && $refundedAmount + $webhook->getAmount()->getPriceInCurrencyUnits(
) < $capturedAmount) {
if ($webhook->isSuccess() && $webhook->getEventCode() === EventCodes::REFUND &&
$refundedAmount->plus($webhook->getAmount())->getValue() < $capturedAmount->getValue()) {
$newState = PaymentStates::STATE_PARTIALLY_REFUNDED;
}

Expand Down

0 comments on commit 1bcee2f

Please sign in to comment.