OrderPolicy list post order-tunnel action where order mail_sent is true
This commit is contained in:
parent
5a08860dd6
commit
536bcde8da
1 changed files with 11 additions and 1 deletions
|
|
@ -82,6 +82,8 @@ class OrderPolicy extends Policy
|
|||
{
|
||||
// phpcs:enable
|
||||
if (
|
||||
// ! Limit to only order where mail has been sent (order-tunnel has completed).
|
||||
$order->mail_sent and
|
||||
$order->validation_status->equals(ValidationStatus::cancelled()) or
|
||||
$order->delivery_status->value >= DeliveryStatus::ready()->value
|
||||
) {
|
||||
|
|
@ -102,6 +104,8 @@ class OrderPolicy extends Policy
|
|||
{
|
||||
$transaction = $order->getTransactionUsedForPayment();
|
||||
if (
|
||||
// ! Limit to only order where mail has been sent (order-tunnel has completed).
|
||||
!$order->mail_sent or
|
||||
$order->validation_status->equals(ValidationStatus::cancelled()) or
|
||||
!$transaction
|
||||
) {
|
||||
|
|
@ -121,7 +125,11 @@ class OrderPolicy extends Policy
|
|||
*/
|
||||
public function changeDeliveryStatus(User $user, Order $order): Response
|
||||
{
|
||||
if ($order->validation_status->equals(ValidationStatus::pending())) {
|
||||
if (
|
||||
// ! Limit to only order where mail has been sent (order-tunnel has completed).
|
||||
!$order->mail_sent or
|
||||
$order->validation_status->equals(ValidationStatus::pending())
|
||||
) {
|
||||
return Response::deny();
|
||||
}
|
||||
// phpcs:enable
|
||||
|
|
@ -141,6 +149,8 @@ class OrderPolicy extends Policy
|
|||
// phpcs:enable
|
||||
$transaction = $order->getTransactionUsedForPayment();
|
||||
if (
|
||||
// ! Limit to only order where mail has been sent (order-tunnel has completed).
|
||||
!$order->mail_sent or
|
||||
!$order->can_be_refund or
|
||||
!$transaction or
|
||||
$transaction->payment_mode->equals(PaymentModeEnum::inShop())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue