From 354d3d4abb347ef5391659c5989e4cb828aa527d Mon Sep 17 00:00:00 2001 From: Aji Kamaludin Date: Thu, 22 Jun 2023 14:53:52 +0700 Subject: [PATCH] add admin fee midtrans --- app/Http/Controllers/SettingController.php | 1 + resources/js/Pages/Setting/Payment.jsx | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/SettingController.php b/app/Http/Controllers/SettingController.php index 0574e34..b5d42c3 100644 --- a/app/Http/Controllers/SettingController.php +++ b/app/Http/Controllers/SettingController.php @@ -68,6 +68,7 @@ class SettingController extends Controller 'MIDTRANS_SERVER_KEY' => 'required|string', 'MIDTRANS_CLIENT_KEY' => 'required|string', 'MIDTRANS_MERCHANT_ID' => 'required|string', + 'MIDTRANS_ADMIN_FEE' => 'required|numeric', 'MIDTRANS_ENABLED' => 'required|in:0,1', 'midtrans_logo_file' => 'nullable|image', ]); diff --git a/resources/js/Pages/Setting/Payment.jsx b/resources/js/Pages/Setting/Payment.jsx index fa8b4f2..67aaebb 100644 --- a/resources/js/Pages/Setting/Payment.jsx +++ b/resources/js/Pages/Setting/Payment.jsx @@ -8,6 +8,7 @@ import TextArea from '@/Components/TextArea' import FormFile from '@/Components/FormFile' import Checkbox from '@/Components/Checkbox' import { extractValue } from './utils' +import FormInputNumeric from '@/Components/FormInputNumeric' export default function General(props) { const { setting, midtrans_notification_url } = props @@ -15,6 +16,7 @@ export default function General(props) { MIDTRANS_SERVER_KEY: extractValue(setting, 'MIDTRANS_SERVER_KEY'), MIDTRANS_CLIENT_KEY: extractValue(setting, 'MIDTRANS_CLIENT_KEY'), MIDTRANS_MERCHANT_ID: extractValue(setting, 'MIDTRANS_MERCHANT_ID'), + MIDTRANS_ADMIN_FEE: extractValue(setting, 'MIDTRANS_ADMIN_FEE'), MIDTRANS_LOGO_URL: extractValue(setting, 'MIDTRANS_LOGO'), MIDTRANS_ENABLED: extractValue(setting, 'MIDTRANS_ENABLED'), midtrans_logo_file: null, @@ -32,11 +34,7 @@ export default function General(props) { } const handleSubmit = () => { - post(route('setting.payment'), { - onSuccess: () => { - setTimeout(() => router.get(route(route().current())), 3000) - }, - }) + post(route('setting.payment')) } return ( @@ -75,6 +73,13 @@ export default function General(props) { label="Client Key" error={errors.MIDTRANS_CLIENT_KEY} /> +