classes/php5_classes/PaymentGateway.class.php

Properties

Description

Holds the geoPaymentGateway class.

Classes

geoPaymentGateway

Properties

 
 
System  
No 
No 

Description

This class should be extended by each different payment gateway, this will have some default functions that each gateway will inherit, and also has a few final static methods used by the system to affect all order items.

Methods

__construct, _createNewRecurringLogTransaction, _failure, _initRecurring, _showCommonAdminOptions, _submitViaPost, _success, _successFailurePage, _updateCommonAdminOptions, callDisplay, callUpdate, gatewayExists, get, getDefault, getDisplayOrder, getEnabled, getGroup, getMaxDisplayOrder, getName, getPaymentGateway, getPaymentGatewayOfType, getRecurringAgreement, getTitle, getType, initRegistry, isRecurring, loadGateways, recurringCancel, recurringUpdateStatus, removeGroupPaymentGateways, save, serialize, set, setDefault, setDisplayOrder, setEnabled, setGroup, setName, setType, unSerialize,

__construct( ) : n/a

Description

Constructor for gateway

Return value

Type Description
n/a n/a

_createNewRecurringLogTransaction( \geoRecurringBilling   $recurring, \geoPaymentGateway   $gateway, ) : \geoTransaction

Description

Create a new transaction, specifically for logging some event for recurring billing. This is meant to be used for transactions that are not for payments, things like logging when it is canceled or payment attempt made or similar.

Arguments

Name Type Description Default
$recurring \geoRecurringBilling
$gateway \geoPaymentGateway

Return value

Type Description
\geoTransaction

Tags

Name Description
since Version 6.0.6

_failure( \geoTransaction   $transaction, string   $errorCode, string   $errorMessage, bool   $skipDisplay = false, ) : n/a

Description

Does common stuff for orders that fail

Arguments

Name Type Description Default
$transaction \geoTransaction
$errorCode string
$errorMessage string
$skipDisplay bool

True to skip showing the failure page automatically.

false

Return value

Type Description
n/a n/a

_initRecurring( \geoOrder   $order, \geoPaymentGateway   $gateway, \geoOrderItem   $item, ) : \geoRecurringBilling

Description

Can be used by payment gateways to get or create a recurring billing item for use when processing payment.

Arguments

Name Type Description Default
$order \geoOrder
$gateway \geoPaymentGateway
$item \geoOrderItem

Return value

Type Description
\geoRecurringBilling

_showCommonAdminOptions( bool   $canTest = true, bool   $isRecurring = false, ) : string

Description

Use this to get the HTML for the common settings that most gateways will need to have, such as "Reqire Admin Approval" and "Account Status".
Note that this function won't do the saving for you, for that you need to call _updateCommonAdminOptions()

Arguments

Name Type Description Default
$canTest bool

false if gateway does not support a switchable "testing mode", otherwise true

true
$isRecurring bool

Whether or not should show recurring settings

false

Return value

Type Description
string HTML needed to display the settings

_submitViaPost( string   $url, array   $fields, bool   $skipExit = false, ) : n/a

Description

Creates a form and submits it with javascript.
Useful when a gateway requires data be sent via non-asynchronous POST (so cURL won't do the trick), Handy when the visitor needs to be sent to the gateway's site but requires data sent via POST instead of GET.

Arguments

Name Type Description Default
$url string

the url to submit to

$fields array

Post fields to include in the submission

$skipExit bool

true to NOT include app_bottom and exit

false

Return value

Type Description
n/a n/a

Tags

Name Description
since Version 6.0.0

_success( \geoOrder   $order, \geoTransaction   $transaction, \geoPaymentGateway   $gateway, bool   $skipDisplay = false, ) : n/a

Description

Does common tasks when a transaction was successful. Only call if invoice is paid off, because this will set the order to active (or pending if require admin approve is turned on)

Arguments

Name Type Description Default
$order \geoOrder
$transaction \geoTransaction
$gateway \geoPaymentGateway
$skipDisplay bool

True to skip showing the success page automatically.

false

Return value

Type Description
n/a n/a

_successFailurePage( bool   $success = false, string   $status = 'pending', bool   $render = true, \geoInvoice   $invoice = null, ) : n/a

Description

Displays a page informing user of success/failure of payment

Arguments

Name Type Description Default
$success bool

true for success, false for failure.

false
$status string

Status of the order, in other words, what would be returned by $order->getStatus()

'pending'
$render bool

If false, will not actually display the page, will just get the view class ready to display

true
$invoice \geoInvoice

Optional, if provided, will add a link to the invoice on the order complete page. Param added in version 6.0.0

null

Return value

Type Description
n/a n/a

_updateCommonAdminOptions( array   $settings, bool   $isRecurring = false, ) : n/a

Description

Update the common admin options, the options that are displayed using {@see geoPaymentGateway::_displayCommonAdminOptions()}

Arguments

Name Type Description Default
$settings array
$isRecurring bool false

Return value

Type Description
n/a n/a

callDisplay( string   $call_name, mixed   $vars = null, string   $seperater = '', string|array   $gateway_name = '', bool   $force_enabled = true, ) : string

Description

Calls the specified display function for the gateway specified, or all of the gateways if no specific gateway is specified, and seperates the returned responses from each of the gateways by $seperater
IMPORTANT: This leaves it up to each gateway to make sure that gateway is turned on and all that, and that input is cleaned.

Arguments

Name Type Description Default
$call_name string
$vars mixed null
$seperater string ''
$gateway_name string|array ''
$force_enabled bool

If false, gateway does not have to be enabled to make this call

true

Return value

Type Description
string

callUpdate( string   $call_name, mixed   $vars = null, string|array   $gateway_name = '', bool   $force_enabled = true, ) : n/a

Description

Calls the specified update function for the gateway specified, or all of the payment gateways if no specific gateway is specified.
IMPORTANT: This leaves it up to each gateway to make sure that gateway is turned on and all that, and that input is cleaned.

Arguments

Name Type Description Default
$call_name string
$vars mixed null
$gateway_name string|array ''
$force_enabled bool

If false, gateway does not have to be enabled to make this call

true

Return value

Type Description
n/a n/a

gatewayExists( string   $gateway_name, ) : boolean

Description

Find whether the given gateway exists or not.

Arguments

Name Type Description Default
$gateway_name string

Return value

Type Description
boolean

get( string   $item, mixed   $default = false, ) : Mixed

Description

Gets the specified item from the registry, or if item is one of the "main" items it gets that instead.

Arguments

Name Type Description Default
$item string
$default mixed

What to return if the item is not set.

false

Return value

Type Description
Mixed the specified item, or false if item is not found.

getDefault( ) : bool

Description

Gets whether this is the default payment gateway or not.

Return value

Type Description
bool

getDisplayOrder( bool   $skipAutoAdd = false, ) : int

Description

Gets the display order.

Arguments

Name Type Description Default
$skipAutoAdd bool

If true, it will not automatically add the payment gateway to the settings in the admin.

false

Return value

Type Description
int

getEnabled( ) : bool

Description

Gets whether this payment gateway is enabled or not.

Return value

Type Description
bool

getGroup( ) : int

Description

Gets the current group set for this page load.

Return value

Type Description
int

getMaxDisplayOrder( ) : int

Description

Gets the current max display order.

Return value

Type Description
int

getName( ) : string

Description

Gets the name of the payment gateway.

Return value

Type Description
string

getPaymentGateway( string   $gateway_name, ) : \geoPaymentGateway|null

Description

Gets a gateway object according to the name

Arguments

Name Type Description Default
$gateway_name string

Return value

Type Description
\geoPaymentGateway|null will return null if gateway not found.

getPaymentGatewayOfType( string   $type, ) : array

Description

Gets an array of gateways matching the given gateway type.

Arguments

Name Type Description Default
$type string

Type of gateway, "recurring" to return gateways that handle recurring payments, or "all" to return all enabled gateways, or "really_all" to get all gateways, even ones not enabled. (really_all added in version 7.2.2)

Return value

Type Description
array

getRecurringAgreement( ) : array|bool

Description

The recurring billing user agreement label and text, should return an array.
Only used if isRecurring returns true and it is recurring payment.

Return value

Type Description
array|bool Either bool false if no agreement shown, or an array like: array ('label' => 'label text', 'text' => 'text in agreement box.')

getTitle( ) : string

Description

Needs to be over-loaded to return a title for this gateway, to be displayed in the admin or other areas. For instance the "name" might be "account_balance" but the title might be "Account Balance"

Return value

Type Description
string

getType( ) : string

Description

Gets the payment gateway type.

Return value

Type Description
string

initRegistry( ) : n/a

Description

initializes the registry for this payment gateway object.

Return value

Type Description
n/a n/a

isRecurring( ) : bool

Description

Whether or not the gateway handles recurring payments, if not implemented the superclass defaults to return false.

Return value

Type Description
bool

loadGateways( string   $dirname = '', bool   $force_serialize = true, ) : n/a

Description

Loads all of the gateway objects into an array.

Arguments

Name Type Description Default
$dirname string

Used internally, just leave it at default.

''
$force_serialize bool

Used internally, just leave it at default.

true

Return value

Type Description
n/a n/a

recurringCancel( \geoRecurringBilling   $recurring, string   $reason = '', ) : n/a

Description

Called to cancel the recurring billing, to stop payments. Gateway should do whatever is needed to cancel the payment status.

Arguments

Name Type Description Default
$recurring \geoRecurringBilling
$reason string

The reason for the cancelation

''

Return value

Type Description
n/a n/a

recurringUpdateStatus( \geoRecurringBilling   $recurring, ) : n/a

Description

Called to query the gateway to see the status of the recurring billing, and update the recurring billing's paidUntil status, update main status (for gateways that choose to use that), add a recurring billing transaction if applicable, etc.

Arguments

Name Type Description Default
$recurring \geoRecurringBilling

Return value

Type Description
n/a n/a

removeGroupPaymentGateways( int   $group, ) : bool

Description

Removes the specified group specific settings, usualyl called from admin.

Arguments

Name Type Description Default
$group int

Return value

Type Description
bool true on success, false on failure.

save( ) : n/a

Description

Alias of geoPaymentGateway::serialize() - see that method for details.

Return value

Type Description
n/a n/a

serialize( ) : n/a

Description

Serializes the current payment gateway settings (saves changes in the database, or creates new transaction if the id is not set. If it is a new order, it will set the order item ID after it has been inserted into the database.
Also automatically serializes any objects attached to it that are not already serialized.

Return value

Type Description
n/a n/a

set( string   $item, mixed   $value, ) : n/a

Description

Sets the given item to the given value. If item is one of built-in items, it sets that instead of something from the registry.

Arguments

Name Type Description Default
$item string
$value mixed

Return value

Type Description
n/a n/a

setDefault( bool   $val, ) : n/a

Description

Sets whether this is the default payment gateway or not.

Arguments

Name Type Description Default
$val bool

Return value

Type Description
n/a n/a

setDisplayOrder( int   $val, ) : n/a

Description

Sets the display order.

Arguments

Name Type Description Default
$val int

Return value

Type Description
n/a n/a

setEnabled( bool   $val, ) : n/a

Description

Set whether the gateway is enabled or not.

Arguments

Name Type Description Default
$val bool

Return value

Type Description
n/a n/a

setGroup( int   $group, bool   $force_new = false, ) : \unknown_type

Description

Set the group specific setting for the rest of this page load (until it is changed again anyways).

Arguments

Name Type Description Default
$group int
$force_new bool

If group specific setting is not found, and this is true, will create group specific settings for this group. Otherwise it would just default to default settings.

false

Return value

Type Description
\unknown_type

setName( string   $name, ) : n/a

Description

Set the name for the payment gateway. Probably not used much, isntead the $name should just be set to the name for each gateway.

Arguments

Name Type Description Default
$name string

Return value

Type Description
n/a n/a

setType( string   $type, ) : n/a

Description

Sets the payment gateway type, but for this page load only, recommended to just set the $type var directly.

Arguments

Name Type Description Default
$type string

Return value

Type Description
n/a n/a

unSerialize( string   $name = 0, ) : n/a

Description

Unserializes the object for the given gateway name and applies parameters to this object.

Arguments

Name Type Description Default
$name string

The gateway name

0

Return value

Type Description
n/a n/a

Properties

$_pendingChanges, $default, $displayOrder, $enabled, $gateways, $group, $name, $registry, $successFailShown, $type,

bool  protected  $_pendingChanges =

Whether or not there are changes that would need to be saved


bool  public  $default =

Whether or not this gateway is the default gateway or not


int  public  $displayOrder =

The display order. Do NOT access directly, use set/get methods instead.


bool  public  $enabled =

Whether enabled or not. Do NOT access directly, use set/get methods instead.


\array(geoPaymentGateway)  private  static $gateways =

Array of gateways


int  public  static $group = 0

The current user's group ID


string  public  $name =

The gateway name. Do NOT access directly, use set/get methods instead.


\geoRegistry  public  $registry =

The gateway registry


bool  private  static $successFailShown = false

Whether or not success/failure page has shown yet or not


string  public  $type =

The gateway type. Do NOT access directly, use set/get methods instead.


Documentation was generated by phpDocumentor 2.2.0 .

Namespaces

  • global

    Packages

    • Default
      • ExampleAddon
        • addon_example_admin
          In charge of doing stuff on the admin side, this is optional.
        • addon_example_info
          Required class for addons, this is the Addon information class, used by the addon system to determine what the addon can do. Also contains info about the addon that can be viewed in the addon management page in the admin.
        • addon_example_pages
          Addon page class, used by the addon system to display pages on the client side.
        • addon_example_setup
          This class is not required. If it, and the function for a particular routine exist, then that function will be called IN ADDITION TO the automated routines of the addon framework.
        • addon_example_tags
          Expects one function for each tag. Function name should be the same as the tag name. Can also have a constructor if anything needs to be constructed.
        • addon_example_util
          This is where to put functions that the main part of the addon will use.
        • eWidgetOrderItem
          This order item is designed to allow users on your site to purchase an eWidget.
      • System
        • DataAccess
          This is the main Database access object.
        • Singleton
          Singleton method class
        • _templateOrderItem
          Developers: use this file as a template to create a new order item.
        • _templatePaymentGateway
          This is the "developer template" payment gateway handler, a developer could use this file as a starting point for creating a new payment gateway in the system.
        • geoAPI
          The main system class for receiving and handling remote API calls, this acts as a translation layer between the communication with the "outside" and each API call.
        • geoAddon
          This is the class that handles anything and everything to do with addons.
        • geoArrayTools
          Utility functions for manipulating arrays
        • geoBrowse
          Contains functions common to browsing listings
        • geoBrowsingFilter
          System for activating, storing, and deactivating browsing filters.
        • geoCJAX
          Class that wraps the CJAX_FRAMEWORK, used to get the CJAX class.
        • geoCache
          This is the main part of the Geo cache system, it does all the "low level" stuff like writing files and escaping cache data.
        • geoCacheModule
          Part of Geo Cache system, specifically tuned to work best with cacheing module data (which will be an array).
        • geoCachePage
          Cache system specifically tuned to work best with cacheing output of pages and modules
        • geoCacheSetting
          Part of Geo Cache system, specifically tuned to work best with cacheing site-wide key=value type settings.
        • geoCacheText
          Part of Geo Cache system, this part specifically tuned to work best with cacheing language specific messages.
        • geoCalendar
          Holds utility method(s) for manipulating stuff dealing with calendar selector.
        • geoCart
          This class is behind the cart, loading all the order items and such and displaying, and processing all the different pages.
        • geoCategory
          Utility class that holds various methods to do stuff with categories in the system.
        • geoCombineResources
          This class helps to combine CSS and JS files, minify them, and optionally compress them.
        • geoCron
          This is the cron job backend, it handles all the communication and security and all that.
        • geoCrypt
          Class to use for encrypting information that needs to be able to be retrieved later.
        • geoDate
          Holds utility method(s) for manipulating stuff dealing with dates.
        • geoEmail
          Class that sends out e-mails.
        • geoFields
          Class that holds settings information for fields to use.
        • geoFieldsField
          A mini object to hold data about a specific field.
        • geoFile
          As the name implies, this is used for file-based utility methods.
        • geoFilter
          A few utility methods, good for filtering stuff.
        • geoFormatString
          Used to display a message nice and pretty, we'll probably be getting rid of this class though so don't go crazy using it.
        • geoHTML
          Class to generate chunks of HTML that are very common, used the most in the admin panel.
        • geoImage
          This class is responsible for a lot of the image processing, along with other aspects like generating the image tag for thumbnails.
        • geoInvoice
          This is the invoice object representing an invoice in the system.
        • geoLeveledField
          Class for doing common things with leveled fields.
        • geoListing
          A listing object, basically a container object for particular listing.
        • geoListingDisplay
          This is basically a container that is responsible for helping to display {listing .
        • geoListingFeed
          Class that helps to render RSS or other types of feeds based on list of listings.
        • geoMaster
          This is dedicated class for getting the value of, and setting, the various "master switches" within the software. Since this is meant as an easy way to get the values of master switches, most of the methods are static.
        • geoNumber
          Utility functions relating to number conversion/manipulation/validation ect.
        • geoOrder
          The geoOrder object, an object representation of an order in the system.
        • geoOrderItem
          The class that all order items must extend.
        • geoPC
          Used for login credential validation, password hashing, etc. along with software licensing.
        • geoPagination
          Utility functions useful for generating pagination of a results page such as when browing ads or searching
        • geoPaymentGateway
          This class should be extended by each different payment gateway, this will have some default functions that each gateway will inherit, and also has a few final static methods used by the system to affect all order items.
        • geoPlanItem
          A container to hold settings for a particular order item type, according to price plan ID, and optionally category ID for category specific settings.
        • geoRecurringBilling
          The geoRecurringBilling object, an object representation of a recurring billing in the system.
        • geoRegion
          Stuff for regions and sub-regions.
        • geoRegistry
          Handy little object, can be used to set registry type settings.
        • geoSearchUtils
          Class for search utilities.
        • geoSellerBuyer
          Handles back-end for the seller/buyer payment gateways, to allow the buyer to more easily pay the seller for a won auction. This handles the underlying system, but the actual work is done by individual seller/buyer gateways, for instance the Paypal buy-now functionality.
        • geoSession
          Manages session storage and session cookies for user sessions.
        • geoString
          Utility functions relating to languages and string manipulation.
        • geoStringData
          This class is to store accented chars, to be used by {@link geoString::removeAccents()}, mainly to keep the String.class.php file un-cluttered.
        • geoTable
          NOT FULLY IMPLEMENTED! Do not use this class yet as it is not finished and may change drastically before we are done with it, or may even be removed.
        • geoTableRow
          NOT FULLY IMPLEMENTED! Do not use this class yet as it is not finished and may change drastically before we are done with it, or may even be removed.
        • geoTableRowset
          NOT FULLY IMPLEMENTED! Do not use this class yet as it is not finished and may change drastically before we are done with it, or may even be removed.
        • geoTableSelect
          Class used to generate a select query, useful when multiple areas want to affect a single query, for instance when generating a search query and there are addons involved.
        • geoTables
          Used to hold database table names, used throughout the code.
        • geoTemplate
          Template object that extends the Smarty class (a 3rd party library) to enable using templates to display things.
        • geoTransaction
          This is the object used for a transaction in the order and invoice system.
        • geoUser
          An object representative of a certain user in the system.
        • geoUserRating
          Store, retrieve, and display inter-user ratings
        • geoUtil
          Misc utility functions
        • geoView
          As the name implies, this is used for creating the page view. It does take a little setup (like any class), the setup is normally done in the display_page method in geoSite, or display_page in geoAdmin if displaying a page in the admin.
        • iApiTransport
          Interface for API Transports, a transport must implement this interface for the system to use it.
        • iOrderItem
          You cannot have abstract static functions, so instead need to have an interface to force the given static functions to be defined.
        • metaDbTables
          Used so that old locations that use the old name geoTables will still work.