Selaa lähdekoodia

バンクチェック登録をマイページ経由で行うように修正

master
sosuke.iwabuchi 1 vuosi sitten
vanhempi
commit
9fd57f8020
9 muutettua tiedostoa jossa 100 lisäystä ja 111 poistoa
  1. +0
    -60
      app/Http/Controllers/Web/BanckCheck/EntryController.php
  2. +0
    -46
      app/Http/Controllers/Web/BanckCheck/EntryParam.php
  3. +2
    -2
      app/Http/Controllers/Web/RobotPayment/BanckCheck/PaymentInfoController.php
  4. +1
    -1
      app/Http/Controllers/Web/RobotPayment/BanckCheck/PaymentInfoParam.php
  5. +35
    -0
      app/Http/Controllers/Web/RobotPayment/BanckCheck/RegisterController.php
  6. +31
    -0
      app/Http/Controllers/Web/RobotPayment/BanckCheck/RegisterParam.php
  7. +0
    -0
      resources/views/robot-payment/bank-check/ok.blade.php
  8. +28
    -0
      resources/views/robot-payment/bank-check/register.blade.php
  9. +3
    -2
      routes/web.php

+ 0
- 60
app/Http/Controllers/Web/BanckCheck/EntryController.php Näytä tiedosto

@@ -1,60 +0,0 @@
<?php

namespace App\Http\Controllers\Web\BanckCheck;

use App\Http\Controllers\Web\WebController;
use App\Kintone\Models\BankCheckResult;
use App\Util\DateUtil;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;

class EntryController extends WebController
{

public function name(): string
{
return "バンクチェック 受付";
}

public function description(): string
{
return "バンクチェック 受付";
}


public function __construct(protected EntryParam $param)
{
parent::__construct();
}

protected function run(Request $request): Response
{
$param = $this->param;

if ($param->token !== config('custom.bank-check.token')) {
abort(403);
}

$model = new BankCheckResult();

$model->customerCode = $param->customerCode;
$model->entryRecordNo = $param->entryRecordNo;
$model->shopOrderNo = $param->cod;
$model->paymentNo = $param->gid;
$model->orderCode = $param->god;
$model->entryResult = $param->rst;
$model->entryErrorCode = $param->ec;
$model->paymentPlanAmount = intval($param->am);
$model->paymentExpiresDate = Carbon::createFromFormat("Ymd", $param->exp);

$requestArr = $request->toArray();
unset($requestArr["token"]);
$model->dataEntry = json_encode($requestArr);

$model->save();

return response()->view('bank-check.ok');
}
}

+ 0
- 46
app/Http/Controllers/Web/BanckCheck/EntryParam.php Näytä tiedosto

@@ -1,46 +0,0 @@
<?php

namespace App\Http\Controllers\Web\BanckCheck;

use App\Http\Controllers\Web\BaseParam;

/**
* @property string $gid 決済受付時に発行された決済番号
* @property string $rst 決済結果(1:OK 2:NG)
* @property string $ap 入金:完了(BAN_SAL)
* @property string $ec エラーコード
* @property string $god オーダーコード
* @property string $cod 店舗側オーダー番号
* @property string $am 決済金額
* @property string $tx 税金額
* @property string $sf 送料
* @property string $ta 合計金額
* @property string $bank 振込先口座情報(ドット「.」区切りの文字列)[銀行コード].[銀行名].[支店コード].[支店名].[口座種別].[口座番号].[口座名義]
* @property string $exp 支払期限(yyyymmdd形式)
* @property string $customerCode カスタム-顧客コード
* @property int $entryRecordNo カスタム-定期申込レコード番号
* @property string $token カスタム-トークン
*/
class EntryParam extends BaseParam
{
public function rules(): array
{
return [
'gid' => $this->str(),
'rst' => $this->str(),
'ap' => $this->str(),
'ec' => $this->str(),
'god' => $this->str(),
'cod' => $this->str(),
'am' => $this->numeric(),
'tx' => $this->numeric(),
'sf' => $this->numeric(),
'ta' => $this->numeric(),
'bank' => $this->str(),
'exp' => $this->str(),
'customer_code' => $this->str(),
'entry_record_no' => $this->numeric(),
'token' => $this->str(),
];
}
}

app/Http/Controllers/Web/BanckCheck/PaymentInfoController.php → app/Http/Controllers/Web/RobotPayment/BanckCheck/PaymentInfoController.php Näytä tiedosto

@@ -1,6 +1,6 @@
<?php

namespace App\Http\Controllers\Web\BanckCheck;
namespace App\Http\Controllers\Web\RobotPayment\BanckCheck;

use App\Exceptions\AppCommonException;
use App\Http\Controllers\Web\WebController;
@@ -44,7 +44,7 @@ class PaymentInfoController extends WebController
}


return response()->view('bank-check.ok');
return response()->view('robot-payment.bank-check.ok');
}

private function handleEntry()

app/Http/Controllers/Web/BanckCheck/PaymentInfoParam.php → app/Http/Controllers/Web/RobotPayment/BanckCheck/PaymentInfoParam.php Näytä tiedosto

@@ -1,6 +1,6 @@
<?php

namespace App\Http\Controllers\Web\BanckCheck;
namespace App\Http\Controllers\Web\RobotPayment\BanckCheck;

use App\Http\Controllers\Web\BaseParam;


+ 35
- 0
app/Http/Controllers/Web/RobotPayment/BanckCheck/RegisterController.php Näytä tiedosto

@@ -0,0 +1,35 @@
<?php

namespace App\Http\Controllers\Web\RobotPayment\BanckCheck;

use App\Http\Controllers\Web\WebController;
use Illuminate\Http\Request;
use Illuminate\Http\Response;

class RegisterController extends WebController
{

public function name(): string
{
return "バンクチェック 登録画面遷移";
}

public function description(): string
{
return "バンクチェック 登録画面遷移";
}


public function __construct(protected RegisterParam $param)
{
$this->middleware('fromKintone');
parent::__construct();
}

protected function run(Request $request): Response
{
$param = $this->param;

return response()->view('robot-payment.bank-check.register', $param->toArray());
}
}

+ 31
- 0
app/Http/Controllers/Web/RobotPayment/BanckCheck/RegisterParam.php Näytä tiedosto

@@ -0,0 +1,31 @@
<?php

namespace App\Http\Controllers\Web\RobotPayment\BanckCheck;

use App\Http\Controllers\Web\BaseParam;

/**
* @property string $aid
* @property string $cod
* @property string $am
* @property string $tx
* @property string $sf
* @property string $customerCode カスタム-顧客コード
* @property int $entryRecordNo カスタム-定期申込レコード番号
*/
class RegisterParam extends BaseParam
{
public function rules(): array
{
return [
'aid' => $this->str(),
'cod' => $this->str(),
'jb' => $this->str(true),
'am' => $this->str(),
'tx' => $this->str(),
'sf' => $this->numeric(),
'customer_code' => $this->str(),
'entry_record_no' => $this->numeric(),
];
}
}

resources/views/bank-check/ok.blade.php → resources/views/robot-payment/bank-check/ok.blade.php Näytä tiedosto


+ 28
- 0
resources/views/robot-payment/bank-check/register.blade.php Näytä tiedosto

@@ -0,0 +1,28 @@
<html>

<body>
<span>
...遷移中
</span>
<form id="target-form" action="https://credit.j-payment.co.jp/link/bankcheck" method="post">
<input type="hidden" name="aid" value="{{ $aid }}">
<input type="hidden" name="cod" value="{{ $cod }}">
<input type="hidden" name="jb" value="{{ $jb }}">
<input type="hidden" name="am" value="{{ $am }}">
<input type="hidden" name="tx" value="{{ $tx }}">
<input type="hidden" name="sf" value="{{ $sf }}">
<input type="hidden" name="customer_code" value="{{ $customer_code }}">
<input type="hidden" name="entry_record_no" value="{{ $entry_record_no }}">
<input type="hidden" name="token" value="{{ config('custom.bank-check.token') }}">
</form>

<script>
window.onload = () => {
document.getElementById('target-form').submit()
}
</script>
</body>



</html>

+ 3
- 2
routes/web.php Näytä tiedosto

@@ -19,10 +19,11 @@ RouteHelper::get('/pdf', App\Http\Controllers\PDFController::class);

// 画像取得
RouteHelper::get('/image/season-ticket-contract/{id}', App\Http\Controllers\Web\Image\SeasonTicketContractImageController::class);
RouteHelper::get('/test/bank', App\Http\Controllers\Web\Image\SeasonTicketContractImageController::class);

// ロボットペイメント画面遷移
RouteHelper::get('/robot-payment/bank-check/register', App\Http\Controllers\Web\RobotPayment\BanckCheck\RegisterController::class);
// BANK CHECK WEBHOOK
RouteHelper::get('/bank-check/info', App\Http\Controllers\Web\BanckCheck\PaymentInfoController::class);
RouteHelper::get('/robot-payment/bank-check/info', App\Http\Controllers\Web\RobotPayment\BanckCheck\PaymentInfoController::class);


// ルーティングで適合しない場合はフロント側のRoutingにゆだねる


Loading…
Peruuta
Tallenna