<commit_before><?php

namespace Adrianbarbos\Mobilpay;

use Omnipay\Omnipay;

class MobilpayGateway
{
    protected $data;

    use DataTrait;

    public function __construct()
    {
        $this->initData();
    }

    public function purchase($autoRedirect = true)
    {
        $gateway = Omnipay::create('MobilPay');
        $gateway->setMerchantId(config('mobilpay.merchant_id'));
        $gateway->setPublicKey(config('mobilpay.public_key_path'));

        $response = $gateway->purchase($this->data)->send();

        if ($autoRedirect) {
            $response->redirect();
        }

        return $response;
    }

    public function response()
    {
        $gateway = Omnipay::create('MobilPay');
        $gateway->setPrivateKey(config('mobilpay.private_key_path'));

        $response = $gateway->completePurchase($_POST)->send();
        $response->sendResponse();

        return $response;
    }
}<commit_msg>added flag for not sending reponse automatically<commit_after><?php

namespace Adrianbarbos\Mobilpay;

use Omnipay\Omnipay;

class MobilpayGateway
{
    protected $data;

    use DataTrait;

    public function __construct()
    {
        $this->initData();
    }

    public function purchase($autoRedirect = true)
    {
        $gateway = Omnipay::create('MobilPay');
        $gateway->setMerchantId(config('mobilpay.merchant_id'));
        $gateway->setPublicKey(config('mobilpay.public_key_path'));

        $response = $gateway->purchase($this->data)->send();

        if ($autoRedirect) {
            $response->redirect();
        }

        return $response;
    }

    public function response($autoSendResponse = true)
    {
        $gateway = Omnipay::create('MobilPay');
        $gateway->setPrivateKey(config('mobilpay.private_key_path'));

        $response = $gateway->completePurchase($_POST)->send();

        if ($autoSendResponse) {
            $response->sendResponse();
        }

        return $response;
    }
}
{'fraction_non_alphanumeric': 0.1400916963830871, 'fraction_numerical': 0.0, 'mean_word_length': 2.776923076923077, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5595257', 'n_tokens_mistral': 609, 'n_tokens_neox': 594, 'n_words': 91}