Skip to content

Commit

Permalink
[SSP-2840] gopay double spend issue (#3635)
Browse files Browse the repository at this point in the history
  • Loading branch information
RostislavKreisinger authored Dec 17, 2024
2 parents 92a23de + 77c3d83 commit 79d3a7f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace Shopsys\FrontendApiBundle\Model\Mutation\Payment\Exception;

use Overblog\GraphQLBundle\Error\UserError;
use Shopsys\FrontendApiBundle\Model\Error\UserErrorWithCodeInterface;

class OrderWaitingForProcessPaymentUserError extends UserError implements UserErrorWithCodeInterface
{
protected const CODE = 'order-process-payment';

/**
* {@inheritdoc}
*/
public function getUserErrorCode(): string
{
return static::CODE;
}
}
5 changes: 5 additions & 0 deletions src/Model/Mutation/Payment/PaymentMutation.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Shopsys\FrontendApiBundle\Model\Mutation\AbstractMutation;
use Shopsys\FrontendApiBundle\Model\Mutation\Payment\Exception\MaxTransactionCountReachedUserError;
use Shopsys\FrontendApiBundle\Model\Mutation\Payment\Exception\OrderAlreadyPaidUserError;
use Shopsys\FrontendApiBundle\Model\Mutation\Payment\Exception\OrderWaitingForProcessPaymentUserError;
use Shopsys\FrontendApiBundle\Model\Order\OrderApiFacade;
use Throwable;

Expand Down Expand Up @@ -43,6 +44,10 @@ public function payOrderMutation(Argument $argument): PaymentSetupCreationData
throw new OrderAlreadyPaidUserError('Order is already paid');
}

if ($order->hasPaymentInProcess()) {
throw new OrderWaitingForProcessPaymentUserError('Order is awaiting payment verification.');
}

if ($order->isMaxTransactionCountReached()) {
throw new MaxTransactionCountReachedUserError('Max transaction count reached');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ OrderDecorator:
isPaid:
type: "Boolean!"
description: "Indicates whether the order is paid successfully with GoPay payment type"
hasPaymentInProcess:
type: "Boolean!"
description: "Indicates whether order payment is still being processed with GoPay payment type"
heurekaAgreement:
type: "Boolean!"
description: "Determines whether the customer agrees with sending satisfaction questionnaires within the Verified by Customers Heureka program"
Expand Down

0 comments on commit 79d3a7f

Please sign in to comment.