diff --git a/app/Console/Commands/SMBCPoll.php b/app/Console/Commands/SMBCPoll.php index 681f276..1423551 100644 --- a/app/Console/Commands/SMBCPoll.php +++ b/app/Console/Commands/SMBCPoll.php @@ -2,11 +2,13 @@ namespace App\Console\Commands; +use App\Email\Members\FailedRegisterBankAccountNotice; use App\Http\API\SMBC\PollResultRecord; use App\Http\API\SMBC\SMBC; use App\Http\API\SMBC\SMBCStatus; use App\Kintone\Models\BankAccountUpdateApplication; use App\Kintone\Models\Customer; +use App\Logic\EmailManager; use App\Logic\GeneralApplicationManager; use App\Models\SmbcPollStatus; use App\Util\DateUtil; @@ -161,8 +163,12 @@ class SMBCPoll extends BaseCommand return; } if ($data->status === SMBCStatus::ERROR || $data->status === SMBCStatus::CANCEL) { - // TODOエラーメール送信 - + // エラーメール送信 + $customer = Customer::findByCustomerCode($data->getCustomerCode()); + $this->outputWarn(sprintf("申請失敗のためエラーメール送信 受付番号%s 顧客コード:%d 氏名:%s", $data->acceptNo, $customer->customerCode, $customer->customerName)); + $email = new FailedRegisterBankAccountNotice($customer); + $emailMmanager = new EmailManager($email); + $emailMmanager->confirm(); return; } if ($data->status === SMBCStatus::PROCESSING) { diff --git a/app/Email/Members/FailedRegisterBankAccountNotice.php b/app/Email/Members/FailedRegisterBankAccountNotice.php new file mode 100644 index 0000000..4b06318 --- /dev/null +++ b/app/Email/Members/FailedRegisterBankAccountNotice.php @@ -0,0 +1,32 @@ + $this->getAppUrl(['dashboard', 'update', 'user', 'back-register']), + ]; + } +} diff --git a/app/Kintone/Models/Customer.php b/app/Kintone/Models/Customer.php index 202f7fb..6bef8b4 100644 --- a/app/Kintone/Models/Customer.php +++ b/app/Kintone/Models/Customer.php @@ -6,7 +6,7 @@ use Illuminate\Support\Facades\Auth; /** * アプリ名 顧客マスタ - * @property string customerCode + * @property int customerCode * @property string customerName * @property string customerNameKana * @property string email diff --git a/resources/views/emails/members/failed_register_bank_account_notice.blade.php b/resources/views/emails/members/failed_register_bank_account_notice.blade.php new file mode 100644 index 0000000..32e3b9b --- /dev/null +++ b/resources/views/emails/members/failed_register_bank_account_notice.blade.php @@ -0,0 +1,9 @@ +@extends('emails.layouts.member') + +@section('contents') +振替口座登録手続きをしていただきましたが、エラー等で登録が完了していません。 +お手数をおかけしますが、下記URLから再度振替口座登録を行ってください。 +(再登録の際は、金融機関での登録完了のご確認をお願いいたします。) + +{{ $url }} +@endsection \ No newline at end of file