thephpleague / omnipay-worldpay

WorldPay driver for the Omnipay PHP payment processing library
MIT License
23 stars 18 forks source link

No data is sent to WorldPay #1

Closed knasher closed 10 years ago

knasher commented 10 years ago

Attempting to send a purchase to WorldPay results in a PurchaseResponse object being returned seemingly without any attempt being made to contact WorldPay servers?

Here's the code:

            $gateway = Omnipay::create('WorldPay');
            $gateway->setInstallationId('123456');
            $gateway->setTestMode(true);

            $data = array(
                'amount'    => '10.00',
                'card'      => array(
                    'cvv'         => '123',
                    'expiryMonth' => '6',
                    'expiryYear'  => '2016',
                    'number'      => '4242424242424242'
                ),
                'currency'  => 'GBP',
                'returnUrl' => 'http://returnurl.dev'
            );
            $response = $gateway->purchase($data)->send();

A look through the code for the plugin shows no access being attempted to WorldPay servers. What am I missing?

amacneil commented 10 years ago

You're not missing anything. Worldpay doesn't require any server to server communication, the data is sent as query parameters by the client.

Following the omnipay conventions, it returns a redirect response. You can call $response->isRedirect() and $response->redirect() to send your customer to Worldpay with the correct URL.