This is the API docs for LemonStand V1, which has been discontinued. LemonStand is now a cloud based platform, available at lemonstand.com.

LemonStand API

Shop_PaymentMethod class

Defined in /modules/shop/models/shop_paymentmethod.php, lines 20-1026
Inheritance Phpr_Extension » Phpr_Extensible » Phpr_Validatable » Db_Base » Db_WhereBase » Db_SqlBase » Db_ActiveRecord » Shop_PaymentMethod
Author LemonStand eCommerce Inc.
Represents a payment method. Object if this class is available through the $payment_method property of the Shop_Order class. Also, a collection of payment method objects is available on the Payment Method step of the Checkout process.

Public properties

Show inherited properties.

Property Type Description Defined By
auto_create_timestamps array a list of create timestamp columns. Db_ActiveRecord
auto_timestamps boolean determines whether create and update timestamp field should be set automatically. Db_ActiveRecord
auto_update_timestamps array a list of update timestamp columns. Db_ActiveRecord
calculated_columns array contains a list of calculated columns. Db_ActiveRecord
description string specifies the payment method description in plain text format. Shop_PaymentMethod
fetched array contains an associative array of table column values fetched from the database. Db_ActiveRecord
has_many array contains a list of Has Many relations. Db_ActiveRecord
has_one array contains a list of Has One relations. Db_ActiveRecord
id integer specifies the payment method record identifier. Shop_PaymentMethod
ls_api_code string specifies the payment method API code. Shop_PaymentMethod
name string specifies the payment method name. Shop_PaymentMethod
primary_key string specifies a name of the table primary key. Db_ActiveRecord
validation Phpr_Validation contains the model's validation object. Db_ActiveRecord

Public methods

Show inherited methods.

Method Description Defined By
add_form_custom_area() adds a form custom area. Db_ActiveRecord
add_form_field() makes a column visible in forms. Db_ActiveRecord
add_form_partial() adds a custom form partial. Db_ActiveRecord
add_form_section() adds a form section. Db_ActiveRecord
after_create() called after a new object is saved to the database. Db_ActiveRecord
after_create_saved() called after a new object is saved to the database. Db_ActiveRecord
after_delete() called after an existing or new record is deleted from the database. Db_ActiveRecord
after_save() called after an existing or new record is created or updated in the database. Db_ActiveRecord
after_update() called after an existing record is updated in the database. Db_ActiveRecord
after_validation() triggered after the model column values are validated. Db_ActiveRecord
after_validation_on_create() triggered after a new model column values are validated. Db_ActiveRecord
after_validation_on_update() triggered after an existing model column values are validated. Db_ActiveRecord
before_create() called before a new object is saved to the database. Db_ActiveRecord
before_update() called before an existing record is updated in the database. Db_ActiveRecord
before_validation() triggered before the model column values are validated. Db_ActiveRecord
before_validation_on_create() triggered before a new model column values are validated. Db_ActiveRecord
before_validation_on_update() triggered before an existing model column values are validated. Db_ActiveRecord
collection() executes the find_all() method and returns a collection. Db_ActiveRecord
columnValue() alias for the displayField() method. Db_ActiveRecord
define_column() adds a column definition to the model. Db_ActiveRecord
define_multi_relation_column() adds column definition for has_and_belongs_to_many or has_many relation field. Db_ActiveRecord
define_relation_column() adds column definition for has_on or belongs_to relation field. Db_ActiveRecord
delete() deletes the record from the database. Db_ActiveRecord
delete_customer_profile() deletes a customer payment profile. Shop_PaymentMethod
delete_form_field() deletes a form field by its corresponding column name. Db_ActiveRecord
displayField() returns a formatted column value. The field should be defined with define_column(), Db_ActiveRecord
find() finds a record by its primary key value. Db_ActiveRecord
find_all() finds all records and returns the Db_DataCollection object, containing a list of models. Db_ActiveRecord
find_by() finds a record by a field value. Db_ActiveRecord
find_by_api_code() finds a payment method by the API code. Shop_PaymentMethod
find_by_id() finds a payment method by its identifier. Shop_PaymentMethod
find_column_definition() finds a column definition by the column name. Db_ActiveRecord
find_customer_profile() finds and returns a customer payment profile for this payment method. Shop_PaymentMethod
find_form_field() finds a form field definition by its corresponding column name. Db_ActiveRecord
get_paymenttype_object() returns a payment type object. Shop_PaymentMethod
has_payment_form() determines whether the payment method has a payment form. Shop_PaymentMethod
init_customer_profile() initializes a new empty customer payment profile. Shop_PaymentMethod
join() adds a table to the query with JOIN statement. Db_SqlBase
limit() allows to limit the result of the find_all() method with the specified number of records. Db_ActiveRecord
list_available_transaction_transitions() returns a list of available transitions from a specific transaction status. Shop_PaymentMethod
list_related_records_deferred() returns a list of relation objects, taking into account deferred relations. Db_ActiveRecord
order() allows to order the result of the find_all() method by a specific table column. Db_SqlBase
orWhere() adds OR statement to the where clause, allowing to to limit the result of the find() and find_all() methods with SQL filter. Db_WhereBase
paginate() allows to limit the result of the find_all() method with a single page of records. Db_ActiveRecord
pay_offline_message() returns the offline payment message if the payment method supports it. Shop_PaymentMethod
profile_exists() checks whether a customer profile for this payment method and a given customer exists. Shop_PaymentMethod
profle_exists() checks whether a customer profile for this payment method and a given customer exists. Shop_PaymentMethod
render_payment_form() renders the payment method payment form. Shop_PaymentMethod
render_payment_profile_form() renders the payment method payment profile form. Shop_PaymentMethod
requestRowCount() returns a number of rows which would be returned with find_all() method. Db_ActiveRecord
request_transaction_status() returns status of a specific transaction. Shop_PaymentMethod
save() saves record to the database. Db_ActiveRecord
set_transaction_status() contacts the payment gateway and sets specific status for specific transaction. Shop_PaymentMethod
supports_payment_profiles() checks whether the payment module supports payment profiles. Shop_PaymentMethod
supports_transaction_status_query() checks whether the payment method supports requesting a status of a specific transaction. Shop_PaymentMethod
where() allows to limit the result of the find() and find_all() methods with SQL filter. Db_WhereBase

Events

Event Description
shop:onExtendPaymentMethodForm Allows to add new fields to the Create/Edit Payment Method form in the Administration Area.
shop:onExtendPaymentMethodModel Allows to define new columns in the payment method model.
shop:onFilterPaymentMethods Allows to filter the payment method list before it is displayed on the checkout pages or in the backend.
shop:onGetPaymentMethodFieldOptions Allows to populate drop-down, radio- or checkbox list fields, which have been added with shop:onExtendPaymentMethodForm event.
shop:onGetPaymentMethodFieldState Determines whether a custom radio button or checkbox list option is checked.

Property details

description property

public string $description;
Specifies the payment method description in plain text format.

id property

public integer $id;
Specifies the payment method record identifier.

ls_api_code property

public string $ls_api_code;
Specifies the payment method API code.

name property

public string $name;
Specifies the payment method name.

Method details

delete_customer_profile() method

public void delete_customer_profile(Shop_Customer $customer)
$customer Shop_Customer specifies a customer object to delete a profile for.
Deletes a customer payment profile. The method deletes the payment profile from the database and from the payment gateway.

find_by_api_code() method

public static Shop_PaymentMethod find_by_api_code(string $code)
$code string specifies the payment method API code.
{return} Shop_PaymentMethod returns the payment method object. Returns NULL if the payment method is not found.
Finds a payment method by the API code. This method allows you to find specific payment methods. You can assign the LemonStand API Code to any payment method in the payment method configuration form.

find_by_id() method

public static Shop_PaymentMethod find_by_id(integer $id)
$id integer specifies the payment method identifier.
{return} Shop_PaymentMethod returns the payment method object. Returns NULL if the payment method is not found.
Finds a payment method by its identifier. This method caches payment methods in memory and it is preferable to use this method instead of direct Db_ActiveRecord operations due to the performance considerations.

find_customer_profile() method

public Shop_CustomerPaymentProfile find_customer_profile(Shop_Customer $customer)
$customer Shop_Customer specifies customer to find a profile for.
{return} Shop_CustomerPaymentProfile returns the customer profile object. Returns NULL if the payment profile doesn't exist.
Finds and returns a customer payment profile for this payment method.

get_paymenttype_object() method

public Shop_PaymentType get_paymenttype_object()
{return} Shop_PaymentType returns a payment type object.
Returns a payment type object. Each payment method has an underlying payment type object. Payment type classes are specific for different payment gateways and implement operations required for working with a specific gateway.

has_payment_form() method

public boolean has_payment_form()
{return} boolean returns TRUE if the method has a payment form.
Determines whether the payment method has a payment form. This method returns TRUE for online payment methods. Some payment methods, for example the custom payment method, do not have a payment form. This method is used inside the payment page.

init_customer_profile() method

public Shop_CustomerPaymentProfile init_customer_profile(Shop_Customer $customer)
$customer Shop_Customer specifies a customer object to initialize a profile for.
{return} Shop_CustomerPaymentProfile returns the customer payment profile object.
Initializes a new empty customer payment profile. This method should be used by payment methods internally.

list_available_transaction_transitions() method

public array list_available_transaction_transitions(string $transaction_id, string $transaction_code)
$transaction_id string gateway-specific transaction identifier
$transaction_code string gateway-specific transaction status code
{return} array returns an array of transaction status actions and status names.
Returns a list of available transitions from a specific transaction status. The method returns an associative array with keys corresponding transaction statuses and values corresponding transaction status actions: array('V'=>'Void', 'S'=>'Submit for settlement'). Transaction statuses are specific for different payment gateways.

pay_offline_message() method

public string pay_offline_message()
{return} string returns the offline payment message. Returns FALSE if the message is not supported.
Returns the offline payment message if the payment method supports it. Some payment methods, for example the custom payment method, do not have a payment form and display an offline payment message instead. This method is used inside the payment page.

profile_exists() method

public boolean profile_exists(Shop_Customer $customer)
$customer Shop_Customer a customer object to find a profile for.
{return} boolean returns TRUE if a profile exists. Returns FALSE otherwise.
Checks whether a customer profile for this payment method and a given customer exists.

profle_exists() method

public boolean profle_exists(Shop_Customer $customer)

This method is deprecated. Use profile_exists() method.

$customer Shop_Customer a customer object to find a profile for.
{return} boolean returns TRUE if a profile exists. Returns FALSE otherwise.
Checks whether a customer profile for this payment method and a given customer exists.

render_payment_form() method

public void render_payment_form(Cms_Controller $controller)
$controller Cms_Controller a CMS controller object.
Renders the payment method payment form. This method is used inside the payment page.

See Also

render_payment_profile_form() method

public void render_payment_profile_form(Cms_Controller $controller)
$controller Cms_Controller a CMS controller object.
Renders the payment method payment profile form. This method is used inside the payment proile page.

request_transaction_status() method

public Shop_TransactionUpdate request_transaction_status($transaction_id)
$transaction_id
{return} Shop_TransactionUpdate returns the transaction information.
Returns status of a specific transaction. This method contacts the payment gateway and requests the actual transaction status.

set_transaction_status() method

public Shop_TransactionUpdate set_transaction_status(Shop_Order $order, string $transaction_id, string $transaction_code, string $new_transaction_code)
$order Shop_Order order object the transaction belongs to.
$transaction_id string gateway-specific transaction identifier.
$transaction_code string current gateway-specific transaction status code.
$new_transaction_code string destination gateway-specific transaction status code.
{return} Shop_TransactionUpdate returns the transaction update information.
Contacts the payment gateway and sets specific status for specific transaction.

supports_payment_profiles() method

public boolean supports_payment_profiles()
{return} boolean returns TRUE if the module supports payment profiles. Returns FALSE otherwise.
Checks whether the payment module supports payment profiles.

supports_transaction_status_query() method

public boolean supports_transaction_status_query()
{return} boolean returns TRUE if transaction status requests are supported. Returns FALSE otherwise.
Checks whether the payment method supports requesting a status of a specific transaction.