You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- <?php
-
- namespace App\Http\Controllers\Web\Receipt;
-
- use App\Exceptions\AppCommonException;
- use App\Http\Controllers\Web\WebController;
- use App\Logic\ReceiptManager;
- use Auth;
- use Illuminate\Http\Request;
- use Illuminate\Http\Response;
-
- class ReceiptDownloadController extends WebController
- {
-
- public function name(): string
- {
- return "領収証PDF取得";
- }
-
- public function description(): string
- {
- return "領収証PDFを取得する";
- }
-
-
- public function __construct(protected ReceiptDownloadParam $param)
- {
- parent::__construct();
- $this->middleware('auth:sanctum');
- }
-
- protected function run(Request $request): Response
- {
- $param = $this->param;
- $manager = new ReceiptManager($param->recordNo);
-
- if ($manager->getReceipt()->receiptNo !== $param->receiptNo) {
- throw new AppCommonException("パラメータ不正");
- }
-
- $customerCode = $manager->getReceipt()->customerCode;
- $customerCodeAuth = Auth::user()->kintone_customer_code;
- if ($customerCode != $customerCodeAuth) {
- throw new AppCommonException("パラメータ不正");
- }
-
- return $manager->getPdf();
- }
- }
|