添加余额支付-支付密码校验
parent
8e1a625197
commit
98c9399e21
|
|
@ -6,6 +6,7 @@ use App\Endpoint\Api\Http\Controllers\Controller;
|
||||||
use App\Endpoint\Api\Http\Resources\Dealer\OrderResource;
|
use App\Endpoint\Api\Http\Resources\Dealer\OrderResource;
|
||||||
use App\Endpoint\Api\Http\Resources\Dealer\OrderSimpleResource;
|
use App\Endpoint\Api\Http\Resources\Dealer\OrderSimpleResource;
|
||||||
use App\Exceptions\BizException;
|
use App\Exceptions\BizException;
|
||||||
|
use App\Exceptions\PayPasswordIncorrectException;
|
||||||
use App\Helpers\Paginator as PaginatorHelper;
|
use App\Helpers\Paginator as PaginatorHelper;
|
||||||
use App\Models\DealerOrder;
|
use App\Models\DealerOrder;
|
||||||
use App\Models\DealerProduct;
|
use App\Models\DealerProduct;
|
||||||
|
|
@ -139,7 +140,19 @@ class OrderController extends Controller
|
||||||
$input = $request->validate([
|
$input = $request->validate([
|
||||||
'pay_image' => ['bail', 'string'],
|
'pay_image' => ['bail', 'string'],
|
||||||
'pay_way' => ['bail', 'string'],
|
'pay_way' => ['bail', 'string'],
|
||||||
|
'pay_password' => ['bail', 'string'],
|
||||||
|
], [], [
|
||||||
|
'pay_image' => '打款凭证',
|
||||||
|
'pay_way' => '支付方式',
|
||||||
|
'pay_password' => '支付密码',
|
||||||
]);
|
]);
|
||||||
|
$payWay = $input['pay_way'] ?? 'offline';
|
||||||
|
if ($payWay == DealerOrder::PAY_WAY_WALLET) {
|
||||||
|
//验证支付密码
|
||||||
|
if (! $request->user()->wallet?->verifyPassword($input['pay_password'] ?? '')) {
|
||||||
|
throw new PayPasswordIncorrectException();
|
||||||
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
$orderService->payOrder($order, $input['pay_way'] ?? 'offline', $input['pay_image'] ?? null);
|
$orderService->payOrder($order, $input['pay_way'] ?? 'offline', $input['pay_image'] ?? null);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue