14
14
use Magento \Sales \Api \OrderRepositoryInterface ;
15
15
use Magento \Sales \Model \Order ;
16
16
use Magento \SalesGraphQl \Model \Formatter \Order as OrderFormatter ;
17
+ use Magento \SalesGraphQl \Model \Order \Token ;
17
18
18
19
class CancelOrderGuest
19
20
{
@@ -25,13 +26,15 @@ class CancelOrderGuest
25
26
* @param ConfirmationKeySender $confirmationKeySender
26
27
* @param GetConfirmationKey $confirmationKey
27
28
* @param Uid $idEncoder
29
+ * @param Token $token
28
30
*/
29
31
public function __construct (
30
32
private readonly OrderFormatter $ orderFormatter ,
31
33
private readonly OrderRepositoryInterface $ orderRepository ,
32
34
private readonly ConfirmationKeySender $ confirmationKeySender ,
33
35
private readonly GetConfirmationKey $ confirmationKey ,
34
- private readonly Uid $ idEncoder
36
+ private readonly Uid $ idEncoder ,
37
+ private readonly Token $ token
35
38
) {
36
39
}
37
40
@@ -72,7 +75,13 @@ private function sendConfirmationKeyEmail(Order $order, string $reason): void
72
75
$ order ,
73
76
[
74
77
'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 '
76
85
]
77
86
);
78
87
0 commit comments