1414use Magento \Sales \Api \OrderRepositoryInterface ;
1515use Magento \Sales \Model \Order ;
1616use Magento \SalesGraphQl \Model \Formatter \Order as OrderFormatter ;
17+ use Magento \SalesGraphQl \Model \Order \Token ;
1718
1819class 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