| 
 | 1 | +diff --git a/vendor/magento/module-gift-card/Model/GetGiftCardEmailUrl.php b/vendor/magento/module-gift-card/Model/GetGiftCardEmailUrl.php  | 
 | 2 | +new file mode 100644  | 
 | 3 | +index 000000000000..094c5a61d08d  | 
 | 4 | +--- /dev/null  | 
 | 5 | ++++ b/vendor/magento/module-gift-card/Model/GetGiftCardEmailUrl.php  | 
 | 6 | +@@ -0,0 +1,52 @@  | 
 | 7 | ++<?php  | 
 | 8 | ++/************************************************************************  | 
 | 9 | ++ *  | 
 | 10 | ++ * ADOBE CONFIDENTIAL  | 
 | 11 | ++ * ___________________  | 
 | 12 | ++ *  | 
 | 13 | ++ * Copyright 2025 Adobe  | 
 | 14 | ++ * All Rights Reserved.  | 
 | 15 | ++ *  | 
 | 16 | ++ * NOTICE: All information contained herein is, and remains  | 
 | 17 | ++ * the property of Adobe and its suppliers, if any. The intellectual  | 
 | 18 | ++ * and technical concepts contained herein are proprietary to Adobe  | 
 | 19 | ++ * and its suppliers and are protected by all applicable intellectual  | 
 | 20 | ++ * property laws, including trade secret and copyright laws.  | 
 | 21 | ++ * Dissemination of this information or reproduction of this material  | 
 | 22 | ++ * is strictly forbidden unless prior written permission is obtained  | 
 | 23 | ++ * from Adobe.  | 
 | 24 | ++ * ************************************************************************  | 
 | 25 | ++ */  | 
 | 26 | ++declare(strict_types=1);  | 
 | 27 | ++  | 
 | 28 | ++namespace Magento\GiftCard\Model;  | 
 | 29 | ++  | 
 | 30 | ++use Magento\Framework\Url;  | 
 | 31 | ++  | 
 | 32 | ++/**  | 
 | 33 | ++ * Get Gift card email url from the code and store ID  | 
 | 34 | ++ */  | 
 | 35 | ++class GetGiftCardEmailUrl  | 
 | 36 | ++{  | 
 | 37 | ++    /**  | 
 | 38 | ++     * @param Url $urlBuilder  | 
 | 39 | ++     */  | 
 | 40 | ++    public function __construct(private readonly Url $urlBuilder)  | 
 | 41 | ++    {  | 
 | 42 | ++    }  | 
 | 43 | ++  | 
 | 44 | ++    /**  | 
 | 45 | ++     * Get gift card URL from given code  | 
 | 46 | ++     *  | 
 | 47 | ++     * @param string $code  | 
 | 48 | ++     * @param string $storeId  | 
 | 49 | ++     * @return string  | 
 | 50 | ++     */  | 
 | 51 | ++    public function execute(string $code, string $storeId): string  | 
 | 52 | ++    {  | 
 | 53 | ++        return $this->urlBuilder->getUrl(  | 
 | 54 | ++            'magento_giftcardaccount/customer',  | 
 | 55 | ++            ['giftcard' => $code, '_scope' => $storeId, '_nosid' => true]  | 
 | 56 | ++        );  | 
 | 57 | ++    }  | 
 | 58 | ++}  | 
 | 59 | +diff --git a/vendor/magento/module-gift-card/Model/GiftCardItemEmail.php b/vendor/magento/module-gift-card/Model/GiftCardItemEmail.php  | 
 | 60 | +index c3364677db6a..7111ce574b16 100644  | 
 | 61 | +--- a/vendor/magento/module-gift-card/Model/GiftCardItemEmail.php  | 
 | 62 | ++++ b/vendor/magento/module-gift-card/Model/GiftCardItemEmail.php  | 
 | 63 | +@@ -1,7 +1,21 @@  | 
 | 64 | + <?php  | 
 | 65 | +-/**  | 
 | 66 | +- * Copyright © Magento, Inc. All rights reserved.  | 
 | 67 | +- * See COPYING.txt for license details.  | 
 | 68 | ++/************************************************************************  | 
 | 69 | ++ *  | 
 | 70 | ++ * ADOBE CONFIDENTIAL  | 
 | 71 | ++ * ___________________  | 
 | 72 | ++ *  | 
 | 73 | ++ * Copyright 2018 Adobe  | 
 | 74 | ++ * All Rights Reserved.  | 
 | 75 | ++ *  | 
 | 76 | ++ * NOTICE: All information contained herein is, and remains  | 
 | 77 | ++ * the property of Adobe and its suppliers, if any. The intellectual  | 
 | 78 | ++ * and technical concepts contained herein are proprietary to Adobe  | 
 | 79 | ++ * and its suppliers and are protected by all applicable intellectual  | 
 | 80 | ++ * property laws, including trade secret and copyright laws.  | 
 | 81 | ++ * Dissemination of this information or reproduction of this material  | 
 | 82 | ++ * is strictly forbidden unless prior written permission is obtained  | 
 | 83 | ++ * from Adobe.  | 
 | 84 | ++ * ************************************************************************  | 
 | 85 | +  */  | 
 | 86 | + declare(strict_types=1);  | 
 | 87 | +   | 
 | 88 | +@@ -9,26 +23,29 @@  | 
 | 89 | +   | 
 | 90 | + use Magento\Framework\App\Area;  | 
 | 91 | + use Magento\Framework\App\Config\ScopeConfigInterface;  | 
 | 92 | ++use Magento\Framework\App\ObjectManager;  | 
 | 93 | ++use Magento\Framework\Currency\Exception\CurrencyException;  | 
 | 94 | ++use Magento\Framework\Exception\LocalizedException;  | 
 | 95 | ++use Magento\Framework\Exception\MailException;  | 
 | 96 | + use Magento\Framework\Locale\CurrencyInterface;  | 
 | 97 | + use Magento\Framework\Mail\Template\TransportBuilder;  | 
 | 98 | +-use Magento\Store\Model\ScopeInterface;  | 
 | 99 | ++use Magento\GiftCard\Helper\Data;  | 
 | 100 | + use Magento\Sales\Model\Order\Item as OrderItem;  | 
 | 101 | ++use Magento\Store\Model\ScopeInterface;  | 
 | 102 | +   | 
 | 103 | + /**  | 
 | 104 | +  * Sends email with info about created gift cards.  | 
 | 105 | ++ *  | 
 | 106 | ++ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)  | 
 | 107 | +  */  | 
 | 108 | + class GiftCardItemEmail  | 
 | 109 | + {  | 
 | 110 | +     /**  | 
 | 111 | +-     * Gift card data  | 
 | 112 | +-     *  | 
 | 113 | +-     * @var \Magento\GiftCard\Helper\Data  | 
 | 114 | ++     * @var Data  | 
 | 115 | +      */  | 
 | 116 | +     private $giftCardData;  | 
 | 117 | +   | 
 | 118 | +     /**  | 
 | 119 | +-     * Scope config  | 
 | 120 | +-     *  | 
 | 121 | +      * @var ScopeConfigInterface  | 
 | 122 | +      */  | 
 | 123 | +     private $scopeConfig;  | 
 | 124 | +@@ -43,22 +60,31 @@ class GiftCardItemEmail  | 
 | 125 | +      */  | 
 | 126 | +     private $localeCurrency;  | 
 | 127 | +   | 
 | 128 | ++    /**  | 
 | 129 | ++     * @var GetGiftCardEmailUrl  | 
 | 130 | ++     */  | 
 | 131 | ++    private $getGiftCardEmailUrl;  | 
 | 132 | ++  | 
 | 133 | +     /**  | 
 | 134 | +      * @param CurrencyInterface $localeCurrency  | 
 | 135 | +      * @param TransportBuilder $transportBuilder  | 
 | 136 | +-     * @param \Magento\GiftCard\Helper\Data $giftCardData  | 
 | 137 | ++     * @param Data $giftCardData  | 
 | 138 | +      * @param ScopeConfigInterface $scopeConfig  | 
 | 139 | ++     * @param GetGiftCardEmailUrl|null $getGiftCardEmailUrl  | 
 | 140 | +      */  | 
 | 141 | +     public function __construct(  | 
 | 142 | +-        CurrencyInterface $localeCurrency,  | 
 | 143 | +-        TransportBuilder $transportBuilder,  | 
 | 144 | +-        \Magento\GiftCard\Helper\Data $giftCardData,  | 
 | 145 | +-        ScopeConfigInterface $scopeConfig  | 
 | 146 | ++        CurrencyInterface       $localeCurrency,  | 
 | 147 | ++        TransportBuilder        $transportBuilder,  | 
 | 148 | ++        Data                    $giftCardData,  | 
 | 149 | ++        ScopeConfigInterface    $scopeConfig,  | 
 | 150 | ++        ?GetGiftCardEmailUrl $getGiftCardEmailUrl = null  | 
 | 151 | +     ) {  | 
 | 152 | +         $this->localeCurrency = $localeCurrency;  | 
 | 153 | +         $this->transportBuilder = $transportBuilder;  | 
 | 154 | +         $this->giftCardData = $giftCardData;  | 
 | 155 | +         $this->scopeConfig = $scopeConfig;  | 
 | 156 | ++        $this->getGiftCardEmailUrl = $getGiftCardEmailUrl ?: ObjectManager::getInstance()  | 
 | 157 | ++            ->get(GetGiftCardEmailUrl::class);  | 
 | 158 | +     }  | 
 | 159 | +   | 
 | 160 | +     /**  | 
 | 161 | +@@ -66,10 +92,13 @@ public function __construct(  | 
 | 162 | +      *  | 
 | 163 | +      * @param OrderItem $giftCardOrderItem  | 
 | 164 | +      * @param array $codes  | 
 | 165 | ++     * @param int $generatedCodesCount  | 
 | 166 | +      * @param int $isRedeemable  | 
 | 167 | +      * @param float|null $amount  | 
 | 168 | +-     * @param int $generatedCodesCount  | 
 | 169 | +      * @return void  | 
 | 170 | ++     * @throws CurrencyException  | 
 | 171 | ++     * @throws LocalizedException  | 
 | 172 | ++     * @throws MailException  | 
 | 173 | +      */  | 
 | 174 | +     public function send(  | 
 | 175 | +         OrderItem $giftCardOrderItem,  | 
 | 176 | +@@ -91,7 +120,8 @@ public function send(  | 
 | 177 | +             ->setCodes($codes)  | 
 | 178 | +             ->setArea(Area::AREA_FRONTEND)  | 
 | 179 | +             ->setIsRedeemable($isRedeemable)  | 
 | 180 | +-            ->setStore($giftCardOrderItem->getStore());  | 
 | 181 | ++            ->setStore($giftCardOrderItem->getStore())  | 
 | 182 | ++            ->setHelper($this->getGiftCardEmailUrl);  | 
 | 183 | +   | 
 | 184 | +         $baseCurrencyCode = $giftCardOrderItem->getStore()  | 
 | 185 | +             ->getBaseCurrencyCode();  | 
 | 186 | +diff --git a/vendor/magento/module-gift-card/view/frontend/templates/email/generated.phtml b/vendor/magento/module-gift-card/view/frontend/templates/email/generated.phtml  | 
 | 187 | +index b1b0e7afc2f5..5d19807fecfa 100644  | 
 | 188 | +--- a/vendor/magento/module-gift-card/view/frontend/templates/email/generated.phtml  | 
 | 189 | ++++ b/vendor/magento/module-gift-card/view/frontend/templates/email/generated.phtml  | 
 | 190 | +@@ -1,22 +1,44 @@  | 
 | 191 | + <?php  | 
 | 192 | +-/**  | 
 | 193 | +- * Copyright © Magento, Inc. All rights reserved.  | 
 | 194 | +- * See COPYING.txt for license details.  | 
 | 195 | ++/************************************************************************  | 
 | 196 | ++ *  | 
 | 197 | ++ * ADOBE CONFIDENTIAL  | 
 | 198 | ++ * ___________________  | 
 | 199 | ++ *  | 
 | 200 | ++ * Copyright 2014 Adobe  | 
 | 201 | ++ * All Rights Reserved.  | 
 | 202 | ++ *  | 
 | 203 | ++ * NOTICE: All information contained herein is, and remains  | 
 | 204 | ++ * the property of Adobe and its suppliers, if any. The intellectual  | 
 | 205 | ++ * and technical concepts contained herein are proprietary to Adobe  | 
 | 206 | ++ * and its suppliers and are protected by all applicable intellectual  | 
 | 207 | ++ * property laws, including trade secret and copyright laws.  | 
 | 208 | ++ * Dissemination of this information or reproduction of this material  | 
 | 209 | ++ * is strictly forbidden unless prior written permission is obtained  | 
 | 210 | ++ * from Adobe.  | 
 | 211 | ++ * ************************************************************************  | 
 | 212 | +  */  | 
 | 213 | +   | 
 | 214 | +-/** @var \Magento\GiftCard\Block\Generated $block */  | 
 | 215 | +-?>  | 
 | 216 | +-<?php $_codes = $block->getCodes(); ?>  | 
 | 217 | +-<?php $_isRedeemable = $block->getIsRedeemable(); ?>  | 
 | 218 | ++/** @var Generated $block */  | 
 | 219 | ++/** @var Escaper $escaper */  | 
 | 220 | ++/** @var GetGiftCardEmailUrl $giftCardEmailUrlHelper */  | 
 | 221 | ++  | 
 | 222 | ++use Magento\Framework\Escaper;  | 
 | 223 | ++use Magento\GiftCard\Block\Generated;  | 
 | 224 | ++use Magento\GiftCard\Model\GetGiftCardEmailUrl;  | 
 | 225 | +   | 
 | 226 | +-<?php foreach ($_codes as $_code) : ?>  | 
 | 227 | +-    <?php if ($_code) : ?>  | 
 | 228 | +-        <?php if ($_isRedeemable) : ?>  | 
 | 229 | +-            <a href="<?= $block->escapeUrl($block->getUrl('magento_giftcardaccount/customer', ['giftcard' => $_code, '_nosid' => true])) ?>">  | 
 | 230 | +-                <?= $block->escapeHtml($_code)?>  | 
 | 231 | ++$getGiftCardEmailUrl = $block->getData('helper');  | 
 | 232 | ++$storeId = $block->getStoreId() ?? $block->getStore()->getStoreId();  | 
 | 233 | ++?>  | 
 | 234 | ++<?php $_codes = $block->getCodes();?>  | 
 | 235 | ++<?php $_isRedeemable = $block->getIsRedeemable();?>  | 
 | 236 | ++<?php foreach ($_codes as $_code):?>  | 
 | 237 | ++    <?php if ($_code):?>  | 
 | 238 | ++        <?php if ($_isRedeemable):?>  | 
 | 239 | ++            <a href="<?= $escaper->escapeUrl($getGiftCardEmailUrl->execute($_code, $storeId)); ?>">  | 
 | 240 | ++                <?= $escaper->escapeHtml($_code)?>  | 
 | 241 | +             </a>  | 
 | 242 | +-        <?php else : ?>  | 
 | 243 | +-            <?= $block->escapeHtml($_code) ?>  | 
 | 244 | ++        <?php else: ?>  | 
 | 245 | ++            <?= $escaper->escapeHtml($_code) ?>  | 
 | 246 | +         <?php endif; ?>  | 
 | 247 | +         <br />  | 
 | 248 | +     <?php endif; ?>  | 
 | 249 | + | 
0 commit comments