Japanese English

PHP 難読化コードの復元・デコード

Wordpress 等でのPHPのマルウェア・ウィルス・改ざんコードをデコードして難読化をオンラインで解除し、
元の読みやすいコードに戻し解読できます。

※すべての難読化コードを解除できるわけではございませんのでご理解とご了承をお願いいたします。

下記のコードを難読化解除しました

<?php /* __________________________________________________ | Obfuscated by YAK Pro - Php Obfuscator 2.0.3 | | on 2023-10-31 14:25:57 | | GitHub: https://github.com/pk-fr/yakpro-po | |__________________________________________________| */ namespace Plugin\AmazonPayV2_42\Service;use Doctrine\ORM\E...



難読化されたPHPコード

<?php
/*   __________________________________________________
    |  Obfuscated by YAK Pro - Php Obfuscator  2.0.3   |
    |              on 2023-10-31 14:25:57              |
    |    GitHub: https://github.com/pk-fr/yakpro-po    |
    |__________________________________________________|
*/
namespace Plugin\AmazonPayV2_42\Service;use Doctrine\ORM\EntityManagerInterface;use Plugin\AmazonPayV2_42\Entity\Master\AmazonStatus;use Plugin\AmazonPayV2_42\Entity\AmazonTrading;use Plugin\AmazonPayV2_42\Exception\AmazonException;use Plugin\AmazonPayV2_42\Exception\AmazonPaymentException;use Plugin\AmazonPayV2_42\Exception\AmazonSystemException;use Plugin\AmazonPayV2_42\Repository\Master\AmazonStatusRepository;use Plugin\AmazonPayV2_42\Repository\ConfigRepository;use Plugin\AmazonPayV2_42\Service\Method\AmazonPay;use Plugin\AmazonPayV2_42\Service\AmazonRequestService;use Eccube\Common\Constant;use Eccube\Common\EccubeConfig;use Eccube\Entity\Customer;use Eccube\Entity\Order;use Eccube\Entity\Shipping;use Eccube\Entity\Master\CustomerStatus;use Eccube\Entity\Master\OrderStatus;use Eccube\Repository\CustomerRepository;use Eccube\Repository\BaseInfoRepository;use Eccube\Repository\PaymentRepository;use Eccube\Repository\PluginRepository;use Eccube\Repository\Master\CustomerStatusRepository;use Eccube\Repository\Master\OrderStatusRepository;use Eccube\Repository\Master\PrefRepository;use Eccube\Service\PurchaseFlow\PurchaseContext;use Eccube\Service\PurchaseFlow\Processor\StockReduceProcessor;use Eccube\Service\PurchaseFlow\Processor\PointProcessor;use Symfony\Component\HttpFoundation\Session\SessionInterface;use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;use Symfony\Component\DependencyInjection\ContainerInterface;class AmazonOrderHelper{private $sessionAmazonProfileKey = 'amazon_pay_v2.profile';private $sessionAmazonShippingAddressKey = 'amazon_pay_v2.shipping_address';private $amazonSettings;private $pointProcessor;private $stockReduceProcessor;public function __construct(CustomerRepository $customerRepository, BaseInfoRepository $baseInfoRepository, PaymentRepository $paymentRepository, PluginRepository $pluginRepository, CustomerStatusRepository $customerStatusRepository, OrderStatusRepository $orderStatusRepository, EntityManagerInterface $entityManager, EccubeConfig $eccubeConfig, PrefRepository $prefRepository, SessionInterface $session, EncoderFactoryInterface $encoderFactory, TokenStorageInterface $tokenStorage, AmazonStatusRepository $amazonStatusRepository, ConfigRepository $configRepository, AmazonRequestService $amazonRequestService, StockReduceProcessor $stockReduceProcessor, PointProcessor $pointProcessor, ContainerInterface $container){goto NEirR;AItkv:$this->customerStatusRepository = $customerStatusRepository;goto uwc1c;QETHl:$this->tokenStorage = $tokenStorage;goto l7COs;n0ZVu:$this->configRepository = $configRepository;goto KvBR4;Le_e0:$this->entityManager = $entityManager;goto wsnlh;NEirR:$this->customerRepository = $customerRepository;goto HJPip;kwptK:$this->container = $container;goto wTWUB;uwc1c:$this->orderStatusRepository = $orderStatusRepository;goto Le_e0;sHXzb:$this->Config = $this->configRepository->get();goto TIw1w;wsnlh:$this->eccubeConfig = $eccubeConfig;goto girBN;XQAU0:$this->pluginRepository = $pluginRepository;goto AItkv;TIw1w:$this->stockReduceProcessor = $stockReduceProcessor;goto MgRiZ;X4j29:$this->paymentRepository = $paymentRepository;goto XQAU0;MgRiZ:$this->pointProcessor = $pointProcessor;goto kwptK;KvBR4:$this->amazonRequestService = $amazonRequestService;goto sHXzb;girBN:$this->prefRepository = $prefRepository;goto o_VbD;o_VbD:$this->session = $session;goto qZh1b;HJPip:$this->BaseInfo = $baseInfoRepository->get();goto X4j29;l7COs:$this->amazonStatusRepository = $amazonStatusRepository;goto n0ZVu;qZh1b:$this->encoderFactory = $encoderFactory;goto QETHl;wTWUB:}public function getOrderer($shippingAddress){goto t4EJg;WZBtX:$Customer->setKana01(' ');goto hq3q_;BQ8xF:$profile = unserialize($this->session->get($this->sessionAmazonProfileKey));goto hYKgC;j45xL:return $Customer;goto tLwKi;s4d9t:$this->convert($Customer, $shippingAddress);goto j45xL;hq3q_:$Customer->setKana02(' ');goto WC6am;h9Sql:$Customer->setName02(' ');goto WZBtX;hebaD:$Customer->setName01(' ');goto h9Sql;t4EJg:$Customer = new Customer();goto hebaD;hYKgC:$Customer->setEmail($profile->email);goto s4d9t;WC6am:$Pref = $this->prefRepository->find(13);goto p6GaG;p6GaG:$Customer->setPref($Pref);goto BQ8xF;tLwKi:}public function initializeAmazonOrder($Order, $Customer){goto dlKyp;Xm5me:return $Order;goto KZOYR;HZY9E:$Order->setEmail($Customer->getEmail());goto UQeNk;N4Psd:$Order->setPayment($Payment);goto HZY9E;UQeNk:$this->entityManager->persist($Order);goto Xm5me;dlKyp:$Payment = $this->paymentRepository->findOneBy(['method_class' => AmazonPay::class]);goto N4Psd;KZOYR:}public function convert($entity, $shippingAddress){goto ua8yk;c06wO:$entity->setKana02(' ');goto tUg4M;BiAtW:$email = $entity->getEmail();goto UzpV0;aM0Yb:if ($entity instanceof Customer) {goto gaXlE;}goto NuLue;UzpV0:PfiCZ:goto Cvqwu;aLZ6y:if (!empty($Pref)) {goto SlTTu;}goto JrPcF;RcDdN:$Pref = $this->prefRepository->findOneBy(['name' => $shippingAddress->stateOrRegion]);goto aLZ6y;i7UCH:$PostalCodeCount = preg_replace('/(-|−)/', '', $shippingAddress->postalCode);goto eNBdq;Z6Gbw:ohu7Y:goto ge83I;VT0wZ:$addr01 = $shippingAddress->stateOrRegion . $addr01;goto jxmWc;eaCuq:oujC3:goto RcDdN;BFo5B:$entity->setKana01(' ')->setKana02(' ');goto vjCRn;mQ6TB:ILI7m:goto Owx3j;kB5vc:$email = $entity->getEmail();goto Vbv5n;Vbv5n:goto PfiCZ;goto jTumI;QucOu:SLY2c:goto obGJF;vt3mr:$AddressLine1Front = mb_substr($convertAmznAddr1, 0, $offset);goto I2aQU;jTumI:bKqBL:goto mJhYb;ivUqT:$entity->setPref($Pref);goto VT0wZ;Xkauw:$addr01 = $shippingAddress->city . $AddressLine1Front;goto RnBuJ;UQL6r:if ($entity instanceof Shipping) {goto bKqBL;}goto aM0Yb;FKUtO:preg_match('/(\\d{3})(\\d{4})/', $shippingAddress->postalCode, $arrPostalCode);goto jwLpd;ua8yk:if (strpos($shippingAddress->postalCode, '-') !== false) {goto S51Kx;}goto FKUtO;CUCwN:$entity->setPref($Pref);goto whRj6;ZwStv:if (isset($arrName['kana01'])) {goto Pi4yg;}goto CmkJM;Khy0a:$email = $Order->getEmail();goto v6eXz;Nw5cj:iIVLA:goto kB5vc;UF0Z4:$entity->setAddr01($addr01)->setAddr02($addr02);goto xEzBU;oWkhP:$convertAmznAddr1 = mb_convert_kana($shippingAddress->addressLine1, 'n', 'utf-8');goto ke1So;n7_E_:if ($entity instanceof Order) {goto iIVLA;}goto UQL6r;LIExk:$entity->setKana01($arrFixKana['kana01'])->setKana02($arrFixKana['kana02']);goto JK6DE;y5qWn:ceC6E:goto LIExk;whRj6:vc2Mr:goto UF0Z4;jZsYM:Etw3i:goto YsiEP;tUg4M:goto Etw3i;goto Z6Gbw;jwLpd:unset($arrPostalCode[0]);goto hYFeL;rymuq:goto Zp2EV;goto y5qWn;Sp6nN:GuLW2:goto qn8gI;JrPcF:logs('amazon_pay_v2')->info('*** 都道府県マッチングエラー *** addr = ' . var_export($shippingAddress, true));goto RLpcB;kagcm:goto sa8wf;goto YQnpo;Smuef:S51Kx:goto phwCT;CmkJM:if ($entity instanceof Shipping) {goto ohu7Y;}goto ULU_0;I2aQU:$AddressLine1End = mb_substr($convertAmznAddr1, $offset);goto Xkauw;NuLue:goto PfiCZ;goto Nw5cj;dK_oq:SlTTu:goto CUCwN;ULU_0:goto Etw3i;goto NcjIm;TpBVW:$offset = strlen(substr($convertAmznAddr1, 0, $matches[0][1]));goto vt3mr;RnBuJ:$addr02 = $AddressLine1End . $convertAmznAddr2;goto UroxA;Cvqwu:$arrFixKana = $this->reviseKana($entity->getName01(), $entity->getName02(), $email);goto ZyQTc;obGJF:$entity->setPostalCode(preg_replace('/(-|−)/', '', $shippingAddress->postalCode));goto ijpjY;M34Sr:$addr02 = $convertAmznAddr2;goto kagcm;jxmWc:goto vc2Mr;goto dK_oq;HTsO3:$entity->setKana01($arrName['kana01']);goto c06wO;eNBdq:if (!(mb_strlen($PostalCodeCount) >= 9)) {goto SLY2c;}goto RohoX;aBYA6:IWQM9:goto i7UCH;mJhYb:$Order = $entity->getOrder();goto Khy0a;YsiEP:if (!($this->Config->getOrderCorrect() == $this->eccubeConfig['amazon_pay_v2']['toggle']['on'])) {goto GuLW2;}goto n7_E_;u_5CK:if (preg_match("/[0-9]/", $convertAmznAddr1, $matches, PREG_OFFSET_CAPTURE)) {goto kpLst;}goto tst9e;L5I2l:if (!($shippingAddress->addressLine3 != '')) {goto oujC3;}goto dS72e;o3JKJ:$entity->setName01($arrName['name01'])->setName02($arrName['name02']);goto ZwStv;RLpcB:$Pref = $this->prefRepository->find(13);goto ivUqT;UroxA:sa8wf:goto L5I2l;FNE3Z:nE390:goto BFo5B;hYFeL:$arrPostalCode = array_values($arrPostalCode);goto AVb6n;ge83I:$entity->setKana01(' ')->setKana02(' ');goto jZsYM;hrSkH:gaXlE:goto BiAtW;NcjIm:Pi4yg:goto HTsO3;RohoX:$arrAmznAddr = ['PostalCode' => ' ', 'CountryCode' => '', 'StateOrRegion' => '', 'Name' => '', 'AddressLine1' => '', 'AddressLine2' => '', 'AddressLine3' => '', 'City' => '', 'Phone' => ''];goto QucOu;v6eXz:goto PfiCZ;goto hrSkH;YQnpo:kpLst:goto TpBVW;JK6DE:goto Zp2EV;goto FNE3Z;AVb6n:goto IWQM9;goto Smuef;vjCRn:Zp2EV:goto Sp6nN;phwCT:$arrPostalCode = explode('-', $shippingAddress->postalCode);goto aBYA6;Owx3j:MIK9E:goto oWkhP;dS72e:$addr02 .= " " . $shippingAddress->addressLine3;goto eaCuq;qn8gI:switch ($shippingAddress->stateOrRegion) {case "東京":$shippingAddress->stateOrRegion = "東京都";goto MIK9E;case "大阪":$shippingAddress->stateOrRegion = "大阪府";goto MIK9E;case "京都":$shippingAddress->stateOrRegion = "京都府";goto MIK9E;case "東京都":goto MIK9E;case "大阪府":goto MIK9E;case "京都府":goto MIK9E;case "北海道":goto MIK9E;default:goto RJDfF;RJDfF:if (preg_match('/県$/u', $shippingAddress->stateOrRegion)) {goto ORd23;}goto eiAPv;eiAPv:$shippingAddress->stateOrRegion .= '県';goto CK2tN;CK2tN:ORd23:goto Sl70Z;Sl70Z:}goto mQ6TB;ke1So:$convertAmznAddr2 = mb_convert_kana($shippingAddress->addressLine2, 'n', 'utf-8');goto u_5CK;bP5Rq:if ($entity->getKana01() == null) {goto nE390;}goto rymuq;ZyQTc:if (!empty($arrFixKana)) {goto ceC6E;}goto bP5Rq;xEzBU:$entity->setPhoneNumber(preg_replace('/(-|−)/', '', $shippingAddress->phoneNumber));goto HLetW;ijpjY:$arrName = $this->divideName($shippingAddress->name);goto o3JKJ;tst9e:$addr01 = $shippingAddress->city . $convertAmznAddr1;goto M34Sr;HLetW:}public function divideName($name){goto ifQm1;jSxp1:$arrResult = $arrFixName;goto JxmaW;MwC1i:$arrResult['name02'] = ' ';goto W5vo6;M7tzV:i_UY9:goto m_619;JxmaW:logs('amazon_pay_v2')->info('*** 名前補正 ***');goto GlkZj;c50JO:W4mF8:goto rnlRO;hYN1t:if (count($arrName) == 2) {goto W4mF8;}goto CzSsS;x9wtl:LJFeT:goto EybM2;GlkZj:UeZzE:goto kHCka;kHCka:xzzVN:goto jOfa6;EybM2:if (!empty($arrFixName)) {goto yqeWh;}goto OvsV3;m_619:return $arrResult;goto jExcy;ifQm1:$arrResult = [];goto u3zKI;CzSsS:$arrResult = $this->reviseLastNameList($name);goto KZhlG;I4h2w:$arrResult['name02'] = $arrName[1];goto M7tzV;CHQKI:$arrFixName = $this->reviseName($name);goto x9wtl;rnlRO:$arrResult['name01'] = $arrName[0];goto I4h2w;OvsV3:$arrResult['name01'] = $name;goto MwC1i;W5vo6:goto UeZzE;goto LT_2b;KZhlG:if (!empty($arrResult)) {goto xzzVN;}goto dFYMS;dFYMS:if (!($this->Config->getOrderCorrect() == $this->eccubeConfig['amazon_pay_v2']['toggle']['on'])) {goto LJFeT;}goto CHQKI;jOfa6:goto i_UY9;goto c50JO;u3zKI:$arrName = preg_split('/[  ]+/u', $name);goto hYN1t;LT_2b:yqeWh:goto jSxp1;jExcy:}private function searchObject($search, $target, $objectName){goto qNCyc;qNCyc:$qb = $this->entityManager->createQueryBuilder();goto r_a_D;Pao26:$qb->andWhere('CONCAT(o.name01, o.name02) = :name')->setParameter('name', $search)->andWhere("TRIM(o.name02) <> ''");goto Ao0iD;OnRYh:if (!($target == 'name')) {goto X1gBj;}goto Pao26;r_a_D:$qb->select('o')->from('\\Eccube\\Entity' . "\\{$objectName}", 'o');goto OnRYh;Ao0iD:X1gBj:goto c240V;c240V:return $qb->getQuery()->getResult();goto tjH5I;tjH5I:}private function searchObjectByNameAndEmail($name01, $name02, $email, $target, $objectName){goto gmr39;v8MMt:return $qb->getQuery()->getResult();goto Lowxn;mpiW7:goto lALFD;goto ILxwh;zQEqQ:lALFD:goto PC1t9;tuyj_:BFom9:goto wxQaL;PC1t9:ZhPtq:goto v8MMt;CiD3D:$qb->select('s')->from(Shipping::class, 's')->leftJoin('s.Order', 'o')->andWhere('s.name01 = :name01')->setParameter('name01', $name01)->andWhere('s.name02 = :name02')->setParameter('name02', $name02)->andWhere('o.email = :email')->setParameter('email', $email)->andWhere("s.kana01 <> ''")->andWhere("s.kana02 <> ''")->andWhere("o.OrderStatus <> :status_pending")->setParameter('status_pending', OrderStatus::PENDING)->andWhere("o.OrderStatus <> :status_processing")->setParameter('status_processing', OrderStatus::PROCESSING)->andWhere("o.AmazonPayV2AmazonStatus IS NOT NULL")->orderBy('o.update_date', 'DESC');goto mTXzm;C_4dR:lQ2qY:goto DSo7J;ILxwh:ww8yj:goto CiD3D;X56Ud:goto lALFD;goto tuyj_;uRPdL:if ($objectName == 'Customer') {goto lQ2qY;}goto X56Ud;v7gzR:if ($objectName == 'Order') {goto BFom9;}goto T9Iph;T9Iph:if ($objectName == 'Shipping') {goto ww8yj;}goto uRPdL;gmr39:$qb = $this->entityManager->createQueryBuilder();goto EykPF;DSo7J:$qb->select('c')->from(Customer::class, 'c')->andWhere('c.name01 = :name01')->setParameter('name01', $name01)->andWhere('c.name02 = :name02')->setParameter('name02', $name02)->andWhere('c.email = :email')->setParameter('email', $email)->andWhere("c.kana01 <> ''")->andWhere("c.kana02 <> ''")->andWhere("c.v2_amazon_user_id <> ''")->orderBy('c.update_date', 'DESC');goto zQEqQ;mTXzm:goto lALFD;goto C_4dR;EykPF:if (!($target == 'kana')) {goto ZhPtq;}goto v7gzR;wxQaL:$qb->select('o')->from(Order::class, 'o')->andWhere('o.name01 = :name01')->setParameter('name01', $name01)->andWhere('o.name02 = :name02')->setParameter('name02', $name02)->andWhere('o.email = :email')->setParameter('email', $email)->andWhere("o.kana01 <> ''")->andWhere("o.kana02 <> ''")->andWhere("o.OrderStatus <> :status_pending")->setParameter('status_pending', OrderStatus::PENDING)->andWhere("o.OrderStatus <> :status_processing")->setParameter('status_processing', OrderStatus::PROCESSING)->andWhere("o.AmazonPayV2AmazonStatus IS NOT NULL")->orderBy('o.update_date', 'DESC');goto mpiW7;Lowxn:}public function reviseName($name){goto jTyFj;Vbx50:QPso_:goto yCgqZ;izrwc:$Objects = $this->searchObject($name, 'name', 'Order');goto aLU3f;vgNE7:$Objects = $this->searchObject($name, 'name', 'Shipping');goto e09kP;hvTg4:$arrFixName['name01'] = $Objects[0]->getName01();goto LN2Hf;jTyFj:$arrFixName = [];goto izrwc;Oi6iB:if (empty($Objects)) {goto QPso_;}goto hvTg4;LN2Hf:$arrFixName['name02'] = $Objects[0]->getName02();goto Vbx50;aLU3f:if (!empty($Objects)) {goto vNOXX;}goto vgNE7;e09kP:if (!empty($Objects)) {goto y_bbi;}goto TyjM4;cr3RQ:vNOXX:goto Oi6iB;kFBFr:y_bbi:goto cr3RQ;yCgqZ:return $arrFixName;goto NSC4S;TyjM4:$Objects = $this->searchObject($name, 'name', 'Customer');goto kFBFr;NSC4S:}public function reviseKana($name01, $name02, $email){goto aYYAz;YPrbJ:j_BcX:goto TavYA;h1rNZ:H9B3x:goto yoKW6;PdyNw:if (empty($Objects)) {goto j_BcX;}goto sQcwG;ZzeZx:$Objects = $this->searchObjectByNameAndEmail($name01, $name02, $email, 'kana', 'Customer');goto h1rNZ;yoKW6:F6NTK:goto PdyNw;gdS1F:$Objects = $this->searchObjectByNameAndEmail($name01, $name02, $email, 'kana', 'Shipping');goto pzpjo;TavYA:return $arrFixKana;goto flVcn;aYYAz:$arrFixKana = [];goto wJTTg;sQcwG:$arrFixKana['kana01'] = $Objects[0]->getKana01();goto rcU_R;MFLqD:if (!empty($Objects)) {goto F6NTK;}goto gdS1F;rcU_R:$arrFixKana['kana02'] = $Objects[0]->getKana02();goto YPrbJ;wJTTg:$Objects = $this->searchObjectByNameAndEmail($name01, $name02, $email, 'kana', 'Order');goto MFLqD;pzpjo:if (!empty($Objects)) {goto H9B3x;}goto ZzeZx;flVcn:}public function reviseLastNameList($name){goto HEChj;zwwrV:$arrName = null;goto ahjKE;ID1xI:return $arrName;goto qcGiY;k1Zzn:$cr_len = mb_strlen($row[0], 'utf-8');goto NiKHP;zOEkw:$arrName['name01'] = $row[0];goto Cw72z;v81e3:$arrName['kana02'] = ' ';goto CNSj7;ahjKE:$last_max_len = 0;goto beoV1;R8_uH:$arrName['kana01'] = $row[1];goto v81e3;beoV1:$row = fgetcsv($fp);goto aB8BT;Xse6H:goto e_pt4;goto Tl2uU;HEChj:$arrName = [];goto jMe_C;YV1jb:if (!($fp === false)) {goto pqpbJ;}goto lENVf;lIdr7:fclose($fp);goto ID1xI;CNSj7:AZ6kn:goto Xse6H;ya1DO:if (!(mb_strpos($name, $row[0], null, 'utf-8') === 0)) {goto AZ6kn;}goto k1Zzn;lENVf:return null;goto LeHIi;LeHIi:pqpbJ:goto zwwrV;k18_s:bxqjd:goto O282j;Tl2uU:C48mD:goto lIdr7;ODgWH:goto e_pt4;goto k18_s;TvmQ1:if (!(($row = fgetcsv($fp)) !== FALSE)) {goto C48mD;}goto ya1DO;O282j:$last_max_len = $cr_len;goto zOEkw;aB8BT:e_pt4:goto TvmQ1;NiKHP:if (!($last_max_len > $cr_len)) {goto bxqjd;}goto ODgWH;jMe_C:$fp = fopen($this->eccubeConfig['plugin_data_realdir'] . '/AmazonPayV2_42/lastNameList.csv', 'r');goto YV1jb;Cw72z:$arrName['name02'] = mb_substr($name, $cr_len, null, 'utf-8');goto R8_uH;qcGiY:}public function copyToOrderFromCustomer(Order $Order, Customer $Customer){goto jz7m4;VG87p:if (!$Customer->getId()) {goto EXgMr;}goto wT4zY;jz7m4:if (!empty($Customer)) {goto NTG7E;}goto HIoiK;iW0zy:EXgMr:goto wlkKB;wT4zY:$Order->setCustomer($Customer);goto iW0zy;wlkKB:$Order->setName01($Customer->getName01())->setName02($Customer->getName02())->setKana01($Customer->getKana01())->setKana02($Customer->getKana02())->setCompanyName($Customer->getCompanyName())->setEmail($Customer->getEmail())->setPhoneNumber($Customer->getPhoneNumber())->setPostalCode($Customer->getPostalCode())->setPref($Customer->getPref())->setAddr01($Customer->getAddr01())->setAddr02($Customer->getAddr02())->setSex($Customer->getSex())->setBirth($Customer->getBirth())->setJob($Customer->getJob());goto DptdI;qXwLo:NTG7E:goto VG87p;HIoiK:return;goto qXwLo;DptdI:}public function completeCheckout(Order $Order, $amazonCheckoutSessionId){goto izgzz;iYJlz:return $response;goto GjRuV;hh0Xl:$response = $this->amazonRequestService->completeCheckoutSession($Order, $amazonCheckoutSessionId);goto iYJlz;vJ3nw:throw AmazonPaymentException::create(AmazonPaymentException::ZERO_PAYMENT);goto ickpy;ickpy:tIFCD:goto hh0Xl;izgzz:if (!($Order->getPaymentTotal() == 0)) {goto tIFCD;}goto vJ3nw;GjRuV:}public function setAmazonOrder(Order $Order, $chargePermissionId, $chargeId = null){goto aZnH3;PueU2:$AmazonStatus = $this->amazonStatusRepository->find($this->Config->getSale());goto CnDAm;uMJoI:if ($payment_total * 9 > $this->eccubeConfig['amazon_pay_v2']['max_billable_amount']) {goto yo8jH;}goto GqazI;WjVH6:goto rg6gg;goto mRw3q;HU1nQ:$payment_total = (int) $Order->getPaymentTotal();goto uMJoI;bDE9P:O9318:goto Ytsmu;BMNpU:yo8jH:goto TBPBz;mRw3q:GpEZF:goto fIUhd;FULpu:rg6gg:goto MtY47;FWl5x:$Order->setAmazonPayV2BillableAmount($billableAmount);goto Qxr6B;YjnAj:MIrhr:goto d0bQD;yKclx:$AmazonTrading->setCaptureAmount(0);goto WjVH6;Qxr6B:goto TmX0V;goto YjnAj;MtY47:$AmazonTrading->setRefundCount(0);goto alRsM;idlHn:$Order->setPaymentDate(new \DateTime());goto UxTQ6;d0bQD:$Order->setAmazonPayV2BillableAmount($billableAmount - $payment_total);goto idlHn;dS2IK:if ($this->Config->getSale() == $this->eccubeConfig['amazon_pay_v2']['sale']['capture']) {goto GpEZF;}goto yKclx;Ogdya:$AmazonTrading->setChargeId($chargeId);goto be9qh;UxTQ6:TmX0V:goto v0xQn;alRsM:$Order->addAmazonPayV2AmazonTrading($AmazonTrading);goto dYH4S;bqxq7:$AmazonTrading->setChargePermissionId($chargePermissionId);goto Ogdya;Ytsmu:if ($this->Config->getSale() == $this->eccubeConfig['amazon_pay_v2']['sale']['capture']) {goto MIrhr;}goto FWl5x;T0DfF:$AmazonTrading->setOrder($Order);goto bqxq7;GqazI:$billableAmount = $payment_total + $this->eccubeConfig['amazon_pay_v2']['max_billable_amount'];goto GSV0o;TBPBz:$billableAmount = floor($payment_total * 9);goto bDE9P;fIUhd:$AmazonTrading->setCaptureAmount($payment_total);goto FULpu;be9qh:$AmazonTrading->setAuthoriAmount($payment_total);goto dS2IK;aZnH3:$Order->setAmazonPayV2ChargePermissionId($chargePermissionId);goto PueU2;v0xQn:$AmazonTrading = new AmazonTrading();goto T0DfF;CnDAm:$Order->setAmazonPayV2AmazonStatus($AmazonStatus);goto HU1nQ;GSV0o:goto O9318;goto BMNpU;dYH4S:}public function registCustomer(Order $Order, $mail_magazine, $profile = null){goto mmC7u;r3ohG:if (!$this->pluginRepository->findOneBy(['code' => 'PostCarrier42', 'enabled' => true])) {goto oKRSi;}goto eGhfF;HGHUx:$CustomerStatus = $this->customerStatusRepository->find(CustomerStatus::REGULAR);goto BOal3;hRb68:if ($profile) {goto adBn7;}goto BB0fD;ZUTCF:vvkoq:goto r3ohG;QISV0:$this->entityManager->persist($Customer);goto iZ9al;mmC7u:logs('amazon_pay_v2')->info('*** 会員登録処理 start ***');goto hRb68;ubesg:$Customer = $this->customerRepository->newCustomer();goto xx5hg;RSLoA:$Customer->setMailmagaFlg(true);goto Cu5o5;tyX6j:adBn7:goto ubesg;pbiep:$this->tokenStorage->setToken($token);goto buiZh;BB0fD:$profile = unserialize($this->session->get($this->sessionAmazonProfileKey));goto tyX6j;FnFgq:$Customer->setName01($Order->getName01())->setName02($Order->getName02())->setPostalCode($Order->getPostalCode())->setEmail($Order->getEmail())->setPref($Order->getPref())->setAddr01($Order->getAddr01())->setAddr02($Order->getAddr02())->setPhoneNumber($Order->getPhoneNumber())->setV2AmazonUserId($profile->buyerId);goto ydWm9;xx5hg:$encoder = $this->encoderFactory->getEncoder($Customer);goto fXrU6;ydWm9:if (!$this->pluginRepository->findOneBy(['code' => 'MailMagazine42', 'enabled' => true])) {goto vvkoq;}goto nvNb2;Q2z59:$enc_password = $encoder->encodePassword($password, $salt);goto fM9vk;aLxC0:XLzAb:goto JEqNF;vEJo4:goto FTaI8;goto ekyk0;gZs2L:ICUIG:goto MDd20;Cu5o5:FTaI8:goto ZUTCF;JEqNF:$Customer->setPostcarrierFlg(true);goto gZs2L;eGhfF:if ($mail_magazine) {goto XLzAb;}goto iIRYW;OoOW4:$Customer->setSalt($salt)->setPassword($enc_password)->setSecretKey($secretKey)->setPoint(0);goto HGHUx;iIRYW:$Customer->setPostcarrierFlg(false);goto IAZii;ekyk0:HR_e9:goto RSLoA;nvNb2:if ($mail_magazine) {goto HR_e9;}goto JY7aQ;XPrSp:$token = new UsernamePasswordToken($Customer, null, 'customer', ['ROLE_USER']);goto pbiep;buiZh:logs('amazon_pay_v2')->info('*** 会員登録処理 end ***');goto r8t8i;JY7aQ:$Customer->setMailmagaFlg(false);goto vEJo4;iZ9al:$this->entityManager->flush();goto XPrSp;r8t8i:return $password;goto M_JXW;BOal3:$Customer->setStatus($CustomerStatus);goto FnFgq;Ve8Rm:$password = $this->createPassword();goto Q2z59;IAZii:goto ICUIG;goto aLxC0;fXrU6:$salt = $encoder->createSalt();goto Ve8Rm;fM9vk:$secretKey = $this->customerRepository->getUniqueSecretKey();goto OoOW4;MDd20:oKRSi:goto QISV0;M_JXW:}public function adminRequest($request, $Order){goto xWJUb;uNmtB:goto bYxfw;goto GvdXI;tYZ4z:goto YUOy4;goto eKTnC;bvH79:$totalRefundAmount = $allRefund_flg ? $payment_total : $sumCaptureAmount - $payment_total;goto S_HpF;VOpDG:Vdm3g:goto wK7j3;VvUXH:goto I94_d;goto zXW1I;SwLTV:if ($V1Enable_flg) {goto kGPLu;}goto G3sLD;YSi4P:zRWdd:goto LJyR2;ioTnd:$amazonErr = "下記のエラーが発生しました。\n" . "リクエストを受け付けないため処理を終了しました。\n";goto VOpDG;LJyR2:$V1Enable_flg = $this->pluginRepository->findOneBy(array('code' => 'AmazonPay', 'enabled' => Constant::ENABLED));goto SwLTV;Wv8Xj:if (is_object($r)) {goto CECzo;}goto V2eaa;piwSp:goto XXxOl;goto CPmv7;ZN3nz:$AmazonTradings = $Order->getAmazonPayV2AmazonTradings();goto IklCn;V2eaa:if ($r === false) {goto CL0ng;}goto O7j7_;bTyb_:CL0ng:goto D93Ry;ZcA18:$Order->setAmazonPayV2AmazonStatus($AmazonStatus);goto hdOP9;VWy8g:$billableAmount = $Order->getBillableAmount();goto y_hsa;vXdDE:xsSMx:goto f0Hbf;Pigpn:Hwpt7:goto NuAYp;NYgqv:$OrderStatus = $this->orderStatusRepository->find($this->orderStatusRepository->find(OrderStatus::CANCEL));goto tPlxA;Ce2mn:$AmazonStatus = $amazonStatusRepositoryV1->find(AmazonStatus::CANCEL);goto piwSp;iXWQg:AU1K7:goto O65Hu;r4muG:$this->entityManager->flush();goto cEw90;tPlxA:if ($Order->getOrderStatus()->getId() == OrderStatus::DELIVERED) {goto ED_ZR;}goto OGQck;lDNaT:BsR7S:goto ITrnR;ZdQJE:goto cfq_d;goto OD2Of;xWJUb:$amazonErr = '';goto x41fA;mvRkl:$version = 'CV2';goto rtYQ9;ho08a:Itqa1:goto tYZ4z;xCFlF:if ($version == 'CV2') {goto L18CJ;}goto IgXIw;dQ6MA:if ($request == 'cancel' && $payment_total == $sumCaptureAmount) {goto xsSMx;}goto bfdNT;sFq1y:$cancel_flg = false;goto bvH79;S_HpF:$resultAmazonTradingInfo = [];goto nKgs7;Ml4gW:$AmazonStatus = $this->amazonStatusRepository->find(AmazonStatus::CAPTURE);goto bNC0i;KKvSx:hswtX:goto ioTnd;nSErN:goto bizJe;goto bTyb_;mpr4A:$Order->setAmazonPayV2BillableAmount($billableAmount);goto Ml4gW;Cjrhs:$totalBillingAmount = $payment_total - $sumCaptureAmount;goto dQ6MA;pyW0f:goto Zb7vS;goto h_DTS;A5bkJ:goto Vdm3g;goto KKvSx;YNoOF:$Customer->setPoint(intval($Customer->getPoint()) - intval($Order->getAddPoint()));goto bck1W;Fnn2H:TReHP:goto sFq1y;DcwSL:if ($version == 'CV1') {goto Hwpt7;}goto zWy3X;wK7j3:return $amazonErr;goto nYXPf;LlAua:j_CjK:goto ho08a;zWy3X:if ($version == 'CV2') {goto Z6WDp;}goto sbaqU;RjRBF:if ($version == 'CV2') {goto ZBNUF;}goto gQwDJ;fCxdU:goto TReHP;goto vXdDE;G3sLD:$amazonErr = 'CV1受注のリクエストを受け付けましたが、CV1が有効化されていません。';goto yN0qB;WrgDC:if ($Order->getPaymentMethod() === 'Amazon Pay') {goto ODRI0;}goto l4IL5;Eug03:if (isset($r->reasonCode)) {goto hswtX;}goto Wv8Xj;b7HUV:if ($version == 'CV2') {goto Q9M3W;}goto SKT8u;Lfvpa:XXxOl:goto EkIAa;OD2Of:CECzo:goto kCdfy;ywwni:if ($version == 'CV1') {goto BsR7S;}goto RjRBF;ANZHt:$billableAmount = $Order->getAmazonPayV2BillableAmount();goto ASfiw;FWhjs:if ($Order->getPaymentMethod() === 'AmazonPay') {goto zRWdd;}goto WrgDC;gQwDJ:goto I94_d;goto lDNaT;nyPY6:kGPLu:goto LQnan;CG50s:foreach ($AmazonTradings as $AmazonTrading) {goto VgT2n;RDg1T:$sumCaptureAmount += $AmazonTrading->getCaptureAmount();goto UMrca;UMrca:b75Rp:goto Zvk75;VgT2n:$sumAuthoriAmount += $AmazonTrading->getAuthoriAmount();goto RDg1T;Zvk75:}goto IdPjC;zXW1I:ZBNUF:goto ZcA18;hdOP9:I94_d:goto r4muG;EoHnP:NWmdj:goto oy_pr;OGQck:if (!($Order->getOrderStatus()->getId() != $OrderStatus->getId())) {goto Itqa1;}goto ys2vL;D93Ry:bizJe:goto ZdQJE;D1rCl:if (!$Customer) {goto j_CjK;}goto Wj3fg;i3h1s:$amazon_status = $Order->getAmazonStatus()->getName();goto o_8UW;oy_pr:YUOy4:goto Y3oIy;GvdXI:FPQBm:goto NYgqv;ys2vL:$this->stockReduceProcessor->rollback($Order, new PurchaseContext());goto yb1Vu;yN0qB:return $amazonErr;goto nyPY6;re0LC:if ($version == 'CV1') {goto MGhHL;}goto xCFlF;yb1Vu:$Customer = $Order->getCustomer();goto D1rCl;Y3oIy:$Order->setOrderStatus($OrderStatus);goto kVOiM;IdPjC:taO7G:goto h9WvB;bNC0i:Zb7vS:goto uNmtB;jXLC1:L18CJ:goto ANZHt;kCdfy:if (!($version == 'CV1')) {goto AU1K7;}goto WXbKT;ITrnR:$Order->setAmazonStatus($AmazonStatus);goto VvUXH;IklCn:$amazon_status = $Order->getAmazonPayV2AmazonStatus()->getName();goto mvRkl;ddaJe:$sumAuthoriAmount = 0;goto iuIre;uEPy0:$AmazonStatus = $this->amazonStatusRepository->find(AmazonStatus::CANCEL);goto Lfvpa;CxVIC:if (!$Customer) {goto NWmdj;}goto YNoOF;O4oqi:$AmazonStatus = $amazonStatusRepositoryV1->find(AmazonStatus::CAPTURE);goto pyW0f;O7j7_:$amazonErr = "下記のエラーが発生しました。\n" . var_export($r, true) . "\n";goto nSErN;YevDr:VqCPb:goto Ce2mn;CPmv7:Q9M3W:goto uEPy0;WXbKT:$amazonStatusRepositoryV1 = $this->container->get(\Plugin\AmazonPay\Repository\Master\AmazonStatusRepository::class);goto iXWQg;O65Hu:if ($cancel_flg || $allRefund_flg) {goto FPQBm;}goto P_jDW;kVOiM:if ($version == 'CV1') {goto VqCPb;}goto b7HUV;nKgs7:foreach ($AmazonTradings as $key => $AmazonTrading) {goto Io5gv;Yj2UY:CB_Iy:goto hPN22;EdSOo:$newAmazonTrading->setChargePermissionId($r->chargePermissionId);goto yUx1h;AdQZB:goto qODJG;goto VHYpE;eOZw1:goto WYDPX;goto WsayL;WZWc0:if ($version == 'CV2') {goto ktVH6;}goto xGIvt;nnXaK:$r = $this->amazonRequestService->captureCharge($newAmazonChargeId, $Order, $addAmount);goto SZ3ZS;gnvp_:$billableAmount = $billableAmount - $billingAmount;goto ZSEtG;tgh9K:$this->entityManager->persist($newAmazonTrading);goto z8RMU;ZSEtG:MW9Rf:goto Q0h6X;uNBmf:kbNpm:goto dT_qM;a6jET:goto vEOBc;goto s00NO;akeNX:goto brioy;goto mTkMZ;iukQl:$amazonChargeId = $AmazonTrading->getChargeId();goto Bm0Xo;yn_IS:if (!($version == 'CV1')) {goto MW9Rf;}goto xWskA;CcoyC:goto qODJG;goto uNBmf;LzcOU:$newAmazonTrading = new AmazonTrading();goto biCZi;X3in7:goto qODJG;goto xOiaN;UAWIG:$newAmazonTrading->setTradingCode($newAmazonChargeId);goto lyVVL;oiHI7:ibTVb:goto qsZL5;m_8ok:$totalBillingAmount = $totalBillingAmount - $addAmount;goto dB0qH;ULxPj:if (!isset($r->chargeId)) {goto K_kSA;}goto gxyKT;JsOor:GxewR:goto XtdtJ;VljP7:$r = $this->amazonRequestService->captureCharge($amazonChargeId, $Order, $billingAmount);goto nu2p2;vBrE5:$addAmount = $totalBillingAmount;goto lwHvq;JOBck:$refundAmount = $captureAmount > $totalRefundAmount ? $totalRefundAmount : $captureAmount;goto XvBFn;rjnuw:$billableAmount = $billableAmount - $addAmount;goto akeNX;Qr3k7:if (!($refundAmount > 0)) {goto GxewR;}goto lTt9q;xL784:$refundCount = $AmazonTrading->getRefundCount();goto Nu9UX;L1i6K:Fmjkn:goto JsOor;LO08Z:$newAmazonTrading->setAuthoriAmount($addAmount);goto xaZEV;H7B2m:if (!(isset($r->reasonCode) && $r === 'status_failed')) {goto EADJb;}goto mW3FW;DnP8R:i5YJh:goto WTBY7;dT_qM:$AmazonTrading->setCaptureAmount($billingAmount);goto XwiFl;xGIvt:goto brioy;goto cM5zT;y3m8d:goto iK6Lc;goto Yj2UY;xWskA:$totalBillingAmount = $totalBillingAmount - $billingAmount;goto gnvp_;dwWO_:if ($amazon_status == 'オーソリ') {goto caTYY;}goto vBrE5;KqDkS:$amazonChargePermissionId = $AmazonTrading->getChargePermissionId();goto iukQl;YfbLR:if ($version == 'CV2') {goto E7EmI;}goto bG905;gxyKT:$newAmazonChargeId = $r->chargeId;goto nnXaK;lyVVL:$newAmazonTrading->setAuthoriAmount($addAmount);goto LUgYx;poNtl:WYDPX:goto FeB0t;LBfaz:if (!($version == 'CV2')) {goto Fmjkn;}goto aMBl7;Q0h6X:goto ibTVb;goto vsN5F;yUx1h:$newAmazonTrading->setChargeId($newAmazonChargeId);goto LO08Z;XwiFl:$this->entityManager->flush($AmazonTrading);goto yn_IS;i93YS:$AmazonTrading->setCaptureAmount($captureAmount - $refundAmount);goto x21Ug;xb6dR:$addAmount = $payment_total - $sumAuthoriAmount;goto xOiLF;qsZL5:if (!($payment_total > $sumAuthoriAmount && $amazon_status == 'オーソリ' || $totalBillingAmount > 0 && $amazon_status == '売上')) {goto Ot64X;}goto dwWO_;hPN22:if ($captureAmount > 0 || $totalBillingAmount == 0) {goto zoFkG;}goto rkrBx;IlhMZ:dOM4z:goto eOZw1;tEPZd:$Order->addAmazonPayV2AmazonTrading($newAmazonTrading);goto ATGqo;ATGqo:brioy:goto tgh9K;H3z0Y:F4Jsw:goto y3m8d;Q35S2:logs('amazon_pay_v2')->error('aws request error from admin_order r=' . var_export($r, true));goto CcoyC;pu5zL:caTYY:goto xb6dR;W8cU5:iK6Lc:goto poNtl;Tczs4:goto F4Jsw;goto SkAAe;rkrBx:$billingAmount = $authoriAmount > $totalBillingAmount ? $totalBillingAmount : $authoriAmount;goto VljP7;lTt9q:$r = $this->amazonRequestService->createRefund($amazonChargeId, $refundAmount);goto LBfaz;LUgYx:$newAmazonTrading->setCaptureamount($addAmount);goto eWVeq;cM5zT:bvixi:goto wnp7e;WsayL:ywH5f:goto Tczs4;ruMw9:logs('amazon_pay_v2')->error('aws request error from admin_order r = ' . var_export($r, true));goto X3in7;XvBFn:$refundCount = $refundCount + 1;goto Qr3k7;U1uQv:$cancel_flg = true;goto H3z0Y;zztqp:$authoriAmount = $AmazonTrading->getAuthoriAmount();goto ighlS;Ib5xN:$Order->addAmazonTrading($newAmazonTrading);goto rjnuw;nu2p2:if (!isset($r->reasonCode)) {goto kbNpm;}goto Q35S2;YpWyU:$cancelPendingCharges = $amazon_status == 'オーソリ';goto atkdD;OtCrB:$r = false;goto oiHI7;c9n9L:$this->entityManager->flush($AmazonTrading);goto D6y7J;lwHvq:goto CNPBw;goto pu5zL;ighlS:$captureAmount = $AmazonTrading->getCaptureAmount();goto xL784;xOiaN:WhWjw:goto i93YS;mW3FW:logs('amazon_pay_v2')->error('aws request error from admin_order r=' . var_export($r, true));goto AdQZB;Nu9UX:if ($request == 'capture') {goto CB_Iy;}goto iQjtU;Bm0Xo:vEOBc:goto zztqp;D6y7J:$totalRefundAmount = $totalRefundAmount - $refundAmount;goto Npz6z;SZ3ZS:if (!isset($r->reasonCode)) {goto TX0vl;}goto A38A2;atkdD:$r = $this->amazonRequestService->closeChargePermission($amazonChargePermissionId, null, $cancelPendingCharges);goto U1uQv;biCZi:$newAmazonTrading->setOrder($Order);goto EdSOo;eWVeq:$newAmazonTrading->setRefundCount(0);goto Ib5xN;bG905:goto vEOBc;goto DnP8R;RnA_B:goto qODJG;goto Q65mh;A38A2:logs('amazon_pay_v2')->error('aws request error from admin_order r=' . var_export($r, true));goto RnA_B;wnp7e:$newAmazonTrading = new \Plugin\AmazonPay\Entity\AmazonTrading();goto I2PAi;s00NO:E7EmI:goto KqDkS;SkAAe:fkzuf:goto YpWyU;aMBl7:$AmazonTrading->setRefundId($r->refundId);goto L1i6K;AeC5X:K_kSA:goto VCo1j;Npz6z:goto ywH5f;goto IlhMZ;WTBY7:$amazonChargeId = substr_replace($AmazonTrading->getTradingCode(), "C", 20, 1);goto aaJqX;I2PAi:$newAmazonTrading->setOrder($Order);goto UAWIG;Io5gv:if ($version == 'CV1') {goto i5YJh;}goto YfbLR;XtdtJ:if (!isset($r->reasonCode)) {goto WhWjw;}goto ruMw9;dB0qH:if ($version == 'CV1') {goto bvixi;}goto WZWc0;Q65mh:TX0vl:goto m_8ok;oanus:if ($totalRefundAmount == 0) {goto dOM4z;}goto JOBck;x21Ug:$AmazonTrading->setRefundCount($refundCount);goto c9n9L;mTkMZ:ktVH6:goto LzcOU;z8RMU:$this->entityManager->flush($newAmazonTrading);goto AeC5X;xOiLF:CNPBw:goto jY0Ak;TRi12:$newAmazonTrading->setRefundCount(0);goto tEPZd;iQjtU:if ($sumCaptureAmount == 0) {goto fkzuf;}goto oanus;vsN5F:zoFkG:goto OtCrB;xaZEV:$newAmazonTrading->setCaptureamount($addAmount);goto TRi12;jY0Ak:$r = $this->amazonRequestService->createCharge($amazonChargePermissionId, $addAmount);goto H7B2m;VHYpE:EADJb:goto ULxPj;VCo1j:Ot64X:goto W8cU5;aaJqX:$amazonChargePermissionId = $Order->getReferenceCode();goto a6jET;FeB0t:}goto NsPx7;o_8UW:$version = 'CV1';goto bFsrq;SKT8u:goto XXxOl;goto YevDr;l4IL5:goto GW7nh;goto YSi4P;bck1W:$this->pointProcessor->rollback($Order, new PurchaseContext());goto EoHnP;ASfiw:oc1Py:goto Cjrhs;iuIre:$sumCaptureAmount = 0;goto CG50s;sbaqU:goto Zb7vS;goto Pigpn;CcSkE:$Customer = $Order->getCustomer();goto CxVIC;rtYQ9:GW7nh:goto ddaJe;y_hsa:goto oc1Py;goto jXLC1;cEw90:cfq_d:goto A5bkJ;LQnan:$AmazonTradings = $Order->getAmazonTradings();goto i3h1s;x41fA:$version = '';goto FWhjs;Wj3fg:$this->pointProcessor->rollback($Order, new PurchaseContext());goto LlAua;EkIAa:bYxfw:goto ywwni;P_jDW:$Order->setPaymentDate(new \DateTime());goto DcwSL;IgXIw:goto oc1Py;goto ImFQ4;h_DTS:Z6WDp:goto mpr4A;NsPx7:qODJG:goto Eug03;bFsrq:goto GW7nh;goto RhRwn;RhRwn:ODRI0:goto ZN3nz;f0Hbf:$allRefund_flg = true;goto Fnn2H;NuAYp:$Order->setBillableAmount($billableAmount);goto O4oqi;ImFQ4:MGhHL:goto VWy8g;eKTnC:ED_ZR:goto CcSkE;bfdNT:$allRefund_flg = false;goto fCxdU;h9WvB:$payment_total = (int) $Order->getPaymentTotal();goto re0LC;nYXPf:}public function checkShippingPref($shippingAddress){goto dmHbP;aa1rc:$Pref = $this->prefRepository->findOneBy(['name' => $shippingAddress->stateOrRegion]);goto sH1IM;XXi81:return true;goto vEksm;sH1IM:if (!empty($Pref)) {goto dK7qk;}goto Z4dbz;KZo6w:return false;goto BOMCS;BOMCS:dK7qk:goto XXi81;dxqsm:hWEQx:goto hMT1n;dmHbP:switch ($shippingAddress->stateOrRegion) {case "東京":$shippingAddress->stateOrRegion = "東京都";goto RtRAB;case "大阪":$shippingAddress->stateOrRegion = "大阪府";goto RtRAB;case "京都":$shippingAddress->stateOrRegion = "京都府";goto RtRAB;case "東京都":goto RtRAB;case "大阪府":goto RtRAB;case "京都府":goto RtRAB;case "北海道":goto RtRAB;default:goto PPpLI;PPpLI:if (preg_match('/県$/u', $shippingAddress->stateOrRegion)) {goto CyvaU;}goto r83iU;lIILE:CyvaU:goto XMVlR;r83iU:$shippingAddress->stateOrRegion .= '県';goto lIILE;XMVlR:}goto dxqsm;Z4dbz:logs('amazon_pay_v2')->info('*** 都道府県マッチングエラー *** addr = ' . var_export($shippingAddress, true));goto KZo6w;hMT1n:RtRAB:goto aa1rc;vEksm:}public function createPassword($length = 8){goto R3dlI;fZStx:$key = array_rand($pwd_strings);goto S4ZEr;Yfi2E:return implode($pwd);goto rniOz;TCsuK:OKQmt:goto e73X8;UruS0:rbrJ_:goto CLNRr;e73X8:if (!(count($pwd) < $length)) {goto rbrJ_;}goto fZStx;R3dlI:$pwd = [];goto NPU7u;S4ZEr:$pwd[] = $pwd_strings[$key][array_rand($pwd_strings[$key])];goto B6LL1;B6LL1:goto OKQmt;goto UruS0;NPU7u:$pwd_strings = ["sletter" => range('a', 'z'), "cletter" => range('A', 'Z'), "number" => range('0', '9')];goto TCsuK;CLNRr:shuffle($pwd);goto Yfi2E;rniOz:}}

デコード(難読化解除)されたコード

<?php

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

use Doctrine\ORM\EntityManagerInterface;
use Plugin\AmazonPayV2_42\Entity\Master\AmazonStatus;
use Plugin\AmazonPayV2_42\Entity\AmazonTrading;
use Plugin\AmazonPayV2_42\Exception\AmazonException;
use Plugin\AmazonPayV2_42\Exception\AmazonPaymentException;
use Plugin\AmazonPayV2_42\Exception\AmazonSystemException;
use Plugin\AmazonPayV2_42\Repository\Master\AmazonStatusRepository;
use Plugin\AmazonPayV2_42\Repository\ConfigRepository;
use Plugin\AmazonPayV2_42\Service\Method\AmazonPay;
use Plugin\AmazonPayV2_42\Service\AmazonRequestService;
use Eccube\Common\Constant;
use Eccube\Common\EccubeConfig;
use Eccube\Entity\Customer;
use Eccube\Entity\Order;
use Eccube\Entity\Shipping;
use Eccube\Entity\Master\CustomerStatus;
use Eccube\Entity\Master\OrderStatus;
use Eccube\Repository\CustomerRepository;
use Eccube\Repository\BaseInfoRepository;
use Eccube\Repository\PaymentRepository;
use Eccube\Repository\PluginRepository;
use Eccube\Repository\Master\CustomerStatusRepository;
use Eccube\Repository\Master\OrderStatusRepository;
use Eccube\Repository\Master\PrefRepository;
use Eccube\Service\PurchaseFlow\PurchaseContext;
use Eccube\Service\PurchaseFlow\Processor\StockReduceProcessor;
use Eccube\Service\PurchaseFlow\Processor\PointProcessor;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class AmazonOrderHelper
{
    private $sessionAmazonProfileKey = 'amazon_pay_v2.profile';
    private $sessionAmazonShippingAddressKey = 'amazon_pay_v2.shipping_address';
    private $amazonSettings;
    private $pointProcessor;
    private $stockReduceProcessor;
    public function __construct(CustomerRepository $customerRepository, BaseInfoRepository $baseInfoRepository, PaymentRepository $paymentRepository, PluginRepository $pluginRepository, CustomerStatusRepository $customerStatusRepository, OrderStatusRepository $orderStatusRepository, EntityManagerInterface $entityManager, EccubeConfig $eccubeConfig, PrefRepository $prefRepository, SessionInterface $session, EncoderFactoryInterface $encoderFactory, TokenStorageInterface $tokenStorage, AmazonStatusRepository $amazonStatusRepository, ConfigRepository $configRepository, AmazonRequestService $amazonRequestService, StockReduceProcessor $stockReduceProcessor, PointProcessor $pointProcessor, ContainerInterface $container)
    {
        $this->customerRepository = $customerRepository;
        $this->BaseInfo = $baseInfoRepository->get();
        $this->paymentRepository = $paymentRepository;
        $this->pluginRepository = $pluginRepository;
        $this->customerStatusRepository = $customerStatusRepository;
        $this->orderStatusRepository = $orderStatusRepository;
        $this->entityManager = $entityManager;
        $this->eccubeConfig = $eccubeConfig;
        $this->prefRepository = $prefRepository;
        $this->session = $session;
        $this->encoderFactory = $encoderFactory;
        $this->tokenStorage = $tokenStorage;
        $this->amazonStatusRepository = $amazonStatusRepository;
        $this->configRepository = $configRepository;
        $this->amazonRequestService = $amazonRequestService;
        $this->Config = $this->configRepository->get();
        $this->stockReduceProcessor = $stockReduceProcessor;
        $this->pointProcessor = $pointProcessor;
        $this->container = $container;
    }
    public function getOrderer($shippingAddress)
    {
        $Customer = new Customer();
        $Customer->setName01(' ');
        $Customer->setName02(' ');
        $Customer->setKana01(' ');
        $Customer->setKana02(' ');
        $Pref = $this->prefRepository->find(13);
        $Customer->setPref($Pref);
        $profile = unserialize($this->session->get($this->sessionAmazonProfileKey));
        $Customer->setEmail($profile->email);
        $this->convert($Customer, $shippingAddress);
        return $Customer;
    }
    public function initializeAmazonOrder($Order, $Customer)
    {
        $Payment = $this->paymentRepository->findOneBy(['method_class' => AmazonPay::class]);
        $Order->setPayment($Payment);
        $Order->setEmail($Customer->getEmail());
        $this->entityManager->persist($Order);
        return $Order;
    }
    public function convert($entity, $shippingAddress)
    {
        if (strpos($shippingAddress->postalCode, '-') !== false) {
            $arrPostalCode = explode('-', $shippingAddress->postalCode);
            goto aBYA6;
        }
        preg_match('/(\\d{3})(\\d{4})/', $shippingAddress->postalCode, $arrPostalCode);
        unset($arrPostalCode[0]);
        $arrPostalCode = array_values($arrPostalCode);
        aBYA6:
        $PostalCodeCount = preg_replace('/(-|−)/', '', $shippingAddress->postalCode);
        if (!(mb_strlen($PostalCodeCount) >= 9)) {
            goto SLY2c;
        }
        $arrAmznAddr = ['PostalCode' => ' ', 'CountryCode' => '', 'StateOrRegion' => '', 'Name' => '', 'AddressLine1' => '', 'AddressLine2' => '', 'AddressLine3' => '', 'City' => '', 'Phone' => ''];
        SLY2c:
        $entity->setPostalCode(preg_replace('/(-|−)/', '', $shippingAddress->postalCode));
        $arrName = $this->divideName($shippingAddress->name);
        $entity->setName01($arrName['name01'])->setName02($arrName['name02']);
        if (isset($arrName['kana01'])) {
            $entity->setKana01($arrName['kana01']);
            $entity->setKana02(' ');
            goto Etw3i;
        }
        if ($entity instanceof Shipping) {
            $entity->setKana01(' ')->setKana02(' ');
            goto jZsYM;
        }
        jZsYM:
        Etw3i:
        if (!($this->Config->getOrderCorrect() == $this->eccubeConfig['amazon_pay_v2']['toggle']['on'])) {
            goto GuLW2;
        }
        if ($entity instanceof Order) {
            $email = $entity->getEmail();
            goto PfiCZ;
        }
        if ($entity instanceof Shipping) {
            $Order = $entity->getOrder();
            $email = $Order->getEmail();
            goto PfiCZ;
        }
        if ($entity instanceof Customer) {
            $email = $entity->getEmail();
            goto UzpV0;
        }
        UzpV0:
        PfiCZ:
        $arrFixKana = $this->reviseKana($entity->getName01(), $entity->getName02(), $email);
        if (!empty($arrFixKana)) {
            $entity->setKana01($arrFixKana['kana01'])->setKana02($arrFixKana['kana02']);
            goto Zp2EV;
        }
        if ($entity->getKana01() == null) {
            $entity->setKana01(' ')->setKana02(' ');
            goto vjCRn;
        }
        vjCRn:
        Zp2EV:
        GuLW2:
        switch ($shippingAddress->stateOrRegion) {
            case "東京":
                $shippingAddress->stateOrRegion = "東京都";
                goto MIK9E;
            case "大阪":
                $shippingAddress->stateOrRegion = "大阪府";
                goto MIK9E;
            case "京都":
                $shippingAddress->stateOrRegion = "京都府";
                goto MIK9E;
            case "東京都":
                goto MIK9E;
            case "大阪府":
                goto MIK9E;
            case "京都府":
                goto MIK9E;
            case "北海道":
                goto MIK9E;
            default:
                if (preg_match('/県$/u', $shippingAddress->stateOrRegion)) {
                    goto ORd23;
                }
                $shippingAddress->stateOrRegion .= '県';
                ORd23:
        }
        MIK9E:
        $convertAmznAddr1 = mb_convert_kana($shippingAddress->addressLine1, 'n', 'utf-8');
        $convertAmznAddr2 = mb_convert_kana($shippingAddress->addressLine2, 'n', 'utf-8');
        if (preg_match("/[0-9]/", $convertAmznAddr1, $matches, PREG_OFFSET_CAPTURE)) {
            $offset = strlen(substr($convertAmznAddr1, 0, $matches[0][1]));
            $AddressLine1Front = mb_substr($convertAmznAddr1, 0, $offset);
            $AddressLine1End = mb_substr($convertAmznAddr1, $offset);
            $addr01 = $shippingAddress->city . $AddressLine1Front;
            $addr02 = $AddressLine1End . $convertAmznAddr2;
            goto UroxA;
        }
        $addr01 = $shippingAddress->city . $convertAmznAddr1;
        $addr02 = $convertAmznAddr2;
        UroxA:
        if (!($shippingAddress->addressLine3 != '')) {
            goto oujC3;
        }
        $addr02 .= " " . $shippingAddress->addressLine3;
        oujC3:
        $Pref = $this->prefRepository->findOneBy(['name' => $shippingAddress->stateOrRegion]);
        if (!empty($Pref)) {
            $entity->setPref($Pref);
            goto whRj6;
        }
        logs('amazon_pay_v2')->info('*** 都道府県マッチングエラー *** addr = ' . var_export($shippingAddress, true));
        $Pref = $this->prefRepository->find(13);
        $entity->setPref($Pref);
        $addr01 = $shippingAddress->stateOrRegion . $addr01;
        whRj6:
        $entity->setAddr01($addr01)->setAddr02($addr02);
        $entity->setPhoneNumber(preg_replace('/(-|−)/', '', $shippingAddress->phoneNumber));
    }
    public function divideName($name)
    {
        $arrResult = [];
        $arrName = preg_split('/[  ]+/u', $name);
        if (count($arrName) == 2) {
            $arrResult['name01'] = $arrName[0];
            $arrResult['name02'] = $arrName[1];
            goto M7tzV;
        }
        $arrResult = $this->reviseLastNameList($name);
        if (!empty($arrResult)) {
            goto xzzVN;
        }
        if (!($this->Config->getOrderCorrect() == $this->eccubeConfig['amazon_pay_v2']['toggle']['on'])) {
            goto LJFeT;
        }
        $arrFixName = $this->reviseName($name);
        LJFeT:
        if (!empty($arrFixName)) {
            $arrResult = $arrFixName;
            logs('amazon_pay_v2')->info('*** 名前補正 ***');
            goto GlkZj;
        }
        $arrResult['name01'] = $name;
        $arrResult['name02'] = ' ';
        GlkZj:
        xzzVN:
        M7tzV:
        return $arrResult;
    }
    private function searchObject($search, $target, $objectName)
    {
        $qb = $this->entityManager->createQueryBuilder();
        $qb->select('o')->from('\\Eccube\\Entity' . "\\{$objectName}", 'o');
        if (!($target == 'name')) {
            goto X1gBj;
        }
        $qb->andWhere('CONCAT(o.name01, o.name02) = :name')->setParameter('name', $search)->andWhere("TRIM(o.name02) <> ''");
        X1gBj:
        return $qb->getQuery()->getResult();
    }
    private function searchObjectByNameAndEmail($name01, $name02, $email, $target, $objectName)
    {
        $qb = $this->entityManager->createQueryBuilder();
        if (!($target == 'kana')) {
            goto ZhPtq;
        }
        if ($objectName == 'Order') {
            $qb->select('o')->from(Order::class, 'o')->andWhere('o.name01 = :name01')->setParameter('name01', $name01)->andWhere('o.name02 = :name02')->setParameter('name02', $name02)->andWhere('o.email = :email')->setParameter('email', $email)->andWhere("o.kana01 <> ''")->andWhere("o.kana02 <> ''")->andWhere("o.OrderStatus <> :status_pending")->setParameter('status_pending', OrderStatus::PENDING)->andWhere("o.OrderStatus <> :status_processing")->setParameter('status_processing', OrderStatus::PROCESSING)->andWhere("o.AmazonPayV2AmazonStatus IS NOT NULL")->orderBy('o.update_date', 'DESC');
            goto lALFD;
        }
        if ($objectName == 'Shipping') {
            $qb->select('s')->from(Shipping::class, 's')->leftJoin('s.Order', 'o')->andWhere('s.name01 = :name01')->setParameter('name01', $name01)->andWhere('s.name02 = :name02')->setParameter('name02', $name02)->andWhere('o.email = :email')->setParameter('email', $email)->andWhere("s.kana01 <> ''")->andWhere("s.kana02 <> ''")->andWhere("o.OrderStatus <> :status_pending")->setParameter('status_pending', OrderStatus::PENDING)->andWhere("o.OrderStatus <> :status_processing")->setParameter('status_processing', OrderStatus::PROCESSING)->andWhere("o.AmazonPayV2AmazonStatus IS NOT NULL")->orderBy('o.update_date', 'DESC');
            goto lALFD;
        }
        if ($objectName == 'Customer') {
            $qb->select('c')->from(Customer::class, 'c')->andWhere('c.name01 = :name01')->setParameter('name01', $name01)->andWhere('c.name02 = :name02')->setParameter('name02', $name02)->andWhere('c.email = :email')->setParameter('email', $email)->andWhere("c.kana01 <> ''")->andWhere("c.kana02 <> ''")->andWhere("c.v2_amazon_user_id <> ''")->orderBy('c.update_date', 'DESC');
            goto zQEqQ;
        }
        zQEqQ:
        lALFD:
        ZhPtq:
        return $qb->getQuery()->getResult();
    }
    public function reviseName($name)
    {
        $arrFixName = [];
        $Objects = $this->searchObject($name, 'name', 'Order');
        if (!empty($Objects)) {
            goto vNOXX;
        }
        $Objects = $this->searchObject($name, 'name', 'Shipping');
        if (!empty($Objects)) {
            goto y_bbi;
        }
        $Objects = $this->searchObject($name, 'name', 'Customer');
        y_bbi:
        vNOXX:
        if (empty($Objects)) {
            goto QPso_;
        }
        $arrFixName['name01'] = $Objects[0]->getName01();
        $arrFixName['name02'] = $Objects[0]->getName02();
        QPso_:
        return $arrFixName;
    }
    public function reviseKana($name01, $name02, $email)
    {
        $arrFixKana = [];
        $Objects = $this->searchObjectByNameAndEmail($name01, $name02, $email, 'kana', 'Order');
        if (!empty($Objects)) {
            goto F6NTK;
        }
        $Objects = $this->searchObjectByNameAndEmail($name01, $name02, $email, 'kana', 'Shipping');
        if (!empty($Objects)) {
            goto H9B3x;
        }
        $Objects = $this->searchObjectByNameAndEmail($name01, $name02, $email, 'kana', 'Customer');
        H9B3x:
        F6NTK:
        if (empty($Objects)) {
            goto j_BcX;
        }
        $arrFixKana['kana01'] = $Objects[0]->getKana01();
        $arrFixKana['kana02'] = $Objects[0]->getKana02();
        j_BcX:
        return $arrFixKana;
    }
    public function reviseLastNameList($name)
    {
        $arrName = [];
        $fp = fopen($this->eccubeConfig['plugin_data_realdir'] . '/AmazonPayV2_42/lastNameList.csv', 'r');
        if (!($fp === false)) {
            $arrName = null;
            $last_max_len = 0;
            $row = fgetcsv($fp);
            e_pt4:
            if (!(($row = fgetcsv($fp)) !== FALSE)) {
                fclose($fp);
                return $arrName;
            }
            if (!(mb_strpos($name, $row[0], null, 'utf-8') === 0)) {
                goto AZ6kn;
            }
            $cr_len = mb_strlen($row[0], 'utf-8');
            if (!($last_max_len > $cr_len)) {
                $last_max_len = $cr_len;
                $arrName['name01'] = $row[0];
                $arrName['name02'] = mb_substr($name, $cr_len, null, 'utf-8');
                $arrName['kana01'] = $row[1];
                $arrName['kana02'] = ' ';
                AZ6kn:
                goto e_pt4;
            }
            goto e_pt4;
        }
        return null;
    }
    public function copyToOrderFromCustomer(Order $Order, Customer $Customer)
    {
        if (!empty($Customer)) {
            if (!$Customer->getId()) {
                goto EXgMr;
            }
            $Order->setCustomer($Customer);
            EXgMr:
            $Order->setName01($Customer->getName01())->setName02($Customer->getName02())->setKana01($Customer->getKana01())->setKana02($Customer->getKana02())->setCompanyName($Customer->getCompanyName())->setEmail($Customer->getEmail())->setPhoneNumber($Customer->getPhoneNumber())->setPostalCode($Customer->getPostalCode())->setPref($Customer->getPref())->setAddr01($Customer->getAddr01())->setAddr02($Customer->getAddr02())->setSex($Customer->getSex())->setBirth($Customer->getBirth())->setJob($Customer->getJob());
            // [PHPDeobfuscator] Implied return
            return;
        }
        return;
    }
    public function completeCheckout(Order $Order, $amazonCheckoutSessionId)
    {
        if (!($Order->getPaymentTotal() == 0)) {
            $response = $this->amazonRequestService->completeCheckoutSession($Order, $amazonCheckoutSessionId);
            return $response;
        }
        throw AmazonPaymentException::create(AmazonPaymentException::ZERO_PAYMENT);
    }
    public function setAmazonOrder(Order $Order, $chargePermissionId, $chargeId = null)
    {
        $Order->setAmazonPayV2ChargePermissionId($chargePermissionId);
        $AmazonStatus = $this->amazonStatusRepository->find($this->Config->getSale());
        $Order->setAmazonPayV2AmazonStatus($AmazonStatus);
        $payment_total = (int) $Order->getPaymentTotal();
        if ($payment_total * 9 > $this->eccubeConfig['amazon_pay_v2']['max_billable_amount']) {
            $billableAmount = floor($payment_total * 9);
            goto bDE9P;
        }
        $billableAmount = $payment_total + $this->eccubeConfig['amazon_pay_v2']['max_billable_amount'];
        bDE9P:
        if ($this->Config->getSale() == $this->eccubeConfig['amazon_pay_v2']['sale']['capture']) {
            $Order->setAmazonPayV2BillableAmount($billableAmount - $payment_total);
            $Order->setPaymentDate(new \DateTime());
            goto UxTQ6;
        }
        $Order->setAmazonPayV2BillableAmount($billableAmount);
        UxTQ6:
        $AmazonTrading = new AmazonTrading();
        $AmazonTrading->setOrder($Order);
        $AmazonTrading->setChargePermissionId($chargePermissionId);
        $AmazonTrading->setChargeId($chargeId);
        $AmazonTrading->setAuthoriAmount($payment_total);
        if ($this->Config->getSale() == $this->eccubeConfig['amazon_pay_v2']['sale']['capture']) {
            $AmazonTrading->setCaptureAmount($payment_total);
            goto FULpu;
        }
        $AmazonTrading->setCaptureAmount(0);
        FULpu:
        $AmazonTrading->setRefundCount(0);
        $Order->addAmazonPayV2AmazonTrading($AmazonTrading);
    }
    public function registCustomer(Order $Order, $mail_magazine, $profile = null)
    {
        logs('amazon_pay_v2')->info('*** 会員登録処理 start ***');
        if ($profile) {
            goto adBn7;
        }
        $profile = unserialize($this->session->get($this->sessionAmazonProfileKey));
        adBn7:
        $Customer = $this->customerRepository->newCustomer();
        $encoder = $this->encoderFactory->getEncoder($Customer);
        $salt = $encoder->createSalt();
        $password = $this->createPassword();
        $enc_password = $encoder->encodePassword($password, $salt);
        $secretKey = $this->customerRepository->getUniqueSecretKey();
        $Customer->setSalt($salt)->setPassword($enc_password)->setSecretKey($secretKey)->setPoint(0);
        $CustomerStatus = $this->customerStatusRepository->find(CustomerStatus::REGULAR);
        $Customer->setStatus($CustomerStatus);
        $Customer->setName01($Order->getName01())->setName02($Order->getName02())->setPostalCode($Order->getPostalCode())->setEmail($Order->getEmail())->setPref($Order->getPref())->setAddr01($Order->getAddr01())->setAddr02($Order->getAddr02())->setPhoneNumber($Order->getPhoneNumber())->setV2AmazonUserId($profile->buyerId);
        if (!$this->pluginRepository->findOneBy(['code' => 'MailMagazine42', 'enabled' => true])) {
            goto vvkoq;
        }
        if ($mail_magazine) {
            $Customer->setMailmagaFlg(true);
            goto Cu5o5;
        }
        $Customer->setMailmagaFlg(false);
        Cu5o5:
        vvkoq:
        if (!$this->pluginRepository->findOneBy(['code' => 'PostCarrier42', 'enabled' => true])) {
            goto oKRSi;
        }
        if ($mail_magazine) {
            $Customer->setPostcarrierFlg(true);
            goto gZs2L;
        }
        $Customer->setPostcarrierFlg(false);
        gZs2L:
        oKRSi:
        $this->entityManager->persist($Customer);
        $this->entityManager->flush();
        $token = new UsernamePasswordToken($Customer, null, 'customer', ['ROLE_USER']);
        $this->tokenStorage->setToken($token);
        logs('amazon_pay_v2')->info('*** 会員登録処理 end ***');
        return $password;
    }
    public function adminRequest($request, $Order)
    {
        $amazonErr = '';
        $version = '';
        if ($Order->getPaymentMethod() === 'AmazonPay') {
            $V1Enable_flg = $this->pluginRepository->findOneBy(array('code' => 'AmazonPay', 'enabled' => Constant::ENABLED));
            if ($V1Enable_flg) {
                $AmazonTradings = $Order->getAmazonTradings();
                $amazon_status = $Order->getAmazonStatus()->getName();
                $version = 'CV1';
                goto GW7nh;
            }
            $amazonErr = 'CV1受注のリクエストを受け付けましたが、CV1が有効化されていません。';
            return $amazonErr;
        }
        if ($Order->getPaymentMethod() === 'Amazon Pay') {
            $AmazonTradings = $Order->getAmazonPayV2AmazonTradings();
            $amazon_status = $Order->getAmazonPayV2AmazonStatus()->getName();
            $version = 'CV2';
            goto rtYQ9;
        }
        rtYQ9:
        GW7nh:
        $sumAuthoriAmount = 0;
        $sumCaptureAmount = 0;
        foreach ($AmazonTradings as $AmazonTrading) {
            $sumAuthoriAmount += $AmazonTrading->getAuthoriAmount();
            $sumCaptureAmount += $AmazonTrading->getCaptureAmount();
        }
        $payment_total = (int) $Order->getPaymentTotal();
        if ($version == 'CV1') {
            $billableAmount = $Order->getBillableAmount();
            goto oc1Py;
        }
        if ($version == 'CV2') {
            $billableAmount = $Order->getAmazonPayV2BillableAmount();
            goto ASfiw;
        }
        ASfiw:
        oc1Py:
        $totalBillingAmount = $payment_total - $sumCaptureAmount;
        if ($request == 'cancel' && $payment_total == $sumCaptureAmount) {
            $allRefund_flg = true;
            goto Fnn2H;
        }
        $allRefund_flg = false;
        Fnn2H:
        $cancel_flg = false;
        $totalRefundAmount = $allRefund_flg ? $payment_total : $sumCaptureAmount - $payment_total;
        $resultAmazonTradingInfo = [];
        foreach ($AmazonTradings as $key => $AmazonTrading) {
            if ($version == 'CV1') {
                $amazonChargeId = substr_replace($AmazonTrading->getTradingCode(), "C", 20, 1);
                $amazonChargePermissionId = $Order->getReferenceCode();
                goto vEOBc;
            }
            if ($version == 'CV2') {
                $amazonChargePermissionId = $AmazonTrading->getChargePermissionId();
                $amazonChargeId = $AmazonTrading->getChargeId();
                goto Bm0Xo;
            }
            Bm0Xo:
            vEOBc:
            $authoriAmount = $AmazonTrading->getAuthoriAmount();
            $captureAmount = $AmazonTrading->getCaptureAmount();
            $refundCount = $AmazonTrading->getRefundCount();
            if ($request == 'capture') {
                if ($captureAmount > 0 || $totalBillingAmount == 0) {
                    $r = false;
                    goto oiHI7;
                }
                $billingAmount = $authoriAmount > $totalBillingAmount ? $totalBillingAmount : $authoriAmount;
                $r = $this->amazonRequestService->captureCharge($amazonChargeId, $Order, $billingAmount);
                if (!isset($r->reasonCode)) {
                    $AmazonTrading->setCaptureAmount($billingAmount);
                    $this->entityManager->flush($AmazonTrading);
                    if (!($version == 'CV1')) {
                        goto MW9Rf;
                    }
                    $totalBillingAmount -= $billingAmount;
                    $billableAmount -= $billingAmount;
                    MW9Rf:
                    oiHI7:
                    if (!($payment_total > $sumAuthoriAmount && $amazon_status == 'オーソリ' || $totalBillingAmount > 0 && $amazon_status == '売上')) {
                        goto Ot64X;
                    }
                    if ($amazon_status == 'オーソリ') {
                        $addAmount = $payment_total - $sumAuthoriAmount;
                        goto xOiLF;
                    }
                    $addAmount = $totalBillingAmount;
                    xOiLF:
                    $r = $this->amazonRequestService->createCharge($amazonChargePermissionId, $addAmount);
                    if (!(isset($r->reasonCode) && $r === 'status_failed')) {
                        if (!isset($r->chargeId)) {
                            goto K_kSA;
                        }
                        $newAmazonChargeId = $r->chargeId;
                        $r = $this->amazonRequestService->captureCharge($newAmazonChargeId, $Order, $addAmount);
                        if (!isset($r->reasonCode)) {
                            $totalBillingAmount -= $addAmount;
                            if ($version == 'CV1') {
                                $newAmazonTrading = new \Plugin\AmazonPay\Entity\AmazonTrading();
                                $newAmazonTrading->setOrder($Order);
                                $newAmazonTrading->setTradingCode($newAmazonChargeId);
                                $newAmazonTrading->setAuthoriAmount($addAmount);
                                $newAmazonTrading->setCaptureamount($addAmount);
                                $newAmazonTrading->setRefundCount(0);
                                $Order->addAmazonTrading($newAmazonTrading);
                                $billableAmount -= $addAmount;
                                goto brioy;
                            }
                            if ($version == 'CV2') {
                                $newAmazonTrading = new AmazonTrading();
                                $newAmazonTrading->setOrder($Order);
                                $newAmazonTrading->setChargePermissionId($r->chargePermissionId);
                                $newAmazonTrading->setChargeId($newAmazonChargeId);
                                $newAmazonTrading->setAuthoriAmount($addAmount);
                                $newAmazonTrading->setCaptureamount($addAmount);
                                $newAmazonTrading->setRefundCount(0);
                                $Order->addAmazonPayV2AmazonTrading($newAmazonTrading);
                                goto ATGqo;
                            }
                            ATGqo:
                            brioy:
                            $this->entityManager->persist($newAmazonTrading);
                            $this->entityManager->flush($newAmazonTrading);
                            K_kSA:
                            Ot64X:
                            goto W8cU5;
                        }
                        logs('amazon_pay_v2')->error('aws request error from admin_order r=' . var_export($r, true));
                        goto qODJG;
                    }
                    logs('amazon_pay_v2')->error('aws request error from admin_order r=' . var_export($r, true));
                    goto qODJG;
                }
                logs('amazon_pay_v2')->error('aws request error from admin_order r=' . var_export($r, true));
                goto qODJG;
            }
            if ($sumCaptureAmount == 0) {
                $cancelPendingCharges = $amazon_status == 'オーソリ';
                $r = $this->amazonRequestService->closeChargePermission($amazonChargePermissionId, null, $cancelPendingCharges);
                $cancel_flg = true;
                goto H3z0Y;
            }
            if ($totalRefundAmount == 0) {
                goto WYDPX;
            }
            $refundAmount = $captureAmount > $totalRefundAmount ? $totalRefundAmount : $captureAmount;
            $refundCount += 1;
            if (!($refundAmount > 0)) {
                goto GxewR;
            }
            $r = $this->amazonRequestService->createRefund($amazonChargeId, $refundAmount);
            if (!($version == 'CV2')) {
                goto Fmjkn;
            }
            $AmazonTrading->setRefundId($r->refundId);
            Fmjkn:
            GxewR:
            if (!isset($r->reasonCode)) {
                $AmazonTrading->setCaptureAmount($captureAmount - $refundAmount);
                $AmazonTrading->setRefundCount($refundCount);
                $this->entityManager->flush($AmazonTrading);
                $totalRefundAmount -= $refundAmount;
                H3z0Y:
                W8cU5:
                WYDPX:
            }
            logs('amazon_pay_v2')->error('aws request error from admin_order r = ' . var_export($r, true));
            goto qODJG;
        }
        qODJG:
        if (isset($r->reasonCode)) {
            $amazonErr = "下記のエラーが発生しました。\nリクエストを受け付けないため処理を終了しました。\n";
            goto VOpDG;
        }
        if (is_object($r)) {
            if (!($version == 'CV1')) {
                goto AU1K7;
            }
            $amazonStatusRepositoryV1 = $this->container->get(\Plugin\AmazonPay\Repository\Master\AmazonStatusRepository::class);
            AU1K7:
            if ($cancel_flg || $allRefund_flg) {
                $OrderStatus = $this->orderStatusRepository->find($this->orderStatusRepository->find(OrderStatus::CANCEL));
                if ($Order->getOrderStatus()->getId() == OrderStatus::DELIVERED) {
                    $Customer = $Order->getCustomer();
                    if (!$Customer) {
                        goto NWmdj;
                    }
                    $Customer->setPoint(intval($Customer->getPoint()) - intval($Order->getAddPoint()));
                    $this->pointProcessor->rollback($Order, new PurchaseContext());
                    NWmdj:
                    goto oy_pr;
                }
                if (!($Order->getOrderStatus()->getId() != $OrderStatus->getId())) {
                    goto Itqa1;
                }
                $this->stockReduceProcessor->rollback($Order, new PurchaseContext());
                $Customer = $Order->getCustomer();
                if (!$Customer) {
                    goto j_CjK;
                }
                $this->pointProcessor->rollback($Order, new PurchaseContext());
                j_CjK:
                Itqa1:
                oy_pr:
                $Order->setOrderStatus($OrderStatus);
                if ($version == 'CV1') {
                    $AmazonStatus = $amazonStatusRepositoryV1->find(AmazonStatus::CANCEL);
                    goto XXxOl;
                }
                if ($version == 'CV2') {
                    $AmazonStatus = $this->amazonStatusRepository->find(AmazonStatus::CANCEL);
                    goto Lfvpa;
                }
                Lfvpa:
                XXxOl:
                goto EkIAa;
            }
            $Order->setPaymentDate(new \DateTime());
            if ($version == 'CV1') {
                $Order->setBillableAmount($billableAmount);
                $AmazonStatus = $amazonStatusRepositoryV1->find(AmazonStatus::CAPTURE);
                goto Zb7vS;
            }
            if ($version == 'CV2') {
                $Order->setAmazonPayV2BillableAmount($billableAmount);
                $AmazonStatus = $this->amazonStatusRepository->find(AmazonStatus::CAPTURE);
                goto bNC0i;
            }
            bNC0i:
            Zb7vS:
            EkIAa:
            if ($version == 'CV1') {
                $Order->setAmazonStatus($AmazonStatus);
                goto I94_d;
            }
            if ($version == 'CV2') {
                $Order->setAmazonPayV2AmazonStatus($AmazonStatus);
                goto hdOP9;
            }
            hdOP9:
            I94_d:
            $this->entityManager->flush();
            goto cEw90;
        }
        if ($r === false) {
            goto D93Ry;
        }
        $amazonErr = "下記のエラーが発生しました。\n" . var_export($r, true) . "\n";
        D93Ry:
        cEw90:
        VOpDG:
        return $amazonErr;
    }
    public function checkShippingPref($shippingAddress)
    {
        switch ($shippingAddress->stateOrRegion) {
            case "東京":
                $shippingAddress->stateOrRegion = "東京都";
                goto RtRAB;
            case "大阪":
                $shippingAddress->stateOrRegion = "大阪府";
                goto RtRAB;
            case "京都":
                $shippingAddress->stateOrRegion = "京都府";
                goto RtRAB;
            case "東京都":
                goto RtRAB;
            case "大阪府":
                goto RtRAB;
            case "京都府":
                goto RtRAB;
            case "北海道":
                goto RtRAB;
            default:
                if (preg_match('/県$/u', $shippingAddress->stateOrRegion)) {
                    goto CyvaU;
                }
                $shippingAddress->stateOrRegion .= '県';
                CyvaU:
        }
        RtRAB:
        $Pref = $this->prefRepository->findOneBy(['name' => $shippingAddress->stateOrRegion]);
        if (!empty($Pref)) {
            return true;
        }
        logs('amazon_pay_v2')->info('*** 都道府県マッチングエラー *** addr = ' . var_export($shippingAddress, true));
        return false;
    }
    public function createPassword($length = 8)
    {
        $pwd = [];
        $pwd_strings = ["sletter" => range('a', 'z'), "cletter" => range('A', 'Z'), "number" => range('0', '9')];
        OKQmt:
        if (!(count($pwd) < $length)) {
            shuffle($pwd);
            return "";
        }
        $key = array_rand($pwd_strings);
        $pwd[] = $pwd_strings[$key][array_rand($pwd_strings[$key])];
        goto OKQmt;
    }
}


■【無料】ワードプレス:マルウェアスキャン&セキュリティープラグイン [マルウェア・ウィルス検出と駆除]

■WordPress のマルウェア駆除、セキュリティー対策 カスタマイズや修正、引っ越し・復旧のご依頼承ります

(C)2019 ワードプレス ドクター All rights reserved.