1

I am working on a Laravel Project where we are Payment Express. What currently we are doing is that we have Payment Express Class with static function (Not a single property) like given below:

Class PaymentExpress {

    public static function first() {

    }

    public static function second() {

    }
}

We are using a billing controller where we get's user's billing info from db and send it to PaymentExpress static functions.

Every thing is getting done by almost by the controller like checking conditions for downgrading, upgrading, pro-rate billing, then sending request to PayamentExpress by using static functions of PaymentExpress and the getting response back and processing the response save it in db. Our controller for billing looks like below:

class BillingController {
    public function billPayment() {

    }

    public function billingPaymentProcessResponse() {

    }
    public function smsPayment() {

    }

    public function billingPaymentProcessResponse() {

    }

}

We have too much lengthy functions like 200 lines or more. I know it's not a good practice and our code is not reusable.

But I don't know how to divide it into parts so that not only it should become a reusable but also easily testable.

How can I do this? I know that I'm not providing code here but you guys can help me with out the code by letting me know the process of writing clean, reusable and easily testable package/module etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.