Japanese English

PHP deobfuscation, decryption, reconstruction tool

De-obfuscate PHP malware/viruses and tampering code on Wordpress to original readable code.

*Please note that not all obfuscation codes can be decoded.

Decoded the code below.

<?php /* __________________________________________________ | Obfuscated by YAK Pro - Php Obfuscator 2.0.3 | | on 2023-07-05 10:12:25 | | GitHub: https://github.com/pk-fr/yakpro-po | |__________________________________________________| */ namespace Plugin\AmazonPayV2_42; use Eccube\Event\Template...



Obfuscated php code

<?php
/*   __________________________________________________
    |  Obfuscated by YAK Pro - Php Obfuscator  2.0.3   |
    |              on 2023-07-05 10:12:25              |
    |    GitHub: https://github.com/pk-fr/yakpro-po    |
    |__________________________________________________|
*/

namespace Plugin\AmazonPayV2_42;

use Eccube\Event\TemplateEvent;
use Eccube\Event\EventArgs;
use Eccube\Event\EccubeEvents;
use Eccube\Common\EccubeConfig;
use Eccube\Repository\PaymentRepository;
use Eccube\Repository\PluginRepository;
use Eccube\Service\OrderHelper;
use Eccube\Service\CartService;
use Plugin\AmazonPayV2_42\Repository\ConfigRepository;
use Plugin\AmazonPayV2_42\Service\AmazonRequestService;
use Plugin\AmazonPayV2_42\Service\Method\AmazonPay;
use Plugin\AmazonPayV2_42\phpseclib\Crypt\Random;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Eccube\Repository\DeliveryRepository;
use Eccube\Repository\PaymentOptionRepository;
use Plugin\AmazonPayV2_42\Entity\AmazonBanner;
use Plugin\AmazonPayV2_42\Service\AmazonBannerService;

class AmazonPayEvent implements EventSubscriberInterface
{
    private $sessionAmazonProfileKey = 'amazon_pay_v2.profile';
    private $sessionAmazonCheckoutSessionIdKey = 'amazon_pay_v2.checkout_session_id';
    private $sessionAmazonLoginStateKey = 'amazon_pay_v2.amazon_login_state';
    protected $eccubeConfig;
    private $router;
    protected $configRepository;
    protected $amazonRequestService;
    protected $deliveryRepository;
    protected $paymentOptionRepository;
    protected $amazonBannerService;
    public function __construct(RequestStack $requestStack, SessionInterface $session, TokenStorageInterface $tokenStorage, EccubeConfig $eccubeConfig, UrlGeneratorInterface $router, PaymentRepository $paymentRepository, PluginRepository $pluginRepository, ConfigRepository $configRepository, ContainerInterface $container, OrderHelper $orderHelper, CartService $cartService, AmazonRequestService $amazonRequestService, DeliveryRepository $deliveryRepository, PaymentOptionRepository $paymentOptionRepository, AmazonBannerService $amazonBannerService)
    {
        goto Sphrz;
        ItOIz:
        $this->paymentOptionRepository = $paymentOptionRepository;
        goto sv2PM;
        dVtXx:
        $this->eccubeConfig = $eccubeConfig;
        goto R1izM;
        seyTw:
        $this->deliveryRepository = $deliveryRepository;
        goto ItOIz;
        KTz_w:
        $this->cartService = $cartService;
        goto i1X7Q;
        Sphrz:
        $this->requestStack = $requestStack;
        goto JvOQY;
        CL0wm:
        $this->configRepository = $configRepository;
        goto oQKaN;
        WdxsT:
        $this->paymentRepository = $paymentRepository;
        goto fkM8P;
        ZV4VB:
        $this->tokenStorage = $tokenStorage;
        goto dVtXx;
        sv2PM:
        $this->amazonBannerService = $amazonBannerService;
        goto iGAhn;
        JvOQY:
        $this->session = $session;
        goto ZV4VB;
        R1izM:
        $this->router = $router;
        goto WdxsT;
        fkM8P:
        $this->pluginRepository = $pluginRepository;
        goto CL0wm;
        i1X7Q:
        $this->amazonRequestService = $amazonRequestService;
        goto seyTw;
        Espbf:
        $this->orderHelper = $orderHelper;
        goto KTz_w;
        oQKaN:
        $this->container = $container;
        goto Espbf;
        iGAhn:
    }
    public static function getSubscribedEvents()
    {
        return [EccubeEvents::FRONT_CART_BUYSTEP_COMPLETE => 'amazon_cart_buystep', 'Cart/index.twig' => 'cart', 'Shopping/index.twig' => 'amazon_pay_shopping', 'Mypage/login.twig' => 'mypage_login', 'Shopping/confirm.twig' => 'amazon_pay_shopping_confirm', 'index.twig' => 'add_banner_on_top'];
    }
    public function add_banner_on_top(TemplateEvent $event)
    {
        goto kuafT;
        sFAFc:
        if (!($Config->getUseAmazonBannerOnTop() == $this->eccubeConfig['amazon_pay_v2']['toggle']['off'])) {
            goto V238C;
        }
        goto JXgl5;
        n2j3Q:
        if (!($Config->getAmazonBannerPlaceOnTop() == $this->eccubeConfig['amazon_pay_v2']['button_place']['auto'])) {
            goto BI_ea;
        }
        goto eHBLe;
        kuafT:
        $Config = $this->configRepository->get();
        goto sFAFc;
        JXgl5:
        return;
        goto k1PH6;
        eHBLe:
        $event->addSnippet('@AmazonPayV2_42/default/amazon_banner_auto_on_top.twig');
        goto wb7n0;
        Czcgs:
        $event->addSnippet($this->amazonBannerService->getBannerCodeOnTop(), false);
        goto d06sR;
        k1PH6:
        V238C:
        goto n2j3Q;
        wb7n0:
        BI_ea:
        goto Czcgs;
        d06sR:
    }
    public function cart(TemplateEvent $event)
    {
        goto kOc5C;
        yg27z:
        Ad_IV:
        goto Zb9yD;
        cJCwf:
        $parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['prod'];
        goto NUSpb;
        Y74ML:
        $parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['sandbox'];
        goto TnKkl;
        kOc5C:
        $Config = $this->configRepository->get();
        goto qRe3s;
        B9xqg:
        $event->addSnippet('@AmazonPayV2_42/default/Cart/button.twig');
        goto A2Prh;
        xCRZQ:
        if (!($Config->getCartButtonPlace() == $this->eccubeConfig['amazon_pay_v2']['button_place']['auto'])) {
            goto RbrmI;
        }
        goto B9xqg;
        H7Vsd:
        g6Bpe:
        goto V1MvC;
        mrKSg:
        foreach ($parameters['Carts'] as $Cart) {
            goto jwhiA;
            Iqkwa:
            $signature = $this->amazonRequestService->signaturePayload($payload);
            goto M8LzS;
            yl0hC:
            $payload = $this->amazonRequestService->createCheckoutSessionPayload($Cart->getCartKey());
            goto Iqkwa;
            lw76E:
            qEl41:
            goto KGBHA;
            mWDKP:
            $parameters['cart'][$cartKey]['signature'] = $signature;
            goto lw76E;
            jwhiA:
            $cartKey = $Cart->getCartKey();
            goto yl0hC;
            M8LzS:
            $parameters['cart'][$cartKey]['payload'] = $payload;
            goto mWDKP;
            KGBHA:
        }
        goto yg27z;
        Zb9yD:
        $parameters['AmazonPayV2Config'] = $Config;
        goto X1EyI;
        LgOgC:
        Kwe_C:
        goto L1uES;
        X1EyI:
        if ($Config->getEnv() == $this->eccubeConfig['amazon_pay_v2']['env']['prod']) {
            goto ZCa9B;
        }
        goto Y74ML;
        WQjj7:
        ZCa9B:
        goto cJCwf;
        P_t9A:
        return;
        goto H7Vsd;
        czq4h:
        $event->setParameters($parameters);
        goto wY6S3;
        XnRfH:
        return;
        goto LgOgC;
        YgZEa:
        $event->addSnippet($this->amazonBannerService->getBannerCodeOnCart(), false);
        goto fbfGK;
        gDaZJ:
        $event->addSnippet('@AmazonPayV2_42/default/amazon_banner_auto_on_cart.twig');
        goto eM2pk;
        ICr_x:
        if (!($Config->getAmazonBannerPlaceOnCart() == $this->eccubeConfig['amazon_pay_v2']['button_place']['auto'])) {
            goto aqL0h;
        }
        goto gDaZJ;
        zch7v:
        $parameters = $event->getParameters();
        goto Kih5j;
        L1uES:
        $Payment = $this->paymentRepository->findOneBy(['method_class' => AmazonPay::class]);
        goto Zs6Fg;
        TnKkl:
        goto NCjOj;
        goto WQjj7;
        A2Prh:
        RbrmI:
        goto FYBIm;
        qRe3s:
        if (!($Config->getUseAmazonBannerOnCart() != $this->eccubeConfig['amazon_pay_v2']['toggle']['off'])) {
            goto Czmze;
        }
        goto ICr_x;
        pu4i9:
        $AmazonSaleTypes = [];
        goto ztYLL;
        hLCw0:
        Tmqpk:
        goto AxXvx;
        NUSpb:
        NCjOj:
        goto czq4h;
        Zs6Fg:
        $AmazonDeliveries = $this->paymentOptionRepository->findBy(['payment_id' => $Payment->getId()]);
        goto pu4i9;
        ztYLL:
        foreach ($AmazonDeliveries as $AmazonDelivery) {
            goto M4IgQ;
            M4IgQ:
            $Delivery = $this->deliveryRepository->findOneBy(['id' => $AmazonDelivery->getDelivery()->getId()]);
            goto Y08OC;
            Y08OC:
            $AmazonSaleTypes[] = $Delivery->getSaleType()->getId();
            goto vZjV1;
            vZjV1:
            vv4RU:
            goto mxdj8;
            mxdj8:
        }
        goto hLCw0;
        fbfGK:
        Czmze:
        goto zch7v;
        Kih5j:
        if (!empty($parameters['Carts'])) {
            goto g6Bpe;
        }
        goto P_t9A;
        wY6S3:
        $event->addSnippet('@AmazonPayV2_42/default/Cart/amazon_pay_js.twig');
        goto xCRZQ;
        eM2pk:
        aqL0h:
        goto YgZEa;
        AxXvx:
        $parameters['AmazonSaleTypes'] = $AmazonSaleTypes;
        goto mrKSg;
        V1MvC:
        if (!($Config->getUseCartButton() == $this->eccubeConfig['amazon_pay_v2']['toggle']['off'])) {
            goto Kwe_C;
        }
        goto XnRfH;
        FYBIm:
    }
    public function amazon_cart_buystep(EventArgs $event)
    {
        goto r59oF;
        YYV3I:
        $this->session->remove($this->sessionAmazonProfileKey);
        goto t4XkL;
        r59oF:
        if (!($this->orderHelper->getNonmember() && $this->session->get($this->sessionAmazonProfileKey))) {
            goto uwzR3;
        }
        goto kHqYg;
        kHqYg:
        $this->session->remove(OrderHelper::SESSION_NON_MEMBER);
        goto YYV3I;
        KWZzO:
        $this->cartService->save();
        goto YZcfA;
        YZcfA:
        uwzR3:
        goto CkR7r;
        t4XkL:
        $this->cartService->setPreOrderId(null);
        goto KWZzO;
        CkR7r:
    }
    public function amazon_pay_shopping(TemplateEvent $event)
    {
        goto E8L_l;
        WG2Y4:
        fgSIh:
        goto HjjcV;
        UWUJz:
        if ($this->pluginRepository->findOneBy(['code' => 'MailMagazine42', 'enabled' => true]) || $this->pluginRepository->findOneBy(['code' => 'PostCarrier42', 'enabled' => true])) {
            goto c58fZ;
        }
        goto pNc5E;
        T1LDq:
        $parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['sandbox'];
        goto d95p8;
        d95p8:
        goto zZW_J;
        goto WG2Y4;
        Zb1Uy:
        goto vLAvG;
        goto L1TZt;
        eLMSX:
        $Order = $parameters['Order'];
        goto J_QtH;
        BP7fI:
        $parameters['AmazonPayV2Config'] = $Config;
        goto UWUJz;
        iVAsD:
        $parameters['useMailMagazine'] = $useMailMagazine;
        goto XspR0;
        qiAaw:
        $parameters = $event->getParameters();
        goto zxRYS;
        rDpbF:
        return;
        goto TlqQ8;
        FqsYK:
        exit;
        goto RDZqW;
        pNc5E:
        $useMailMagazine = false;
        goto Zb1Uy;
        zxRYS:
        if (!(preg_match('/shopping\\/amazon_pay/', $uri) == false)) {
            goto F7vRd;
        }
        goto Cap0Y;
        Vd4tC:
        $amazonCheckoutSessionId = $this->session->get($this->sessionAmazonCheckoutSessionIdKey);
        goto Jmr3s;
        FopmI:
        $event->addSnippet('@AmazonPayV2_42/default/Shopping/customer_regist_v2.twig');
        goto Vd4tC;
        Kd4km:
        vLAvG:
        goto iVAsD;
        NjWb2:
        $useMailMagazine = true;
        goto Kd4km;
        mIOhn:
        $parameters['amazonCheckoutSessionId'] = $amazonCheckoutSessionId;
        goto BP7fI;
        nMNpH:
        $event->addSnippet('@AmazonPayV2_42/default/Shopping/widgets.twig');
        goto FopmI;
        Jmr3s:
        $parameters = $event->getParameters();
        goto mIOhn;
        CM7vD:
        zZW_J:
        goto Ndi8Z;
        RDZqW:
        YCoiB:
        goto rDpbF;
        L1TZt:
        c58fZ:
        goto NjWb2;
        E8L_l:
        $request = $this->requestStack->getMasterRequest();
        goto u9GN5;
        u9GN5:
        $uri = $request->getUri();
        goto qiAaw;
        Cap0Y:
        $referer = $request->headers->get('referer');
        goto eLMSX;
        J_QtH:
        $Payment = $Order->getPayment();
        goto wzA83;
        TlqQ8:
        F7vRd:
        goto JgYQ5;
        HjjcV:
        $parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['prod'];
        goto CM7vD;
        Ndi8Z:
        $event->setParameters($parameters);
        goto Oh9aW;
        zqpQW:
        header("Location:" . $this->container->get('router')->generate('amazon_pay_shopping'));
        goto FqsYK;
        wzA83:
        if (!($Payment && $Payment->getMethodClass() === AmazonPay::class && preg_match('/shopping_coupon/', $referer))) {
            goto YCoiB;
        }
        goto zqpQW;
        XspR0:
        if ($Config->getEnv() == $this->eccubeConfig['amazon_pay_v2']['env']['prod']) {
            goto fgSIh;
        }
        goto T1LDq;
        JgYQ5:
        $Config = $this->configRepository->get();
        goto nMNpH;
        Oh9aW:
    }
    public function amazon_pay_shopping_confirm(TemplateEvent $event)
    {
        goto xSecW;
        dgZnV:
        O4kiN:
        goto IoJML;
        rSneR:
        goto PJM00;
        goto dgZnV;
        Ps4ZJ:
        $Config = $this->configRepository->get();
        goto M3arZ;
        m9x41:
        $parameters = $event->getParameters();
        goto eNq7l;
        Tuwd3:
        return;
        goto uVAAL;
        sLW67:
        goto IR3dP;
        goto rEwsP;
        IoJML:
        $parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['prod'];
        goto tHn08;
        M3arZ:
        $event->addSnippet('@AmazonPayV2_42/default/Shopping/confirm_widgets.twig');
        goto Hd670;
        oXvFa:
        $event->setParameters($parameters);
        goto Y_IyZ;
        MJHSo:
        IR3dP:
        goto X7GqU;
        lKNAT:
        $parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['sandbox'];
        goto rSneR;
        X7GqU:
        $parameters['useMailMagazine'] = $useMailMagazine;
        goto V5O1Z;
        i6By8:
        $useMailMagazine = false;
        goto sLW67;
        l7mNv:
        if ($this->pluginRepository->findOneBy(['code' => 'MailMagazine42', 'enabled' => true]) || $this->pluginRepository->findOneBy(['code' => 'PostCarrier42', 'enabled' => true])) {
            goto b09WN;
        }
        goto i6By8;
        xSecW:
        $request = $this->requestStack->getMasterRequest();
        goto eo7B6;
        LuY3e:
        $useMailMagazine = true;
        goto MJHSo;
        Hd670:
        $event->addSnippet('@AmazonPayV2_42/default/Shopping/confirm_customer_regist_v2.twig');
        goto m9x41;
        uVAAL:
        QlDTF:
        goto Ps4ZJ;
        tHn08:
        PJM00:
        goto oXvFa;
        eo7B6:
        $uri = $request->getUri();
        goto WoyGc;
        V5O1Z:
        if ($Config->getEnv() == $this->eccubeConfig['amazon_pay_v2']['env']['prod']) {
            goto O4kiN;
        }
        goto lKNAT;
        WoyGc:
        if (!(preg_match('/shopping\\/amazon_pay/', $uri) == false)) {
            goto QlDTF;
        }
        goto Tuwd3;
        rEwsP:
        b09WN:
        goto LuY3e;
        eNq7l:
        $parameters['AmazonPayV2Config'] = $Config;
        goto l7mNv;
        Y_IyZ:
    }
    public function mypage_login(TemplateEvent $event)
    {
        goto pl1Gp;
        UQTHe:
        if (!($Config->getUseMypageLoginButton() == $this->eccubeConfig['amazon_pay_v2']['toggle']['off'])) {
            goto b8GB6;
        }
        goto wud37;
        svyZy:
        if ($Config->getEnv() == $this->eccubeConfig['amazon_pay_v2']['env']['prod']) {
            goto izZZs;
        }
        goto J8hS1;
        fIW_v:
        $event->addSnippet('@AmazonPayV2_42/default/Mypage/amazon_login_js.twig');
        goto QdRgV;
        ZyQTZ:
        goto EBJD8;
        goto ixG2j;
        upp0b:
        $event->setParameters($parameters);
        goto cFqcp;
        OgRnP:
        $state = $this->session->get($this->sessionAmazonLoginStateKey);
        goto A0GGz;
        A0GGz:
        if ($state) {
            goto uTNP3;
        }
        goto SNFmo;
        pl1Gp:
        $Config = $this->configRepository->get();
        goto UQTHe;
        Znc0c:
        $returnUrl = $this->router->generate('login_with_amazon', ['state' => $state], UrlGeneratorInterface::ABSOLUTE_URL);
        goto F5QC6;
        oUjEe:
        $this->session->set($this->sessionAmazonLoginStateKey, $state);
        goto PAMXM;
        PL0WE:
        $parameters['payload'] = $payload;
        goto NSfWJ;
        ixG2j:
        izZZs:
        goto r_e0V;
        SNFmo:
        $state = bin2hex(Random::string(16));
        goto oUjEe;
        wud37:
        return;
        goto PAcDj;
        PAcDj:
        b8GB6:
        goto OgRnP;
        r_e0V:
        $parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['prod'];
        goto aXPGe;
        PAMXM:
        uTNP3:
        goto Znc0c;
        aXPGe:
        EBJD8:
        goto upp0b;
        z1kbf:
        UzskJ:
        goto fIW_v;
        OlvyX:
        $payload = $this->amazonRequestService->createSigninPayload($returnUrl);
        goto Kxhl7;
        cFqcp:
        if (!($Config->getMypageLoginButtonPlace() == $this->eccubeConfig['amazon_pay_v2']['button_place']['auto'])) {
            goto UzskJ;
        }
        goto vI6q6;
        vI6q6:
        $event->addSnippet('@AmazonPayV2_42/default/Mypage/login_page_button.twig');
        goto z1kbf;
        NSfWJ:
        $parameters['signature'] = $signature;
        goto ZUDMb;
        sthrN:
        $parameters['AmazonPayV2Config'] = $Config;
        goto svyZy;
        F5QC6:
        $parameters = $event->getParameters();
        goto OlvyX;
        J8hS1:
        $parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['sandbox'];
        goto ZyQTZ;
        Kxhl7:
        $signature = $this->amazonRequestService->signaturePayload($payload);
        goto PL0WE;
        ZUDMb:
        $parameters['buttonColor'] = $Config->getMypageLoginButtonColor();
        goto sthrN;
        QdRgV:
    }
}

Decoded(de-Obfuscated) php code

<?php

/*   __________________________________________________
    |  Obfuscated by YAK Pro - Php Obfuscator  2.0.3   |
    |              on 2023-07-05 10:12:25              |
    |    GitHub: https://github.com/pk-fr/yakpro-po    |
    |__________________________________________________|
*/
namespace Plugin\AmazonPayV2_42;

use Eccube\Event\TemplateEvent;
use Eccube\Event\EventArgs;
use Eccube\Event\EccubeEvents;
use Eccube\Common\EccubeConfig;
use Eccube\Repository\PaymentRepository;
use Eccube\Repository\PluginRepository;
use Eccube\Service\OrderHelper;
use Eccube\Service\CartService;
use Plugin\AmazonPayV2_42\Repository\ConfigRepository;
use Plugin\AmazonPayV2_42\Service\AmazonRequestService;
use Plugin\AmazonPayV2_42\Service\Method\AmazonPay;
use Plugin\AmazonPayV2_42\phpseclib\Crypt\Random;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Eccube\Repository\DeliveryRepository;
use Eccube\Repository\PaymentOptionRepository;
use Plugin\AmazonPayV2_42\Entity\AmazonBanner;
use Plugin\AmazonPayV2_42\Service\AmazonBannerService;
class AmazonPayEvent implements EventSubscriberInterface
{
    private $sessionAmazonProfileKey = 'amazon_pay_v2.profile';
    private $sessionAmazonCheckoutSessionIdKey = 'amazon_pay_v2.checkout_session_id';
    private $sessionAmazonLoginStateKey = 'amazon_pay_v2.amazon_login_state';
    protected $eccubeConfig;
    private $router;
    protected $configRepository;
    protected $amazonRequestService;
    protected $deliveryRepository;
    protected $paymentOptionRepository;
    protected $amazonBannerService;
    public function __construct(RequestStack $requestStack, SessionInterface $session, TokenStorageInterface $tokenStorage, EccubeConfig $eccubeConfig, UrlGeneratorInterface $router, PaymentRepository $paymentRepository, PluginRepository $pluginRepository, ConfigRepository $configRepository, ContainerInterface $container, OrderHelper $orderHelper, CartService $cartService, AmazonRequestService $amazonRequestService, DeliveryRepository $deliveryRepository, PaymentOptionRepository $paymentOptionRepository, AmazonBannerService $amazonBannerService)
    {
        $this->requestStack = $requestStack;
        $this->session = $session;
        $this->tokenStorage = $tokenStorage;
        $this->eccubeConfig = $eccubeConfig;
        $this->router = $router;
        $this->paymentRepository = $paymentRepository;
        $this->pluginRepository = $pluginRepository;
        $this->configRepository = $configRepository;
        $this->container = $container;
        $this->orderHelper = $orderHelper;
        $this->cartService = $cartService;
        $this->amazonRequestService = $amazonRequestService;
        $this->deliveryRepository = $deliveryRepository;
        $this->paymentOptionRepository = $paymentOptionRepository;
        $this->amazonBannerService = $amazonBannerService;
    }
    public static function getSubscribedEvents()
    {
        return [EccubeEvents::FRONT_CART_BUYSTEP_COMPLETE => 'amazon_cart_buystep', 'Cart/index.twig' => 'cart', 'Shopping/index.twig' => 'amazon_pay_shopping', 'Mypage/login.twig' => 'mypage_login', 'Shopping/confirm.twig' => 'amazon_pay_shopping_confirm', 'index.twig' => 'add_banner_on_top'];
    }
    public function add_banner_on_top(TemplateEvent $event)
    {
        $Config = $this->configRepository->get();
        if (!($Config->getUseAmazonBannerOnTop() == $this->eccubeConfig['amazon_pay_v2']['toggle']['off'])) {
            if (!($Config->getAmazonBannerPlaceOnTop() == $this->eccubeConfig['amazon_pay_v2']['button_place']['auto'])) {
                goto BI_ea;
            }
            $event->addSnippet('@AmazonPayV2_42/default/amazon_banner_auto_on_top.twig');
            BI_ea:
            $event->addSnippet($this->amazonBannerService->getBannerCodeOnTop(), false);
            // [PHPDeobfuscator] Implied return
            return;
        }
        return;
    }
    public function cart(TemplateEvent $event)
    {
        $Config = $this->configRepository->get();
        if (!($Config->getUseAmazonBannerOnCart() != $this->eccubeConfig['amazon_pay_v2']['toggle']['off'])) {
            goto Czmze;
        }
        if (!($Config->getAmazonBannerPlaceOnCart() == $this->eccubeConfig['amazon_pay_v2']['button_place']['auto'])) {
            goto aqL0h;
        }
        $event->addSnippet('@AmazonPayV2_42/default/amazon_banner_auto_on_cart.twig');
        aqL0h:
        $event->addSnippet($this->amazonBannerService->getBannerCodeOnCart(), false);
        Czmze:
        $parameters = $event->getParameters();
        if (!empty($parameters['Carts'])) {
            if (!($Config->getUseCartButton() == $this->eccubeConfig['amazon_pay_v2']['toggle']['off'])) {
                $Payment = $this->paymentRepository->findOneBy(['method_class' => AmazonPay::class]);
                $AmazonDeliveries = $this->paymentOptionRepository->findBy(['payment_id' => $Payment->getId()]);
                $AmazonSaleTypes = [];
                foreach ($AmazonDeliveries as $AmazonDelivery) {
                    $Delivery = $this->deliveryRepository->findOneBy(['id' => $AmazonDelivery->getDelivery()->getId()]);
                    $AmazonSaleTypes[] = $Delivery->getSaleType()->getId();
                }
                $parameters['AmazonSaleTypes'] = $AmazonSaleTypes;
                foreach ($parameters['Carts'] as $Cart) {
                    $cartKey = $Cart->getCartKey();
                    $payload = $this->amazonRequestService->createCheckoutSessionPayload($Cart->getCartKey());
                    $signature = $this->amazonRequestService->signaturePayload($payload);
                    $parameters['cart'][$cartKey]['payload'] = $payload;
                    $parameters['cart'][$cartKey]['signature'] = $signature;
                }
                $parameters['AmazonPayV2Config'] = $Config;
                if ($Config->getEnv() == $this->eccubeConfig['amazon_pay_v2']['env']['prod']) {
                    $parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['prod'];
                    goto NUSpb;
                }
                $parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['sandbox'];
                NUSpb:
                $event->setParameters($parameters);
                $event->addSnippet('@AmazonPayV2_42/default/Cart/amazon_pay_js.twig');
                if (!($Config->getCartButtonPlace() == $this->eccubeConfig['amazon_pay_v2']['button_place']['auto'])) {
                    goto RbrmI;
                }
                $event->addSnippet('@AmazonPayV2_42/default/Cart/button.twig');
                RbrmI:
                // [PHPDeobfuscator] Implied return
                return;
            }
            return;
        }
        return;
    }
    public function amazon_cart_buystep(EventArgs $event)
    {
        if (!($this->orderHelper->getNonmember() && $this->session->get($this->sessionAmazonProfileKey))) {
            goto uwzR3;
        }
        $this->session->remove(OrderHelper::SESSION_NON_MEMBER);
        $this->session->remove($this->sessionAmazonProfileKey);
        $this->cartService->setPreOrderId(null);
        $this->cartService->save();
        uwzR3:
    }
    public function amazon_pay_shopping(TemplateEvent $event)
    {
        $request = $this->requestStack->getMasterRequest();
        $uri = $request->getUri();
        $parameters = $event->getParameters();
        if (!(preg_match('/shopping\\/amazon_pay/', $uri) == false)) {
            $Config = $this->configRepository->get();
            $event->addSnippet('@AmazonPayV2_42/default/Shopping/widgets.twig');
            $event->addSnippet('@AmazonPayV2_42/default/Shopping/customer_regist_v2.twig');
            $amazonCheckoutSessionId = $this->session->get($this->sessionAmazonCheckoutSessionIdKey);
            $parameters = $event->getParameters();
            $parameters['amazonCheckoutSessionId'] = $amazonCheckoutSessionId;
            $parameters['AmazonPayV2Config'] = $Config;
            if ($this->pluginRepository->findOneBy(['code' => 'MailMagazine42', 'enabled' => true]) || $this->pluginRepository->findOneBy(['code' => 'PostCarrier42', 'enabled' => true])) {
                $useMailMagazine = true;
                goto Kd4km;
            }
            $useMailMagazine = false;
            Kd4km:
            $parameters['useMailMagazine'] = $useMailMagazine;
            if ($Config->getEnv() == $this->eccubeConfig['amazon_pay_v2']['env']['prod']) {
                $parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['prod'];
                goto CM7vD;
            }
            $parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['sandbox'];
            CM7vD:
            $event->setParameters($parameters);
            // [PHPDeobfuscator] Implied return
            return;
        }
        $referer = $request->headers->get('referer');
        $Order = $parameters['Order'];
        $Payment = $Order->getPayment();
        if (!($Payment && $Payment->getMethodClass() === AmazonPay::class && preg_match('/shopping_coupon/', $referer))) {
            return;
        }
        header("Location:" . $this->container->get('router')->generate('amazon_pay_shopping'));
        exit;
    }
    public function amazon_pay_shopping_confirm(TemplateEvent $event)
    {
        $request = $this->requestStack->getMasterRequest();
        $uri = $request->getUri();
        if (!(preg_match('/shopping\\/amazon_pay/', $uri) == false)) {
            $Config = $this->configRepository->get();
            $event->addSnippet('@AmazonPayV2_42/default/Shopping/confirm_widgets.twig');
            $event->addSnippet('@AmazonPayV2_42/default/Shopping/confirm_customer_regist_v2.twig');
            $parameters = $event->getParameters();
            $parameters['AmazonPayV2Config'] = $Config;
            if ($this->pluginRepository->findOneBy(['code' => 'MailMagazine42', 'enabled' => true]) || $this->pluginRepository->findOneBy(['code' => 'PostCarrier42', 'enabled' => true])) {
                $useMailMagazine = true;
                goto MJHSo;
            }
            $useMailMagazine = false;
            MJHSo:
            $parameters['useMailMagazine'] = $useMailMagazine;
            if ($Config->getEnv() == $this->eccubeConfig['amazon_pay_v2']['env']['prod']) {
                $parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['prod'];
                goto tHn08;
            }
            $parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['sandbox'];
            tHn08:
            $event->setParameters($parameters);
            // [PHPDeobfuscator] Implied return
            return;
        }
        return;
    }
    public function mypage_login(TemplateEvent $event)
    {
        $Config = $this->configRepository->get();
        if (!($Config->getUseMypageLoginButton() == $this->eccubeConfig['amazon_pay_v2']['toggle']['off'])) {
            $state = $this->session->get($this->sessionAmazonLoginStateKey);
            if ($state) {
                goto uTNP3;
            }
            $state = bin2hex(Random::string(16));
            $this->session->set($this->sessionAmazonLoginStateKey, $state);
            uTNP3:
            $returnUrl = $this->router->generate('login_with_amazon', ['state' => $state], UrlGeneratorInterface::ABSOLUTE_URL);
            $parameters = $event->getParameters();
            $payload = $this->amazonRequestService->createSigninPayload($returnUrl);
            $signature = $this->amazonRequestService->signaturePayload($payload);
            $parameters['payload'] = $payload;
            $parameters['signature'] = $signature;
            $parameters['buttonColor'] = $Config->getMypageLoginButtonColor();
            $parameters['AmazonPayV2Config'] = $Config;
            if ($Config->getEnv() == $this->eccubeConfig['amazon_pay_v2']['env']['prod']) {
                $parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['prod'];
                goto aXPGe;
            }
            $parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['sandbox'];
            aXPGe:
            $event->setParameters($parameters);
            if (!($Config->getMypageLoginButtonPlace() == $this->eccubeConfig['amazon_pay_v2']['button_place']['auto'])) {
                goto UzskJ;
            }
            $event->addSnippet('@AmazonPayV2_42/default/Mypage/login_page_button.twig');
            UzskJ:
            $event->addSnippet('@AmazonPayV2_42/default/Mypage/amazon_login_js.twig');
            // [PHPDeobfuscator] Implied return
            return;
        }
        return;
    }
}


Malware detection & removal plugin for WordPress

(C)2020 Wordpress Doctor All rights reserved.