GuzzleHttp Error: Call to undefined method GuzzleHttp\Client::sendAsync()

荒凉一梦 提交于 2021-01-29 20:43:04

问题


I am using GuzzleHttp 6.5.5

Setting up payment gateway AuthorizeNet.

Composer.json file is

"require": {
        "league/omnipay": "^3.0",
        "academe/omnipay-authorizenetapi": " ~3.0",
        "php-http/guzzle6-adapter": "1.1.1"
    }

Payment Code:

 require_once('assets/import/authorizenet/vendor/autoload.php');
        $gateway = Omnipay\Omnipay::create('AuthorizeNetApi_Api');
  
        $gateway->setAuthName($pt->config->anet_login_id);
        $gateway->setTransactionKey($pt->config->anet_transaction_id);
        $gateway->setTestMode(true);
  
        $creditCard = new Omnipay\Common\CreditCard([
          // Swiped tracks can be provided instead, if the card is present.
          'number' => '4000123412341234',
          'expiryMonth' => '12',
          'expiryYear' => '2020',
          'cvv' => '123',
          // Billing and shipping details can be added here.
        ]);
        if (!empty($_POST['pay_type']) && $_POST['pay_type'] == 'rent' && !empty($video->rent_price)) {
          $final_amount = $amount = $video->rent_price;
        }
        else{
          $final_amount = $amount = $video->sell_video;
        }
      
        $transactionId = rand(100000000, 999999999);
        $billingData = [
          'amount' => $final_amount,
          'transactionId' => $transactionId,
          'card'=>$creditCard,
          'currency' => $pt->config->anet_currency,
        ];
 
    $request = $gateway->authorize($billingData);
    $response = $request->send();
    $data = $response->getData();
 

When trying to send payment request got this error:

Error: Call to undefined method GuzzleHttp\Client::sendAsync() in ...authorizenet/vendor/php-http/guzzle6-adapter/src/Client.php on line 6

I didn't found any solution

What should I do to make it work?

来源:https://stackoverflow.com/questions/63287286/guzzlehttp-error-call-to-undefined-method-guzzlehttp-clientsendasync

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!