shetabit / payment

simple laravel payment package , supports multiple drivers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

مشکل تایید بانک ملت

vahidalvandi opened this issue · comments

یک برنامه خیلی ساده است ولی در هنگام تایید خطا میدهد

خطای ناشناخته رخ داده است.

  public function sendtobank(Request $request, $package_id)
    {

        $messages = [
            'fullname.required' => 'نام و نام خانوادگی الزامی است',
            'mobile.required' => 'ورود موبایل الزامی است',
            'mobile.phone' => 'شماره موبایل وارد شده معتبر نیست',
        ];

        $rules = [
            'fullname' => ['required', 'string', 'max:255'],
            'mobile' => ['required', 'phone:AUTO,IR'],
            'email' => ['string', 'email'],
        ];

        $request->validate($rules, $messages);

        $package = package::find($package_id);

        session()->put('invoice', [
            'fullname' => request()->fullname,
            'mobile' => request()->mobile,
            'amount' => $package->amount / 10,
        ]);


        // Do all things together in a single line.
        return Payment::purchase(
            (new Invoice)->amount(session('invoice.amount')),
            function ($driver, $transactionId) {
                session()->put('invoice.transactionId', $transactionId);
            }
        )->pay()->render();

    }

    public function verify()
    {

        $invoice = session('invoice');

        try {


            $receipt = Payment::amount($invoice['amount'])->transactionId($invoice['transactionId'])->verify();

            // You can show payment referenceId to the user.
            echo $receipt->getReferenceId();

        } catch (InvalidPaymentException $exception) {
            /**
             * when payment is not verified, it will throw an exception.
             * We can catch the exception to handle invalid payments.
             * getMessage method, returns a suitable message that can be used in user interface.
             **/
            echo $exception->getMessage();
        }


    }

طبق مستندات خود پکیج نوشته شده چرا اجرا نمیشه ؟

؟؟؟؟؟؟؟

see the below issue

#187 (comment)