Difference between revisions of "Freeside:3:Documentation:Developer/FS/payment gateway"

From Freeside
Jump to: navigation, search
m (Edit via perl MediaWiki framework (1.13))
 
m (Edit via perl MediaWiki framework (1.13))
 
Line 20: Line 20:
 
An FS::payment_gateway object represents an payment gateway. FS::payment_gateway inherits from FS::Record. The following fields are currently supported:
 
An FS::payment_gateway object represents an payment gateway. FS::payment_gateway inherits from FS::Record. The following fields are currently supported:
  
; gatewaynum - primary key; gateway_namespace - Business::OnlinePayment or Business::OnlineThirdPartyPayment; gateway_module - Business::OnlinePayment:: module name; gateway_username - payment gateway username; gateway_password - payment gateway password; gateway_action - optional action or actions (multiple actions are separated with `,': for example: `Authorization Only, Post Authorization'). Defaults to `Normal Authorization'.; disabled - Disabled flag, empty or 'Y'
+
; gatewaynum - primary key; gateway_namespace - Business::OnlinePayment, Business::OnlineThirdPartyPayment, or Business::BatchPayment; gateway_module - Business::OnlinePayment:: (or other) module name; gateway_username - payment gateway username; gateway_password - payment gateway password; gateway_action - optional action or actions (multiple actions are separated with `,': for example: `Authorization Only, Post Authorization'). Defaults to `Normal Authorization'.; disabled - Disabled flag, empty or 'Y'; gateway_callback_url - For ThirdPartyPayment only, set to the URL that the user should be redirected to on a successful payment. This will be sent as a transaction parameter named "return_url".; gateway_cancel_url - For ThirdPartyPayment only, set to the URL that the user should be redirected to if they cancel the transaction. This will be sent as a transaction parameter named "cancel_url".; auto_resolve_status - For BatchPayment only, set to 'approve' to auto-approve unresolved payments after some number of days, 'reject' to auto-decline them, or null to do nothing.; auto_resolve_days - For BatchPayment, the number of days to wait before auto-resolving the batch.
 
==METHODS==
 
==METHODS==
 
; new HASHREF
 
; new HASHREF
Line 38: Line 38:
 
; disable
 
; disable
 
:Disables this payment gateway: deletes all associated agent_payment_gateway overrides and sets the ''disabled'' field to "'''Y'''".
 
:Disables this payment gateway: deletes all associated agent_payment_gateway overrides and sets the ''disabled'' field to "'''Y'''".
 +
; label
 +
:Returns a semi-friendly label for the gateway.
 
; namespace_description
 
; namespace_description
 
:returns a friendly name for the namespace
 
:returns a friendly name for the namespace
 +
; batch_processor OPTIONS
 +
:For BatchPayment gateways only. Returns a [[Freeside:3:Documentation:Developer/Business/BatchPayment/Processor|Business::BatchPayment::Processor]] object to communicate with the gateway.
 +
 +
:OPTIONS will be passed to the constructor, along with any gateway options in the database for this [[Freeside:3:Documentation:Developer/FS/payment gateway|FS::payment_gateway]]. Useful things to include there may include 'input' and 'output' (to direct transport to files), 'debug', and 'test_mode'.
 +
 +
:If the global 'business-batchpayment-test_transaction' flag is set, 'test_mode' will be forced on, and gateways that don't support test mode will be disabled.
 +
; processor OPTIONS
 +
:Loads the module for the processor and returns an instance of it.
  
 
==BUGS==
 
==BUGS==
 
==SEE ALSO==
 
==SEE ALSO==
 
[[Freeside:3:Documentation:Developer/FS/Record|FS::Record]], schema.html from the base documentation.
 
[[Freeside:3:Documentation:Developer/FS/Record|FS::Record]], schema.html from the base documentation.

Latest revision as of 13:37, 27 June 2014

NAME

FS::payment_gateway - Object methods for payment_gateway records

SYNOPSIS

 use FS::payment_gateway;

 $record = new FS::payment_gateway \%hash;
 $record = new FS::payment_gateway { 'column' => 'value' };

 $error = $record->insert;

 $error = $new_record->replace($old_record);

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

An FS::payment_gateway object represents an payment gateway. FS::payment_gateway inherits from FS::Record. The following fields are currently supported:

gatewaynum - primary key; gateway_namespace - Business::OnlinePayment, Business::OnlineThirdPartyPayment, or Business::BatchPayment; gateway_module - Business::OnlinePayment:: (or other) module name; gateway_username - payment gateway username; gateway_password - payment gateway password; gateway_action - optional action or actions (multiple actions are separated with `,': for example: `Authorization Only, Post Authorization'). Defaults to `Normal Authorization'.; disabled - Disabled flag, empty or 'Y'; gateway_callback_url - For ThirdPartyPayment only, set to the URL that the user should be redirected to on a successful payment. This will be sent as a transaction parameter named "return_url".; gateway_cancel_url - For ThirdPartyPayment only, set to the URL that the user should be redirected to if they cancel the transaction. This will be sent as a transaction parameter named "cancel_url".; auto_resolve_status - For BatchPayment only, set to 'approve' to auto-approve unresolved payments after some number of days, 'reject' to auto-decline them, or null to do nothing.; auto_resolve_days - For BatchPayment, the number of days to wait before auto-resolving the batch.

METHODS

new HASHREF
Creates a new payment gateway. To add the payment gateway to the database, see "insert".
Note that this stores the hash reference, not a distinct copy of the hash it points to. You can ask the object for a copy with the hash method.
insert
Adds this record to the database. If there is an error, returns the error, otherwise returns false.
delete
Delete this record from the database.
replace OLD_RECORD
Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
check
Checks all fields to make sure this is a valid payment gateway. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
agent_payment_gateway
Returns any agent overrides for this payment gateway.
disable
Disables this payment gateway: deletes all associated agent_payment_gateway overrides and sets the disabled field to "Y".
label
Returns a semi-friendly label for the gateway.
namespace_description
returns a friendly name for the namespace
batch_processor OPTIONS
For BatchPayment gateways only. Returns a Business::BatchPayment::Processor object to communicate with the gateway.
OPTIONS will be passed to the constructor, along with any gateway options in the database for this FS::payment_gateway. Useful things to include there may include 'input' and 'output' (to direct transport to files), 'debug', and 'test_mode'.
If the global 'business-batchpayment-test_transaction' flag is set, 'test_mode' will be forced on, and gateways that don't support test mode will be disabled.
processor OPTIONS
Loads the module for the processor and returns an instance of it.

BUGS

SEE ALSO

FS::Record, schema.html from the base documentation.