De-obfuscate PHP malware/viruses and tampering code on Wordpress to original readable code.
*Please note that not all obfuscation codes can be decoded.<?php /** * @version EC-CUBE4系 * @copyright 株式会社 翔 kakeru.co.jp * * 2022年03月02日カスタマイズ * * app/Customize/Plugin/AmazonPayV2/Controller/AmazonShoppingController.php * * * del * * * ≡≡≡┏(^o^)┛ *****************************************************/ namespace Customize\Plugin\AmazonPayV2\Controller; use Customize\Converter\OrderConverter; use Customize\Service\OrderService; use Eccube\Entity\Delivery; use Eccube\Entity\OrderItem; use Eccube\Repository\DeliveryRepository; use Eccube\Repository\Master\OrderStatusRepository; use Eccube\Repository\OrderRepository; use Plugin\AmazonPayV2\Repository\ConfigRepository; use Plugin\AmazonPayV2\Service\AmazonOrderHelper; use Plugin\AmazonPayV2\Service\AmazonRequestService; use Plugin\AmazonPayV2\Service\Method\AmazonPay; use Eccube\Common\EccubeConfig; use Eccube\Controller\AbstractShoppingController; use Eccube\Entity\Order; use Eccube\Entity\Shipping; use Eccube\Entity\Master\OrderStatus; use Customize\Form\Type\Shopping\OrderType; use Eccube\Repository\CustomerRepository; use Eccube\Repository\Master\PrefRepository; use Eccube\Repository\ProductClassRepository; use Eccube\Repository\PluginRepository; use Customize\Service\CartService; use Customize\Service\MailService; use Customize\Service\OrderHelper; use Eccube\Service\PurchaseFlow\PurchaseContext; use Eccube\Service\PurchaseFlow\PurchaseFlow; use Plugin\AmazonPayV2\Exception\AmazonPaymentException; use Plugin\AmazonPayV2\Amazon\Pay\API\Client; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormError; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\RouterInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Validator\Constraints as Assert; use Doctrine\DBAL\LockMode; use Customize\Service\CustomerService; class AmazonShoppingController extends \Plugin\AmazonPayV2\Controller\AmazonShoppingController { private $sessionAmazonProfileKey = 'amazon_pay_v2.profile'; private $sessionAmazonCheckoutSessionIdKey = 'amazon_pay_v2.checkout_session_id'; private $sessionAmazonCustomerParamKey = 'amazon_pay_v2.customer_regist_v2'; private $sessionAmazonCustomerErrorKey = 'amazon_pay_v2.customer_regist_v2_error'; private $sessionIsShippingRefresh = 'amazon_pay_v2.is_shipping_refresh'; protected $validator; protected $cartService; protected $amazonOrderHelper; protected $CustomerService; protected $OrderService; protected $OrderConverter; public function __construct(EccubeConfig $eccubeConfig, PurchaseFlow $cartPurchaseFlow, CartService $cartService, MailService $mailService, OrderHelper $orderHelper, CustomerRepository $customerRepository, OrderRepository $orderRepository, OrderStatusRepository $orderStatusRepository, PrefRepository $prefRepository, ProductClassRepository $productClassRepository, PluginRepository $pluginRepository, ConfigRepository $configRepository, AmazonOrderHelper $amazonOrderHelper, AmazonRequestService $amazonRequestService, ValidatorInterface $validator, EncoderFactoryInterface $encoderFactory, TokenStorageInterface $tokenStorage, DeliveryRepository $deliveryRepository, CustomerService $CustomerService, OrderService $OrderService, OrderConverter $OrderConverter) { goto OGLeK; itDJv:$this->orderHelper = $orderHelper; goto rQr9s; oo0Qj:$this->validator = $validator; goto w4_oj; b0K_z:$this->orderStatusRepository = $orderStatusRepository; goto qdiTb; qdiTb:$this->prefRepository = $prefRepository; goto GzXrf; D6Wzb:$this->mailService = $mailService; goto itDJv; p85wH:$this->purchaseFlow = $cartPurchaseFlow; goto i299s; GzXrf:$this->productClassRepository = $productClassRepository; goto n5K05; qetUI:$this->amazonOrderHelper = $amazonOrderHelper; goto kRDfl; Tq1xZ:$this->deliveryRepository = $deliveryRepository; goto qHNSV; rIgeu:$this->Config = $configRepository->get(); goto qetUI; kRDfl:$this->amazonRequestService = $amazonRequestService; goto oo0Qj; i299s:$this->cartService = $cartService; goto D6Wzb; w4_oj:$this->encoderFactory = $encoderFactory; goto ZL0uk; OGLeK:$this->eccubeConfig = $eccubeConfig; goto p85wH; ZL0uk:$this->tokenStorage = $tokenStorage; goto Tq1xZ; rQr9s:$this->customerRepository = $customerRepository; goto qmjU0; n5K05:$this->pluginRepository = $pluginRepository; goto rIgeu; qmjU0:$this->orderRepository = $orderRepository; $this->CustomerService=$CustomerService; $this->OrderService=$OrderService; $this->OrderConverter=$OrderConverter; goto b0K_z; qHNSV:} /** * @Route("/shopping/amazon_pay/", name="amazon_pay_shopping") * @Template("Shopping/index.twig") *s * @param Request $request */ public function index(Request $request, PurchaseFlow $cartPurchaseFlow){ goto SYXom; noX5V:logs('amazon_pay_v2')->info('[注文手続] カートが購入フローへ遷移できない状態のため, カート画面に遷移します.'); goto CxUd1; FoI6B:$this->session->set(OrderHelper::SESSION_NON_MEMBER, $Customer); goto vLfOi; tzk1X:rC3WD:goto WeJPF; CxUd1:return $this->redirectToRoute('cart'); goto ccQY9; C3Nie:$initOrderFlg = false; goto gFue3; PKlI4:hLPGK:goto ts14s; WR4bg:return $this->redirectToRoute('shopping_error'); goto v_WBs; d295M:$arrAmazonCustomerParam['customer_regist_v2'] = false; goto W9a9p; Lh7dn:$Order = $this->amazonOrderHelper->initializeAmazonOrder($Order, $Customer); goto O4y8x; uoNNH:Zxw1w:goto wsH3Z; b4KA6:SFm7H:goto Kaufg; Hl0nG:if (!empty($arrAmazonCustomerParam['mail_magazine'])) {goto Fn0N7; }goto lfN9a; Zpdil:iKvi3:goto pV55_; Ev0Vx:if (!($AmazonDefaultDelivery === false)) {goto mGL25; }goto QNLFA; Oauoz:$initOrderFlg = true; goto CTmF6; swGIb:$this->session->remove($this->sessionAmazonCheckoutSessionIdKey); goto WR4bg; asgql:$this->amazonOrderHelper->convert($Shippings->first(), $checkoutSession->shippingAddress); goto EkIE7; CSbY8:goto iKvi3; goto QDCaI; KxxQ0:$this->entityManager->flush(); goto dn7Wq; Oe_Ag:return $this->redirectToRoute('shopping_error'); goto PKlI4; hUWMM:$checkoutSession = $this->amazonRequestService->getCheckoutSession($amazonCheckoutSessionId); goto IPyIp; G2q_t:$this->session->remove($this->sessionIsShippingRefresh); goto UMmql; xAE7L:logs('amazon_pay_v2')->info('[注文手続] Warningが発生しました.', [$flowResult->getWarning()]); goto p8d5x; Kaufg:$this->session->set($this->sessionAmazonCustomerErrorKey, null); goto tzk1X; CWiYd:$Cart = $this->cartService->getCart(); goto GZLqZ; QDCaI:JJ_Rt:goto I7wpW; qfq3Y:$Shipping->setShippingDeliveryName($AmazonDefaultDelivery->getName()); goto KxxQ0; mWLMd:if (!empty($arrAmazonCustomerParam['customer_regist_v2'])) {goto D2lKt; }goto d295M; k2RLS:kA1xQ:goto osD_u; W9a9p:D2lKt:goto Hl0nG; R2mCj:$arrAmazonCustomerParam = ['customer_regist_v2' => true, 'mail_magazine' => true, 'login_check_v2' => 'regist', 'amazon_login_email_v2' => null, 'amazon_login_password_v2' => null]; goto CSbY8; CTmF6:goto NnJ7q; goto uoNNH; LFQcR:$Shipping->setDelivery($AmazonDefaultDelivery); goto qfq3Y; iyC2y:if (!($amazonCustomerError = $this->session->get($this->sessionAmazonCustomerErrorKey))) {goto rC3WD; }goto H48hc; FbIu1:$this->setAmazonCustomerData($form, $arrAmazonCustomerParam); goto JK6JJ; U1TC1:$amazonCheckoutSessionId = $this->session->get($this->sessionAmazonCheckoutSessionIdKey); goto hUWMM; ts14s:if (!$flowResult->hasWarning()) {goto mACEj; }goto xAE7L; RzYmZ:if (!$flowResult->hasError()) {goto hLPGK; }goto jenSz; UIEb0:$Shipping = $Order->getShippings()->first(); goto qe3dX; I7wpW:$arrAmazonCustomerParam = unserialize($amazonCustomerParam); goto mWLMd; X3zer:mGL25:goto G_YZ0; AodbH:if ($this->isGranted('ROLE_USER')) {goto eM3B_; }goto FoI6B; JK6JJ:twH8i:goto iyC2y; IPyIp:if (!($checkoutSession && $checkoutSession->statusDetails->state !== 'Open')) {goto torhj; }goto eIIbD; osD_u:NnJ7q:goto SXwwt; UAo4B:if ($this->isGranted('IS_AUTHENTICATED_FULLY')) {goto twH8i; }goto FbIu1; eIIbD:logs('amazon_pay_v2')->info('[注文手続] CheckoutSessionがOpenで無い為決済処理を中断します.', ['CheckoutSessionId => $amazonCheckoutSessionId']); goto swGIb; p8d5x:$cartPurchaseFlow->validate($Cart, new PurchaseContext()); goto roS_f; v_WBs:torhj:goto yKbLN; vNTRI: #23022/02/18 # 1 ログインしている ログイン情報を使う # 2 戻り値のメールアドレス # 3 戻り値のアマゾンID # 4 新規登録 if ($this->CustomerService->GetAmazonLoginFlg()>=3){ $profile = unserialize($this->session->get($this->sessionAmazonProfileKey)); $Customer = $this->customerRepository->getRegularCustomerByEmail($profile->email) ?? $this->amazonOrderHelper->getOrderer($checkoutSession->shippingAddress); }else{ $Customer = $this->getUser() ? $this->getUser() : $this->amazonOrderHelper->getOrderer($checkoutSession->shippingAddress); } goto AodbH; oAoyt:logs('amazon_pay_v2')->info('AmazonShopping::index end.'); goto morH6; G_YZ0:if (!($initOrderFlg && $AmazonDefaultDelivery)) {goto Hbrg_; }goto LFQcR; QNLFA:$this->addError('Amazon Payでご利用できる配送方法が存在しません。'); goto X3zer; LnOr3:$this->entityManager->flush(); goto RzYmZ; O4y8x:if (!$this->session->get($this->sessionIsShippingRefresh)) {goto iIClx; }goto dJTQV; dn7Wq:Hbrg_:goto Lh7dn; roS_f:$this->cartService->save(); goto dS3t5; Vj6Wi:logs('amazon_pay_v2')->info('[注文手続] 集計処理を開始します.', [$Order->getId()]); goto egjWL; zRPFu:foreach ($arrAmazonCustomerError as $key => $val) {$form[$key]->addError(new FormError($val)); h5iVe:}goto b4KA6; SYXom:logs('amazon_pay_v2')->info('AmazonShopping::index start.'); goto CWiYd; yKbLN:logs('amazon_pay_v2')->info('[注文手続] 受注の初期化処理を開始します.'); goto vNTRI; ccQY9:EMkXl:goto U1TC1; gdYtd:if ($amazonCustomerParam = $this->session->get($this->sessionAmazonCustomerParamKey)) {goto JJ_Rt; }goto R2mCj; vLfOi:eM3B_:goto C3Nie; egjWL:$flowResult = $this->executePurchaseFlow($Order, false); goto LnOr3; wsH3Z:if (!$Order->isMultiple()) {goto kA1xQ; }goto lQ5pq; GZLqZ:if ($Cart && $this->orderHelper->verifyCart($Cart)) {goto EMkXl; }goto noX5V; UMmql:iIClx:goto Vj6Wi; H48hc:$arrAmazonCustomerError = unserialize($amazonCustomerError); goto zRPFu; WeJPF:$form->handleRequest($request); goto oAoyt; morH6:return [ 'form' => $form->createView(), 'Order' => $Order, 'AmazonCustomer' => $arrAmazonCustomerParam, 'AmazonPaymentDescriptor' => $checkoutSession->paymentPreferences[0]->paymentDescriptor, 'AmazonShippingAddress' => $checkoutSession->shippingAddress, 'lmCustomer' => $this->CustomerService->GetLandMarkCustomerId($Customer->getLmCustomerId()), ]; goto vvvpo; lQ5pq:$Cart->setPreOrderId(null); goto k2RLS; dJTQV:$Shippings = $Order->getShippings(); goto asgql; qe3dX:$AmazonDefaultDelivery = $this->getAmazonPayDefaultDelivery($Shipping); goto Ev0Vx; uT4Fu:Fn0N7:goto Zpdil; gFue3:if ($Order = $this->orderHelper->getPurchaseProcessingOrder($Cart->getPreOrderId())) {goto Zxw1w; }goto Oauoz; pV55_:$form = $this->createForm(OrderType::class, $Order); goto UAo4B; lfN9a:$arrAmazonCustomerParam['mail_magazine'] = false; goto uT4Fu; SXwwt:$Order = $this->orderHelper->initializeOrder($Cart, $Customer); goto UIEb0; EkIE7:$this->entityManager->flush(); goto G2q_t; jenSz:logs('amazon_pay_v2')->info('[注文手続] Errorが発生したため購入エラー画面へ遷移します.', [$flowResult->getErrors()]); goto Oe_Ag; dS3t5:mACEj:goto gdYtd; vvvpo:} /** * ご注文内容のご確認 * * @Route("/shopping/amazon_pay/confirm/", name="amazon_pay_shopping_confirm", methods={"POST"}) * @Template("Shopping/confirm.twig") */ public function confirm(Request $request){goto Oa2I2; WUzxB:jFIef:goto UTsMC; S2K54:jeZ0j:goto GWCKG; uLFMX:XYVf2:goto Ky12g; HmloI:logs('amazon_pay_v2')->info('[注文手続] カートが購入フローへ遷移できない状態のため, カート画面に遷移します.'); goto iwFM4; hNHzw:$Cart = $this->cartService->getCart(); goto eLzmW; eqrTy:$preOrderId = $this->cartService->getPreOrderId(); goto GqiHk; GqiHk:$Order = $this->orderHelper->getPurchaseProcessingOrder($preOrderId); goto SL8qq; NV8JM:JNTlz:goto eqrTy; h3S7H:W10ZW:goto NCaQ2; bSGgq:foreach ($PaymentResult->getErrors() as $error) {$this->addError($error); iy7KJ:}goto uLFMX; oFM8j:$response = $PaymentResult->getResponse(); goto PFID7; Aah6Z:if (!$response) {goto ryu7g; }goto anILc; m1a48:if (!$PaymentResult) {goto iflG0; }goto tqWK3; VaIdh:$paymentMethod = $this->createPaymentMethod($Order, $form); goto CxAj9; b4_tp:if ($this->isGranted('IS_AUTHENTICATED_FULLY')) {goto jeZ0j; }goto XS4_n; UJFM1:return $this->redirectToRoute('amazon_pay_shopping'); goto lCAtx; k_Ej3:$this->session->set($this->sessionAmazonCustomerParamKey, serialize($arrAmazonCustomerParam)); goto Huo03; XS4_n:$this->setAmazonCustomerData($form, $arrAmazonCustomerParam); goto S2K54; UIEre:return [ 'form' => $form->createView(), 'Order' => $Order, 'orderHeader' => $this->OrderService->createOrderHeader($Order), ]; goto h3S7H; vTPOe:iflG0:goto qskKf; Wrw2f:logs('amazon_pay_v2')->info('[注文確認] PaymentMethod::verifyを実行します.', [$Order->getPayment()->getMethodClass()]); goto VaIdh; y3rU8:ryu7g:goto Wrw2f; UTsMC:$arrAmazonCustomerParam = $this->getAmazonCustomerParam($request); goto k_Ej3; KnwJV:return $this->redirectToRoute('amazon_pay_shopping'); goto ikf3G; GWCKG:$form->handleRequest($request); goto HFZau; dxHpq:$this->entityManager->flush(); goto Aah6Z; mqJFA:return $response; goto JjEDv; NCaQ2:logs('amazon_pay_v2')->info('[注文確認] フォームエラーのため, 注文手続画面へ遷移します', [$Order->getId()]); goto cPK8k; ikf3G:khydE:goto m2pi2; NuLua:$this->entityManager->flush(); goto M02gp; jKyvl:$this->session->set($this->sessionAmazonCustomerErrorKey, serialize($arrAmazonCustomerError)); goto KnwJV; cEmtq:$response = $this->executePurchaseFlow($Order); goto dxHpq; tqWK3:if ($PaymentResult->isSuccess()) {goto ehD_V; }goto Xc6c7; iwFM4:return $this->redirectToRoute('cart'); goto NV8JM; CxAj9:$PaymentResult = $paymentMethod->verify(); goto m1a48; PFID7:if (!($response && ($response->isRedirection() || $response->getContent()))) {goto vEWIJ; }goto NuLua; JjEDv:vEWIJ:goto vTPOe; cPK8k:return $this->redirectToRoute('amazon_pay_shopping', ['request' => $request], 307); goto Zl5hK; Huo03:$form = $this->createForm(OrderType::class, $Order); goto b4_tp; M02gp:logs('amazon_pay_v2')->info('[注文確認] PaymentMethod::verifyが指定したレスポンスを表示します.'); goto mqJFA; anILc:return $this->redirectToRoute('amazon_pay_shopping'); goto y3rU8; lCAtx:ehD_V:goto oFM8j; EGQgj:logs('amazon_pay_v2')->info('[注文確認] 注文確認画面を表示します.'); goto UIEre; Oa2I2:logs('amazon_pay_v2')->info('AmazonShopping::confirm start.'); goto hNHzw; SL8qq:if ($Order) {goto jFIef; }goto jRHIs; jbaDy:logs('amazon_pay_v2')->info('[注文確認] 集計処理を開始します.', [$Order->getId()]); goto cEmtq; ASSAk:return $this->redirectToRoute('shopping_error'); goto WUzxB; eLzmW:if ($Cart && $this->orderHelper->verifyCart($Cart)) {goto JNTlz; }goto HmloI; Xc6c7:$this->entityManager->rollback(); goto bSGgq; qskKf:$this->entityManager->flush(); goto EGQgj; HFZau:if (!($arrAmazonCustomerError = $this->checkAmazonCustomerError($request, $form, $Order))) {goto khydE; }goto jKyvl; m2pi2:if (!($form->isSubmitted() && $form->isValid())) {goto W10ZW; }goto jbaDy; jRHIs:logs('amazon_pay_v2')->info('[リダイレクト] 購入処理中の受注が存在しません.'); goto ASSAk; Ky12g:logs('amazon_pay_v2')->info('[注文確認] PaymentMethod::verifyのエラーのため, 注文手続き画面へ遷移します.', [$PaymentResult->getErrors()]); goto UJFM1; Zl5hK:} /** * 購入処理 * * @Route("/shopping/amazon_pay/checkout/", name="amazon_pay_shopping_checkout", methods={"POST"}) * @Template("Shopping/index.twig") */ public function checkout(Request $request){goto J0p46; Q9IvY:$this->entityManager->flush(); goto fTf3p; jlYYn:ENr8g:goto BDTmb; ZjDk1:if (!isset($checkoutSession->reasonCode)) {goto u0itC; }goto L8NSA; fTf3p:return new RedirectResponse($checkoutSession->webCheckoutDetails->amazonPayRedirectUrl); goto k4QJy; O30aN:$this->session->set($this->sessionAmazonCustomerErrorKey, serialize($arrAmazonCustomerError)); goto cLRkO; H2NNt:HshpR:goto XDMxI; GcttE:logs('amazon_pay_v2')->info('[リダイレクト] 購入処理中の受注が存在しません.'); goto xzXio; abh1r:$amazonCustomerParam = $this->session->get($this->sessionAmazonCustomerParamKey); goto usFaZ; RTbER:if (!($arrAmazonCustomerError = $this->checkAmazonCustomerError($request, $form, $Order))) {goto p1YHh; }goto O30aN; Pdkja:return $this->redirectToRoute('amazon_pay_shopping'); goto QN1as; eini7:$this->session->remove($this->sessionAmazonCheckoutSessionIdKey); goto l8cTd; MOOU1:if ($Order) {goto ywli2; }goto GcttE; xUTFb:$preOrderId = $this->cartService->getPreOrderId(); goto Df7Up; xQ9ga:if (!$response) {goto ENr8g; }goto kont7; KoBJn:LuxKG:goto SG_71; Cp6GD:logs('amazon_pay_v2')->info('購入処理開始', [$Order->getId()]); goto f_bmi; cLRkO:return $this->redirectToRoute('amazon_pay_shopping'); goto eBppc; pxgJI:return $this->redirectToRoute('cart'); goto KF_Vb; hK1yz:logs('amazon_pay_v2')->info('購入チェックエラー', [$Order->getId()]); goto dZUnT; dqYUM:$this->session->set($this->sessionAmazonCustomerParamKey, serialize($arrAmazonCustomerParam)); goto XBk2y; eBppc:p1YHh:goto dDCts; XOg80:XtHy9:goto pMhLa; q9OiB:logs('amazon_pay_v2')->error('[注文手続] 都道府県割当エラー', [$Order->getId()]); goto qS04v; cM6x7:p13Fi:goto hLQbm; BDTmb:$paymentMethod = $this->createPaymentMethod($Order, $form); goto EYRei; kqv8Y:if ($Cart && $this->orderHelper->verifyCart($Cart)) {goto qby4T; }goto h8r7Z; hLQbm:$form->handleRequest($request); goto XCX4g; n5dhM:$checkoutSession = $this->amazonRequestService->updateCheckoutSession($Order, $amazonCheckoutSessionId); goto ZjDk1; emGSf:JUWSg:goto Gm1AU; pMhLa:if ($this->Config->getUseConfirmPage() == $this->eccubeConfig['amazon_pay_v2']['toggle']['off']) {goto R930j; }goto abh1r; YIICH:$shippingDifference = $this->checkShippingDifference($Order, $checkoutSession->shippingAddress); goto IUDqY; kont7:return $this->redirectToRoute('amazon_pay_shopping'); goto jlYYn; kWVMl:ywli2:goto Qt4zz; XDMxI:if (!($checkoutSession && $checkoutSession->statusDetails->state !== 'Open')) {goto XtHy9; }goto xCQhI; xCAXa:$this->session->set($this->sessionIsShippingRefresh, true); goto Pdkja; IUDqY:if (!$shippingDifference) {goto Z0KIB; }goto xCAXa; YFPJo:$this->setAmazonCustomerData($form, $arrAmazonCustomerParam); goto cM6x7; kkdnA:return $response; goto VqCSj; tU4ay:$this->addError('amazon_pay_v2.front.shopping.undefined_pref_error'); goto q9OiB; SG_71:if ($this->isGranted('IS_AUTHENTICATED_FULLY')) {goto p13Fi; }goto YFPJo; qS04v:return $this->redirectToRoute('shopping_error'); goto H2NNt; k4QJy:ybF2c:goto hK1yz; p3hbj:if ($this->amazonOrderHelper->checkShippingPref($checkoutSession->shippingAddress)) {goto HshpR; }goto tU4ay; f_bmi:$response = $this->executePurchaseFlow($Order); goto R4Xhc; QN1as:Z0KIB:goto p3hbj; DA3a9:$form = $this->createForm(OrderType::class, $Order, ['skip_add_form' => true]); goto AsCuN; XBk2y:$form = $this->createForm(OrderType::class, $Order); goto KoBJn; epKZk:$arrAmazonCustomerParam = $this->getAmazonCustomerParam($request); goto dqYUM; AsCuN:goto LuxKG; goto WX4Mf; bNHnF:u0itC:goto Cp6GD; MEkQX:return $this->redirectToRoute('amazon_pay_shopping'); goto bNHnF; Gm1AU:eBlwU:goto dORgU; EYRei:logs('amazon_pay_v2')->info('[注文処理] PaymentMethod::applyを実行します.'); goto X7s5P; h8r7Z:logs('amazon_pay_v2')->info('[注文手続] カートが購入フローへ遷移できない状態のため, カート画面に遷移します.'); goto pxgJI; X7s5P:if (!($response = $paymentMethod->apply())) {goto IK8wX; }goto kkdnA; J0p46:logs('amazon_pay_v2')->info('AmazonShopping::order start.'); goto mIMJ8; XCX4g:if ($this->Config->getUseConfirmPage() == $this->eccubeConfig['amazon_pay_v2']['toggle']['on']) {goto JUWSg; }goto RTbER; VqCSj:IK8wX:goto zvT87; Qt4zz:$amazonCheckoutSessionId = $this->session->get($this->sessionAmazonCheckoutSessionIdKey); goto Cxm04; dZUnT:return $this->redirectToRoute('amazon_pay_shopping', ['request' => $request], 307); goto zlI4V; w2_qG:$Order->setAmazonPayV2SessionTemp(serialize($session_temp)); goto Q9IvY; usFaZ:$arrAmazonCustomerParam = unserialize($amazonCustomerParam); goto DA3a9; xzXio:return $this->redirectToRoute('shopping_error'); goto kWVMl; wX2I3:$this->addError('予期しないエラーが発生しました。'); goto MEkQX; KF_Vb:qby4T:goto xUTFb; dDCts:goto eBlwU; goto emGSf; l8cTd:return $this->redirectToRoute('shopping_error'); goto XOg80; R4Xhc:$this->entityManager->flush(); goto xQ9ga; xCQhI:logs('amazon_pay_v2')->info('[注文手続] CheckoutSessionがOpenで無い為決済処理を中断します.', ['CheckoutSessionId => $amazonCheckoutSessionId']); goto eini7; Df7Up:$Order = $this->orderHelper->getPurchaseProcessingOrder($preOrderId); goto MOOU1; zvT87:$session_temp = ['IS_AUTHENTICATED_FULLY' => $this->isGranted('IS_AUTHENTICATED_FULLY'), $this->sessionAmazonCheckoutSessionIdKey => $amazonCheckoutSessionId, $this->sessionAmazonProfileKey => unserialize($this->session->get($this->sessionAmazonProfileKey)), $this->sessionAmazonCustomerParamKey => unserialize($this->session->get($this->sessionAmazonCustomerParamKey))]; goto w2_qG; L8NSA:logs('amazon_pay_v2')->error('reasonCode: ' . $checkoutSession->reasonCode . ' message: ' . $checkoutSession->message); goto wX2I3; WX4Mf:R930j:goto epKZk; dORgU:if (!($form->isSubmitted() && $form->isValid())) {goto ybF2c; }goto n5dhM; mIMJ8:$Cart = $this->cartService->getCart(); goto kqv8Y; Cxm04:$checkoutSession = $this->amazonRequestService->getCheckoutSession($amazonCheckoutSessionId); goto YIICH; zlI4V:} /** * 結果受取 * * @Route("/shopping/amazon_pay/checkout_result", name="amazon_pay_shopping_checkout_result") */ public function checkoutResult(Request $request){goto Qm3Ph; P01mS:cArLO:goto VvZk7; Wq0yI:if ($Order->getOrderStatus() != $this->orderStatusRepository->find(OrderStatus::PENDING)) {goto GVCRJ; }goto xL3Ed; g7VQk:try {goto RCSpI; dSn7t:$Customers = $this->customerRepository->getNonWithdrawingCustomers(['v2_amazon_user_id' => $profile->buyerId]); goto IDtks; fT2SD:Zc1cZ:goto N7KIk; HGHa2:XivtK:goto xzf4V; OoRyC:$this->setLogin($request, $Order); goto jgNuA; olNNU:YtRLE:goto ZWS7U; qSkZD:$Order->setCustomer($Customer); goto fBXlX; ZZ138:if (!(!$Customer->getV2AmazonUserId() && empty($Customers[0]))) {goto eUsKj; }goto SeVor; s6xGb:$mail = $Order->getEmail(); goto CU5TT; P5YPK:logs('amazon_pay_v2')->info('[注文処理] 注文処理が完了しました.', [$Order->getId()]); goto Fv7IQ; FRCEQ:if (!($response = $this->executeCheckout($paymentMethod, $Order))) {goto Zc1cZ; }goto FJQQw; aiCk6:if ($this->isGranted('IS_AUTHENTICATED_FULLY')) {goto YtRLE; }goto H3IvF; owYG4:$Customers = $this->customerRepository->getNonWithdrawingCustomers(['v2_amazon_user_id' => $profile->buyerId]); goto ZZ138; URfS6:$url = $this->generateUrl('mypage_login', [], UrlGeneratorInterface::ABSOLUTE_URL); goto JscgE; DH3st:eUsKj:goto HGHa2; JSIGs:$paymentMethod = $this->createPaymentMethod($Order, $form, $amazonCheckoutSessionId); goto szgJF; O7B_r:MoBx2:goto s6xGb; VNoYB:$this->entityManager->lock($Order, LockMode::PESSIMISTIC_WRITE); goto TsPZI; rnGMj:$password = $this->amazonOrderHelper->registCustomer($Order, $arrAmazonCustomerParam['mail_magazine']); goto h0Aiu; q1dpy:goto jdn68; goto O7B_r; H3IvF:if (empty($arrAmazonCustomerParam['login_check_v2']) || $arrAmazonCustomerParam['login_check_v2'] == 'regist') {goto V9eRe; }goto SQ1D8; jgNuA:$Customer = $Order->getCustomer(); goto dSn7t; xP3SL:jdn68:goto GGZ1T; Pmb10:goto XivtK; goto olNNU; CU5TT: $mail_message = <<<__EOS__ ************************************************ 会員登録情報 ************************************************ マイページURL:{$url} ※会員登録済みです。メールアドレスは{$mail}です。 __EOS__; goto xP3SL; ozBWW:Ny6Xy:goto mTfGH; SLKyJ:$form = $this->createForm(OrderType::class, $Order); goto JSIGs; IDtks:if (!(!$Customer->getV2AmazonUserId() && empty($Customers[0]))) {goto HmFp8; }goto Jev7W; Yq0bV:HmFp8:goto ai00v; RCSpI:logs('amazon_pay_v2')->info('決済完了レスポンス受取', [$Order->getId()]); goto SLKyJ; ai00v:fEo3v:goto J5RqM; SeVor:$Customer->setV2AmazonUserId($profile->buyerId); goto DH3st; Fv7IQ:logs('amazon_pay_v2')->info('購入処理完了', [$Order->getId()]); goto WqYws; h0Aiu:$Customer = $this->getUser(); goto qSkZD; Jev7W:$Customer->setV2AmazonUserId($profile->buyerId); goto Yq0bV; N7KIk:$profile = unserialize($this->session->get($this->sessionAmazonProfileKey)); goto aiCk6; ZWS7U:$Customer = $this->getUser(); goto owYG4; JgV7I:if (!$arrAmazonCustomerParam['customer_regist_v2']) {goto Ny6Xy; }goto URfS6; OSbHF:V9eRe:goto JgV7I; mTfGH:SNT12:goto Pmb10; SQ1D8:if (!($arrAmazonCustomerParam['login_check_v2'] == 'login')) {goto fEo3v; }goto OoRyC; JscgE:if ($this->customerRepository->getNonWithdrawingCustomers(['email' => $Order->getEmail()]) || $this->customerRepository->getNonWithdrawingCustomers(['v2_amazon_user_id' => $profile->buyerId])) {goto MoBx2; }goto rnGMj; szgJF:$this->entityManager->beginTransaction(); goto VNoYB; qXGrU: $mail_message = <<<__EOS__ ************************************************ 会員登録情報 ************************************************ マイページURL:{$url} ログインメールアドレス:{$mail} 初期パスワード:{$password} __EOS__; goto q1dpy; xzf4V:$this->entityManager->flush(); goto WosWE; TsPZI:logs('amazon_pay_v2')->info('[注文処理] PaymentMethod::checkoutを実行します.'); goto FRCEQ; J5RqM:goto SNT12; goto OSbHF; GGZ1T:$Order->setCompleteMailMessage($mail_message); goto ozBWW; WosWE:$this->entityManager->commit(); goto P5YPK; fBXlX:$mail = $Customer->getEmail(); goto qXGrU; FJQQw:return $response; goto fT2SD; WqYws:} catch (ShoppingException $e) {goto nq9Eo; Ncb1U:$this->entityManager->commit(); goto L3biP; L3biP:return $this->redirectToRoute('shopping_error'); goto GE54x; nq9Eo:$this->addError($e->getMessage()); goto P6lZ8; BFACM:$this->entityManager->flush(); goto Ncb1U; P6lZ8:logs('amazon_pay_v2')->error('購入エラー', [$e->getMessage()]); goto S1cdl; S1cdl:$this->purchaseFlow->rollback($Order, new PurchaseContext()); goto BFACM; GE54x:} catch (AmazonPaymentException $e) {goto iplDE; iplDE:$this->addError($e->getMessage()); goto i_ccl; i_ccl:logs('amazon_pay_v2')->error($e->getMessage(), [$Order->getId()]); goto HNkUE; HNkUE:$this->purchaseFlow->rollback($Order, new PurchaseContext()); goto sJA2v; sJA2v:$this->entityManager->flush(); goto jyU86; FZyTa:return $this->redirectToRoute('shopping_error'); goto MUp6M; jyU86:$this->entityManager->commit(); goto FZyTa; MUp6M:} catch (\Exception $e) {goto tNTBs; tNTBs:$this->addError('front.shopping.system_error'); goto eFNDv; nQrYg:$this->entityManager->commit(); goto PmNP6; eFNDv:logs('amazon_pay_v2')->error('予期しないエラー', [get_class($e), $e->getMessage()]); goto H4N7Z; vOhf8:$this->entityManager->flush(); goto nQrYg; PmNP6:return $this->redirectToRoute('shopping_error'); goto uns10; H4N7Z:$this->purchaseFlow->rollback($Order, new PurchaseContext()); goto vOhf8; uns10:}goto nesHI; Dkdvv:jCgg1:goto XP4Sz; OflNh:$this->session->set($this->sessionAmazonCustomerParamKey, null); goto EAg7Z; K1n8T:$Order = $this->orderRepository->findOneBy(['pre_order_id' => $preOrderId]); goto zn4BI; XP4Sz:$amazonCheckoutSessionId = $request->get('amazonCheckoutSessionId'); goto DQQZA; DDIX7:$Order->setAmazonPayV2SessionTemp(null); goto yUPD6; q7vT1:return $this->redirectToRoute('shopping_complete'); goto b84sL; aSlBC:logs('amazon_pay_v2')->info('[注文処理] 購入完了画面へ遷移します.', [$Order->getId()]); goto kctfc; YJfTq:logs('amazon_pay_v2')->info('[注文処理] 注文処理が完了しました. 購入完了画面へ遷移します.', [$Order->getId()]); goto q7vT1; aR37l:GVCRJ:goto vspE5; t5w3N:$this->entityManager->flush(); goto Bwnrl; WJJh1:OMq7m:goto NzsZl; nPaOr:$this->entityManager->flush(); goto Y28Pc; VvZk7:$this->mailService->sendOrderMail($Order); goto nPaOr; zLjb7:$this->session->set(OrderHelper::SESSION_ORDER_ID, $Order->getId()); goto jayKF; zn4BI:if ($Order) {goto OMq7m; }goto Te8wY; vspE5:logs('amazon_pay_v2')->info('[リダイレクト] 決済処理中の受注が存在しません.'); goto lCgVS; MS2Ey:x52iD:goto gcM6t; kctfc:return $this->redirectToRoute('shopping_complete'); goto W3Htn; tXzuc:$arrAmazonCustomerParam = unserialize($amazonCustomerParam); goto g7VQk; Qm3Ph:$preOrderId = $this->cartService->getPreOrderId(); goto K1n8T; mQYNN:$this->cartService->clear(); goto ZYXO6; fBqbU:$this->session->set($this->sessionAmazonCheckoutSessionIdKey, null); goto BOaDe; Y28Pc:logs('amazon_pay_v2')->info('[注文処理] カートをクリアします.', [$Order->getId()]); goto hfFmY; gcM6t:logs('amazon_pay_v2')->info('[注文処理] IPNにより注文処理完了済.', [$Order->getId()]); goto zLjb7; Te8wY:logs('amazon_pay_v2')->info('[リダイレクト] 受注が存在しません.'); goto PyEu_; xL3Ed:goto jCgg1; goto MS2Ey; Bwnrl:$this->session->set($this->sessionAmazonCheckoutSessionIdKey, null); goto OflNh; X2nVj:$Order->appendCompleteMailMessage("特記事項:" . $this->Config->getMailNotices()); goto P01mS; EAg7Z:$this->session->set($this->sessionAmazonCustomerErrorKey, null); goto aSlBC; DQQZA:$amazonCustomerParam = $this->session->get($this->sessionAmazonCustomerParamKey); goto tXzuc; WYNSo:logs('amazon_pay_v2')->info('[注文処理] 注文メールの送信を行います.', [$Order->getId()]); goto TuAPG; BOaDe:$this->session->set($this->sessionAmazonCustomerParamKey, null); goto FZdG9; ZYXO6:$Order->setAmazonPayV2SessionTemp(null); goto t5w3N; FZdG9:$this->session->set($this->sessionAmazonCustomerErrorKey, null); goto YJfTq; lCgVS:return $this->redirectToRoute('shopping_error'); goto Dkdvv; nesHI:logs('amazon_pay_v2')->info('AmazonShopping::complete_order end.'); goto Z53t6; TuAPG:if (is_null($this->Config->getMailNotices())) {goto cArLO; }goto X2nVj; Z53t6:$this->session->set(OrderHelper::SESSION_ORDER_ID, $Order->getId()); goto WYNSo; jayKF:logs('amazon_pay_v2')->info('[注文処理] カートをクリアします.', [$Order->getId()]); goto mQYNN; NzsZl:if ($Order->getOrderStatus() == $this->orderStatusRepository->find(OrderStatus::NEW)) {goto x52iD; }goto Wq0yI; yUPD6:$this->entityManager->flush(); goto fBqbU; PyEu_:return $this->redirectToRoute('shopping_error'); goto WJJh1; hfFmY:$this->cartService->clear(); goto DDIX7; W3Htn:goto jCgg1; goto aR37l; b84sL:} /** * 購入確認画面から, 他の画面へのリダイレクト. * 配送業者や支払方法、お問い合わせ情報をDBに保持してから遷移する. * * @Route("/shopping/amazon_pay/redirect_to/", name="amazon_pay_shopping_redirect_to", methods={"POST"}) * @Template("Shopping/index.twig") */ public function redirectTo(Request $request, RouterInterface $router){ $preOrderId = $this->cartService->getPreOrderId(); $Order = $this->orderHelper->getPurchaseProcessingOrder($preOrderId); if ($Order) {$form = $this->createForm(OrderType::class, $Order);} $form->handleRequest($request); if (!($form->isSubmitted() && $form->isValid())) {goto HeELs; } logs('amazon_pay_v2')->info('[リダイレクト] 集計処理を開始します.', [$Order->getId()]); $flowResult = $this->executePurchaseFlow($Order, false); $this->entityManager->flush(); if (!$flowResult->hasError()) { if (!$flowResult->hasWarning()) { $redirectTo = $form['redirect_to']->getData(); if (!empty($redirectTo)) { #2022/09/28 #配送先に移管の場合 ID が抜けているので修正 バグです $pattern = '/^' . preg_quote($request->getBasePath(), '/') . '/'; $redirectTo = preg_replace($pattern, '', $redirectTo); $result = $router->match($redirectTo); $Path=[]; if ($Id = $result['id'] ?? null){ $Path=['id'=>$Id]; } return $this->forwardToRoute($result['_route'],$Path); } } } goto LSCo_; YS4b9:HeELs:goto ufEi1; UijAL:SV2Xb:goto AUK_3; Q4pRZ:logs('amazon_pay_v2')->info('[リダイレクト] 購入処理中の受注が存在しません.'); goto F1vcE; m7HkS:UiQsx:goto hr37m; f6new:c2wsR:goto z_00i; ufEi1:logs('amazon_pay_v2')->info('[リダイレクト] フォームエラーのため, 注文手続き画面を表示します.', [$Order->getId()]); goto k_4Rt; F1vcE:return $this->redirectToRoute('shopping_error'); goto f6new; oMduZ:logs('amazon_pay_v2')->info('[リダイレクト] リダイレクト先未指定のため注文手続き画面へ遷移します.'); goto jWzkB; PogT3:H1fzI:goto r9G1O; FV9LX://9 goto PTVg9; z_00i: goto Vl3WS; mOUBI:return $this->redirectToRoute('amazon_pay_shopping'); goto m7HkS; AUK_3:try {goto yCPHr; yCPHr://15 goto RIOYI; f_BFL://19 goto f2UxH; qGuab://18 goto f_BFL; RIOYI://17 goto qGuab; f2UxH:} catch (\Exception $e) {logs('amazon_pay_v2')->info('[リダイレクト] URLの形式が不正です', [$redirectTo, $e->getMessage()]); return $this->redirectToRoute('shopping_error'); }goto YS4b9; cKYBz:logs('amazon_pay_v2')->info('Warningが発生したため注文手続き画面へ遷移します.', [$flowResult->getWarning()]); goto mOUBI; LSCo_: goto ofHh2; hr37m: //14 goto nDgLY; Vl3WS: //5 goto jpAEZ; YpZoH:return $this->redirectToRoute('shopping_error'); goto PogT3; Xb3OJ://11 goto n447q; PTVg9://10 goto Xb3OJ; jWzkB:return $this->redirectToRoute('amazon_pay_shopping'); goto UijAL; r9G1O: //13 goto cKYBz; nDgLY: goto oMduZ; fa9k3:logs('amazon_pay_v2')->info('Errorが発生したため購入エラー画面へ遷移します.', [$flowResult->getErrors()]); goto YpZoH; n447q://12 goto fa9k3; dtQRK: goto Q4pRZ; jpAEZ: //6 goto FV9LX; ofHh2: goto dtQRK; k_4Rt:return $this->redirectToRoute('amazon_pay_shopping', ['request' => $request], 307); goto wXcvT; wXcvT:} /** * API通信によって配送業者や支払方法、お問い合わせ情報をDBに保存する. * * @Route("/shopping/amazon_pay/order_save", name="amazon_pay_shopping_order_save", methods={"POST", "GET"}) */ public function orderSave(Request $request){goto cobOg; tzWVo:logs('amazon_pay_v2')->info('集計処理を開始します.', [$Order->getId()]); goto cuYS0; f4gOB:if (!$flowResult->hasWarning()) {goto L4Czp; }goto SwOc5; SwOc5:logs('amazon_pay_v2')->info('executePurchaseFlowでWarningが発生しました.', [$flowResult->getWarning()]); goto mBMVK; hpGBS:return $this->json(['error' => 'executePurchaseFlow::Error'], 500); goto Z3khf; NzkEo:dU7yF:goto ubb3p; Pr1Ot:if (!($form->isSubmitted() && $form->isValid())) {goto BllLP; }goto tzWVo; c10Lr:logs('amazon_pay_v2')->info('フォームエラーが発生しました.'); goto uSlYX; ubb3p:$preOrderId = $this->cartService->getPreOrderId(); goto lqkOT; YZTD0:return $this->json(['error' => 'OrderNotFound'], 500); goto T7H_h; lqkOT:$Order = $this->orderHelper->getPurchaseProcessingOrder($preOrderId); goto kk5YE; sqMKU:BllLP:goto c10Lr; T7H_h:hEfwc:goto YXZgZ; YXZgZ:$form = $this->createForm(OrderType::class, $Order); goto QKq5B; mBMVK:return $this->json(['error' => 'executePurchaseFlow::Warning'], 500); goto zJVhj; xDbxx:if (!$flowResult->hasError()) {goto EmvDs; }goto YYCQp; YYCQp:logs('amazon_pay_v2')->info('executePurchaseFlowでErrorが発生しました.', [$flowResult->getErrors()]); goto hpGBS; QKq5B:$form->handleRequest($request); goto Pr1Ot; Z3khf:EmvDs:goto f4gOB; mC0ZD:throw new BadRequestHttpException(); goto NzkEo; I3dTX:logs('amazon_pay_v2')->info('購入処理中の受注が存在しません.'); goto YZTD0; cuYS0:$flowResult = $this->executePurchaseFlow($Order, false); goto irQ6J; irQ6J:$this->entityManager->flush(); goto xDbxx; uSlYX:return $this->json(['error' => 'validateError'], 500); goto NVf1V; cobOg:if ($request->isXmlHttpRequest()) {goto dU7yF; }goto mC0ZD; kk5YE:if ($Order) {goto hEfwc; }goto I3dTX; gmZVr:return $this->json([]); goto sqMKU; zJVhj:L4Czp:goto gmZVr; NVf1V:}private function createPaymentMethod(Order $Order, FormInterface $form, $amazonCheckoutSessionId = null){goto a2G6r; viNmY:$PaymentMethod->setOrder($Order); goto BgMX6; xQsVo:$PaymentMethod->setAmazonCheckoutSessionId($amazonCheckoutSessionId); goto evvgh; PE3lL:if (is_null($amazonCheckoutSessionId)) {goto lm0Gv; }goto xQsVo; pbAv5:return $PaymentMethod; goto J0AsN; a2G6r:$PaymentMethod = $this->container->get($Order->getPayment()->getMethodClass()); goto viNmY; BgMX6:$PaymentMethod->setFormType($form); goto PE3lL; evvgh:lm0Gv:goto pbAv5; J0AsN:}protected function executeCheckout(AmazonPay $paymentMethod, Order $Order){goto MVQ8q; cxBfr:logs('amazon_pay_v2')->info('[注文処理] PaymentMethod::checkoutのエラーのため, 購入エラー画面へ遷移します.', [$PaymentResult->getErrors()]); goto gSelX; LqmEG:$response = $PaymentResult->getResponse(); goto GjU3s; MVQ8q:$PaymentResult = $paymentMethod->checkout(); goto LqmEG; RiaMC:b1s68:goto IFZjZ; hyGK6:if ($PaymentResult->isSuccess()) {goto b1s68; }goto v4A45; gSelX:return $this->redirectToRoute('shopping_error'); goto RiaMC; Se32k:logs('amazon_pay_v2')->info('[注文処理] PaymentMethod::checkoutが指定したレスポンスを表示します.'); goto MLZxj; kNId3:AVK_V:goto hyGK6; v4A45:$this->purchaseFlow->rollback($Order, new PurchaseContext()); goto txDXW; txDXW:foreach ($PaymentResult->getErrors() as $error) {$this->addError($error); gp8_V:}goto Ah6zC; MLZxj:return $response; goto kNId3; GjU3s:if (!($response && ($response->isRedirection() || $response->getContent()))) {goto AVK_V; }goto UTbXe; Ah6zC:f0GAJ:goto cxBfr; UTbXe:$this->entityManager->flush(); goto Se32k; IFZjZ:}private function getAmazonCustomerParam($request){goto kXL54; pezZ3:$amazon_login_password_v2 = empty($request->get('_shopping_order')['amazon_login_password_v2']) ? null : $request->get('_shopping_order')['amazon_login_password_v2']; goto NEUri; p5hCh:$login_check_v2 = empty($request->get('_shopping_order')['login_check_v2']) ? null : $request->get('_shopping_order')['login_check_v2']; goto b9vPH; kXL54:$customer_regist_v2 = empty($request->get('_shopping_order')['customer_regist_v2']) ? false : true; goto NGo93; NEUri:return ['customer_regist_v2' => $customer_regist_v2, 'mail_magazine' => $mail_magazine, 'login_check_v2' => $login_check_v2, 'amazon_login_email_v2' => $amazon_login_email_v2, 'amazon_login_password_v2' => $amazon_login_password_v2]; goto klkVD; b9vPH:$amazon_login_email_v2 = empty($request->get('_shopping_order')['amazon_login_email_v2']) ? null : $request->get('_shopping_order')['amazon_login_email_v2']; goto pezZ3; NGo93:$mail_magazine = empty($request->get('_shopping_order')['mail_magazine']) ? false : true; goto p5hCh; klkVD:}private function checkAmazonCustomerError($request, $form, $Order){goto PBhdc; eLl9b:if (!('POST' === $request->getMethod() && strpos($request_uri, 'shopping/amazon_pay/address') === false && strpos($request_uri, 'shopping/amazon_pay/delivery') === false)) {goto ZDti5; }goto GikWD; tuPdE:$Customer = $this->customerRepository->getNonWithdrawingCustomers(['email' => $Order->getEmail()]); goto agKt4; JyWpx:$violations = $this->validator->validate($form['amazon_login_password_v2']->getData(), [new Assert\NotBlank()]); goto HL86w; GiAkP:$arrError['amazon_login_password_v2'] = '※ パスワードが' . $amazon_login_password_v2_error; goto Kl1hX; l5zWz:goto NEu8e; goto QYSf2; hCdCZ:ZDti5:goto ACbqX; oYWnN:$amazon_login_email_v2_error = ''; goto b8NAF; ORDay:x0tIr:goto nammF; hXl1s:foreach ($violations as $violation) {$amazon_login_password_v2_error .= $violation->getMessage() . PHP_EOL; ly7sp:}goto XEONA; J97eW:NEu8e:goto hCdCZ; NT4rC:$arrError['customer_regist_v2'] = '※ 会員登録が選択されていません。'; goto KRPWo; dVlli:if (empty($Customer[0])) {goto tXdhC; }goto RSW01; RkQd2:return $arrError; goto WDahp; B17hs:if (empty($amazon_login_password_v2_error)) {goto tPD0l; }goto GiAkP; nRKxA:if (empty($form['customer_regist_v2']->getData())) {goto uTaJd; }goto tuPdE; hzcmP:fLq4f:goto mwrAC; k2txs:$salt = $Customer[0]->getSalt(); goto a_NZp; a_NZp:$customerPassword = $Customer[0]->getPassword(); goto VpJ1x; yaDl3:$Customer = $this->customerRepository->getNonWithdrawingCustomers(['email' => $form['amazon_login_email_v2']->getData()]); goto dVlli; ACbqX:c3_hG:goto RkQd2; q3jYN:$arrError['amazon_login_email_v2'] = '※ メールアドレスまたはパスワードが正しくありません。'; goto ipmH0; XxcJe:$arrError['customer_regist_v2'] = '※ このAmazonアカウントで既に会員登録済みです。メールアドレスは' . $AmazonCustomer[0]->getEmail() . 'です。'; goto TjHkS; WhdL4:if ($login_check_v2 == 'regist') {goto jEJH1; }goto dFxmV; MzFRE:$violations = $this->validator->validate($form['amazon_login_email_v2']->getData(), [new Assert\NotBlank(), new Assert\Email()]); goto oYWnN; XEONA:C_BSn:goto B17hs; Ml1bA:A9_8z:goto bzCdh; nammF:goto kDNe2; goto eGswa; d_rHA:if (!(!$this->isGranted('IS_AUTHENTICATED_FULLY') && $this->Config->getLoginRequired() == $this->eccubeConfig['amazon_pay_v2']['toggle']['on'])) {goto c3_hG; }goto ShU7_; mwrAC:B3rq1:goto l5zWz; bzCdh:$arrError['customer_regist_v2'] = '※ 会員登録済みです。メールアドレスは' . $Order->getEmail() . 'です。'; goto boLVU; RSW01:$encoder = $this->encoderFactory->getEncoder($Customer[0]); goto k2txs; Kl1hX:tPD0l:goto uqNkL; PBhdc:$arrError = []; goto d_rHA; gxYRT:if (!empty($Customer[0])) {goto A9_8z; }goto aW0B1; UsvCV:goto af_V9; goto ZXtf8; eGswa:tXdhC:goto q3jYN; GikWD:$login_check_v2 = $form['login_check_v2']->getData(); goto WhdL4; uI5qg:goto gNiNu; goto Ml1bA; d5ep8:UOl_2:goto VeVdw; agKt4:$profile = unserialize($this->session->get($this->sessionAmazonProfileKey)); goto c3uxv; ShU7_:$request_uri = $request->getUri(); goto eLl9b; TjHkS:WGkut:goto uI5qg; ZXtf8:uTaJd:goto NT4rC; HL86w:$amazon_login_password_v2_error = ''; goto hXl1s; rwHFn:hm6sO:goto JyWpx; VeVdw:if (empty($amazon_login_email_v2_error)) {goto hm6sO; }goto eBWBR; aW0B1:if (empty($AmazonCustomer[0])) {goto WGkut; }goto XxcJe; QYSf2:jEJH1:goto nRKxA; dFxmV:if (!($login_check_v2 == 'login')) {goto B3rq1; }goto MzFRE; VpJ1x:if ($encoder->isPasswordValid($customerPassword, $form['amazon_login_password_v2']->getData(), $salt)) {goto x0tIr; }goto IBA7E; ipmH0:kDNe2:goto hzcmP; eBWBR:$arrError['amazon_login_email_v2'] = '※ メールアドレスが' . $amazon_login_email_v2_error; goto rwHFn; boLVU:gNiNu:goto UsvCV; b8NAF:foreach ($violations as $violation) {$amazon_login_email_v2_error .= $violation->getMessage() . PHP_EOL; TMP69:}goto d5ep8; KRPWo:af_V9:goto J97eW; c3uxv:$AmazonCustomer = $this->customerRepository->getNonWithdrawingCustomers(['v2_amazon_user_id' => $profile->buyerId]); goto gxYRT; uqNkL:if (!(empty($login_check_v2_error) && empty($amazon_login_email_v2_error) && empty($amazon_login_password_v2_error))) {goto fLq4f; }goto yaDl3; IBA7E:$arrError['amazon_login_email_v2'] = '※ メールアドレスまたはパスワードが正しくありません。'; goto ORDay; WDahp:}private function setLogin($request, $Order){goto sKgc7; qmnqD:$token = new UsernamePasswordToken($Customer[0], null, 'customer', ['ROLE_USER']); goto D3gDo; sKgc7:$Customer = $this->customerRepository->getNonWithdrawingCustomers(['email' => $Order->getEmail()]); goto kOYtp; D3gDo:$this->tokenStorage->setToken($token); goto O9S59; kOYtp:$Order->setCustomer($Customer[0]); goto qmnqD; O9S59:$this->amazonOrderHelper->copyToOrderFromCustomer($Order, $Customer[0]); goto xJ2c5; xJ2c5:}private function setAmazonCustomerData($form, $arrAmazonCustomerParam){goto Lhnm_; gD9TT:if (!($this->Config->getLoginRequired() == $this->eccubeConfig['amazon_pay_v2']['toggle']['on'] && !$this->isGranted('IS_AUTHENTICATED_FULLY'))) {goto PSlzy; }goto Pn7K2; jSrn9:$form->get('amazon_login_password_v2')->setData($arrAmazonCustomerParam['amazon_login_password_v2']); goto JjBcX; dYCCQ:AYpWt:goto gD9TT; Pn7K2:$form->get('login_check_v2')->setData($arrAmazonCustomerParam['login_check_v2']); goto dEZW3; Lhnm_:$form->get('customer_regist_v2')->setData($arrAmazonCustomerParam['customer_regist_v2']); goto VlySA; PyElI:$form->get('mail_magazine')->setData($arrAmazonCustomerParam['mail_magazine']); goto dYCCQ; JjBcX:PSlzy:goto LO5OI; VlySA:if (!($this->pluginRepository->findOneBy(['code' => 'MailMagazine4', 'enabled' => true]) || $this->pluginRepository->findOneBy(['code' => 'PostCarrier4', 'enabled' => true]))) {goto AYpWt; }goto PyElI; dEZW3:$form->get('amazon_login_email_v2')->setData($arrAmazonCustomerParam['amazon_login_email_v2']); goto jSrn9; LO5OI:}public function getPendingProcessingOrder($preOrderId = null){goto vLg42; vxTto:Op44b:goto UnwjM; Jfa6z:return $this->orderRepository->findOneBy(['pre_order_id' => $preOrderId, 'OrderStatus' => $OrderStatus]); goto eBVyo; UnwjM:$OrderStatus = $this->orderStatusRepository->find(OrderStatus::PENDING); goto Jfa6z; vNsMz:return null; goto vxTto; vLg42:if (!(null === $preOrderId)) {goto Op44b; }goto vNsMz; eBVyo:}private function checkShippingDifference($Order, $shippingAddress){goto GbpWe; ss9g7:$this->amazonOrderHelper->convert($amazonShipping, $shippingAddress); goto uaMj5; ATNHR:$shippingDifference = true; goto Db30R; uaMj5:$Shippings = $Order->getShippings(); goto z7qmX; HdYl3:if (!($Shippings->first()->getPostalCode() !== $amazonShipping->getPostalCode() || $Shippings->first()->getName01() !== $amazonShipping->getName01() || $Shippings->first()->getName02() !== $amazonShipping->getName02() || $Shippings->first()->getKana01() !== $amazonShipping->getKana01() || $Shippings->first()->getKana02() !== $amazonShipping->getKana02() || $Shippings->first()->getPref() !== $amazonShipping->getPref() || $Shippings->first()->getAddr01() !== $amazonShipping->getAddr01() || $Shippings->first()->getAddr02() !== $amazonShipping->getAddr02())) {goto q80Nu; }goto ATNHR; z7qmX:$shippingDifference = false; goto HdYl3; Db30R:q80Nu:goto l5qRz; XK5BW:$amazonShipping->setOrder($Order); goto ss9g7; l5qRz:return $shippingDifference; goto psnzx; GbpWe:$amazonShipping = new Shipping(); goto XK5BW; psnzx:}protected function getAmazonPayDefaultDelivery(Shipping $Shipping){goto iSn0b; R6Q33:$SaleTypes = []; goto BpkmQ; BpkmQ:foreach ($OrderItems as $OrderItem) {goto wZLSz; GUANb:$SaleType = $ProductClass->getSaleType(); goto xwAC1; xwAC1:$SaleTypes[$SaleType->getId()] = $SaleType; goto sJKgE; sJKgE:A3NUF:goto NK3Kk; wZLSz:$ProductClass = $OrderItem->getProductClass(); goto GUANb; NK3Kk:}goto RGGpy; VzJb2:TlYc0:goto pfLlw; hJMuM:foreach ($Deliveries as $key => $Delivery) {goto rXUy5; tj8_q:$amazonPayFlg = false; goto rZVjO; rXUy5:$PaymentOptions = $Delivery->getPaymentOptions(); goto tj8_q; g1_zI:gtR6F:goto CUDex; CUDex:if ($amazonPayFlg) {goto T3oHg; }goto u2KMM; rZVjO:foreach ($PaymentOptions as $PaymentOption) {goto RxukF; CZUbM:eHWBR:goto gfFBg; RxukF:$Payment = $PaymentOption->getPayment(); goto FFd1f; FFd1f:if (!($Payment->getMethodClass() === AmazonPay::class)) {goto XEb_1; }goto YrLu4; YrLu4:$amazonPayFlg = true; goto Tkxm3; Y0843:XEb_1:goto CZUbM; Tkxm3:goto gtR6F; goto Y0843; gfFBg:}goto g1_zI; abcgn:BPdlz:goto qfMEr; u2KMM:unset($Deliveries[$key]); goto ilV0n; ilV0n:T3oHg:goto abcgn; qfMEr:}goto VzJb2; Jzujf:$Deliveries = $this->deliveryRepository->getDeliveries($SaleTypes); goto hJMuM; pfLlw:$Delivery = current($Deliveries); goto hoJnG; RGGpy:zzf0w:goto Jzujf; iSn0b:$OrderItems = $Shipping->getProductOrderItems(); goto R6Q33; hoJnG:return $Delivery; goto mvZlw; mvZlw:}}
<?php /** * @version EC-CUBE4系 * @copyright 株式会社 翔 kakeru.co.jp * * 2022年03月02日カスタマイズ * * app/Customize/Plugin/AmazonPayV2/Controller/AmazonShoppingController.php * * * del * * * ≡≡≡┏(^o^)┛ *****************************************************/ namespace Customize\Plugin\AmazonPayV2\Controller; use Customize\Converter\OrderConverter; use Customize\Service\OrderService; use Eccube\Entity\Delivery; use Eccube\Entity\OrderItem; use Eccube\Repository\DeliveryRepository; use Eccube\Repository\Master\OrderStatusRepository; use Eccube\Repository\OrderRepository; use Plugin\AmazonPayV2\Repository\ConfigRepository; use Plugin\AmazonPayV2\Service\AmazonOrderHelper; use Plugin\AmazonPayV2\Service\AmazonRequestService; use Plugin\AmazonPayV2\Service\Method\AmazonPay; use Eccube\Common\EccubeConfig; use Eccube\Controller\AbstractShoppingController; use Eccube\Entity\Order; use Eccube\Entity\Shipping; use Eccube\Entity\Master\OrderStatus; use Customize\Form\Type\Shopping\OrderType; use Eccube\Repository\CustomerRepository; use Eccube\Repository\Master\PrefRepository; use Eccube\Repository\ProductClassRepository; use Eccube\Repository\PluginRepository; use Customize\Service\CartService; use Customize\Service\MailService; use Customize\Service\OrderHelper; use Eccube\Service\PurchaseFlow\PurchaseContext; use Eccube\Service\PurchaseFlow\PurchaseFlow; use Plugin\AmazonPayV2\Exception\AmazonPaymentException; use Plugin\AmazonPayV2\Amazon\Pay\API\Client; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormError; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\RouterInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Validator\Constraints as Assert; use Doctrine\DBAL\LockMode; use Customize\Service\CustomerService; class AmazonShoppingController extends \Plugin\AmazonPayV2\Controller\AmazonShoppingController { private $sessionAmazonProfileKey = 'amazon_pay_v2.profile'; private $sessionAmazonCheckoutSessionIdKey = 'amazon_pay_v2.checkout_session_id'; private $sessionAmazonCustomerParamKey = 'amazon_pay_v2.customer_regist_v2'; private $sessionAmazonCustomerErrorKey = 'amazon_pay_v2.customer_regist_v2_error'; private $sessionIsShippingRefresh = 'amazon_pay_v2.is_shipping_refresh'; protected $validator; protected $cartService; protected $amazonOrderHelper; protected $CustomerService; protected $OrderService; protected $OrderConverter; public function __construct(EccubeConfig $eccubeConfig, PurchaseFlow $cartPurchaseFlow, CartService $cartService, MailService $mailService, OrderHelper $orderHelper, CustomerRepository $customerRepository, OrderRepository $orderRepository, OrderStatusRepository $orderStatusRepository, PrefRepository $prefRepository, ProductClassRepository $productClassRepository, PluginRepository $pluginRepository, ConfigRepository $configRepository, AmazonOrderHelper $amazonOrderHelper, AmazonRequestService $amazonRequestService, ValidatorInterface $validator, EncoderFactoryInterface $encoderFactory, TokenStorageInterface $tokenStorage, DeliveryRepository $deliveryRepository, CustomerService $CustomerService, OrderService $OrderService, OrderConverter $OrderConverter) { $this->eccubeConfig = $eccubeConfig; $this->purchaseFlow = $cartPurchaseFlow; $this->cartService = $cartService; $this->mailService = $mailService; $this->orderHelper = $orderHelper; $this->customerRepository = $customerRepository; $this->orderRepository = $orderRepository; $this->CustomerService = $CustomerService; $this->OrderService = $OrderService; $this->OrderConverter = $OrderConverter; $this->orderStatusRepository = $orderStatusRepository; $this->prefRepository = $prefRepository; $this->productClassRepository = $productClassRepository; $this->pluginRepository = $pluginRepository; $this->Config = $configRepository->get(); $this->amazonOrderHelper = $amazonOrderHelper; $this->amazonRequestService = $amazonRequestService; $this->validator = $validator; $this->encoderFactory = $encoderFactory; $this->tokenStorage = $tokenStorage; $this->deliveryRepository = $deliveryRepository; } /** * @Route("/shopping/amazon_pay/", name="amazon_pay_shopping") * @Template("Shopping/index.twig") *s * @param Request $request */ public function index(Request $request, PurchaseFlow $cartPurchaseFlow) { logs('amazon_pay_v2')->info('AmazonShopping::index start.'); $Cart = $this->cartService->getCart(); if ($Cart && $this->orderHelper->verifyCart($Cart)) { $amazonCheckoutSessionId = $this->session->get($this->sessionAmazonCheckoutSessionIdKey); $checkoutSession = $this->amazonRequestService->getCheckoutSession($amazonCheckoutSessionId); if (!($checkoutSession && $checkoutSession->statusDetails->state !== 'Open')) { logs('amazon_pay_v2')->info('[注文手続] 受注の初期化処理を開始します.'); #23022/02/18 # 1 ログインしている ログイン情報を使う # 2 戻り値のメールアドレス # 3 戻り値のアマゾンID # 4 新規登録 if ($this->CustomerService->GetAmazonLoginFlg() >= 3) { $profile = unserialize($this->session->get($this->sessionAmazonProfileKey)); $Customer = $this->customerRepository->getRegularCustomerByEmail($profile->email) ?? $this->amazonOrderHelper->getOrderer($checkoutSession->shippingAddress); } else { $Customer = $this->getUser() ? $this->getUser() : $this->amazonOrderHelper->getOrderer($checkoutSession->shippingAddress); } if ($this->isGranted('ROLE_USER')) { goto eM3B_; } $this->session->set(OrderHelper::SESSION_NON_MEMBER, $Customer); eM3B_: $initOrderFlg = false; if ($Order = $this->orderHelper->getPurchaseProcessingOrder($Cart->getPreOrderId())) { if (!$Order->isMultiple()) { goto kA1xQ; } $Cart->setPreOrderId(null); kA1xQ: goto osD_u; } $initOrderFlg = true; osD_u: $Order = $this->orderHelper->initializeOrder($Cart, $Customer); $Shipping = $Order->getShippings()->first(); $AmazonDefaultDelivery = $this->getAmazonPayDefaultDelivery($Shipping); if (!($AmazonDefaultDelivery === false)) { goto mGL25; } $this->addError('Amazon Payでご利用できる配送方法が存在しません。'); mGL25: if (!($initOrderFlg && $AmazonDefaultDelivery)) { goto Hbrg_; } $Shipping->setDelivery($AmazonDefaultDelivery); $Shipping->setShippingDeliveryName($AmazonDefaultDelivery->getName()); $this->entityManager->flush(); Hbrg_: $Order = $this->amazonOrderHelper->initializeAmazonOrder($Order, $Customer); if (!$this->session->get($this->sessionIsShippingRefresh)) { goto iIClx; } $Shippings = $Order->getShippings(); $this->amazonOrderHelper->convert($Shippings->first(), $checkoutSession->shippingAddress); $this->entityManager->flush(); $this->session->remove($this->sessionIsShippingRefresh); iIClx: logs('amazon_pay_v2')->info('[注文手続] 集計処理を開始します.', [$Order->getId()]); $flowResult = $this->executePurchaseFlow($Order, false); $this->entityManager->flush(); if (!$flowResult->hasError()) { if (!$flowResult->hasWarning()) { goto mACEj; } logs('amazon_pay_v2')->info('[注文手続] Warningが発生しました.', [$flowResult->getWarning()]); $cartPurchaseFlow->validate($Cart, new PurchaseContext()); $this->cartService->save(); mACEj: if ($amazonCustomerParam = $this->session->get($this->sessionAmazonCustomerParamKey)) { $arrAmazonCustomerParam = unserialize($amazonCustomerParam); if (!empty($arrAmazonCustomerParam['customer_regist_v2'])) { goto D2lKt; } $arrAmazonCustomerParam['customer_regist_v2'] = false; D2lKt: if (!empty($arrAmazonCustomerParam['mail_magazine'])) { goto Fn0N7; } $arrAmazonCustomerParam['mail_magazine'] = false; Fn0N7: goto Zpdil; } $arrAmazonCustomerParam = ['customer_regist_v2' => true, 'mail_magazine' => true, 'login_check_v2' => 'regist', 'amazon_login_email_v2' => null, 'amazon_login_password_v2' => null]; Zpdil: $form = $this->createForm(OrderType::class, $Order); if ($this->isGranted('IS_AUTHENTICATED_FULLY')) { goto twH8i; } $this->setAmazonCustomerData($form, $arrAmazonCustomerParam); twH8i: if (!($amazonCustomerError = $this->session->get($this->sessionAmazonCustomerErrorKey))) { goto rC3WD; } $arrAmazonCustomerError = unserialize($amazonCustomerError); foreach ($arrAmazonCustomerError as $key => $val) { $form[$key]->addError(new FormError($val)); } $this->session->set($this->sessionAmazonCustomerErrorKey, null); rC3WD: $form->handleRequest($request); logs('amazon_pay_v2')->info('AmazonShopping::index end.'); return ['form' => $form->createView(), 'Order' => $Order, 'AmazonCustomer' => $arrAmazonCustomerParam, 'AmazonPaymentDescriptor' => $checkoutSession->paymentPreferences[0]->paymentDescriptor, 'AmazonShippingAddress' => $checkoutSession->shippingAddress, 'lmCustomer' => $this->CustomerService->GetLandMarkCustomerId($Customer->getLmCustomerId())]; } logs('amazon_pay_v2')->info('[注文手続] Errorが発生したため購入エラー画面へ遷移します.', [$flowResult->getErrors()]); return $this->redirectToRoute('shopping_error'); } logs('amazon_pay_v2')->info('[注文手続] CheckoutSessionがOpenで無い為決済処理を中断します.', ['CheckoutSessionId => $amazonCheckoutSessionId']); $this->session->remove($this->sessionAmazonCheckoutSessionIdKey); return $this->redirectToRoute('shopping_error'); } logs('amazon_pay_v2')->info('[注文手続] カートが購入フローへ遷移できない状態のため, カート画面に遷移します.'); return $this->redirectToRoute('cart'); } /** * ご注文内容のご確認 * * @Route("/shopping/amazon_pay/confirm/", name="amazon_pay_shopping_confirm", methods={"POST"}) * @Template("Shopping/confirm.twig") */ public function confirm(Request $request) { logs('amazon_pay_v2')->info('AmazonShopping::confirm start.'); $Cart = $this->cartService->getCart(); if ($Cart && $this->orderHelper->verifyCart($Cart)) { $preOrderId = $this->cartService->getPreOrderId(); $Order = $this->orderHelper->getPurchaseProcessingOrder($preOrderId); if ($Order) { $arrAmazonCustomerParam = $this->getAmazonCustomerParam($request); $this->session->set($this->sessionAmazonCustomerParamKey, serialize($arrAmazonCustomerParam)); $form = $this->createForm(OrderType::class, $Order); if ($this->isGranted('IS_AUTHENTICATED_FULLY')) { goto jeZ0j; } $this->setAmazonCustomerData($form, $arrAmazonCustomerParam); jeZ0j: $form->handleRequest($request); if (!($arrAmazonCustomerError = $this->checkAmazonCustomerError($request, $form, $Order))) { if (!($form->isSubmitted() && $form->isValid())) { logs('amazon_pay_v2')->info('[注文確認] フォームエラーのため, 注文手続画面へ遷移します', [$Order->getId()]); return $this->redirectToRoute('amazon_pay_shopping', ['request' => $request], 307); } logs('amazon_pay_v2')->info('[注文確認] 集計処理を開始します.', [$Order->getId()]); $response = $this->executePurchaseFlow($Order); $this->entityManager->flush(); if (!$response) { logs('amazon_pay_v2')->info('[注文確認] PaymentMethod::verifyを実行します.', [$Order->getPayment()->getMethodClass()]); $paymentMethod = $this->createPaymentMethod($Order, $form); $PaymentResult = $paymentMethod->verify(); if (!$PaymentResult) { goto iflG0; } if ($PaymentResult->isSuccess()) { $response = $PaymentResult->getResponse(); if (!($response && ($response->isRedirection() || $response->getContent()))) { iflG0: $this->entityManager->flush(); logs('amazon_pay_v2')->info('[注文確認] 注文確認画面を表示します.'); return ['form' => $form->createView(), 'Order' => $Order, 'orderHeader' => $this->OrderService->createOrderHeader($Order)]; } $this->entityManager->flush(); logs('amazon_pay_v2')->info('[注文確認] PaymentMethod::verifyが指定したレスポンスを表示します.'); return $response; } $this->entityManager->rollback(); foreach ($PaymentResult->getErrors() as $error) { $this->addError($error); } logs('amazon_pay_v2')->info('[注文確認] PaymentMethod::verifyのエラーのため, 注文手続き画面へ遷移します.', [$PaymentResult->getErrors()]); return $this->redirectToRoute('amazon_pay_shopping'); } return $this->redirectToRoute('amazon_pay_shopping'); } $this->session->set($this->sessionAmazonCustomerErrorKey, serialize($arrAmazonCustomerError)); return $this->redirectToRoute('amazon_pay_shopping'); } logs('amazon_pay_v2')->info('[リダイレクト] 購入処理中の受注が存在しません.'); return $this->redirectToRoute('shopping_error'); } logs('amazon_pay_v2')->info('[注文手続] カートが購入フローへ遷移できない状態のため, カート画面に遷移します.'); return $this->redirectToRoute('cart'); } /** * 購入処理 * * @Route("/shopping/amazon_pay/checkout/", name="amazon_pay_shopping_checkout", methods={"POST"}) * @Template("Shopping/index.twig") */ public function checkout(Request $request) { logs('amazon_pay_v2')->info('AmazonShopping::order start.'); $Cart = $this->cartService->getCart(); if ($Cart && $this->orderHelper->verifyCart($Cart)) { $preOrderId = $this->cartService->getPreOrderId(); $Order = $this->orderHelper->getPurchaseProcessingOrder($preOrderId); if ($Order) { $amazonCheckoutSessionId = $this->session->get($this->sessionAmazonCheckoutSessionIdKey); $checkoutSession = $this->amazonRequestService->getCheckoutSession($amazonCheckoutSessionId); $shippingDifference = $this->checkShippingDifference($Order, $checkoutSession->shippingAddress); if (!$shippingDifference) { if ($this->amazonOrderHelper->checkShippingPref($checkoutSession->shippingAddress)) { if (!($checkoutSession && $checkoutSession->statusDetails->state !== 'Open')) { if ($this->Config->getUseConfirmPage() == $this->eccubeConfig['amazon_pay_v2']['toggle']['off']) { $arrAmazonCustomerParam = $this->getAmazonCustomerParam($request); $this->session->set($this->sessionAmazonCustomerParamKey, serialize($arrAmazonCustomerParam)); $form = $this->createForm(OrderType::class, $Order); goto KoBJn; } $amazonCustomerParam = $this->session->get($this->sessionAmazonCustomerParamKey); $arrAmazonCustomerParam = unserialize($amazonCustomerParam); $form = $this->createForm(OrderType::class, $Order, ['skip_add_form' => true]); KoBJn: if ($this->isGranted('IS_AUTHENTICATED_FULLY')) { goto p13Fi; } $this->setAmazonCustomerData($form, $arrAmazonCustomerParam); p13Fi: $form->handleRequest($request); if ($this->Config->getUseConfirmPage() == $this->eccubeConfig['amazon_pay_v2']['toggle']['on']) { goto Gm1AU; } if (!($arrAmazonCustomerError = $this->checkAmazonCustomerError($request, $form, $Order))) { Gm1AU: if (!($form->isSubmitted() && $form->isValid())) { logs('amazon_pay_v2')->info('購入チェックエラー', [$Order->getId()]); return $this->redirectToRoute('amazon_pay_shopping', ['request' => $request], 307); } $checkoutSession = $this->amazonRequestService->updateCheckoutSession($Order, $amazonCheckoutSessionId); if (!isset($checkoutSession->reasonCode)) { logs('amazon_pay_v2')->info('購入処理開始', [$Order->getId()]); $response = $this->executePurchaseFlow($Order); $this->entityManager->flush(); if (!$response) { $paymentMethod = $this->createPaymentMethod($Order, $form); logs('amazon_pay_v2')->info('[注文処理] PaymentMethod::applyを実行します.'); if (!($response = $paymentMethod->apply())) { $session_temp = ['IS_AUTHENTICATED_FULLY' => $this->isGranted('IS_AUTHENTICATED_FULLY'), $this->sessionAmazonCheckoutSessionIdKey => $amazonCheckoutSessionId, $this->sessionAmazonProfileKey => unserialize($this->session->get($this->sessionAmazonProfileKey)), $this->sessionAmazonCustomerParamKey => unserialize($this->session->get($this->sessionAmazonCustomerParamKey))]; $Order->setAmazonPayV2SessionTemp(serialize($session_temp)); $this->entityManager->flush(); return new RedirectResponse($checkoutSession->webCheckoutDetails->amazonPayRedirectUrl); } return $response; } return $this->redirectToRoute('amazon_pay_shopping'); } logs('amazon_pay_v2')->error('reasonCode: ' . $checkoutSession->reasonCode . ' message: ' . $checkoutSession->message); $this->addError('予期しないエラーが発生しました。'); return $this->redirectToRoute('amazon_pay_shopping'); } $this->session->set($this->sessionAmazonCustomerErrorKey, serialize($arrAmazonCustomerError)); return $this->redirectToRoute('amazon_pay_shopping'); } logs('amazon_pay_v2')->info('[注文手続] CheckoutSessionがOpenで無い為決済処理を中断します.', ['CheckoutSessionId => $amazonCheckoutSessionId']); $this->session->remove($this->sessionAmazonCheckoutSessionIdKey); return $this->redirectToRoute('shopping_error'); } $this->addError('amazon_pay_v2.front.shopping.undefined_pref_error'); logs('amazon_pay_v2')->error('[注文手続] 都道府県割当エラー', [$Order->getId()]); return $this->redirectToRoute('shopping_error'); } $this->session->set($this->sessionIsShippingRefresh, true); return $this->redirectToRoute('amazon_pay_shopping'); } logs('amazon_pay_v2')->info('[リダイレクト] 購入処理中の受注が存在しません.'); return $this->redirectToRoute('shopping_error'); } logs('amazon_pay_v2')->info('[注文手続] カートが購入フローへ遷移できない状態のため, カート画面に遷移します.'); return $this->redirectToRoute('cart'); } /** * 結果受取 * * @Route("/shopping/amazon_pay/checkout_result", name="amazon_pay_shopping_checkout_result") */ public function checkoutResult(Request $request) { $preOrderId = $this->cartService->getPreOrderId(); $Order = $this->orderRepository->findOneBy(['pre_order_id' => $preOrderId]); if ($Order) { if ($Order->getOrderStatus() == $this->orderStatusRepository->find(OrderStatus::NEW)) { logs('amazon_pay_v2')->info('[注文処理] IPNにより注文処理完了済.', [$Order->getId()]); $this->session->set(OrderHelper::SESSION_ORDER_ID, $Order->getId()); logs('amazon_pay_v2')->info('[注文処理] カートをクリアします.', [$Order->getId()]); $this->cartService->clear(); $Order->setAmazonPayV2SessionTemp(null); $this->entityManager->flush(); $this->session->set($this->sessionAmazonCheckoutSessionIdKey, null); $this->session->set($this->sessionAmazonCustomerParamKey, null); $this->session->set($this->sessionAmazonCustomerErrorKey, null); logs('amazon_pay_v2')->info('[注文処理] 購入完了画面へ遷移します.', [$Order->getId()]); return $this->redirectToRoute('shopping_complete'); } if ($Order->getOrderStatus() != $this->orderStatusRepository->find(OrderStatus::PENDING)) { logs('amazon_pay_v2')->info('[リダイレクト] 決済処理中の受注が存在しません.'); return $this->redirectToRoute('shopping_error'); } jCgg1: $amazonCheckoutSessionId = $request->get('amazonCheckoutSessionId'); $amazonCustomerParam = $this->session->get($this->sessionAmazonCustomerParamKey); $arrAmazonCustomerParam = unserialize($amazonCustomerParam); try { logs('amazon_pay_v2')->info('決済完了レスポンス受取', [$Order->getId()]); $form = $this->createForm(OrderType::class, $Order); $paymentMethod = $this->createPaymentMethod($Order, $form, $amazonCheckoutSessionId); $this->entityManager->beginTransaction(); $this->entityManager->lock($Order, LockMode::PESSIMISTIC_WRITE); logs('amazon_pay_v2')->info('[注文処理] PaymentMethod::checkoutを実行します.'); if (!($response = $this->executeCheckout($paymentMethod, $Order))) { $profile = unserialize($this->session->get($this->sessionAmazonProfileKey)); if ($this->isGranted('IS_AUTHENTICATED_FULLY')) { $Customer = $this->getUser(); $Customers = $this->customerRepository->getNonWithdrawingCustomers(['v2_amazon_user_id' => $profile->buyerId]); if (!(!$Customer->getV2AmazonUserId() && empty($Customers[0]))) { goto eUsKj; } $Customer->setV2AmazonUserId($profile->buyerId); eUsKj: goto HGHa2; } if (empty($arrAmazonCustomerParam['login_check_v2']) || $arrAmazonCustomerParam['login_check_v2'] == 'regist') { if (!$arrAmazonCustomerParam['customer_regist_v2']) { goto Ny6Xy; } $url = $this->generateUrl('mypage_login', [], UrlGeneratorInterface::ABSOLUTE_URL); if ($this->customerRepository->getNonWithdrawingCustomers(['email' => $Order->getEmail()]) || $this->customerRepository->getNonWithdrawingCustomers(['v2_amazon_user_id' => $profile->buyerId])) { $mail = $Order->getEmail(); $mail_message = <<<__EOS__ ************************************************ 会員登録情報 ************************************************ マイページURL:{$url} ※会員登録済みです。メールアドレスは{$mail}です。 __EOS__; goto xP3SL; } $password = $this->amazonOrderHelper->registCustomer($Order, $arrAmazonCustomerParam['mail_magazine']); $Customer = $this->getUser(); $Order->setCustomer($Customer); $mail = $Customer->getEmail(); $mail_message = <<<__EOS__ ************************************************ 会員登録情報 ************************************************ マイページURL:{$url} ログインメールアドレス:{$mail} 初期パスワード:{$password} __EOS__; xP3SL: $Order->setCompleteMailMessage($mail_message); Ny6Xy: goto mTfGH; } if (!($arrAmazonCustomerParam['login_check_v2'] == 'login')) { goto fEo3v; } $this->setLogin($request, $Order); $Customer = $Order->getCustomer(); $Customers = $this->customerRepository->getNonWithdrawingCustomers(['v2_amazon_user_id' => $profile->buyerId]); if (!(!$Customer->getV2AmazonUserId() && empty($Customers[0]))) { goto HmFp8; } $Customer->setV2AmazonUserId($profile->buyerId); HmFp8: fEo3v: mTfGH: HGHa2: $this->entityManager->flush(); $this->entityManager->commit(); logs('amazon_pay_v2')->info('[注文処理] 注文処理が完了しました.', [$Order->getId()]); logs('amazon_pay_v2')->info('購入処理完了', [$Order->getId()]); } return $response; } catch (ShoppingException $e) { $this->addError($e->getMessage()); logs('amazon_pay_v2')->error('購入エラー', [$e->getMessage()]); $this->purchaseFlow->rollback($Order, new PurchaseContext()); $this->entityManager->flush(); $this->entityManager->commit(); return $this->redirectToRoute('shopping_error'); } catch (AmazonPaymentException $e) { $this->addError($e->getMessage()); logs('amazon_pay_v2')->error($e->getMessage(), [$Order->getId()]); $this->purchaseFlow->rollback($Order, new PurchaseContext()); $this->entityManager->flush(); $this->entityManager->commit(); return $this->redirectToRoute('shopping_error'); } catch (\Exception $e) { $this->addError('front.shopping.system_error'); logs('amazon_pay_v2')->error('予期しないエラー', [get_class($e), $e->getMessage()]); $this->purchaseFlow->rollback($Order, new PurchaseContext()); $this->entityManager->flush(); $this->entityManager->commit(); return $this->redirectToRoute('shopping_error'); } logs('amazon_pay_v2')->info('AmazonShopping::complete_order end.'); $this->session->set(OrderHelper::SESSION_ORDER_ID, $Order->getId()); logs('amazon_pay_v2')->info('[注文処理] 注文メールの送信を行います.', [$Order->getId()]); if (is_null($this->Config->getMailNotices())) { goto cArLO; } $Order->appendCompleteMailMessage("特記事項:" . $this->Config->getMailNotices()); cArLO: $this->mailService->sendOrderMail($Order); $this->entityManager->flush(); logs('amazon_pay_v2')->info('[注文処理] カートをクリアします.', [$Order->getId()]); $this->cartService->clear(); $Order->setAmazonPayV2SessionTemp(null); $this->entityManager->flush(); $this->session->set($this->sessionAmazonCheckoutSessionIdKey, null); $this->session->set($this->sessionAmazonCustomerParamKey, null); $this->session->set($this->sessionAmazonCustomerErrorKey, null); logs('amazon_pay_v2')->info('[注文処理] 注文処理が完了しました. 購入完了画面へ遷移します.', [$Order->getId()]); return $this->redirectToRoute('shopping_complete'); } logs('amazon_pay_v2')->info('[リダイレクト] 受注が存在しません.'); return $this->redirectToRoute('shopping_error'); } /** * 購入確認画面から, 他の画面へのリダイレクト. * 配送業者や支払方法、お問い合わせ情報をDBに保持してから遷移する. * * @Route("/shopping/amazon_pay/redirect_to/", name="amazon_pay_shopping_redirect_to", methods={"POST"}) * @Template("Shopping/index.twig") */ public function redirectTo(Request $request, RouterInterface $router) { $preOrderId = $this->cartService->getPreOrderId(); $Order = $this->orderHelper->getPurchaseProcessingOrder($preOrderId); if ($Order) { $form = $this->createForm(OrderType::class, $Order); } $form->handleRequest($request); if (!($form->isSubmitted() && $form->isValid())) { YS4b9: logs('amazon_pay_v2')->info('[リダイレクト] フォームエラーのため, 注文手続き画面を表示します.', [$Order->getId()]); return $this->redirectToRoute('amazon_pay_shopping', ['request' => $request], 307); } logs('amazon_pay_v2')->info('[リダイレクト] 集計処理を開始します.', [$Order->getId()]); $flowResult = $this->executePurchaseFlow($Order, false); $this->entityManager->flush(); if (!$flowResult->hasError()) { if (!$flowResult->hasWarning()) { $redirectTo = $form['redirect_to']->getData(); if (!empty($redirectTo)) { #2022/09/28 #配送先に移管の場合 ID が抜けているので修正 バグです $pattern = '/^' . preg_quote($request->getBasePath(), '/') . '/'; $redirectTo = preg_replace($pattern, '', $redirectTo); $result = $router->match($redirectTo); $Path = []; if ($Id = $result['id'] ?? null) { $Path = ['id' => $Id]; } return $this->forwardToRoute($result['_route'], $Path); } } } logs('amazon_pay_v2')->info('[リダイレクト] 購入処理中の受注が存在しません.'); return $this->redirectToRoute('shopping_error'); } /** * API通信によって配送業者や支払方法、お問い合わせ情報をDBに保存する. * * @Route("/shopping/amazon_pay/order_save", name="amazon_pay_shopping_order_save", methods={"POST", "GET"}) */ public function orderSave(Request $request) { if ($request->isXmlHttpRequest()) { $preOrderId = $this->cartService->getPreOrderId(); $Order = $this->orderHelper->getPurchaseProcessingOrder($preOrderId); if ($Order) { $form = $this->createForm(OrderType::class, $Order); $form->handleRequest($request); if (!($form->isSubmitted() && $form->isValid())) { logs('amazon_pay_v2')->info('フォームエラーが発生しました.'); return $this->json(['error' => 'validateError'], 500); } logs('amazon_pay_v2')->info('集計処理を開始します.', [$Order->getId()]); $flowResult = $this->executePurchaseFlow($Order, false); $this->entityManager->flush(); if (!$flowResult->hasError()) { if (!$flowResult->hasWarning()) { return $this->json([]); } logs('amazon_pay_v2')->info('executePurchaseFlowでWarningが発生しました.', [$flowResult->getWarning()]); return $this->json(['error' => 'executePurchaseFlow::Warning'], 500); } logs('amazon_pay_v2')->info('executePurchaseFlowでErrorが発生しました.', [$flowResult->getErrors()]); return $this->json(['error' => 'executePurchaseFlow::Error'], 500); } logs('amazon_pay_v2')->info('購入処理中の受注が存在しません.'); return $this->json(['error' => 'OrderNotFound'], 500); } throw new BadRequestHttpException(); } private function createPaymentMethod(Order $Order, FormInterface $form, $amazonCheckoutSessionId = null) { $PaymentMethod = $this->container->get($Order->getPayment()->getMethodClass()); $PaymentMethod->setOrder($Order); $PaymentMethod->setFormType($form); if (is_null($amazonCheckoutSessionId)) { goto lm0Gv; } $PaymentMethod->setAmazonCheckoutSessionId($amazonCheckoutSessionId); lm0Gv: return $PaymentMethod; } protected function executeCheckout(AmazonPay $paymentMethod, Order $Order) { $PaymentResult = $paymentMethod->checkout(); $response = $PaymentResult->getResponse(); if (!($response && ($response->isRedirection() || $response->getContent()))) { if ($PaymentResult->isSuccess()) { // [PHPDeobfuscator] Implied return return; } $this->purchaseFlow->rollback($Order, new PurchaseContext()); foreach ($PaymentResult->getErrors() as $error) { $this->addError($error); } logs('amazon_pay_v2')->info('[注文処理] PaymentMethod::checkoutのエラーのため, 購入エラー画面へ遷移します.', [$PaymentResult->getErrors()]); return $this->redirectToRoute('shopping_error'); } $this->entityManager->flush(); logs('amazon_pay_v2')->info('[注文処理] PaymentMethod::checkoutが指定したレスポンスを表示します.'); return $response; } private function getAmazonCustomerParam($request) { $customer_regist_v2 = empty($request->get('_shopping_order')['customer_regist_v2']) ? false : true; $mail_magazine = empty($request->get('_shopping_order')['mail_magazine']) ? false : true; $login_check_v2 = empty($request->get('_shopping_order')['login_check_v2']) ? null : $request->get('_shopping_order')['login_check_v2']; $amazon_login_email_v2 = empty($request->get('_shopping_order')['amazon_login_email_v2']) ? null : $request->get('_shopping_order')['amazon_login_email_v2']; $amazon_login_password_v2 = empty($request->get('_shopping_order')['amazon_login_password_v2']) ? null : $request->get('_shopping_order')['amazon_login_password_v2']; return ['customer_regist_v2' => $customer_regist_v2, 'mail_magazine' => $mail_magazine, 'login_check_v2' => $login_check_v2, 'amazon_login_email_v2' => $amazon_login_email_v2, 'amazon_login_password_v2' => $amazon_login_password_v2]; } private function checkAmazonCustomerError($request, $form, $Order) { $arrError = []; if (!(!$this->isGranted('IS_AUTHENTICATED_FULLY') && $this->Config->getLoginRequired() == $this->eccubeConfig['amazon_pay_v2']['toggle']['on'])) { goto c3_hG; } $request_uri = $request->getUri(); if (!('POST' === $request->getMethod() && strpos($request_uri, 'shopping/amazon_pay/address') === false && strpos($request_uri, 'shopping/amazon_pay/delivery') === false)) { goto ZDti5; } $login_check_v2 = $form['login_check_v2']->getData(); if ($login_check_v2 == 'regist') { if (empty($form['customer_regist_v2']->getData())) { $arrError['customer_regist_v2'] = '※ 会員登録が選択されていません。'; goto KRPWo; } $Customer = $this->customerRepository->getNonWithdrawingCustomers(['email' => $Order->getEmail()]); $profile = unserialize($this->session->get($this->sessionAmazonProfileKey)); $AmazonCustomer = $this->customerRepository->getNonWithdrawingCustomers(['v2_amazon_user_id' => $profile->buyerId]); if (!empty($Customer[0])) { $arrError['customer_regist_v2'] = '※ 会員登録済みです。メールアドレスは' . $Order->getEmail() . 'です。'; goto boLVU; } if (empty($AmazonCustomer[0])) { goto WGkut; } $arrError['customer_regist_v2'] = '※ このAmazonアカウントで既に会員登録済みです。メールアドレスは' . $AmazonCustomer[0]->getEmail() . 'です。'; WGkut: boLVU: KRPWo: goto J97eW; } if (!($login_check_v2 == 'login')) { goto B3rq1; } $violations = $this->validator->validate($form['amazon_login_email_v2']->getData(), [new Assert\NotBlank(), new Assert\Email()]); $amazon_login_email_v2_error = ''; foreach ($violations as $violation) { $amazon_login_email_v2_error .= $violation->getMessage() . PHP_EOL; } if (empty($amazon_login_email_v2_error)) { goto hm6sO; } $arrError['amazon_login_email_v2'] = '※ メールアドレスが' . $amazon_login_email_v2_error; hm6sO: $violations = $this->validator->validate($form['amazon_login_password_v2']->getData(), [new Assert\NotBlank()]); $amazon_login_password_v2_error = ''; foreach ($violations as $violation) { $amazon_login_password_v2_error .= $violation->getMessage() . PHP_EOL; } if (empty($amazon_login_password_v2_error)) { goto tPD0l; } $arrError['amazon_login_password_v2'] = '※ パスワードが' . $amazon_login_password_v2_error; tPD0l: if (!(empty($login_check_v2_error) && empty($amazon_login_email_v2_error) && empty($amazon_login_password_v2_error))) { goto fLq4f; } $Customer = $this->customerRepository->getNonWithdrawingCustomers(['email' => $form['amazon_login_email_v2']->getData()]); if (empty($Customer[0])) { $arrError['amazon_login_email_v2'] = '※ メールアドレスまたはパスワードが正しくありません。'; goto ipmH0; } $encoder = $this->encoderFactory->getEncoder($Customer[0]); $salt = $Customer[0]->getSalt(); $customerPassword = $Customer[0]->getPassword(); if ($encoder->isPasswordValid($customerPassword, $form['amazon_login_password_v2']->getData(), $salt)) { goto x0tIr; } $arrError['amazon_login_email_v2'] = '※ メールアドレスまたはパスワードが正しくありません。'; x0tIr: ipmH0: fLq4f: B3rq1: J97eW: ZDti5: c3_hG: return $arrError; } private function setLogin($request, $Order) { $Customer = $this->customerRepository->getNonWithdrawingCustomers(['email' => $Order->getEmail()]); $Order->setCustomer($Customer[0]); $token = new UsernamePasswordToken($Customer[0], null, 'customer', ['ROLE_USER']); $this->tokenStorage->setToken($token); $this->amazonOrderHelper->copyToOrderFromCustomer($Order, $Customer[0]); } private function setAmazonCustomerData($form, $arrAmazonCustomerParam) { $form->get('customer_regist_v2')->setData($arrAmazonCustomerParam['customer_regist_v2']); if (!($this->pluginRepository->findOneBy(['code' => 'MailMagazine4', 'enabled' => true]) || $this->pluginRepository->findOneBy(['code' => 'PostCarrier4', 'enabled' => true]))) { goto AYpWt; } $form->get('mail_magazine')->setData($arrAmazonCustomerParam['mail_magazine']); AYpWt: if (!($this->Config->getLoginRequired() == $this->eccubeConfig['amazon_pay_v2']['toggle']['on'] && !$this->isGranted('IS_AUTHENTICATED_FULLY'))) { goto PSlzy; } $form->get('login_check_v2')->setData($arrAmazonCustomerParam['login_check_v2']); $form->get('amazon_login_email_v2')->setData($arrAmazonCustomerParam['amazon_login_email_v2']); $form->get('amazon_login_password_v2')->setData($arrAmazonCustomerParam['amazon_login_password_v2']); PSlzy: } public function getPendingProcessingOrder($preOrderId = null) { if (!(null === $preOrderId)) { $OrderStatus = $this->orderStatusRepository->find(OrderStatus::PENDING); return $this->orderRepository->findOneBy(['pre_order_id' => $preOrderId, 'OrderStatus' => $OrderStatus]); } return null; } private function checkShippingDifference($Order, $shippingAddress) { $amazonShipping = new Shipping(); $amazonShipping->setOrder($Order); $this->amazonOrderHelper->convert($amazonShipping, $shippingAddress); $Shippings = $Order->getShippings(); $shippingDifference = false; if (!($Shippings->first()->getPostalCode() !== $amazonShipping->getPostalCode() || $Shippings->first()->getName01() !== $amazonShipping->getName01() || $Shippings->first()->getName02() !== $amazonShipping->getName02() || $Shippings->first()->getKana01() !== $amazonShipping->getKana01() || $Shippings->first()->getKana02() !== $amazonShipping->getKana02() || $Shippings->first()->getPref() !== $amazonShipping->getPref() || $Shippings->first()->getAddr01() !== $amazonShipping->getAddr01() || $Shippings->first()->getAddr02() !== $amazonShipping->getAddr02())) { goto q80Nu; } $shippingDifference = true; q80Nu: return $shippingDifference; } protected function getAmazonPayDefaultDelivery(Shipping $Shipping) { $OrderItems = $Shipping->getProductOrderItems(); $SaleTypes = []; foreach ($OrderItems as $OrderItem) { $ProductClass = $OrderItem->getProductClass(); $SaleType = $ProductClass->getSaleType(); $SaleTypes[$SaleType->getId()] = $SaleType; } $Deliveries = $this->deliveryRepository->getDeliveries($SaleTypes); foreach ($Deliveries as $key => $Delivery) { $PaymentOptions = $Delivery->getPaymentOptions(); $amazonPayFlg = false; foreach ($PaymentOptions as $PaymentOption) { $Payment = $PaymentOption->getPayment(); if (!($Payment->getMethodClass() === AmazonPay::class)) { } $amazonPayFlg = true; goto gtR6F; } gtR6F: if ($amazonPayFlg) { goto T3oHg; } unset($Deliveries[$key]); T3oHg: } $Delivery = current($Deliveries); return $Delivery; } }
Malware detection & removal plugin for WordPress
(C)2020 Wordpress Doctor All rights reserved.