VirtueMart - 1.1 Developer's Guide
Implementation Details
21
Caution
The code inside this form MUST BE VALID! If you use PHP code, check if you have written
correct code that can be parsed!
correct code that can be parsed!
4.1.3. Implementation Details
Important
The information in this section only applies to situations when you want to implement a
new payment method of the type “Payment Processor” or “HTML-form-based” (simliar to
PayPal). All other payment methods can be created by just adding a new payment method in
the shop administration! Then you don’t need to create a new payment module.
new payment method of the type “Payment Processor” or “HTML-form-based” (simliar to
PayPal). All other payment methods can be created by just adding a new payment method in
the shop administration! Then you don’t need to create a new payment module.
A payment module implements a technique to either
• communicate with a remote server to authenticate the credit card of a user or
• create a HTML Form to send the user to the pages of the payment provider where he/she can pay
and return to your shop afterwards.
All payment modules are located in the directory
/administrator/components/com_virtuemart/classes/payment/
and provide two files: the class file and the configuration file.
Example: Module "mynewpayment"
You must have two files called
•
ps_mynewpayment.php
(including the class ps_mynewpayment)
•
ps_mynewpayment.cfg.php
(containing all necessary configuration constant definitions)
If the user has chosen to pay using a payment method, which has this class as its processor (entry under
Class Name), the file
Class Name), the file
ps_mynewpayment.php
will be included on checkout and its functions will
be used to process the payment details, regardless of the implementation.
4.1.4. The API specification
The following is a list of all methods that must be implemented in a payment module's class file.
string show_configuration( void )
Shows the configuration form for this payment module in the
payment method form.
payment method form.
boolean has_configuration( void )
returns true if the payment module can be configured,
false if not
boolean
configfile_writeable( void )
configfile_writeable( void )
returns true if the configuration file for that payment module
is writeable,
is writeable,
false if not
boolean
configfile_readable( void )
configfile_readable( void )