app/Plugin/SlnPayment42/Service/SlnAction/Credit.php line 969

Open in your IDE?
  1. <?php
  2. namespace Plugin\SlnPayment42\Service\SlnAction;
  3. use Doctrine\ORM\EntityManagerInterface;
  4. use Eccube\Repository\OrderRepository;
  5. use Eccube\Common\EccubeConfig;
  6. use Eccube\Entity\Master\CustomerStatus;
  7. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  8. use Plugin\SlnPayment42\Entity\OrderPaymentStatus;
  9. use Plugin\SlnPayment42\Repository\MemCardIdRepository;
  10. use Plugin\SlnPayment42\Repository\PluginConfigRepository;
  11. use Plugin\SlnPayment42\Repository\OrderPaymentHistoryRepository;
  12. use Plugin\SlnPayment42\Repository\OrderPaymentSendRepository;
  13. use Plugin\SlnPayment42\Service\BasicItem;
  14. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Request\Check;
  15. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Check as RespCheck;
  16. use Plugin\SlnPayment42\Service\SlnContent\Credit\Master;
  17. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Request\Auth;
  18. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Auth as RespAuth;
  19. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Request\Gathering;
  20. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Gathering as RespGathering;
  21. use Plugin\SlnPayment42\Entity\OrderPaymentHistory;
  22. use Plugin\SlnPayment42\Service\SlnContent\Credit\Process;
  23. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Request\Capture;
  24. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Capture as RespCapture;
  25. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Request\Delete;
  26. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Delete as RespDelete;
  27. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Request\Change;
  28. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Change as RespChange;
  29. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Request\Search;
  30. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Search as RespSearch;
  31. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Request\ReAuth;
  32. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\ReAuth as RespReAuth;
  33. use Plugin\SlnPayment42\Exception\SlnShoppingException;
  34. use Plugin\SlnPayment42\Service\Util;
  35. use Plugin\SlnPayment42\Service\CryptAES;
  36. use Plugin\SlnPayment42\Service\SlnContent\Credit\ThreeDMaster;
  37. use Plugin\SlnPayment42\Service\SlnAction\HttpSend;
  38. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Request\ThreeDAuth;
  39. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Request\ThreeDGathering;
  40. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\ThreeDAuth as RespThreeDAuth;
  41. use Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\ThreeDGathering as RespThreeDGathering;
  42. /**
  43.  * クレジットカード取引
  44.  */
  45. class Credit
  46. {
  47.     /**
  48.      * @var EntityManagerInterface
  49.      */
  50.     protected $entityManager;
  51.     /**
  52.      * @var EccubeConfig
  53.      */
  54.     private $eccubeConfig;
  55.     /**
  56.      * @var OrderRepository
  57.      */
  58.     private $orderRepository;
  59.     /**
  60.      * @var BasicItem
  61.      */
  62.     private $basicItem;
  63.     /**
  64.      * @var Util
  65.      */
  66.     private $util;
  67.     /**
  68.      * HttpSend
  69.      */
  70.     private $httpSend;
  71.     /**
  72.      * @var MemCardIdRepository
  73.      */
  74.     private $memCardIdRepository;
  75.     /**
  76.      * @var PluginConfigRepository
  77.      */
  78.     private $configRepository;
  79.     /**
  80.      * @var OrderPaymentHistoryRepository
  81.      */
  82.     private $orderPaymentHistoryRepository;
  83.     /**
  84.      * @var OrderPaymentSendRepository
  85.      */
  86.     private $orderPaymentSendRepository;
  87.     public function __construct(
  88.         EntityManagerInterface $entityManager,
  89.         EccubeConfig $eccubeConfig,
  90.         OrderRepository $orderRepository,
  91.         BasicItem $basicItem,
  92.         Util $util,
  93.         HttpSend $httpSend,
  94.         MemCardIdRepository $memCardIdRepository,
  95.         PluginConfigRepository $configRepository,
  96.         OrderPaymentHistoryRepository $orderPaymentHistoryRepository,
  97.         OrderPaymentSendRepository $orderPaymentSendRepository
  98.     ) {
  99.         $this->entityManager $entityManager;
  100.         $this->eccubeConfig $eccubeConfig;
  101.         $this->orderRepository $orderRepository;
  102.         $this->basicItem $basicItem;
  103.         $this->util $util;
  104.         $this->httpSend $httpSend;
  105.         $this->memCardIdRepository $memCardIdRepository;
  106.         $this->configRepository $configRepository;
  107.         $this->orderPaymentHistoryRepository $orderPaymentHistoryRepository;
  108.         $this->orderPaymentSendRepository $orderPaymentSendRepository;
  109.     }
  110.     /**
  111.      * カードチェック
  112.      * @param \Eccube\Entity\Customer $customer
  113.      * @param \Plugin\SlnPayment42\Entity\ConfigSubData $config
  114.      * @param Master $master
  115.      * @throws \Exception
  116.      * @return \Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Check|mixed
  117.      */
  118.     public function Check
  119.         \Eccube\Entity\Customer $Customer
  120.         \Plugin\SlnPayment42\Entity\ConfigSubData $config
  121.         Master $master)
  122.     {
  123.         $sendUrl $config->getCreditConnectionPlace1();
  124.         
  125.         if (!strlen($sendUrl)) {
  126.             throw new \Exception("決済モジュールの通信エラーが発生しました。詳しくは管理者にご連絡してください");
  127.         }
  128.         
  129.         $Check = new Check($master);
  130.         $this->util->setActionBasic($Check$config);
  131.         $this->util->setActionNotOrderMerchantFree($Check$Customer);
  132.         
  133.         $Check['TenantId'] = $config->getTenantId();
  134.         
  135.         $httpResponse $this->httpSend->sendData($sendUrl$Checknulltrue);
  136.         if ($httpResponse) {
  137.             return $this->DeCodeCheckResponse($httpResponse);
  138.         } else {//通信エラーカードページに戻してエラー情報を表示する
  139.             throw new \Exception("決済モジュールの通信エラーが発生しました。詳しくは管理者にご連絡してください。");
  140.         }
  141.     }
  142.     
  143.     /**
  144.      * カードチェック情報返信解析
  145.      * @param unknown $response_body
  146.      * @throws \Exception
  147.      * @return \Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Check|mixed
  148.      */
  149.     public function DeCodeCheckResponse($response_body)
  150.     {
  151.         $RespCheck = new RespCheck(new Master());
  152.         $this->util->deCodeRespData($RespCheck$response_body);
  153.         
  154.         //返信内容をDBに記録する
  155.         $this->orderPaymentHistoryRepository->addSendResponseLog(null$RespCheck);
  156.         
  157.         if($RespCheck['ResponseCd'] != "OK") {
  158.             $arrErr $this->util->reErrorDecode($RespCheck['ResponseCd']);
  159.             $error strlen($arrErr[0]) ? $arrErr[1] : $RespCheck['ResponseCd'];
  160.             throw new SlnShoppingException("カードチェックが失敗しました:" $errornullnull,
  161.                         array_merge((array)$RespCheck['ResponseCd'], (array)$arrErr));
  162.         }
  163.         
  164.         return $RespCheck;
  165.     }
  166.     
  167.     /**
  168.      * カード与信処理を行う
  169.      * @param \Eccube\Entity\Order $Order
  170.      * @param \Plugin\SlnPayment42\Entity\ConfigSubData $config
  171.      * @param Master $master
  172.      * @throws \Exception
  173.      * @return \Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Auth|mixed
  174.      */
  175.     public function Auth(
  176.         \Eccube\Entity\Order $Order
  177.         \Plugin\SlnPayment42\Entity\ConfigSubData $config
  178.         Master $master)
  179.     {
  180.         $sendUrl $config->getCreditConnectionPlace1();
  181.         
  182.         if (!strlen($sendUrl)) {
  183.             throw new \Exception("決済モジュールの通信エラーが発生しました。詳しくは管理者にご連絡してください");
  184.         }
  185.         //クレジットカード決済送信情報を登録する
  186.         $this->orderPaymentSendRepository->addData($Order);
  187.         $sendId $this->orderPaymentSendRepository->getLatestData($Order"")->getId();
  188.         
  189.         $Auth = new Auth($master);
  190.         $this->util->setActionBasic($Auth$config);
  191.         $this->util->setActionMerchantFree($Auth$Order);
  192.         $Auth['TenantId'] = $config->getTenantId();
  193.         $Auth['Amount'] = floor($Order->getPaymentTotal());
  194.         $Auth['ProcNo'] = substr(str_pad($sendId70STR_PAD_LEFT), -7);
  195.         
  196.         $httpResponse $this->httpSend->sendData($sendUrl$Auth$Order->getId(), true);
  197.         if ($httpResponse) {
  198.             return $this->DeCodeAuthResponse($httpResponse$Order->getId());
  199.         } else {//通信エラーカードページに戻してエラー情報を表示する
  200.             throw new \Exception("決済モジュールの通信エラーが発生しました。詳しくは管理者にご連絡してください。");
  201.         }
  202.     }
  203.     
  204.     /**
  205.      * カード与信返信情報を解析する
  206.      * @param unknown $response_body
  207.      * @param unknown $orderId
  208.      * @throws \Exception
  209.      * @return \Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Auth|mixed
  210.      */
  211.     public function DeCodeAuthResponse($response_body$orderId)
  212.     {
  213.         $RespAuth = new RespAuth(new Master());
  214.         $this->util->deCodeRespData($RespAuth$response_body);
  215.         
  216.         //返信内容をDBに記録する
  217.         $this->orderPaymentHistoryRepository->addSendResponseLog($orderId$RespAuth);
  218.         
  219.         if($RespAuth['ResponseCd'] != "OK") {
  220.             $arrErr $this->util->reErrorDecode($RespAuth['ResponseCd']);
  221.             $error strlen($arrErr[0]) ? $arrErr[1] : $RespAuth['ResponseCd'];
  222.             throw new SlnShoppingException("カードの与信処理が失敗しました:" $errornullnull,
  223.                             array_merge((array)$RespAuth['ResponseCd'], (array)$arrErr));
  224.         }
  225.         
  226.         return $RespAuth;
  227.     }
  228.     
  229.     /**
  230.      * 与信売上計上処理を行う
  231.      * @param \Eccube\Entity\Order $Order
  232.      * @param \Plugin\SlnPayment42\Entity\ConfigSubData $config
  233.      * @param Master $master
  234.      * @throws \Exception
  235.      * @return \Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Auth|mixed
  236.      */
  237.     public function Gathering
  238.         \Eccube\Entity\Order $Order
  239.         \Plugin\SlnPayment42\Entity\ConfigSubData $config
  240.         Master $master)
  241.     {
  242.         $sendUrl $config->getCreditConnectionPlace1();
  243.     
  244.         if (!strlen($sendUrl)) {
  245.             throw new \Exception("決済モジュールの通信エラーが発生しました。詳しくは管理者にご連絡してください");
  246.         }
  247.         //クレジットカード決済送信情報を登録する
  248.         $this->orderPaymentSendRepository->addData($Order);
  249.         $sendId $this->orderPaymentSendRepository->getLatestData($Order"")->getId();
  250.     
  251.         $Gathering = new Gathering($master);
  252.         $this->util->setActionBasic($Gathering$config);
  253.         $this->util->setActionMerchantFree($Gathering$Order);
  254.         $Gathering['TenantId'] = $config->getTenantId();
  255.         $Gathering['Amount'] = floor($Order->getPaymentTotal());
  256.         $Gathering['ProcNo'] = substr(str_pad($sendId70STR_PAD_LEFT), -7);
  257.     
  258.         $httpResponse $this->httpSend->sendData($sendUrl$Gathering$Order->getId(), true);
  259.         if ($httpResponse) {
  260.             return $this->DeCodeGatheringResponse($httpResponse$Order->getId());
  261.         } else {//通信エラーカードページに戻してエラー情報を表示する
  262.             throw new \Exception("決済モジュールの通信エラーが発生しました。詳しくは管理者にご連絡してください。");
  263.         }
  264.     }
  265.     
  266.     /**
  267.      * 与信売上計上返信情報を解析する
  268.      * @param unknown $response_body
  269.      * @param unknown $orderId
  270.      * @throws \Exception
  271.      * @return \Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Auth|mixed
  272.      */
  273.     public function DeCodeGatheringResponse($response_body$orderId)
  274.     {
  275.         $RespGathering = new RespGathering(new Master());
  276.         $this->util->deCodeRespData($RespGathering$response_body);
  277.         
  278.         //返信内容をDBに記録する
  279.         $this->orderPaymentHistoryRepository->addSendResponseLog($orderId$RespGathering);
  280.         
  281.         if($RespGathering['ResponseCd'] != "OK") {
  282.             $arrErr $this->util->reErrorDecode($RespGathering['ResponseCd']);
  283.             $error strlen($arrErr[0]) ? $arrErr[1] : $RespGathering['ResponseCd'];
  284.             throw new SlnShoppingException("カード与信の売上計上が失敗しました:" $errornullnull,
  285.                             array_merge((array)$RespGathering['ResponseCd'], (array)$arrErr));
  286.         }
  287.         
  288.         return $RespGathering;
  289.     }
  290.     
  291.     /**
  292.      * 売上計上処理を行う
  293.      * @param \Eccube\Entity\Order $Order
  294.      * @param \Plugin\SlnPayment42\Entity\ConfigSubData $config
  295.      * @param OrderPaymentHistory $history
  296.      * @throws \Exception
  297.      * @return \Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Capture|mixed
  298.      */
  299.     public function Capture(
  300.         \Eccube\Entity\Order $Order
  301.         \Plugin\SlnPayment42\Entity\ConfigSubData $config
  302.         OrderPaymentHistory $history)
  303.     {
  304.         $sendUrl $config->getCreditConnectionPlace1();
  305.         
  306.         if (!strlen($sendUrl)) {
  307.             throw new \Exception("決済モジュールの通信エラーが発生しました。詳しくは管理者にご連絡してください");
  308.         }
  309.        
  310.         /* @var $kaiinHistory \Plugin\SlnPayment42\Entity\OrderPaymentHistory */
  311.         $q $this->entityManager->createQuery("SELECT h from \Plugin\SlnPayment42\Entity\OrderPaymentHistory h
  312.             WHERE h.id < :id AND h.orderId = :orderId AND (h.operateId = :operateId1 OR h.operateId = :operateId2 OR h.operateId = :operateId3) AND h.requestFlg = 1 ORDER BY h.id DESC")
  313.             ->setParameter(":orderId"$Order->getId())
  314.             ->setParameter(":operateId1"'1Auth')
  315.             ->setParameter(":operateId2"'1Gathering')
  316.             ->setParameter(":operateId3"'1ReAuth')
  317.             ->setParameter(":id"$history->getId())
  318.             ->setMaxResults(1);
  319.         $kaiinHistory $q->getResult();
  320.         $kaiinHistory $kaiinHistory[0];
  321.         $kaiinData json_decode($kaiinHistory->getBody(), 1);
  322.         
  323.         $body $history->getBody();
  324.         $data json_decode($body1);
  325.         
  326.         $Capture = new Capture(new Process());
  327.         $this->util->setActionBasic($Capture$config);
  328.         $this->util->setActionMerchantFree($Capture$Order);
  329.         $Capture['ProcessId'] = $history->getProcessId();
  330.         $Capture['ProcessPass'] = $data['ProcessPass'];
  331.         
  332.         if (array_key_exists('KaiinId'$kaiinData)) {
  333.             $Capture['KaiinId'] = $kaiinData['KaiinId'];
  334.         }
  335.         
  336.         $KaiinPass null;
  337.         
  338.         if ($Capture['KaiinId'] && $Order->getCustomer()) {
  339.             if ($Order->getCustomer()->getStatus()->getId() != CustomerStatus::WITHDRAWING) { // 退会済みの場合は後続処理を行わせない
  340.                 list($KaiinId$KaiinPass) = $this->util->getNewKaiin($this->memCardIdRepository$Order->getCustomer(), $this->eccubeConfig->get('eccube_auth_magic'));
  341.             }
  342.         }
  343.         
  344.         $Capture['KaiinPass'] = $KaiinPass;
  345.         $Capture['SalesDate'] = date("Ymd");
  346.         
  347.         $httpResponse $this->httpSend->sendData($sendUrl$Capture$Order->getId(), true);
  348.         if ($httpResponse) {
  349.             return $this->DeCodeCaptureResponse($httpResponse$Order->getId());
  350.         } else {//通信エラーカードページに戻してエラー情報を表示する
  351.             throw new \Exception("決済モジュールの通信エラーが発生しました。詳しくは管理者にご連絡してください。");
  352.         }
  353.     }
  354.     
  355.     /**
  356.      * 売上計上返信情報を解析する
  357.      * @param unknown $response_body
  358.      * @param unknown $orderId
  359.      * @throws \Exception
  360.      * @return \Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Capture|mixed
  361.      */
  362.     public function DeCodeCaptureResponse($response_body$orderId)
  363.     {
  364.         $RespCapture = new RespCapture(new Process());
  365.         $this->util->deCodeRespData($RespCapture$response_body);
  366.         
  367.         //返信内容をDBに記録する
  368.         $this->orderPaymentHistoryRepository->addSendResponseLog($orderId$RespCapture);
  369.         
  370.         if($RespCapture['ResponseCd'] != "OK") {
  371.             $arrErr $this->util->reErrorDecode($RespCapture['ResponseCd']);
  372.             $error strlen($arrErr[0]) ? $arrErr[1] : $RespCapture['ResponseCd'];
  373.             throw new SlnShoppingException("カード与信の売上計上が失敗しました:" $errornullnull,
  374.                         array_merge((array)$RespCapture['ResponseCd'], (array)$arrErr));
  375.         }
  376.         
  377.         return $RespCapture;
  378.     }
  379.     
  380.     /**
  381.      * 取消処理を行う
  382.      * @param \Eccube\Entity\Order $Order
  383.      * @param \Plugin\SlnPayment42\Entity\ConfigSubData $config
  384.      * @param OrderPaymentHistory $history
  385.      * @throws \Exception
  386.      * @return \Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Delete|mixed
  387.      */
  388.     public function Delete(
  389.         \Eccube\Entity\Order $Order
  390.         \Plugin\SlnPayment42\Entity\ConfigSubData $config
  391.         OrderPaymentHistory $history)
  392.     {
  393.         $sendUrl $config->getCreditConnectionPlace1();
  394.         
  395.         if (!strlen($sendUrl)) {
  396.             throw new \Exception("決済モジュールの通信エラーが発生しました。詳しくは管理者にご連絡してください");
  397.         }
  398.         
  399.         $body $history->getBody();
  400.         $data json_decode($body1);
  401.         
  402.         $Delete = new Delete(new Process());
  403.         $this->util->setActionBasic($Delete$config);
  404.         $this->util->setActionMerchantFree($Delete$Order);
  405.         $Delete['ProcessId'] = $history->getProcessId();
  406.         $Delete['ProcessPass'] = $data['ProcessPass'];
  407.         
  408.         /* @var $kaiinHistory \Plugin\SlnPayment42\Entity\OrderPaymentHistory */
  409.         $q $this->entityManager->createQuery("SELECT h from \Plugin\SlnPayment42\Entity\OrderPaymentHistory h
  410.             WHERE h.id < :id AND h.orderId = :orderId AND (h.operateId = :operateId1 OR h.operateId = :operateId2 OR h.operateId = :operateId3) AND h.requestFlg = 1 ORDER BY h.id DESC")
  411.             ->setParameter(":orderId"$Order->getId())
  412.             ->setParameter(":operateId1"'1Auth')
  413.             ->setParameter(":operateId2"'1Gathering')
  414.             ->setParameter(":operateId3"'1ReAuth')
  415.             ->setParameter(":id"$history->getId())
  416.             ->setMaxResults(1);
  417.         $kaiinHistory $q->getResult();
  418.         $kaiinHistory $kaiinHistory[0];
  419.       
  420.         $kaiinData json_decode($kaiinHistory->getBody(), 1);
  421.         
  422.         if (array_key_exists('KaiinId'$kaiinData)) {
  423.             $Delete['KaiinId'] = $kaiinData['KaiinId'];
  424.         }
  425.         
  426.         $KaiinPass null;
  427.         
  428.         if ($Delete['KaiinId'] && $Order->getCustomer()) {
  429.             if ($Order->getCustomer()->getStatus()->getId() != CustomerStatus::WITHDRAWING) { // 退会済みの場合は後続処理を行わせない
  430.                 list($KaiinId$KaiinPass) = $this->util->getNewKaiin($this->memCardIdRepository$Order->getCustomer(), $this->eccubeConfig->get('eccube_auth_magic'));
  431.             }
  432.         }
  433.         
  434.         $Delete['KaiinPass'] = $KaiinPass;
  435.         
  436.         $httpResponse $this->httpSend->sendData($sendUrl$Delete$Order->getId(), true);
  437.         if ($httpResponse) {
  438.             return $this->DeCodeDeleteResponse($httpResponse$Order->getId());
  439.         } else {//通信エラーカードページに戻してエラー情報を表示する
  440.             throw new \Exception("決済モジュールの通信エラーが発生しました。詳しくは管理者にご連絡してください。");
  441.         }
  442.         
  443.     }
  444.     
  445.     /**
  446.      * 取消処理返信解析
  447.      * @param unknown $response_body
  448.      * @param unknown $orderId
  449.      * @throws \Exception
  450.      * @return \Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Delete|mixed
  451.      */
  452.     public function DeCodeDeleteResponse($response_body$orderId)
  453.     {
  454.         $RespDelete = new RespDelete(new Process());
  455.         $this->util->deCodeRespData($RespDelete$response_body);
  456.         
  457.         //返信内容をDBに記録する
  458.         $this->orderPaymentHistoryRepository->addSendResponseLog($orderId$RespDelete);
  459.         
  460.         if($RespDelete['ResponseCd'] != "OK") {
  461.             $arrErr $this->util->reErrorDecode($RespDelete['ResponseCd']);
  462.             $error strlen($arrErr[0]) ? $arrErr[1] : $RespDelete['ResponseCd'];
  463.             throw new SlnShoppingException("カード決済の取消が失敗しました:" $errornullnull,
  464.                         array_merge((array)$RespDelete['ResponseCd'], (array)$arrErr));
  465.         }
  466.         
  467.         return $RespDelete;
  468.     }
  469.     
  470.     /**
  471.      * 利用額変更処理を行う
  472.      * @param \Eccube\Entity\Order $Order
  473.      * @param \Plugin\SlnPayment42\Entity\ConfigSubData $config
  474.      * @param OrderPaymentHistory $history
  475.      * @throws \Exception
  476.      * @return \Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Change|mixed
  477.      */
  478.     public function Change(
  479.         \Eccube\Entity\Order $Order
  480.         \Plugin\SlnPayment42\Entity\ConfigSubData $config
  481.         OrderPaymentHistory $history)
  482.     {
  483.         $sendUrl $config->getCreditConnectionPlace1();
  484.         
  485.         if (!strlen($sendUrl)) {
  486.             throw new \Exception("決済モジュールの通信エラーが発生しました。詳しくは管理者にご連絡してください");
  487.         }
  488.         
  489.         $body $history->getBody();
  490.         $data json_decode($body1);
  491.         
  492.         $Change = new Change(new Process());
  493.         $this->util->setActionBasic($Change$config);
  494.         $this->util->setActionMerchantFree($Change$Order);
  495.         $Change['ProcessId'] = $history->getProcessId();
  496.         $Change['ProcessPass'] = $data['ProcessPass'];
  497.         
  498.         /* @var $kaiinHistory \Plugin\SlnPayment42\Entity\OrderPaymentHistory */
  499.         $q $this->entityManager->createQuery("SELECT h from \Plugin\SlnPayment42\Entity\OrderPaymentHistory h
  500.             WHERE h.id < :id AND h.orderId = :orderId AND (h.operateId = :operateId1 OR h.operateId = :operateId2 OR h.operateId = :operateId3) AND h.requestFlg = 1 ORDER BY h.id DESC")
  501.             ->setParameter(":orderId"$Order->getId())
  502.             ->setParameter(":operateId1"'1Auth')
  503.             ->setParameter(":operateId2"'1Gathering')
  504.             ->setParameter(":operateId3"'1ReAuth')
  505.             ->setParameter(":id"$history->getId())
  506.             ->setMaxResults(1);
  507.         $kaiinHistory $q->getResult();
  508.         $kaiinHistory $kaiinHistory[0];
  509.         $kaiinData json_decode($kaiinHistory->getBody(), 1);
  510.         
  511.         if (array_key_exists('KaiinId'$kaiinData)) {
  512.             $Change['KaiinId'] = $kaiinData['KaiinId'];
  513.         }
  514.         
  515.         $KaiinPass null;
  516.         
  517.         if ($Change['KaiinId'] && $Order->getCustomer()) {
  518.             if ($Order->getCustomer()->getStatus()->getId() != CustomerStatus::WITHDRAWING) { // 退会済みの場合は後続処理を行わせない
  519.                 list($KaiinId$KaiinPass) = $this->util->getNewKaiin($this->memCardIdRepository$Order->getCustomer(), $this->eccubeConfig->get('eccube_auth_magic'));
  520.             }
  521.         }
  522.         
  523.         $Change['KaiinPass'] = $KaiinPass;
  524.         $Change['Amount'] = floor($Order->getPaymentTotal());
  525.         
  526.         $httpResponse $this->httpSend->sendData($sendUrl$Change$Order->getId(), true);
  527.         if ($httpResponse) {
  528.             return $this->DeCodeChangeResponse($httpResponse$Order->getId());
  529.         } else {//通信エラーカードページに戻してエラー情報を表示する
  530.             throw new \Exception("決済モジュールの通信エラーが発生しました。詳しくは管理者にご連絡してください。");
  531.         }
  532.         
  533.     }
  534.     
  535.     /**
  536.      * 利用額変更返信情報を解析する
  537.      * @param unknown $response_body
  538.      * @param unknown $orderId
  539.      * @throws \Exception
  540.      * @return \Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Change|mixed
  541.      */
  542.     public function DeCodeChangeResponse($response_body$orderId)
  543.     {
  544.         $RespChange = new RespChange(new Process());
  545.         $this->util->deCodeRespData($RespChange$response_body);
  546.     
  547.         //返信内容をDBに記録する
  548.         $this->orderPaymentHistoryRepository->addSendResponseLog($orderId$RespChange);
  549.     
  550.         if($RespChange['ResponseCd'] != "OK") {
  551.             $arrErr $this->util->reErrorDecode($RespChange['ResponseCd']);
  552.             $error strlen($arrErr[0]) ? $arrErr[1] : $RespChange['ResponseCd'];
  553.             throw new SlnShoppingException("カードの利用額変更に失敗しました:" $errornullnull,
  554.                         array_merge((array)$RespChange['ResponseCd'], (array)$arrErr));
  555.         }
  556.     
  557.         return $RespChange;
  558.     }
  559.     
  560.     /**
  561.      * 取引参照を行う
  562.      * @param \Eccube\Entity\Order $Order
  563.      * @param \Plugin\SlnPayment42\Entity\ConfigSubData $config
  564.      * @param OrderPaymentHistory $history
  565.      * @throws \Exception
  566.      * @return \Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Search|mixed
  567.      */
  568.     public function Search(
  569.         \Eccube\Entity\Order $Order
  570.         \Plugin\SlnPayment42\Entity\ConfigSubData $config
  571.         OrderPaymentHistory $history)
  572.     {
  573.         $sendUrl $config->getCreditConnectionPlace1();
  574.         
  575.         if (!strlen($sendUrl)) {
  576.             throw new \Exception("決済モジュールの通信エラーが発生しました。詳しくは管理者にご連絡してください");
  577.         }
  578.         
  579.         $body $history->getBody();
  580.         $data json_decode($body1);
  581.         
  582.         $Search = new Search(new Process());
  583.         $this->util->setActionBasic($Search$config);
  584.         $this->util->setActionMerchantFree($Search$Order);
  585.         $Search['ProcessId'] = $history->getProcessId();
  586.         $Search['ProcessPass'] = $data['ProcessPass'];
  587.         
  588.         /* @var $kaiinHistory \Plugin\SlnPayment42\Entity\OrderPaymentHistory */
  589.         $q $this->entityManager->createQuery("SELECT h from \Plugin\SlnPayment42\Entity\OrderPaymentHistory h
  590.             WHERE h.id < :id AND h.orderId = :orderId AND (h.operateId = :operateId1 OR h.operateId = :operateId2 OR h.operateId = :operateId3) ORDER BY h.id DESC")
  591.             ->setParameter(":orderId"$Order->getId())
  592.             ->setParameter(":operateId1"'1Auth')
  593.             ->setParameter(":operateId2"'1Gathering')
  594.             ->setParameter(":operateId3"'1ReAuth')
  595.             ->setParameter(":id"$history->getId())
  596.             ->setMaxResults(1);
  597.         $kaiinHistory $q->getResult();
  598.         $kaiinHistory $kaiinHistory[0];
  599.         $kaiinData json_decode($kaiinHistory->getBody(), 1);
  600.         
  601.         if (array_key_exists('KaiinId'$kaiinData)) {
  602.             $Search['KaiinId'] = $kaiinData['KaiinId'];
  603.         }
  604.         
  605.         $KaiinPass null;
  606.         
  607.         if ($Search['KaiinId'] && $Order->getCustomer()) {
  608.             list($KaiinId$KaiinPass) = $this->util->getNewKaiin($this->memCardIdRepository$Order->getCustomer(), $this->eccubeConfig->get('eccube_auth_magic'));
  609.         }
  610.         
  611.         $Search['KaiinPass'] = $KaiinPass;
  612.         
  613.         $httpResponse $this->httpSend->sendData($sendUrl$Search$Order->getId(), true);
  614.         if ($httpResponse) {
  615.             return $this->DeCodeSearchResponse($httpResponse$Order->getId());
  616.         } else {//通信エラーカードページに戻してエラー情報を表示する
  617.             throw new \Exception("決済モジュールの通信エラーが発生しました。詳しくは管理者にご連絡してください。");
  618.         }
  619.     }
  620.     
  621.     /**
  622.      * 取引参照返信情報を解析
  623.      * @param unknown $response_body
  624.      * @param unknown $orderId
  625.      * @throws \Exception
  626.      * @return \Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Search|mixed
  627.      */
  628.     public function DeCodeSearchResponse($response_body$orderId)
  629.     {
  630.         $RespSearch = new RespSearch(new Process());
  631.         $this->util->deCodeRespData($RespSearch$response_body);
  632.         
  633.         //返信内容をDBに記録する
  634.         $this->orderPaymentHistoryRepository->addSendResponseLog($orderId$RespSearch);
  635.         
  636.         if($RespSearch['ResponseCd'] != "OK") {
  637.             $arrErr $this->util->reErrorDecode($RespSearch['ResponseCd']);
  638.             $error strlen($arrErr[0]) ? $arrErr[1] : $RespSearch['ResponseCd'];
  639.             throw new SlnShoppingException("取引の参照が失敗しました:" $errornullnull,
  640.                         array_merge((array)$RespSearch['ResponseCd'], (array)$arrErr));
  641.         }
  642.         
  643.         return $RespSearch;
  644.     }
  645.     
  646.     /**
  647.      * 再オーソリ処理を行う
  648.      * @param \Eccube\Entity\Order $Order
  649.      * @param \Plugin\SlnPayment42\Entity\ConfigSubData $config
  650.      * @param OrderPaymentHistory $history
  651.      * @throws \Exception
  652.      * @return \Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\ReAuth|mixed
  653.      */
  654.     public function ReAuth(
  655.         \Eccube\Entity\Order $Order
  656.         \Plugin\SlnPayment42\Entity\ConfigSubData $config
  657.         OrderPaymentHistory $history)
  658.     {
  659.         $sendUrl $config->getCreditConnectionPlace1();
  660.         
  661.         if (!strlen($sendUrl)) {
  662.             throw new \Exception("決済モジュールの通信エラーが発生しました。詳しくは管理者にご連絡してください");
  663.         }
  664.         
  665.         $body $history->getBody();
  666.         $data json_decode($body1);
  667.         
  668.         $ReAuth = new ReAuth(new Process());
  669.         $this->util->setActionBasic($ReAuth$config);
  670.         $this->util->setActionMerchantFree($ReAuth$Order);
  671.         $ReAuth['ProcessId'] = $history->getProcessId();
  672.         $ReAuth['ProcessPass'] = $data['ProcessPass'];
  673.         
  674.         /* @var $kaiinHistory \Plugin\SlnPayment42\Entity\OrderPaymentHistory */
  675.         $q $this->entityManager->createQuery("SELECT h from \Plugin\SlnPayment42\Entity\OrderPaymentHistory h
  676.             WHERE h.id < :id AND h.orderId = :orderId AND (h.operateId = :operateId1 OR h.operateId = :operateId2 OR h.operateId = :operateId3) AND h.requestFlg = 1 ORDER BY h.id DESC")
  677.             ->setParameter(":orderId"$Order->getId())
  678.             ->setParameter(":operateId1"'1Auth')
  679.             ->setParameter(":operateId2"'1Gathering')
  680.             ->setParameter(":operateId3"'1ReAuth')
  681.             ->setParameter(":id"$history->getId())
  682.             ->setMaxResults(1);
  683.         $kaiinHistory $q->getResult();
  684.         $kaiinHistory $kaiinHistory[0];
  685.         $kaiinData json_decode($kaiinHistory->getBody(), 1);
  686.         
  687.         if (array_key_exists('KaiinId'$kaiinData)) {
  688.             $ReAuth['KaiinId'] = $kaiinData['KaiinId'];
  689.         }
  690.         
  691.         $KaiinPass null;
  692.         
  693.         if ($ReAuth['KaiinId'] && $Order->getCustomer()) {
  694.             if ($Order->getCustomer()->getStatus()->getId() != CustomerStatus::WITHDRAWING) { // 退会済みの場合は後続処理を行わせない
  695.                 list($KaiinId$KaiinPass) = $this->util->getNewKaiin($this->memCardIdRepository$Order->getCustomer(), $this->eccubeConfig->get('eccube_auth_magic'));
  696.             }
  697.         }
  698.         
  699.         $ReAuth['KaiinPass'] = $KaiinPass;
  700.         if ($kaiinHistory->getOperateId() == '1Gathering') {
  701.             $ReAuth['SalesDate'] = date("Ymd");
  702.         }
  703.         $ReAuth['Amount'] = floor($Order->getPaymentTotal());
  704.         
  705.         $httpResponse $this->httpSend->sendData($sendUrl$ReAuth$Order->getId(), true);
  706.         if ($httpResponse) {
  707.             return $this->DeCodeReAuthResponse($httpResponse$Order->getId());
  708.         } else {//通信エラーカードページに戻してエラー情報を表示する
  709.             throw new \Exception("決済モジュールの通信エラーが発生しました。詳しくは管理者にご連絡してください。");
  710.         }
  711.     }
  712.     
  713.     /**
  714.      * 再オーソリ返信情報を解析する
  715.      * @param unknown $response_body
  716.      * @param unknown $orderId
  717.      * @throws \Exception
  718.      * @return \Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\ReAuth|mixed
  719.      */
  720.     public function DeCodeReAuthResponse($response_body$orderId)
  721.     {
  722.         $RespReAuth = new RespReAuth(new Process());
  723.         $this->util->deCodeRespData($RespReAuth$response_body);
  724.         
  725.         //返信内容をDBに記録する
  726.         $this->orderPaymentHistoryRepository->addSendResponseLog($orderId$RespReAuth);
  727.         
  728.         if($RespReAuth['ResponseCd'] != "OK") {
  729.             $arrErr $this->util->reErrorDecode($RespReAuth['ResponseCd']);
  730.             $error strlen($arrErr[0]) ? $arrErr[1] : $RespReAuth['ResponseCd'];
  731.             throw new SlnShoppingException("再オーソリに失敗しました:" $errornullnull,
  732.                         array_merge((array)$RespReAuth['ResponseCd'], (array)$arrErr));
  733.         }
  734.         
  735.         return $RespReAuth;
  736.     }
  737.     
  738.     /**
  739.      * 3D決済
  740.      * @param \Eccube\Entity\Order $Order
  741.      * @param \Plugin\SlnPayment42\Entity\ConfigSubData $config
  742.      * @param Master $master
  743.      * @throws \Exception
  744.      */
  745.     public function ThreeDAuth(
  746.         \Eccube\Entity\Order $Order,
  747.         \Plugin\SlnPayment42\Entity\ConfigSubData $config,
  748.         ThreeDMaster $master)
  749.     {
  750.     
  751.         $sendUrl $config->getCreditConnectionPlace7();
  752.     
  753.         if (!strlen($sendUrl)) {
  754.             throw new \Exception("決済モジュールの通信エラーが発生しました。詳しくは管理者にご連絡してください");
  755.         }
  756.         //3D決済送信情報を登録する
  757.         $this->orderPaymentSendRepository->addData($Order);
  758.         $sendId $this->orderPaymentSendRepository->getLatestData($Order"")->getId();
  759.     
  760.         $Auth = new ThreeDAuth($master);
  761.         $this->util->setActionBasic($Auth$config);
  762.         $this->util->setActionMerchantFree($Auth$Order);
  763.         $Auth['TenantId'] = $config->getTenantId();
  764.         $Auth['Amount'] = floor($Order->getPaymentTotal());
  765.         $Auth['RedirectUrl'] = $this->util->generateUrl('sln_3d_card', [], UrlGeneratorInterface::ABSOLUTE_URL);
  766.         $Auth['PostUrl'] = $this->util->generateUrl('sln_3d_card_post', [], UrlGeneratorInterface::ABSOLUTE_URL);
  767.         $Auth['ProcNo'] = substr(str_pad($sendId70STR_PAD_LEFT), -7);
  768.         $Auth['OperateId'] = "1Auth";
  769.         // log_debugはデバッグ時以外コメントアウトすること
  770.         // log_debug('$Auth: '. print_r($Auth, true));
  771.     
  772.         $cryptAES = new CryptAES();
  773.         $cryptAES->setKey($config->getCreditAesKey());
  774.         $cryptAES->setIv($config->getCreditAesIv());
  775.     
  776.         $encryptValue $this->util->aesEnCode($Auth$cryptAES);
  777.         
  778.         $this->util->addCardNotice("redirect_url: {$sendUrl} send_data:" json_encode($this->util->logDataReset($Auth->getPostData())));
  779.         
  780.         $this->orderPaymentHistoryRepository->addSendRequestLog($Order->getId(), $Auth);
  781.     
  782.         return sprintf('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  783.                 <html>
  784.                 <head>
  785.                 <title></title>
  786.                 </head>
  787.                 <body onload="javascript:document.forms[\'redirectForm\'].submit();">
  788.                     <form action="%s" method="post" id="redirectForm">
  789.                         <input type="hidden" name="MerchantId" value="%s" />
  790.                         <input type="hidden" name="EncryptValue" value="%s" />
  791.                     </form>
  792.                 </body>
  793.                 </html>'$sendUrl$config->getMerchantId(), $encryptValue);
  794.     }
  795.     
  796.     /**
  797.      * 3D決済
  798.      * @param \Eccube\Entity\Order $Order
  799.      * @param \Plugin\SlnPayment42\Entity\ConfigSubData $config
  800.      * @param Master $master
  801.      * @throws \Exception
  802.      */
  803.     public function ThreeDGathering(
  804.         \Eccube\Entity\Order $Order,
  805.         \Plugin\SlnPayment42\Entity\ConfigSubData $config,
  806.         ThreeDMaster $master)
  807.     {
  808.         $sendUrl $config->getCreditConnectionPlace7();
  809.     
  810.         if (!strlen($sendUrl)) {
  811.             throw new \Exception("決済モジュールの通信エラーが発生しました。詳しくは管理者にご連絡してください");
  812.         }
  813.         //3D決済送信情報を登録する
  814.         $this->orderPaymentSendRepository->addData($Order);
  815.         $sendId $this->orderPaymentSendRepository->getLatestData($Order"")->getId();
  816.     
  817.         $Auth = new ThreeDGathering($master);
  818.         $this->util->setActionBasic($Auth$config);
  819.         $this->util->setActionMerchantFree($Auth$Order);
  820.         $Auth['TenantId'] = $config->getTenantId();
  821.         $Auth['Amount'] = floor($Order->getPaymentTotal());
  822.         
  823.         $Auth['RedirectUrl'] = $this->util->generateUrl('sln_3d_card', [], UrlGeneratorInterface::ABSOLUTE_URL);
  824.         $Auth['PostUrl'] = $this->util->generateUrl('sln_3d_card_post', [], UrlGeneratorInterface::ABSOLUTE_URL);
  825.         $Auth['ProcNo'] = substr(str_pad($sendId70STR_PAD_LEFT), -7);
  826.         $Auth['OperateId'] = "1Gathering";
  827.     
  828.         // log_debugはデバッグ時以外コメントアウトすること
  829.         // log_debug('$Auth: '. print_r($Auth, true));
  830.         $cryptAES = new CryptAES();
  831.         $cryptAES->setKey($config->getCreditAesKey());
  832.         $cryptAES->setIv($config->getCreditAesIv());
  833.     
  834.         $encryptValue $this->util->aesEnCode($Auth$cryptAES);
  835.     
  836.         $this->util->addCardNotice("redirect_url: {$sendUrl} send_data:" json_encode($this->util->logDataReset($Auth->getPostData())));
  837.     
  838.         $this->orderPaymentHistoryRepository->addSendRequestLog($Order->getId(), $Auth);
  839.         
  840.         return sprintf('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  841.                 <html>
  842.                 <head>
  843.                 <title></title>
  844.                 </head>
  845.                 <body onload="javascript:document.forms[\'redirectForm\'].submit();">
  846.                     <form action="%s" method="post" id="redirectForm">
  847.                         <input type="hidden" name="MerchantId" value="%s" />
  848.                         <input type="hidden" name="EncryptValue" value="%s" />
  849.                     </form>
  850.                 </body>
  851.                 </html>'$sendUrl$config->getMerchantId(), $encryptValue);
  852.     }
  853.     
  854.     /**
  855.      * カード与信返信情報を解析する
  856.      * @param unknown $response_body
  857.      * @param unknown $orderId
  858.      * @throws \Exception
  859.      * @return \Plugin\SlnPayment42\Service\SlnAction\Content\Credit\Response\Auth|mixed
  860.      */
  861.     public function DeCodeThreeDResponse($response_body$orderId$func '')
  862.     {
  863.         $config $this->configRepository->getConfig();
  864.         
  865.         $cryptAES = new CryptAES();
  866.         $cryptAES->setKey($config->getCreditAesKey());
  867.         $cryptAES->setIv($config->getCreditAesIv());
  868.         
  869.         $reData $this->util->aesDeCode($response_body$cryptAES);
  870.         
  871.         $this->util->addCardNotice("response_post_data:({$func})" json_encode($reData));
  872.         
  873.         if ($reData['OperateId'] == "1Auth") {
  874.             $RespAuth = new RespThreeDAuth(new ThreeDMaster());
  875.         } else {
  876.             $RespAuth = new RespThreeDGathering(new ThreeDMaster());
  877.         }
  878.         
  879.         foreach ($reData as $key => $value) {
  880.             $RespAuth[$key] = $value;
  881.         }
  882.     
  883.         //返信内容をDBに記録する
  884.         if (!$orderId) {
  885.             $Order $this->orderRepository->findOneBy(array('id' => $RespAuth['MerchantFree1']));
  886.             if ($Order->getId()) {
  887.                 $orderId $Order->getId();
  888.             } else {
  889.                 throw new SlnShoppingException("受注は存在していません。({$RespAuth['MerchantFree1']})"nullnull, array(), array());
  890.             }
  891.         }
  892.         
  893.         $this->orderPaymentHistoryRepository->addSendResponseLog($orderId$RespAuth);
  894.         
  895.         $errorMess null;
  896.         
  897.         if ($RespAuth['ResponseCd'] != "OK") {
  898.             switch ($RespAuth->getContent()->getSecureResultCode()) {
  899.                 case 1:
  900.                     $errorMess "3D セキュア認証前にエラーが発生したため 3D セキュア認証未実施です。";
  901.                     break;
  902.                 case 2://3D パスワード未設定
  903.                     $errorMess "お客様カードは 3D セキュアパスワードが未設定のため 3D セキュア認証未実施です。カード会社のセキュアパスワードを設定の上、再度ご購入をお願いいたします。";
  904.                     break;
  905.                 case 3://カード発行会社未対応
  906.                     $errorMess "カード発行会社が 3D セキュアに未対応のため 3D セキュア認証未実施です。";
  907.                     break;
  908.                 case 4://アテンプト
  909.                     $errorMess "3D セキュア認証が正常に完了しませんでした。";
  910.                     break;
  911.                 case 8://認証システムメンテナンス中
  912.                     $errorMess "認証システムがメンテナンス中のため 3D セキュア認証未実施です。後ほど再購入をお願いいたします。";
  913.                     break;
  914.                 case 9://認証システムエラー
  915.                     $errorMess "認証システムでエラーが発生したため 3D セキュア認証未実施です。";
  916.                     break;
  917.                 default:
  918.             }   
  919.         }
  920.         
  921.         if ($errorMess) {
  922.             $arrErr $this->util->reErrorDecode($RespAuth['ResponseCd']);
  923.             throw new SlnShoppingException("カードの与信処理が失敗しました:" $errorMessnullnull,
  924.                 array_merge((array)$RespAuth['ResponseCd'], (array)$arrErr),
  925.                 $orderId
  926.             );
  927.         }
  928.         
  929.         if($RespAuth['ResponseCd'] != "OK") {
  930.             $arrErr $this->util->reErrorDecode($RespAuth['ResponseCd']);
  931.             $error strlen($arrErr[0]) ? $arrErr[1] : $RespAuth['ResponseCd'];
  932.             throw new SlnShoppingException("カードの与信処理が失敗しました:" $errornullnull,
  933.                 array_merge((array)$RespAuth['ResponseCd'], (array)$arrErr),
  934.                 $orderId
  935.             );
  936.         }
  937.     
  938.         return $RespAuth;
  939.     }
  940.     /**
  941.      * カード与信返信情報を複合化する(POST受信時の決済情報取得用)
  942.      * @param unknown $response_body
  943.      * @param string $func
  944.      * @throws \Exception
  945.      * @return unknown $RespAuth
  946.      */
  947.     public function decodeRespAuth($response_body$func '')
  948.     {
  949.         $config $this->configRepository->getConfig();
  950.         $cryptAES = new CryptAES();
  951.         $cryptAES->setKey($config->getCreditAesKey());
  952.         $cryptAES->setIv($config->getCreditAesIv());
  953.         $reData $this->util->aesDeCode($response_body$cryptAES);
  954.         $this->util->addCardNotice("response_post_data:({$func})" json_encode($reData));
  955.         if ($reData['OperateId'] == "1Auth") {
  956.             $RespAuth = new RespThreeDAuth(new ThreeDMaster());
  957.         } else {
  958.             $RespAuth = new RespThreeDGathering(new ThreeDMaster());
  959.         }
  960.         foreach ($reData as $key => $value) {
  961.             $RespAuth[$key] = $value;
  962.         }
  963.         return $RespAuth;
  964.     }
  965.     /**
  966.      * 決済ステータスが購入処理対象かチェックする
  967.      * @param OrderPaymentStatus $paymentStatus
  968.      * @return boolean
  969.      */
  970.     public function isPurchaseProcessTarget(OrderPaymentStatus $paymentStatus)
  971.     {
  972.         $slnPaymentStatus $this->basicItem->getSlnPaymentStatus();
  973.         $targetStatus = [
  974.             $slnPaymentStatus['UNSETTLED'],
  975.             $slnPaymentStatus['FAIL'],
  976.         ];
  977.         if (in_array($paymentStatus->getPaymentStatus(), $targetStatus)) {
  978.             return true;
  979.         }
  980.         return false;
  981.     }
  982. }