 public function refundStoreOld(Request $request){   
        $validatedData = $request->validate([
            'dealer_id' => 'required',
            'merchant_id' => 'required',
            'amount' => 'required|numeric',
            'transaction_id' => 'required|string',
            'reason' => 'required|string',
        ]);
        // dd($request->all());
        $merchant = Models\Merchant::findorfail($request->merchant_id);
        // dd($merchant);

        $merchant_name = $merchant->fullname;
        $dealer = Models\OrgUser::findorfail($request->dealer_id);
        $dealer_name = $dealer->name;
        $organisation = Models\Organisation::findorfail($request->dealer_id);
        $result = Models\MerchantToDealerRefund::create([
            'dealer_id' => $request->dealer_id,
            'merchant_id' => $request->merchant_id,
            'amount' => $request->amount,
            'dealer_msisdn' => $dealer->phone,
            'reason' => $request->reason,
        ]);
        $merchant_balance = $merchant->balance;
        $merchant->balance = $merchant_balance - $request->amount;
        $merchant->save();

        //Review this -- should dealers belong to a larger organisation or they should be on their own
        $dealer_balance = $organisation->balance;
        $organisation->balance = $dealer_balance + $request->amount;
        $organisation->save();

        $desc = [
            'title' => 'Dealer Refund',
            'data' => "Redunded a dealer with an amount of  " . $request->amount,
            'type' => 'merchant',
        ];

        $activity = new ActivityLog;
        $activity->user_id = $request->session()->get('current_org_user.id'); // org_user_id ;
        $activity->user_type = 'merchant';
        $activity->description = json_encode($desc);
        $activity->save();
        
        $msg = "You have been Successfully refunded a dealer ($dealer_name) with an amount of $request->amount.";
        $dealer_msg = "You have received a refund amount of $request->amount from Airtime Merchant ($merchant_name)";
        $smsgateway = new Smsgateway; 
        if(env('APP_ENV') !== 'local'){
            $result = $smsgateway->sendSmsNew($merchant->phone, $msg);
            $result = $smsgateway->sendSmsNew($dealer->phone, $dealer_msg);
        }
        \Log::info($msg);
        \Log::info($dealer_msg);
        // $this->sendNtfy($msg);
        if($request->ajax()){
            return response()->json([
                'code' => 1,
                'status' => 'success',
                'message' => 'Dealer Refund Successfully processed'
            ]);
        }
        else{
            return redirect()->to('merchant/refunds')->with('success_message', 'Dealer Refund Successfully processed');
        }
    }