thephpleague / omnipay-eway

eWay driver for the Omnipay PHP payment processing library
MIT License
13 stars 17 forks source link

No error message shown #27

Open ashussen opened 5 years ago

ashussen commented 5 years ago

Hi everyone,

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, and make this work?

        $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]

Thanks before.

incarnate commented 5 years ago

Hi @ashussen

Thanks for raising this issue. After a bit of digging it turns out that in the v3 upgrade the authorisation line got removed from the request. So the transaction is failing with an authorisation failure (which the Omnipay library also isn't handling gracefully).

Putting the auth back is fairly straight forward, I'll try and find some time this weekend to put it back - unless someone else would like a shot.

ashussen commented 5 years ago

@incarnate Awesome!

Thank you for your help. I end up using eWay default API. But it would be great if this can be fixed so that we can uniform all types of transaction process.

incarnate commented 5 years ago

Version 3.0.1 has been released which resolves this issue (PR #28)