'BadMethodCallException error while calling payment API

I got this error while calling Payment API :BadMethodCallException: Method App\Http\Controllers\API\DsaAPIController::checkDsa does not exist.

Here is my code :

public function paymentStatus(PaymentStatusRequest $request, Dsa $dsa_payment)
{
    /*
        If user is already successfully subscribed then he has his invoice 
        So that his invoice will not generated again
  */
    // For subscribed user - whose process is successfully completed 
    if ($this->checkDsa(DSA::class, 'user_id', Auth::guard('api')->id())) {
        return $this->getMessage([], config('constants.messages.errors.already_dsa'), config('constants.validation_codes.unprocessable_entity'), false);
    }dd('poojan');

    if (
        $dsa_payment->status == config('constants.dsa_payments.payment_status.1')
        || $dsa_payment->user_id != Auth::guard('api')->id()
    ) {
        return $this->getMessage([], config('constants.messages.errors.processing_old_request'), config('constants.validation_codes.unprocessable_entity'), false);
    }

    /*
        If the user's payment done successfully then change status in the subscription table and generate invoice
  */
    if ($request->payment_status == config('constants.dsa_payments.payment_status.1')) {
        $dsa_payment->update([
            'status' => $request->payment_status
        ]);

        $user = User::find($dsa_payment->user_id);
        $plan = Plan::find($dsa_plan->plan_id);
        $amount = CountryPlan::where([
            'country_id' => $user->country_id,
            'dsa_plan_id' => $dsa_plan->id
        ])->first()->amount;
    }
}`

Here is console/kernel.php

  protected $commands = [
    Commands\CheckCouponExpiry::class,
    Commands\CheckSubscription::class,
    Commands\CheckDsa::class,
    Commands\CheckPayment::class,
];

Here is command checkDsa.php

use Illuminate\Console\Command;

class CheckDsa extends Command {
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'check:is_dsa';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *  
     * @return int
     */
    public function handle()
    {
        $dsas = Dsa::where([
            'status' => config('constants.subscriptions.status.1')])
            ->get();

    }
}

Here is my middleware:

class CheckDsa {
    use MessagesTrait;

    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle(Request $request, Closure $next)
    {
        $is_subscribe = Auth::guard('api')->user()->dsa_payment()
            ->where([
                'status' => config('constants.dsa_payment.status.1'),
            ])
            ->exists();

        return ($is_dsa)
            ? $next($request)
            : $this->getMessage([], config('constants.messages.errors.not_dsa'), config('constants.validation_codes.forbidden'), false);
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source