Ver código fonte

チャージ取消 追加

develop
sosuke.iwabuchi 1 ano atrás
pai
commit
a9d9d536ec
4 arquivos alterados com 12 adições e 3 exclusões
  1. +1
    -0
      app/Codes/DepositTransferReason.php
  2. +3
    -1
      app/Http/Controllers/Web/BaseParam.php
  3. +2
    -1
      app/Http/Controllers/Web/Shop/DepositChargeParam.php
  4. +6
    -1
      app/Logics/QRService/ChargeLogic.php

+ 1
- 0
app/Codes/DepositTransferReason.php Ver arquivo

@@ -5,6 +5,7 @@ namespace App\Codes;
enum DepositTransferReason: string
{
case チャージ = "チャージ";
case チャージ_取消 = "チャージ_取消";
case 駐車料金割引_認証 = "駐車料金割引_認証";
case 駐車料金割引_印字 = "駐車料金割引_印字";
case 駐車料金割引_取得 = "駐車料金割引_取得";


+ 3
- 1
app/Http/Controllers/Web/BaseParam.php Ver arquivo

@@ -17,6 +17,7 @@ abstract class BaseParam implements IParam
const NULLABLE = 'nullable';
const STR = 'string';
const NUMERIC = 'numeric';
const INTEGER = 'integer';
const DATE = 'date';
const BOOLEAN_ = 'boolean';
const IMAGE = 'image';
@@ -178,7 +179,8 @@ abstract class BaseParam implements IParam
{
return array_merge([
$this->isNullable($condition, $nullable) ? self::NULLABLE : self::REQUIRED,
self::NUMERIC
self::NUMERIC,
self::INTEGER,
], is_array($condition) ? $condition : []);
}
protected function boolean(array|bool $condition = [], $nullable = false): array


+ 2
- 1
app/Http/Controllers/Web/Shop/DepositChargeParam.php Ver arquivo

@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Web\Shop;

use App\Http\Controllers\Web\BaseParam;
use App\Models\HtpmsCustomer\Deposit\Deposit;
use Illuminate\Validation\Rule;

/**
* @property string shopId
@@ -15,7 +16,7 @@ class DepositChargeParam extends BaseParam
{
return [
Deposit::COL_NAME_SHOP_ID => $this->str(),
"amount" => $this->numeric(),
"amount" => $this->numeric(["between:-100000,100000", Rule::notIn("0")]),
];
}
}

+ 6
- 1
app/Logics/QRService/ChargeLogic.php Ver arquivo

@@ -22,7 +22,12 @@ class ChargeLogic

$history = self::makeTransferHistory($shopId, $amount);
$deposit->deposit += $amount;
$history->transfer_reason = DepositTransferReason::チャージ;

if (0 < $amount) {
$history->transfer_reason = DepositTransferReason::チャージ;
} else {
$history->transfer_reason = DepositTransferReason::チャージ_取消;
}

$deposit->save();
$history->save();


Carregando…
Cancelar
Salvar