classes/php5_classes/RecurringBilling.class.php

Properties

Description

Holds the geoRecurringBilling object class.

Classes

geoRecurringBilling

Properties

 
 
System  
No 
No 

Description

The geoRecurringBilling object, an object representation of a recurring billing in the system.
One geoRecurringBilling object per item that has recurring billing to auto renew (or auto whatever) an item based on if auto payments are kept active or not.

Methods

addTransaction, cancel, detachTransaction, get, getAllForUser, getCycleDuration, getGateway, getId, getItemType, getOrder, getOrderId, getOrderItem, getPaidUntil, getPricePerCycle, getRecurringBilling, getSecondaryId, getStartDate, getStatus, getTransaction, getUserId, getUserMessage, initRegistry, initTransactions, processPayment, remove, save, serialize, set, setCycleDuration, setGateway, setId, setItemType, setOrder, setPaidUntil, setPricePerCycle, setSecondaryId, setStartDate, setStatus, setUserId, setUserMessage, touch, unSerialize, updateStatus,

addTransaction( \geoTransaction   $transaction, ) : boolean

Description

Adds a transaction to this recurring billing. The transaction CAN be not serialized yet, if that is the case it will be added to the new array inside of the transactions array.

Arguments

Name Type Description Default
$transaction \geoTransaction

Return value

Type Description
boolean true if add was successful, false otherwise.

cancel( string   $reason = '', bool   $alreadyCanceledInGateway = false, ) : bool

Description

This calls on the gateway to cancel the recurring billing, and then calls the order item to let it know the recurring billing has been canceled so it can act accordingly.

Arguments

Name Type Description Default
$reason string

If specified, will pass to payment gateway as reason recurring billing was canceled, but it depends on each payment gateway whether it will be used or not. Example of use might be "user canceled".

''
$alreadyCanceledInGateway bool

If true, signifies that the recurring billing is already known to be canceled by the payment gateway, so it will skip notifying the payment gateway of the cancelation. True is a special case that should only be used by the gateway itself.

false

Return value

Type Description
bool True if call to payment gateway to cancel recurring is good, false if there was a problem at the payment gateway stage.

detachTransaction( int   $transaction_id, ) : n/a

Description

Detaches a transaction from this invoice object.

Arguments

Name Type Description Default
$transaction_id int

Return value

Type Description
n/a n/a

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.

getAllForUser( int   $userId, bool   $returnObjects = true, bool   $skipUserCheck = false, ) : array

Description

Gets an array of all the recurring billing objects for the specified user.

Arguments

Name Type Description Default
$userId int

The user id. If passing in 0, must set $skipUserCheck to true to get any results.

$returnObjects bool

if false, only return an array of recurring billing ID's

true
$skipUserCheck bool

If true, will skip check on user ID and get all recurring billings even if user id is 0.

false

Return value

Type Description
array An array of recurring billing objects, or recurring ID's, depending on $returnObjects is true or false

Tags

Name Description
since Version 4.1.2

getCycleDuration( ) : int

Description

Gets the cycle duration in seconds.

Return value

Type Description
int The cycle duration in seconds.

getGateway( ) : \geoPaymentGateway

Description

Gets the payment gateway used for this recurring billing.

Return value

Type Description
\geoPaymentGateway

getId( ) : int

Description

Gets the ID for this recurring billing.

Return value

Type Description
int

getItemType( ) : string

Description

Gets the item type, since a recurring billing can out-live the order item, need to have reference to original order item type.

Return value

Type Description
string

getOrder( ) : \geoOrder

Description

Gets the order this recurring billing is attached to.

Return value

Type Description
\geoOrder

getOrderId( ) : int

Description

Gets the original order ID, can be used even if order is not around any more. Where getOrder might return null, this might return the order ID.

Return value

Type Description
int

getOrderItem( ) : \geoOrderItem

Description

Gets the main order item attached to the order for this recurring billing, or boolean false if not.
.

Return value

Type Description
\geoOrderItem

getPaidUntil( ) : int

Description

Get the paid until timestamp currently set.

Return value

Type Description
int The timestamp this recurring billing is paid through

getPricePerCycle( ) : float

Description

Gets the price charge per cycle.

Return value

Type Description
float

getRecurringBilling( int|string   $id, ) : \geoRecurringBilling

Description

Get a recurring billing object according to it's ID

Arguments

Name Type Description Default
$id int|string

Either the internal ID or the secondary ID

Return value

Type Description
\geoRecurringBilling

getSecondaryId( ) : string

Description

Get the secondary ID for this recurring billing.

Return value

Type Description
string

getStartDate( ) : int

Description

Get the start date, that is the first time the recurring billing was charged.

Return value

Type Description
int The timestamp this recurring billing started on.

getStatus( ) : string

Description

Get the current status for the recurring billint. Statuses recognized by system: geoRecurringBilling::STATUS_ACTIVE = recurring billing was paid up and active at last check.
geoRecurringBilling::STATUS_CANCELED = do not automatically check status of recurring billing after paidUntil is past, or do any other processing. Any others - considered "in between" status, it's not active but it could become active at a later date. Can be specific to payment gateway, and may be displayed to client and/or admin.

Return value

Type Description
string

getTransaction( int   $id = 0, ) : \geoTransaction|\array(geoTransaction)

Description

Gets a transaction object attached to this recurring billing, specified by the ID, or an array of all the transaction objects attached to this invoice if no ID is specified.

Arguments

Name Type Description Default
$id int 0

Return value

Type Description
\geoTransaction|\array(geoTransaction) object if ID is valid, or array of all transaction objects if id is 0, or null if id is not valid.

getUserId( ) : int

Description

Gets the user ID this recurring billing is for, if that is applicable for this recurring billing. Will be 0 if not applicable.

Return value

Type Description
int

getUserMessage( ) : string

Description

Gets the "temporary" user message previously set by setUserMessage earlier in the page load, if any was set.

Return value

Type Description
string

initRegistry( ) : n/a

Description

Used internally to init registry

Return value

Type Description
n/a n/a

initTransactions( ) : n/a

Description

initializes transactions, used internally.

Return value

Type Description
n/a n/a

processPayment( \geoTransaction   $transaction, int   $paidUntil = 0, ) : n/a

Description

Use to process a new payment for a recurring billing, for a transaction that extends the time and costs money. Also triggers order item hook to allow "affiliate" type order items hooks to work.

Arguments

Name Type Description Default
$transaction \geoTransaction

The transaction, with all of the details of the transaction (other than the attached recurring billing) already set.

$paidUntil int

Timestamp for the "new" paid-util date due to the new payment that was received. If not specified, will assume "now + recurringDuration"

0

Return value

Type Description
n/a n/a

Tags

Name Description
since Version 7.1.0

remove( int   $id, bool   $removeAttached = true, ) : n/a

Description

Removes specified recurring billing given the ID

Arguments

Name Type Description Default
$id int
$removeAttached bool true

Return value

Type Description
n/a n/a

save( ) : n/a

Description

Just a wrapper function for serialize()

Return value

Type Description
n/a n/a

serialize( ) : n/a

Description

If there are any changes, this saves the data in this recurring billing object to the DB.

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

setCycleDuration( int   $cycleDuration, ) : n/a

Description

Sets the cycle duration for this recurring billing.

Arguments

Name Type Description Default
$cycleDuration int

The cycle duration in seconds.

Return value

Type Description
n/a n/a

setGateway( \geoPaymentGateway|string   $gateway, ) : n/a

Description

Sets the payment gateway.

Arguments

Name Type Description Default
$gateway \geoPaymentGateway|string

Either the geoPaymentGateway object, or string of the gateway name.

Return value

Type Description
n/a n/a

setId( int   $id, ) : n/a

Description

Sets the internal ID for this recurring billing.

Arguments

Name Type Description Default
$id int

Return value

Type Description
n/a n/a

setItemType( string   $itemType, ) : n/a

Description

Sets the item type.

Arguments

Name Type Description Default
$itemType string

Return value

Type Description
n/a n/a

setOrder( \geoOrder|int   $order, ) : n/a

Description

Set the order attached to this recurring billing.

Arguments

Name Type Description Default
$order \geoOrder|int

Either the order object or the order id.

Return value

Type Description
n/a n/a

setPaidUntil( int   $timestamp, ) : n/a

Description

Sets the timestamp for when this recurring billing is currently paid through.

Arguments

Name Type Description Default
$timestamp int

Return value

Type Description
n/a n/a

setPricePerCycle( float   $price, ) : n/a

Description

Sets the price per cycle for this recurring billing.

Arguments

Name Type Description Default
$price float

Return value

Type Description
n/a n/a

setSecondaryId( string   $id, ) : n/a

Description

This is REQUIRED for every recurring payment, or your gateway will only be able to have 1 recurring payment.
Sets the secondary ID for this recurring billing, needs to be unique for this recurring billing's gateway or it will fail upon saving. Also, note that this CANNOT be an int, or it will not be set. If you wish to use an int, prepend it with a string like "myid_###" or similar. Even if there is any chance it could be interpreted as a numeric value, prepend it with a string. Max length for secondaryID is 255, if you need something longer it is recommended to set this to the first 255 chars, then set the full to registry like $recurring->set('fullId', $fullId); but remember the first 255 chars must be unique

Arguments

Name Type Description Default
$id string

Return value

Type Description
n/a n/a

setStartDate( int   $timestamp, ) : n/a

Description

Sets the timestamp for when this recurring billing started on.

Arguments

Name Type Description Default
$timestamp int

Return value

Type Description
n/a n/a

setStatus( string   $status, ) : n/a

Description

Sets the status of this recurring billing. Statuses recognized by system: geoRecurringBilling::STATUS_ACTIVE = recurring billing was paid up and active at last check.
geoRecurringBilling::STATUS_CANCELED = do not automatically check status of recurring billing after paidUntil is past, or do any other processing. Any others - considered "in between" status, it's not active but it could become active at a later date. Can be specific to payment gateway, and may be displayed to client and/or admin.

Arguments

Name Type Description Default
$status string

Return value

Type Description
n/a n/a

setUserId( int   $userId, ) : n/a

Description

Sets the user ID for this recurring billing.

Arguments

Name Type Description Default
$userId int

Return value

Type Description
n/a n/a

setUserMessage( string   $message, ) : n/a

Description

Sets a user message for this page load and this recurring billing that can later be retrieved.

Arguments

Name Type Description Default
$message string

Return value

Type Description
n/a n/a

touch( ) : n/a

Description

Touch this recurring billing object, indicating that there are changes to be saved on serialize.

Return value

Type Description
n/a n/a

unSerialize( \number   $id = 0, ) : n/a

Description

un-serialize, as in, get the info from the db

Arguments

Name Type Description Default
$id \number 0

Return value

Type Description
n/a n/a

updateStatus( bool   $gatewayUpdates = true, bool   $itemUpdates = true, ) : n/a

Description

Calls upon the payment gateway used for this recurring billing to get an updated status, and to refresh the paid until var for this billing.

Arguments

Name Type Description Default
$gatewayUpdates bool

If false, will skip over alerting the payment gateway to update the status on the recurring billing.

true
$itemUpdates bool

If false, will skip over alerting the order item that the status on the recurring billing may have just been changed.

true

Return value

Type Description
n/a n/a

Properties

$_cycleDuration, $_gateway, $_id, $_itemType, $_order, $_paidUntil, $_pendingChanges, $_pricePerCycle, $_recurringBillings, $_registry, $_secondaryId, $_startDate, $_status, $_transactions, $_userId, $_userMessage,

int  private  $_cycleDuration =

The cycle duration in seconds


\geoPaymentGateway  private  $_gateway =

Each recurring billing is married to a specific gateway, this is that gateway.


int  private  $_id =

The internal ID for this recurring billing.


string  private  $_itemType =

The order item type, since the order won't always be around need to know who to process this guy through later down the road.


\geoOrder  private  $_order =

The order this recurring item is attached to. The order will hold a lot of the data, such as the user.


int  private  $_paidUntil =

Date that this recurring payment has been paid until.


boolean  private  $_pendingChanges =

Used internally to remember whether there has been changes to the recurring billing since it was last serialized. If there is not changes, when serialize is called, nothing will be done.


float  private  $_pricePerCycle =

The price charged for every cycle.


array  private  static $_recurringBillings =

Array of recurring billing objects that have been retrieved in this page load.


\geoRegistry  private  $_registry =

The registry for this recurring billing, holds misc. data needed for specific gateways.


string  private  $_secondaryId =

A secondary ID to identify according to some external ID, needs to be unique between all recurring billing's with the same gateway.


int  private  $_startDate =

Date that the first payment was made on for this recurring billing.


string  private  $_status =

Current status of the recurring billing, or last known status.


array  private  $_transactions =

An array of all the transactions in this recurring billing item

Array of geoTransaction objects (or id's for transactions)




int  private  $_userId =

The user id this recurring billing is "for", if applicable.


string  private  $_userMessage =

Used to save a "user message" that can be set and retrieved to allow gateways to specify specific messages in certain scenarios.


Constants

  STATUS_ACTIVE = 'active'

Use this to indicate that the current status is active for setStatus.


  STATUS_CANCELED = 'canceled'

Indicates a canceled recurring billing, which means it cannot be resumed so no further processing is done for that recurring billing.


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.