app/Plugin/AmazonPayV2/AmazonPayEvent.php line 8

Open in your IDE?
  1. <?php
  2. /*   __________________________________________________
  3.     |  Obfuscated by YAK Pro - Php Obfuscator  2.0.3   |
  4.     |              on 2022-07-29 16:08:35              |
  5.     |    GitHub: https://github.com/pk-fr/yakpro-po    |
  6.     |__________________________________________________|
  7. */
  8. namespace Plugin\AmazonPayV2;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\Repository\ConfigRepository;use Plugin\AmazonPayV2\Service\AmazonRequestService;use Plugin\AmazonPayV2\Service\Method\AmazonPay;use Plugin\AmazonPayV2\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;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;public function __construct(RequestStack $requestStackSessionInterface $sessionTokenStorageInterface $tokenStorageEccubeConfig $eccubeConfigUrlGeneratorInterface $routerPaymentRepository $paymentRepositoryPluginRepository $pluginRepositoryConfigRepository $configRepositoryContainerInterface $containerOrderHelper $orderHelperCartService $cartServiceAmazonRequestService $amazonRequestServiceDeliveryRepository $deliveryRepositoryPaymentOptionRepository $paymentOptionRepository){goto eFEt_;LQK_G:$this->router $router;goto edw2L;iuLYP:$this->paymentOptionRepository $paymentOptionRepository;goto Upx9x;wH2_F:$this->pluginRepository $pluginRepository;goto xGNhF;qLDbm:$this->amazonRequestService $amazonRequestService;goto yLwYL;JN4a1:$this->orderHelper $orderHelper;goto n0lch;n0lch:$this->cartService $cartService;goto qLDbm;xGNhF:$this->configRepository $configRepository;goto A7CIN;MMno1:$this->session $session;goto ZCuBq;edw2L:$this->paymentRepository $paymentRepository;goto wH2_F;yLwYL:$this->deliveryRepository $deliveryRepository;goto iuLYP;ZCuBq:$this->tokenStorage $tokenStorage;goto FZeoh;A7CIN:$this->container $container;goto JN4a1;FZeoh:$this->eccubeConfig $eccubeConfig;goto LQK_G;eFEt_:$this->requestStack $requestStack;goto MMno1;Upx9x:}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'];}public function cart(TemplateEvent $event){goto aSDAb;BOtA0:$parameters['AmazonSaleTypes'] = $AmazonSaleTypes;goto r0u6B;Lsugh:if ($Config->getEnv() == $this->eccubeConfig['amazon_pay_v2']['env']['prod']) {goto LL7V6;}goto jbgL6;SXBy4:$Payment $this->paymentRepository->findOneBy(['method_class' => AmazonPay::class]);goto b6mOj;r0u6B:foreach ($parameters['Carts'] as $Cart) {goto Qk8Xt;NnSy5:eW_AI:goto UK05Y;MIKTU:$parameters['cart'][$cartKey]['signature'] = $signature;goto NnSy5;Qk8Xt:$cartKey $Cart->getCartKey();goto VgAIm;lbAaN:$parameters['cart'][$cartKey]['payload'] = $payload;goto MIKTU;VgAIm:$payload $this->amazonRequestService->createCheckoutSessionPayload($Cart->getCartKey());goto qr6Ob;qr6Ob:$signature $this->amazonRequestService->signaturePayload($payload);goto lbAaN;UK05Y:}goto ycZGz;hmzLr:Gu7Yq:goto pMfY4;wCcD9:SY6xQ:goto IXb8H;Noe0Y:EahSN:goto BOtA0;pMfY4:$event->setParameters($parameters);goto PKNrQ;upy9D:if (!($Config->getCartButtonPlace() == $this->eccubeConfig['amazon_pay_v2']['button_place']['auto'])) {goto SY6xQ;}goto CGq4n;ypRdW:$Config $this->configRepository->get();goto ODV1f;FHwMf:gdFAt:goto SXBy4;U5Qti:LL7V6:goto B5SbA;aSDAb:$parameters $event->getParameters();goto uk4Gu;FSu6j:$parameters['AmazonPayV2Config'] = $Config;goto Lsugh;CGq4n:$event->addSnippet('@AmazonPayV2/default/Cart/button.twig');goto wCcD9;ODV1f:if (!($Config->getUseCartButton() == $this->eccubeConfig['amazon_pay_v2']['toggle']['off'])) {goto gdFAt;}goto eS1NE;K40fs:$AmazonSaleTypes = [];goto dwQIk;ycZGz:AhrA2:goto FSu6j;B5SbA:$parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['prod'];goto hmzLr;dwQIk:foreach ($AmazonDeliveries as $AmazonDelivery) {goto w2Crx;LpxCG:$AmazonSaleTypes[] = $Delivery->getSaleType()->getId();goto AryUW;AryUW:YbmyI:goto DL0r0;w2Crx:$Delivery $this->deliveryRepository->findOneBy(['id' => $AmazonDelivery->getDelivery()->getId()]);goto LpxCG;DL0r0:}goto Noe0Y;PKNrQ:$event->addSnippet('@AmazonPayV2/default/Cart/amazon_pay_js.twig');goto upy9D;eS1NE:return;goto FHwMf;b6mOj:$AmazonDeliveries $this->paymentOptionRepository->findBy(['payment_id' => $Payment->getId()]);goto K40fs;qW5Fc:goto Gu7Yq;goto U5Qti;uk4Gu:if (!empty($parameters['Carts'])) {goto ERAnb;}goto JtR29;JtR29:return;goto SB4aR;SB4aR:ERAnb:goto ypRdW;jbgL6:$parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['sandbox'];goto qW5Fc;IXb8H:}public function amazon_cart_buystep(EventArgs $event){goto PL9LR;yJE21:KSY7p:goto slVNd;o3Pgv:$this->cartService->setPreOrderId(null);goto JcQxp;BsPRx:$this->session->remove($this->sessionAmazonProfileKey);goto o3Pgv;CiwoU:$this->session->remove(OrderHelper::SESSION_NON_MEMBER);goto BsPRx;PL9LR:if (!($this->orderHelper->getNonmember() && $this->session->get($this->sessionAmazonProfileKey))) {goto KSY7p;}goto CiwoU;JcQxp:$this->cartService->save();goto yJE21;slVNd:}public function amazon_pay_shopping(TemplateEvent $event){goto iIXg2;mgYb0:$parameters['useMailMagazine'] = $useMailMagazine;goto lke7B;GxeMS:o5WId:goto ke2IE;gla8M:$Order $parameters['Order'];goto v7X6X;VVOLS:$amazonCheckoutSessionId $this->session->get($this->sessionAmazonCheckoutSessionIdKey);goto BqU9K;taucz:header("Location:" $this->container->get('router')->generate('amazon_pay_shopping'));goto qqg68;g7G1m:if ($this->pluginRepository->findOneBy(['code' => 'MailMagazine4''enabled' => true]) || $this->pluginRepository->findOneBy(['code' => 'PostCarrier4''enabled' => true])) {goto cRzUI;}goto Uzhsl;ZqbSX:$event->addSnippet('@AmazonPayV2/default/Shopping/widgets.twig');goto PD0nL;l4dGp:goto PX9Pj;goto DoH4o;BqU9K:$parameters $event->getParameters();goto CXtf0;q304c:$parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['sandbox'];goto l4dGp;o1z3w:if (!(preg_match('/shopping\\/amazon_pay/'$uri) == false)) {goto mF5Yd;}goto jz004;cgWD3:$Config $this->configRepository->get();goto ZqbSX;c0_KE:goto ZtclP;goto wt2ZP;qqg68:exit;goto GxeMS;DoH4o:lId_o:goto QKkNE;Uzhsl:$useMailMagazine false;goto c0_KE;zn1ka:ZtclP:goto mgYb0;v7X6X:$Payment $Order->getPayment();goto MwomI;lke7B:if ($Config->getEnv() == $this->eccubeConfig['amazon_pay_v2']['env']['prod']) {goto lId_o;}goto q304c;PD0nL:$event->addSnippet('@AmazonPayV2/default/Shopping/customer_regist_v2.twig');goto VVOLS;ke2IE:return;goto oglaE;dWqkW:$event->setParameters($parameters);goto wDtYD;QKkNE:$parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['prod'];goto lKB1h;jz004:$referer $request->headers->get('referer');goto gla8M;Lqfgi:$uri $request->getUri();goto ygqOV;dYr88:$parameters['AmazonPayV2Config'] = $Config;goto g7G1m;lKB1h:PX9Pj:goto dWqkW;MwomI:if (!($Payment && $Payment->getMethodClass() === AmazonPay::class && preg_match('/shopping_coupon/'$referer))) {goto o5WId;}goto taucz;ygqOV:$parameters $event->getParameters();goto o1z3w;CXtf0:$parameters['amazonCheckoutSessionId'] = $amazonCheckoutSessionId;goto dYr88;iIXg2:$request $this->requestStack->getMasterRequest();goto Lqfgi;oxK37:$useMailMagazine true;goto zn1ka;wt2ZP:cRzUI:goto oxK37;oglaE:mF5Yd:goto cgWD3;wDtYD:}public function amazon_pay_shopping_confirm(TemplateEvent $event){goto FtP_N;S_orI:$parameters['AmazonPayV2Config'] = $Config;goto qyKOU;IRCmS:mxijL:goto GeTI_;mY0Sl:$useMailMagazine true;goto wHxle;q2A1z:$event->addSnippet('@AmazonPayV2/default/Shopping/confirm_customer_regist_v2.twig');goto qaol7;qyKOU:if ($this->pluginRepository->findOneBy(['code' => 'MailMagazine4''enabled' => true]) || $this->pluginRepository->findOneBy(['code' => 'PostCarrier4''enabled' => true])) {goto WgZQl;}goto gO1Ga;GDWy4:NtqDv:goto JLyWl;FtP_N:$request $this->requestStack->getMasterRequest();goto aR4K8;nkaCY:goto mxijL;goto u1_uF;qaol7:$parameters $event->getParameters();goto S_orI;JLyWl:$Config $this->configRepository->get();goto Damng;yTjj4:return;goto GDWy4;onwiu:WgZQl:goto mY0Sl;u1_uF:Riy9g:goto KsDbR;eATpO:goto W2Wmo;goto onwiu;Damng:$event->addSnippet('@AmazonPayV2/default/Shopping/confirm_widgets.twig');goto q2A1z;aR4K8:$uri $request->getUri();goto oDraT;rVTmX:$parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['sandbox'];goto nkaCY;KsDbR:$parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['prod'];goto IRCmS;oDraT:if (!(preg_match('/shopping\\/amazon_pay/'$uri) == false)) {goto NtqDv;}goto yTjj4;XSnWU:$parameters['useMailMagazine'] = $useMailMagazine;goto hWa1u;wHxle:W2Wmo:goto XSnWU;gO1Ga:$useMailMagazine false;goto eATpO;hWa1u:if ($Config->getEnv() == $this->eccubeConfig['amazon_pay_v2']['env']['prod']) {goto Riy9g;}goto rVTmX;GeTI_:$event->setParameters($parameters);goto hNpQP;hNpQP:}public function mypage_login(TemplateEvent $event){goto vZM2d;ao9UC:$parameters['signature'] = $signature;goto wpbW0;oV3Yj:dHrjh:goto NQ6cf;VgYjC:$parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['prod'];goto wTp3V;We1Mu:$event->setParameters($parameters);goto rdVRu;vZM2d:$Config $this->configRepository->get();goto sTgGj;iMplf:$parameters['payload'] = $payload;goto ao9UC;WIUAs:$signature $this->amazonRequestService->signaturePayload($payload);goto iMplf;KLOgy:RJ0Lm:goto VgYjC;f2gD4:$parameters['AmazonPayV2Config'] = $Config;goto W4gzb;W4gzb:if ($Config->getEnv() == $this->eccubeConfig['amazon_pay_v2']['env']['prod']) {goto RJ0Lm;}goto Oi9Fm;wTp3V:OWO6v:goto We1Mu;IIsEy:$returnUrl $this->router->generate('login_with_amazon', ['state' => $state], UrlGeneratorInterface::ABSOLUTE_URL);goto ZZnaO;Oi9Fm:$parameters['AmazonPayV2Api'] = $this->eccubeConfig['amazon_pay_v2']['api']['sandbox'];goto JP0sH;Idijx:w9GHF:goto JCG48;p1dWY:return;goto Idijx;NQ6cf:$event->addSnippet('@AmazonPayV2/default/Mypage/amazon_login_js.twig');goto NCDhf;XzNEQ:$payload $this->amazonRequestService->createSigninPayload($returnUrl);goto WIUAs;Vq2l1:if ($state) {goto kTKqS;}goto fYcNa;ZZnaO:$parameters $event->getParameters();goto XzNEQ;JCG48:$state $this->session->get($this->sessionAmazonLoginStateKey);goto Vq2l1;fYcNa:$state bin2hex(Random::string(16));goto cch8U;PphEN:$event->addSnippet('@AmazonPayV2/default/Mypage/login_page_button.twig');goto oV3Yj;z1mC7:kTKqS:goto IIsEy;wpbW0:$parameters['buttonColor'] = $Config->getMypageLoginButtonColor();goto f2gD4;cch8U:$this->session->set($this->sessionAmazonLoginStateKey$state);goto z1mC7;JP0sH:goto OWO6v;goto KLOgy;rdVRu:if (!($Config->getMypageLoginButtonPlace() == $this->eccubeConfig['amazon_pay_v2']['button_place']['auto'])) {goto dHrjh;}goto PphEN;sTgGj:if (!($Config->getUseMypageLoginButton() == $this->eccubeConfig['amazon_pay_v2']['toggle']['off'])) {goto w9GHF;}goto p1dWY;NCDhf:}}