VirtueMart - 1.1 Developer's Guide
Installing a Payment Module
22
returns true if the configuration file for that payment module
is readable,
is readable,
false if not
void write_configuration( Array )
Stores all configuration values for this payment module in the
configuration file.
configuration file.
boolean process_payment(String
$order_number, Float $order_total,
Array &$d)
$order_number, Float $order_total,
Array &$d)
This is the main function for all payment modules that use
direct connections to a payment gateway (like authorize.net or
eWay XML). This is the place, where the payment details are
validated and captured on success.
direct connections to a payment gateway (like authorize.net or
eWay XML). This is the place, where the payment details are
validated and captured on success.
Returns true on sucess, false on failure.
float get_payment_rate(Float
$subtotal)
$subtotal)
This is the function to calculate the fee / discount for this special
payment module (so you can calculate a fee, depending on the
order total amount).
payment module (so you can calculate a fee, depending on the
order total amount).
Note
IF you are about to change configuration variables: do this in both functions:
show_configuration and write_configuration!
show_configuration and write_configuration!
4.1.5. Installing a Payment Module
Since there's no real installer for payment modules, you must copy the two files
ps_mynewpayment.php
and
ps_mynewpayment.cfg.php
into the directory
/
administrator/components/com_virtuemart/classes/payment/
first.
After you have done that, you can add a new payment method ("Store" # "Add Payment Method").
It's important to fill in the correct name for Payment Class Name (in this case: ps_mynewpayment) -
here's the reason why you must give the class file the same name as the class inside the file: the Shop
now tries to include a file called "ps_mynewpayment.php" on Saving the payment method.
It's important to fill in the correct name for Payment Class Name (in this case: ps_mynewpayment) -
here's the reason why you must give the class file the same name as the class inside the file: the Shop
now tries to include a file called "ps_mynewpayment.php" on Saving the payment method.
When you now re-open the newly created payment method, you have access to the configuration form.
4.2. Shipping Modules
4.2.1. The Basics
Shipping modules are located in the directory
/administrator/components/com_virtuemart/classes/shipping/
and have three files: the class file, the information file and the configuration file.
Example: Module "myShipping"
You must have three files, called
•
myShipping.php
(including the class myShipping)
•
myShipping.ini
(containing the Name of the Module & the Author and the File Version..)