Skip to content

Commit a0d9d1a

Browse files
committed
ACP2E-3647: [CLOUD]: GraphQl error Internal server error placeOrder mutation
1 parent 4de008a commit a0d9d1a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/code/Magento/SalesGraphQl/Model/Resolver/OrderTotal.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2019 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -125,7 +125,8 @@ private function getDiscountDetails(OrderInterface $order): array
125125
'amount' => [
126126
'value' => abs((float) $order->getDiscountAmount()),
127127
'currency' => $order->getOrderCurrencyCode()
128-
]
128+
],
129+
'order_model' => $order
129130
];
130131
}
131132
return $orderDiscounts;

app/code/Magento/SalesRuleGraphQl/Model/Resolver/Coupon.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public function __construct(
3333
*/
3434
public function resolve(Field $field, $context, ResolveInfo $info, ?array $value = null, ?array $args = null)
3535
{
36+
if(isset($value['order_model'])) {
37+
return ['code' => $value['order_model']->getCouponCode()];
38+
}
3639
if (!isset($value['discount_model'])) {
3740
throw new LocalizedException(__('"discount_model" value should be specified'));
3841
}

0 commit comments

Comments
 (0)