Skip to content

Commit ea407a5

Browse files
authored
Merge pull request #330 from deepak-soni1/LYNX-689
LYNX-689: Guest user confirmation url is redirected to order status page as it is missing orderRef
2 parents 44231f7 + ee0f508 commit ea407a5

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

app/code/Magento/OrderCancellationGraphQl/Model/CancelOrderGuest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Magento\Sales\Api\OrderRepositoryInterface;
1515
use Magento\Sales\Model\Order;
1616
use Magento\SalesGraphQl\Model\Formatter\Order as OrderFormatter;
17+
use Magento\SalesGraphQl\Model\Order\Token;
1718

1819
class CancelOrderGuest
1920
{
@@ -25,13 +26,15 @@ class CancelOrderGuest
2526
* @param ConfirmationKeySender $confirmationKeySender
2627
* @param GetConfirmationKey $confirmationKey
2728
* @param Uid $idEncoder
29+
* @param Token $token
2830
*/
2931
public function __construct(
3032
private readonly OrderFormatter $orderFormatter,
3133
private readonly OrderRepositoryInterface $orderRepository,
3234
private readonly ConfirmationKeySender $confirmationKeySender,
3335
private readonly GetConfirmationKey $confirmationKey,
34-
private readonly Uid $idEncoder
36+
private readonly Uid $idEncoder,
37+
private readonly Token $token
3538
) {
3639
}
3740

@@ -72,7 +75,13 @@ private function sendConfirmationKeyEmail(Order $order, string $reason): void
7275
$order,
7376
[
7477
'order_id' => $this->idEncoder->encode((string)$order->getEntityId()),
75-
'confirmation_key' => $this->confirmationKey->execute($order, $reason)
78+
'confirmation_key' => $this->confirmationKey->execute($order, $reason),
79+
'orderRef' => $this->token->encrypt(
80+
$order->getIncrementId(),
81+
$order->getBillingAddress()->getEmail(),
82+
$order->getBillingAddress()->getLastname()
83+
),
84+
'action' => 'cancel'
7685
]
7786
);
7887

0 commit comments

Comments
 (0)