Omnipay - Empty Error Message

188 views Asked by At

I have been working with this code for a while and still couldn't figure out what is the problem with it.

Maybe some of the code has a problem, but Omnipay didn't show anything as the error message.

Can anyone please help me find out my mistakes?

    $gateway = Omnipay::create('Eway_RapidDirect');
    write_log($gateway->getDefaultParameters());
    $gateway->initialize([
        'apiKey' => 'API KEY',
        'password' => 'PASSWORD',
        'testMode' => true
    ]);

   $card = new CreditCard([
      'number' => '4444333322221111',
      'expiryMonth' => '6',
      'expiryYear' => '2030',
      'cvn' => '123'
     ]
   );

   $transaction = $gateway->purchase([
       'amount'        => '10.00',
       'currency'      => 'AUD',
       'transactionId' => 'RAM0001',
       'card'          => $card,
     ]
   );

   $response = $transaction->send();
   if ($response->isSuccessful()) {
       write_log('success');
   } else {
       write_log('failed');
       write_log($response->getMessage());
   }

The code always print

[07-Aug-2018 09:07:01 UTC] failed
[07-Aug-2018 09:07:01 UTC]

Plugin github: Omnipay Eway

1

There are 1 answers

0
John C On

This issue was due to a bug in the OmniPay eWAY library where the authentication headers were not set. Making matters worse, authentication failures aren't handled gracefully, resulting in the blank error message.

Version 3.0.1 contains a fix for the missing authentication.