-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from appinlet/release/1.0.1
1.0.1
- Loading branch information
Showing
24 changed files
with
3,184 additions
and
679 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,62 @@ | ||
# mod-events-manager-pro | ||
|
||
PayFast Events Manager Pro v2 Module v1.00 for Events Manager Pro v2.3.9 | ||
|
||
Installation | ||
|
||
WHAT ARE THE INSTALLATION REQUIREMENTS? | ||
You will need a working installation of WordPress with Events Manager and Events Manager Pro | ||
|
||
In order to integrate EM Pro with PayFast you will need to include gateway.payfast.php on line 464 of | ||
events-manager-pro/add-ons/gateways/gateways.php as follows: | ||
include('gateway.payfast.php'); | ||
|
||
You will also need to add South African Rand to the currency options. This is done in | ||
events-manager/em-functions.php as follows: | ||
On line 223 add " 'ZAR' => 'ZAR - South African Rand' " to the array | ||
On line 224 and 225 add " 'ZAR' => 'R' " to the array | ||
|
||
HOW DO I INSTALL THE PAYFAST MODULE? | ||
1. Download and unzip the file. | ||
2. Using FTP copy the wp-content file to your root WordPress directory. | ||
3. Log in to the admin dashboard of your website, navigate to Events>Payment Gateways | ||
4. Click on PayFast settings and setup the settings page accordingly | ||
- If you are testing in sandbox mode leave the Merchant ID and Key fields blank. | ||
- If you are ready to go live insert your merchant ID and Key, as well as | ||
passphrase (only if you have the passphrase set on your PayFast account). | ||
5. Click save changes | ||
6. Navigate back to Events>Payment Gateways and click on activate PayFast. | ||
7. Navigate to Settings>Bookings>Pricing Options and select currency ZAR. | ||
|
||
Please [click here](https://payfast.io/integration/shopping-carts/events-manager-pro/) for more information concerning this module. | ||
## Payfast module v1.0.1 for Events Manager v6.4.7.2 and Events Manager Pro v3.2.8.1 | ||
|
||
This is the Payfast module for Events Manager Pro. Please feel free | ||
to [contact the Payfast support team](https://payfast.io/contact/) should you require any assistance. | ||
|
||
## Installation | ||
|
||
1. Verify that WordPress has the **Events Manager** and **Events Manager Pro** plugins installed and activated. | ||
2. Download and unzip [v1.0.1](https://github.com/Payfast/mod-events-manager-pro/archive/refs/tags/v1.0.1.zip). | ||
3. Using FTP to copy the wp-content file to your root WordPress directory. | ||
4. Add ```include('gateway.payfast.php');``` to **line 87** of: | ||
|
||
``` | ||
/wp-content/plugins/events-manager-pro/add-ons/gateways/gateways.php | ||
``` | ||
|
||
Be careful to not edit **gateway.php**, as there are two similarly named files. To confirm, you should see ```// load native gateways``` on **line 83** of the **init()** function. | ||
|
||
5. Add ```'ZAR' => 'ZAR - South African Rand'``` to **line 262**, and add ```'ZAR' => 'R'``` to **lines 263-264** of: | ||
|
||
``` | ||
/wp-content/plugins/events-manager/em-functions.php | ||
``` | ||
|
||
For example, your **em_get_currencies()** function may change from: | ||
|
||
``` | ||
function em_get_currencies(){ | ||
$currencies = new stdClass(); | ||
$currencies->names = array('EUR' => 'EUR - Euros','USD' => 'USD - U.S. Dollars','GBP' => 'GBP - British Pounds','CAD' => 'CAD - Canadian Dollars','AUD' => 'AUD - Australian Dollars','BRL' => 'BRL - Brazilian Reais','CZK' => 'CZK - Czech koruna','DKK' => 'DKK - Danish Kroner','HKD' => 'HKD - Hong Kong Dollars','HUF' => 'HUF - Hungarian Forints','ILS' => 'ILS - Israeli New Shekels','JPY' => 'JPY - Japanese Yen','MYR' => 'MYR - Malaysian Ringgit','MXN' => 'MXN - Mexican Pesos','TWD' => 'TWD - New Taiwan Dollars','NZD' => 'NZD - New Zealand Dollars','NOK' => 'NOK - Norwegian Kroner','PHP' => 'PHP - Philippine Pesos','PLN' => 'PLN - Polish Zlotys','SGD' => 'SGD - Singapore Dollars','SEK' => 'SEK - Swedish Kronor','CHF' => 'CHF - Swiss Francs','THB' => 'THB - Thai Baht','TRY' => 'TRY - Turkish Liras', 'RUB'=>'RUB - Russian Ruble'); | ||
$currencies->symbols = array( 'EUR' => '€','USD' => '$','GBP' => '£','CAD' => '$','AUD' => '$','BRL' => 'R$','CZK' => 'Kč','DKK' => 'kr','HKD' => '$','HUF' => 'Ft','JPY' => '¥','MYR' => 'RM','MXN' => '$','TWD' => '$','NZD' => '$','NOK' => 'kr','PHP' => 'Php', 'PLN' => 'zł','SGD' => '$','SEK' => 'kr','CHF' => 'CHF','TRY' => 'TL','RUB'=>'₽'); | ||
$currencies->true_symbols = array( 'EUR' => '€','USD' => '$','GBP' => '£','CAD' => '$','AUD' => '$','BRL' => 'R$','CZK' => 'Kč','DKK' => 'kr','HKD' => '$','HUF' => 'Ft','JPY' => '¥','MYR' => 'RM','MXN' => '$','TWD' => '$','NZD' => '$','NOK' => 'kr','PHP' => 'Php','PLN' => 'zł','SGD' => '$','SEK' => 'kr','CHF' => 'CHF','TRY' => 'TL', 'RUB'=>'₽'); | ||
return apply_filters('em_get_currencies',$currencies); | ||
} | ||
``` | ||
|
||
Into: | ||
|
||
``` | ||
function em_get_currencies(){ | ||
$currencies = new stdClass(); | ||
$currencies->names = array('EUR' => 'EUR - Euros','USD' => 'USD - U.S. Dollars','GBP' => 'GBP - British Pounds','CAD' => 'CAD - Canadian Dollars','AUD' => 'AUD - Australian Dollars','BRL' => 'BRL - Brazilian Reais','CZK' => 'CZK - Czech koruna','DKK' => 'DKK - Danish Kroner','HKD' => 'HKD - Hong Kong Dollars','HUF' => 'HUF - Hungarian Forints','ILS' => 'ILS - Israeli New Shekels','JPY' => 'JPY - Japanese Yen','MYR' => 'MYR - Malaysian Ringgit','MXN' => 'MXN - Mexican Pesos','TWD' => 'TWD - New Taiwan Dollars','NZD' => 'NZD - New Zealand Dollars','NOK' => 'NOK - Norwegian Kroner','PHP' => 'PHP - Philippine Pesos','PLN' => 'PLN - Polish Zlotys','SGD' => 'SGD - Singapore Dollars','SEK' => 'SEK - Swedish Kronor','CHF' => 'CHF - Swiss Francs','THB' => 'THB - Thai Baht','TRY' => 'TRY - Turkish Liras', 'RUB'=>'RUB - Russian Ruble', 'ZAR' => 'ZAR - South African Rand'); | ||
$currencies->symbols = array( 'EUR' => '€','USD' => '$','GBP' => '£','CAD' => '$','AUD' => '$','BRL' => 'R$','CZK' => 'Kč','DKK' => 'kr','HKD' => '$','HUF' => 'Ft','JPY' => '¥','MYR' => 'RM','MXN' => '$','TWD' => '$','NZD' => '$','NOK' => 'kr','PHP' => 'Php', 'PLN' => 'zł','SGD' => '$','SEK' => 'kr','CHF' => 'CHF','TRY' => 'TL','RUB'=>'₽', 'ZAR' => 'R'); | ||
$currencies->true_symbols = array( 'EUR' => '€','USD' => '$','GBP' => '£','CAD' => '$','AUD' => '$','BRL' => 'R$','CZK' => 'Kč','DKK' => 'kr','HKD' => '$','HUF' => 'Ft','JPY' => '¥','MYR' => 'RM','MXN' => '$','TWD' => '$','NZD' => '$','NOK' => 'kr','PHP' => 'Php','PLN' => 'zł','SGD' => '$','SEK' => 'kr','CHF' => 'CHF','TRY' => 'TL', 'RUB'=>'₽', 'ZAR' => 'R'); | ||
return apply_filters('em_get_currencies',$currencies); | ||
} | ||
``` | ||
|
||
6. Log in to the admin dashboard of your website, then navigate to **Events** -> **Payment Gateways**. | ||
7. Click on **Payfast** -> **settings**, then set the **General Options** and **Payfast Options** according to your needs. | ||
8. Click the **Save Changes** button. | ||
9. Navigate back to **Events** -> **Payment Gateways**, then click **Payfast** -> **Activate**. | ||
10. Navigate to **Settings** -> **Bookings** -> **Pricing Options** and select **ZAR - South African Rand** from the **Currency** dropdown. | ||
|
||
Please [click here](https://payfast.io/integration/plugins/events-manager-pro/) for more information concerning this | ||
module. | ||
|
||
## Collaboration | ||
|
||
Please submit pull requests with any tweaks, features or fixes you would like to share. |
5 changes: 5 additions & 0 deletions
5
wp-content/plugins/events-manager-pro/add-ons/gateways/composer.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"require": { | ||
"payfast/payfast-common": "^1.0" | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
wp-content/plugins/events-manager-pro/add-ons/gateways/composer.lock
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
192 changes: 192 additions & 0 deletions
192
wp-content/plugins/events-manager-pro/add-ons/gateways/gateway.payfast-admin.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
<?php | ||
|
||
namespace EM\Payments\Payfast; | ||
|
||
|
||
define('BOOKING_TIMEOUT', '_booking_timeout'); | ||
define('MERCHANT_ID', '_merchant_id'); | ||
define('MERCHANT_KEY', '_merchant_key'); | ||
define('STATUS', '_status'); | ||
define('PASSPHRASE', '_passphrase'); | ||
define('RETURN_API', '_return'); | ||
define('CANCEL_RETURN', '_cancel_return'); | ||
define('BOOKING_FEEDBACK_THANKS', '_booking_feedback_thanks'); | ||
define('MANUAL_APPROVAL', '_manual_approval'); | ||
define('BOOKING_FEEDBACK', '_booking_feedback'); | ||
define('SELECTED_SELECTED', 'selected="selected"'); | ||
|
||
/** | ||
* This Gateway is slightly special, because as well as providing public static functions that need to be activated, | ||
* there are offline payment public static functions that are always there e.g. adding manual payments. | ||
*/ | ||
class Gateway_Admin extends \EM\Payments\Gateway_Admin | ||
{ | ||
public static function init() | ||
{ | ||
parent::init(); | ||
} | ||
|
||
public static function settings_tabs($custom_tabs = array()) | ||
{ | ||
$tabs = array( | ||
'options' => array( | ||
'name' => sprintf(esc_html__emp('%s Options'), 'Payfast'), | ||
'callback' => array(static::class, 'mysettings'), | ||
), | ||
); | ||
|
||
return parent::settings_tabs($tabs); | ||
} | ||
|
||
public static function mysettings() | ||
{ | ||
global $EM_options; | ||
?> | ||
<table class="form-table"> | ||
<tbody> | ||
<tr style="vertical-align: top;"> | ||
<th scope="row"><?php | ||
_e('Redirect Message', 'em-pro') ?></th> | ||
<td> | ||
<input type="text" name="payfast_booking_feedback" value="<?php | ||
esc_attr_e(get_option('em_' . static::$gateway . BOOKING_FEEDBACK_THANKS)); ?>" | ||
style='width: 40em;'/><br/> | ||
<em> | ||
<?php | ||
_e('The message that is shown before a user is redirected to Payfast.', 'em-pro'); ?> | ||
</em> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<table class="form-table"> | ||
<caption><?php | ||
echo sprintf(__('%s Options', 'em-pro'), 'Payfast'); ?></caption> | ||
<tbody> | ||
<tr style="vertical-align: top;"> | ||
<th scope="row"><?php | ||
_e('Merchant ID', 'em-pro') ?></th> | ||
<td> | ||
<input type="text" name="merchant_id" value="<?php | ||
esc_attr_e(get_option('em_' . static::$gateway . MERCHANT_ID)); ?>"/> | ||
<br/> | ||
</td> | ||
</tr> | ||
<tbody> | ||
<tr style="vertical-align: top;"> | ||
<th scope="row"><?php | ||
_e('Merchant Key', 'em-pro') ?></th> | ||
<td> | ||
<input type="text" name="merchant_key" value="<?php | ||
esc_attr_e(get_option('em_' . static::$gateway . MERCHANT_KEY)); ?>"/> | ||
<br/> | ||
</td> | ||
</tr> | ||
<tr style="vertical-align: top;"> | ||
<th scope="row"><?php | ||
_e('Passphrase', 'em-pro') ?></th> | ||
<td><input type="text" name="passphrase" value="<?php | ||
esc_attr_e(get_option('em_' . static::$gateway . PASSPHRASE)); ?>"/> | ||
<br/> | ||
</td> | ||
</tr> | ||
<tr style="vertical-align: top;"> | ||
<th scope="row"><?php | ||
_e('Mode', 'em-pro') ?></th> | ||
<td> | ||
<select name="payfast_status"> | ||
<option value="live" <?php | ||
if (get_option('em_' . static::$gateway . STATUS) == 'live') { | ||
echo SELECTED_SELECTED; | ||
} ?>><?php | ||
_e('Live', 'em-pro') ?></option> | ||
<option value="test" <?php | ||
if (get_option('em_' . static::$gateway . STATUS) == 'test') { | ||
echo SELECTED_SELECTED; | ||
} ?>><?php | ||
_e('Test Mode (Sandbox)', 'em-pro') ?></option> | ||
</select> | ||
<br/> | ||
</td> | ||
</tr> | ||
<tr style="vertical-align: top;"> | ||
<th scope="row"><?php | ||
_e('Debug', 'em-pro') ?></th> | ||
<td> | ||
<select name="payfast_debug"> | ||
<option value="true" <?php | ||
if (get_option('em_' . static::$gateway . "_debug") == 'true') { | ||
echo SELECTED_SELECTED; | ||
} ?>><?php | ||
_e('On', 'em-pro') ?></option> | ||
<option value="false" <?php | ||
if (get_option('em_' . static::$gateway . "_debug") == 'false') { | ||
echo SELECTED_SELECTED; | ||
} ?>><?php | ||
_e('Off', 'em-pro') ?></option> | ||
</select> | ||
<br/> | ||
</td> | ||
</tr> | ||
<tr style="vertical-align: top;"> | ||
<th scope="row"><?php | ||
_e('Return URL', 'em-pro') ?></th> | ||
<td> | ||
<input type="text" name="payfast_return" value="<?php | ||
esc_attr_e(get_option('em_' . static::$gateway . RETURN_API)); ?>" style='width: 40em;'/><br/> | ||
<em><?php | ||
_e('The URL of the page the user is returned to after payment.', 'em-pro'); ?></em> | ||
</td> | ||
</tr> | ||
<tr style="vertical-align: top;"> | ||
<th scope="row"><?php | ||
_e('Cancel URL', 'em-pro') ?></th> | ||
<td> | ||
<input type="text" name="payfast_cancel_return" value="<?php | ||
esc_attr_e(get_option('em_' . static::$gateway . CANCEL_RETURN)); ?>" style='width: 40em;'/><br/> | ||
<em><?php | ||
_e('If a user cancels, they will be redirected to this page.', 'em-pro'); ?></em> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<?php | ||
} | ||
|
||
/* | ||
* Run when saving Payfast settings, saves the settings available in EM_Gateway_Paypal::mysettings() | ||
*/ | ||
public static function update($options = array()) | ||
{ | ||
$gateway_options = array( | ||
static::$gateway . MERCHANT_ID => $_REQUEST['merchant_id'], | ||
static::$gateway . MERCHANT_KEY => $_REQUEST['merchant_key'], | ||
static::$gateway . PASSPHRASE => $_REQUEST['passphrase'], | ||
static::$gateway . "_currency" => $_REQUEST['currency'], | ||
static::$gateway . STATUS => $_REQUEST[static::$gateway . '_status'], | ||
static::$gateway . "_debug" => $_REQUEST[static::$gateway . '_debug'], | ||
static::$gateway . "_manual_approval" => $_REQUEST[static::$gateway . MANUAL_APPROVAL], | ||
static::$gateway . BOOKING_FEEDBACK => wp_kses_data( | ||
$_REQUEST[static::$gateway . '_booking_feedback'] | ||
), | ||
static::$gateway . "_booking_feedback_free" => wp_kses_data( | ||
$_REQUEST[static::$gateway . '_booking_feedback_free'] | ||
), | ||
static::$gateway . "_booking_feedback_thanks" => wp_kses_data( | ||
$_REQUEST[static::$gateway . BOOKING_FEEDBACK_THANKS] | ||
), | ||
static::$gateway . "_booking_timeout" => $_REQUEST[static::$gateway . BOOKING_TIMEOUT], | ||
static::$gateway . RETURN_API => $_REQUEST[static::$gateway . '_return'], | ||
static::$gateway . CANCEL_RETURN => $_REQUEST[static::$gateway . '_cancel_return'], | ||
); | ||
foreach ($gateway_options as $key => $option) { | ||
update_option('em_' . $key, stripslashes($option)); | ||
} | ||
|
||
// Default action is to return true | ||
return parent::update($gateway_options); | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.