public |
#
__construct( )
Constructor.
Checks that an instance hasn't already been created and checks the gateway identifier.
Adds callbacks to the appropriate hooks.
|
public |
#
getInstance( )
Get the instance (or create one) of the child class.
|
public |
#
register_gateway( $gateways )
Filters the gateways. Hooked onto eventorganiser_gateways adds the gateway and label
|
public |
#
enabled_gateway( $enabled_gateways )
Filters the gateways. Hooked onto eventorganiser_enabled_gateways. If the gateway is not enabled it is removed form the array.
|
public |
#
register_settings( )
Registers the gateway's settings with WordPress.
|
public |
#
add_settings( )
Creates gateway's settings sections and adds the gateway options as specified by child class in ::get_options(). Automatically prepends the 'live status' option.
|
public |
#
get_return_url( $booking, $form )
Get the url to return after transaction is complete. This is just a helper function and can over over-ridden by a child class.
|
public |
#
get_ipn_url( )
Returns the IPN url (url for the gateway to send instant payment notifications to). This is of the form: www.yoursite.coom?eo-listener=ipn&eo-gateway=[gateway-identifier] If you need the IPN url you can retrieve it via $this->get_ipn_url() .
|
public |
#
get_option( $key )
Returns a gateway option specified by $key . $key here is the 'name' associated to the option. as specified in ::get_option().
|
public |
#
is_enabled( )
Is the gateway enabled. This will return true if the gateway is in 'live' or 'sandbox' mode.
Enabled gateways will appear on the booking form
|
public |
#
is_live( )
Is the gateway live. This will return true only if the gateway is in 'live' mode.
|
public |
#
init( )
Called when the class is constructed, allows child class to add additional hooks if needed.
|
public |
#
get_options( )
Should be over-ridden by a child class. Specifies the options for the gateway. This should be returned as an array of options. Each option is an array specifying:
-
field_type - one of text, textarea, radio, checkbox, select
- name - lowercase alpha-numerics and dashes only!
- label - human readable label for the option
- options - array of value => label pairs for select/radio/checkbox options.
Options can be retreived by {@see subclass::get_option()}
|
public |
#
settings_section_text( )
Optional. Set the text to appear at the top of your gateway's settings section.
|
public |
#
process( $booking_id, $booking, $error, $form )
This method must be specified by a child class. It handles the payment processing of a gateway. Depending on your gateway's specifications you may need to:
- Redirect the user your paypal to complete payment offsite (e.g. PayPal)
- Collect user entered credit card details and charge the card (e.g. PayPal Pro)
- Use a generated token to process payment (e.g. Stripe)
If you wish to display an error message on the booking form simpley add an error to $error :
$error->add( 'my-error-code', 'This error message will appear on the booking form' );
|
public |
#
get_label( )
Specify a human-readable label for your gateway. This will be used for the admin settings page and the front-end. To specify a different label for the front-end you can over-ride the subclass::get_front_end_label() method.
|
public |
#
get_front_end_label( )
Specify a human-readable label for your gateway for the front-end. Defaults to subclass::get_label() method.
|
public |
#
handle_ipn( )
If you redirect the user to complete payment off-site, you will need to specify a payment notification url.
This method is fired whenever that notification url is hit. You should inspect $_POST for a response from your
payment gateway, validate it, and then take appropriate action (i.e. confirm the booking via {@see eo_confirm_booking() }).
|
public |
#
payment_form( $element )
If processing payment on-site you shall need to take credit card details from. For security reasons do not use the form customiser for this, as this saves the data unencrypted in the database. Instead use this method to add form fields for collecting credit card details.
|
public |
#
setup_form( $form, $event_id )
|
public |
#
log( $booking_id, $timestamp, $log )
|