Back | Home
الـ Path الحالي: /home/picotech/domains/instantly.picotech.app/public_html/public/../Modules/PaymentGateway/PaymentGatewayProvider
الملفات الموجودة في هذا الـ Path:
.
..
AuthorizeNetPayment.php
CashmallPayment.php
IyzicoPayment.php
MolliePayment.php
PayPalPayment.php
Payment.php
PaymentGateway.php
PaymentInterface.php
PaystackPayment.php
PaytmPayment.php
ProcessPayment.php
StripeCheckoutPayment.php
StripePayment.php

مشاهدة ملف: ProcessPayment.php

<?php

namespace Modules\PaymentGateway\PaymentGatewayProvider;

class ProcessPayment
{


    private $gateway;
    public $plan;
    public $planReq;
    public $request;
    public $redirect_url;
    public $error_message;
    public $return_view;
    public $total;
    public $will_redirect= false;

    public function __construct()
    {

    }

    public function set_gateway($gateway)
    {
        $this->gateway = $gateway;
        return $this;
    }

    public function set_plan($plan, $total)
    {
        $this->plan = $plan;
        $this->total = $total;
        return $this;
    }
    public function plan_request($planReq){
        $this->planReq = $planReq;
        return $this;
    }

    public function request($request)
    {
        $this->request = $request;
        return $this;
    }

    public function process()
    {
        if ($this->gateway == 'paypal') {
            $gateway = new PayPalPayment($this->total);
            $gateway->plan($this->plan);
            $gateway->request($this->request);
            $gateway->plan_request($this->planReq);
        } else if ($this->gateway == 'card') {
            $gateway = new StripePayment($this->total);
            $gateway->plan($this->plan);
            $gateway->request($this->request);
            $gateway->plan_request($this->planReq);
        }else if ($this->gateway == 'paytm') {
            $gateway = new PaytmPayment($this->total);
            $gateway->plan($this->plan);
            $gateway->request($this->request);
            $gateway->plan_request($this->planReq);
        }else if ($this->gateway == 'paystack') {
            $gateway = new PaystackPayment($this->total);
            $gateway->plan($this->plan);
            $gateway->request($this->request);
            $gateway->plan_request($this->planReq);
        }else if ($this->gateway == 'mollie') {
            $gateway = new MolliePayment($this->total);
            $gateway->plan($this->plan);
            $gateway->request($this->request);
            $gateway->plan_request($this->planReq);
        }else if ($this->gateway == 'stripe_checkout') {
            $gateway = new StripeCheckoutPayment($this->total);
            $gateway->plan($this->plan);
            $gateway->request($this->request);
            $gateway->plan_request($this->planReq);
        }else if ($this->gateway == 'iyzico') {
            $gateway = new IyzicoPayment($this->total);
            $gateway->plan($this->plan);
            $gateway->request($this->request);
            $gateway->plan_request($this->planReq);
        }else if ($this->gateway == 'authorize_net') {
            $gateway = new AuthorizeNetPayment($this->total);
            $gateway->plan($this->plan);
            $gateway->request($this->request);
            $gateway->plan_request($this->planReq);
        }

        $payment = new Payment($gateway);
        $payment->trigger();

        $this->redirect_url =$payment->gateway->redirect_url();
        $this->will_redirect =$payment->gateway->will_redirect();
        $this->error_message =$payment->gateway->error_message();
        $this->return_view =$payment->gateway->return_view();

        return $this;

    }

}