getEmail(); // 送信 if ($this->emailManager === null) { throw new LogicException("EmailManager不正"); } info(sprintf("Email送信依頼受信 %s [%s]", $this->param->emailId->value, json_encode($request->toArray()))); $this->emailManager->confirm(); } catch (Exception $e) { LoggingUtil::debugException($e); return $this->failedResponse(); } return $this->successResponse(); } private function getEmail() { $emailId = $this->param->emailId; if ($emailId === Email::TERMINATE_ORDER_APPROVE) { $application = TerminateApplication::findByApplicationNo($this->param->applicationNo); $seasonTicketContract = SeasonTicketContract::find($application->seasonTicketContractRecordNo); $this->setEmail(new TerminateOrderApprove($seasonTicketContract, $application)); return; } if ($emailId === Email::VEHICLE_INFO_UPDATE_ORDER_APPROVE) { $application = VehicleInfoUpdateApplication::findByApplicationNo($this->param->applicationNo); $seasonTicketContract = SeasonTicketContract::find($application->seasonTicketContractRecordNo); $this->setEmail(new VehicleInfoUpdateOrderApprove($seasonTicketContract, $application)); return; } if ($emailId === Email::USER_INFO_UPDATE_ORDER_APPROVE) { $application = UserInfoUpdateApplication::findByApplicationNo($this->param->applicationNo); $this->setEmail(new UserInfoUpdateOrderApprove($application)); return; } if ($emailId === Email::ENTRY_APPROVE) { $entry = SeasonTicketContractEntry::find($this->param->seasonTicketContractEntryRecordNo); $parking = $entry->getParking(); $plan = $entry->getPlan(); $email = new EntryApprove($parking, $entry, $plan); $email->setFirstMonthPaymentPlan(PaymentPlan::find($entry->firstMonthPaymentPlanRecordNo)); if ($entry->partitialPaymentPlanRecordNo) { $email->setPartitialPaymentPlan(PaymentPlan::find($entry->partitialPaymentPlanRecordNo)); } if ($entry->depositPaymentPlanRecordNo) { $email->setDepositPaymentPlan(PaymentPlan::find($entry->depositPaymentPlanRecordNo)); } $this->setEmail($email); return; } if ($emailId === Email::ENTRY_PAYMENT_COMPLETE) { $entry = SeasonTicketContractEntry::find($this->param->seasonTicketContractEntryRecordNo); $parking = $entry->getParking(); $plan = $entry->getPlan(); $seasonTicketContract = $entry->getSeasonTicketContract(); $this->setEmail(new EntryPaymentComplete($parking, $entry, $plan, $seasonTicketContract)); return; } if ($emailId === Email::CHANGE_PLAN_ORDER_APPROVE) { $application = ChangePlanApplication::findByApplicationNo($this->param->applicationNo); $seasonTicketContract = SeasonTicketContract::find($application->seasonTicketContractRecordNo); $this->setEmail(new ChangePlanOrderApprove($seasonTicketContract, $application)); return; } if ($emailId === Email::COULD_NOT_PEY_NOTICE) { $seasonTicketContract = SeasonTicketContract::find($this->param->seasonTicketContractRecordNo); $paymentPlan = PaymentPlan::find($this->param->paymentPlanRecordNo); $this->setEmail(new CouldNotPayNotice($seasonTicketContract, $paymentPlan)); return; } if ($emailId === Email::REGISTER_CREDITCARD) { $application = ChangePaymentMethodCreditcardOrderApplication::findByApplicationNo($this->param->applicationNo); $this->setEmail(new RegisterCreditcard($application)); return; } if ($this->email === null || $this->emailManager === null) { throw new LogicException("setEmail不正"); } } private function setEmail(BaseEmailer $email) { $this->email = $email; $this->emailManager = new EmailManager($email); } }