Skip to content

Commit

Permalink
Merge pull request PAYONE-GmbH#247 from PAYONE-GmbH/fix/PAYONE-188-Ba…
Browse files Browse the repository at this point in the history
…ncontact-Capture

[PAYONE-188] Fix capture for bancontact
  • Loading branch information
janteuber authored Mar 29, 2023
2 parents aa95e16 + c2f0c27 commit cee83f6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/PaymentHandler/PayoneBancontactPaymentHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use PayonePayment\Components\ConfigReader\ConfigReaderInterface;
use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface;
use PayonePayment\Components\PaymentStateHandler\PaymentStateHandlerInterface;
use PayonePayment\Components\TransactionStatus\TransactionStatusService;
use PayonePayment\Payone\Client\Exception\PayoneRequestException;
use PayonePayment\Payone\Client\PayoneClientInterface;
use PayonePayment\Payone\RequestParameter\RequestParameterFactory;
Expand Down Expand Up @@ -125,22 +126,22 @@ public function finalize(AsyncPaymentTransactionStruct $transaction, Request $re
*/
public static function isCapturable(array $transactionData, array $payoneTransActionData): bool
{
if (static::isNeverCapturable($payoneTransActionData)) {
if ($payoneTransActionData['authorizationType'] !== TransactionStatusService::AUTHORIZATION_TYPE_PREAUTHORIZATION) {
return false;
}

return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData);
return strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_PAID;
}

/**
* {@inheritdoc}
*/
public static function isRefundable(array $transactionData): bool
{
if (static::isNeverRefundable($transactionData)) {
return false;
if (strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE && (float) $transactionData['receivable'] !== 0.0) {
return true;
}

return static::matchesIsRefundableDefaults($transactionData);
return strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_PAID;
}
}

0 comments on commit cee83f6

Please sign in to comment.