Overview

Namespaces

  • Guzzle
    • Batch
      • Exception
    • Cache
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
        • Header
      • QueryAggregator
    • Inflection
    • Iterator
    • Log
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Async
      • Backoff
      • Cache
      • Cookie
        • CookieJar
        • Exception
      • CurlAuth
      • ErrorResponse
        • Exception
      • History
      • Log
      • Md5
      • Mock
      • Oauth
    • Service
      • Builder
      • Command
        • Factory
        • LocationVisitor
          • Request
          • Response
      • Description
      • Exception
      • Resource
    • Stream
    • Tests
      • Batch
      • Cache
      • Common
        • Cache
        • Exception
      • Http
        • Curl
        • Exception
        • Message
          • Header
      • Inflection
      • Iterator
      • Log
      • Message
      • Mock
      • Parser
        • Cookie
        • Message
      • Parsers
        • UriTemplate
      • Plugin
        • Async
        • Backoff
        • Cache
        • Cookie
          • CookieJar
        • CurlAuth
        • ErrorResponse
        • History
        • Log
        • Md5
        • Mock
        • Oauth
        • Redirect
      • Service
        • Builder
        • Command
          • LocationVisitor
            • Request
            • Response
        • Description
        • Exception
        • Mock
          • Command
            • Sub
          • Model
        • Resource
      • Stream
  • None
  • Omnipay
    • Common
      • Exception
      • Message
    • Dummy
      • Message
    • VivaPayments
      • Message
  • PHP

Classes

  • Gateway
  • Overview
  • Namespace
  • Class
  • Tree

Class Gateway

Dummy Gateway

This gateway is useful for testing. It simply authorizes any payment made using a valid credit card number and expiry.

Any card number which passes the Luhn algorithm and ends in an even number is authorized, for example: 4242424242424242

Any card number which passes the Luhn algorithm and ends in an odd number is declined, for example: 4111111111111111

Example

// Create a gateway for the Dummy Gateway
// (routes to GatewayFactory::create)
$gateway = Omnipay::create('Dummy');

// Initialise the gateway
$gateway->initialize(array(
    'testMode' => true, // Doesn't really matter what you use here.
));

// Create a credit card object
// This card can be used for testing.
$card = new CreditCard(array(
            'firstName'    => 'Example',
            'lastName'     => 'Customer',
            'number'       => '4242424242424242',
            'expiryMonth'  => '01',
            'expiryYear'   => '2020',
            'cvv'          => '123',
));

// Do a purchase transaction on the gateway
$transaction = $gateway->purchase(array(
    'amount'                   => '10.00',
    'currency'                 => 'AUD',
    'card'                     => $card,
));
$response = $transaction->send();
if ($response->isSuccessful()) {
    echo "Purchase transaction was successful!\n";
    $sale_id = $response->getTransactionReference();
    echo "Transaction reference = " . $sale_id . "\n";
}
Omnipay\Common\AbstractGateway implements Omnipay\Common\GatewayInterface
Extended by Omnipay\Dummy\Gateway
Namespace: Omnipay\Dummy
Located at Gateway.php
Methods summary
public
# getName( )

Get gateway display name

Get gateway display name

This can be used by carts to get the display name for each gateway.

public array
# getDefaultParameters( )

Returns

array

Overrides

Omnipay\Common\AbstractGateway::getDefaultParameters()
public Omnipay\Dummy\Message\AuthorizeRequest
# authorize( array $parameters = array() )

Create an authorize request.

Create an authorize request.

Parameters

$parameters

Returns

Omnipay\Dummy\Message\AuthorizeRequest
public Omnipay\Dummy\Message\AuthorizeRequest
# purchase( array $parameters = array() )

Create a purchase request.

Create a purchase request.

Parameters

$parameters

Returns

Omnipay\Dummy\Message\AuthorizeRequest
Methods inherited from Omnipay\Common\AbstractGateway
__construct(), createRequest(), getCurrency(), getDefaultHttpClient(), getDefaultHttpRequest(), getParameter(), getParameters(), getShortName(), getTestMode(), initialize(), setCurrency(), setParameter(), setTestMode(), supportsAcceptNotification(), supportsAuthorize(), supportsCapture(), supportsCompleteAuthorize(), supportsCompletePurchase(), supportsCreateCard(), supportsDeleteCard(), supportsPurchase(), supportsRefund(), supportsUpdateCard(), supportsVoid()
Magic methods inherited from Omnipay\Common\GatewayInterface
authorize(), capture(), completeAuthorize(), completePurchase(), createCard(), deleteCard(), purchase(), refund(), updateCard(), void()
Properties inherited from Omnipay\Common\AbstractGateway
$httpClient, $httpRequest, $parameters
Omnipay Viva Payments Gateway Module API Documentation API documentation generated by ApiGen