Skip to content

Commit e1abbaf

Browse files
Merge pull request #26 from AppInlet/release/1.8.0
[1.8.0]
2 parents ba7679d + d03da39 commit e1abbaf

File tree

23 files changed

+833
-775
lines changed

23 files changed

+833
-775
lines changed

CHANGELOG.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
11
# Changelog
22

3-
## [1.7.0](https://github.com/Payfast/mod-gravityforms/releases/tag/v1.7.0)
3+
## [1.8.0](https://github.com/Payfast/gravityforms-aggregation/releases/tag/v1.8.0)
4+
5+
### Added
6+
7+
- Updated Common Library to version 1.4.0.
8+
- Revised configuration branding to Payfast Aggregation.
9+
10+
### Fixed
11+
12+
- Resolved an issue where certain subscription forms were failing to process payments.
13+
14+
## [1.7.0](https://github.com/Payfast/gravityforms-aggregation/releases/tag/v1.7.0)
415

516
### Added
617

718
- Enhanced plugin compatibility with WordPress Marketplace by adhering to updated code quality standards, improving
819
performance and security.
920
- Upgraded Payfast Common Library to version 1.4.0.
1021

11-
## [1.6.0](https://github.com/Payfast/mod-gravityforms/releases/tag/v1.6.0)
22+
## [1.6.0](https://github.com/Payfast/gravityforms-aggregation/releases/tag/v1.6.0)
1223

1324
### Added
1425

1526
- Tested with WordPress 6.7.1 and Gravity Forms 2.9.1.
1627
- Code standards for PHP 8.2.
1728
- Updated the Payfast Common Library.
1829

19-
## [1.5.5](https://github.com/Payfast/mod-gravityforms/releases/tag/v1.5.5)
30+
## [1.5.5](https://github.com/Payfast/gravityforms-aggregation/releases/tag/v1.5.5)
2031

2132
### Added
2233

@@ -26,7 +37,7 @@
2637

2738
- Improved compatibility with other gateways.
2839

29-
## [1.5.4](https://github.com/Payfast/mod-gravityforms/releases/tag/v1.5.4)
40+
## [1.5.4](https://github.com/Payfast/gravityforms-aggregation/releases/tag/v1.5.4)
3041

3142
### Added
3243

@@ -42,7 +53,7 @@
4253

4354
- Bug fixes and improvements.
4455

45-
## [1.5.3](https://github.com/Payfast/mod-gravityforms/releases/tag/v1.5.3)
56+
## [1.5.3](https://github.com/Payfast/gravityforms-aggregation/releases/tag/v1.5.3)
4657

4758
### Added
4859

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# mod-gravityforms
1+
# gravityforms-aggregation
22

3-
## Payfast module v1.7.0 for Gravity Forms v2.9.13
3+
## Payfast Aggregation module v1.8.0 for Gravity Forms v2.9.17
44

5-
This is the Payfast module for Gravity Forms. Please feel free
5+
This is the Payfast Aggregation module for Gravity Forms. Please feel free
66
to [contact the Payfast support team](https://payfast.io/contact/) should you require any assistance.
77

88
## Installation
99

1010
1. Log in to your WordPress Admin panel.
1111
2. Navigate to **Plugins > Add New > Upload Plugin**.
1212
3. Click **Choose File** and select
13-
**[gravityformspayfast.zip](https://github.com/Payfast/mod-gravityforms/releases/download/v1.7.0/gravityformspayfast.zip)**.
13+
**[gravityformspayfast.zip](https://github.com/Payfast/gravityforms-aggregation/releases/download/v1.8.0/gravityformspayfast.zip)**.
1414
4. Click **Install Now**.
1515
5. Click **Activate Plugin**.
1616
5. Go to **Forms** -> **Settings**, under **Default Currency**, select **South African Rand** and click

gravityformspayfast/class-gf-payfast.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class GFPayFast extends GFPaymentAddOn
2222
protected $_path = 'gravityformspayfast/payfast.php';
2323
protected $_full_path = __FILE__;
2424
protected $_url = 'http://www.gravityforms.com';
25-
protected $_title = 'Gravity Forms Payfast Add-On';
26-
protected $_short_title = 'Payfast';
25+
protected $_title = 'Gravity Forms Payfast Aggregation Add-On';
26+
protected $_short_title = 'Payfast Aggregation';
2727
protected $_supports_callbacks = true;
2828
protected $_capabilities = array('gravityforms_payfast', 'gravityforms_payfast_uninstall');
2929
// Members plugin integration
@@ -35,7 +35,7 @@ class GFPayFast extends GFPaymentAddOn
3535
// Automatic upgrade enabled
3636
private $productionUrl = 'https://www.payfast.co.za/eng/process/';
3737
private $sandboxUrl = 'https://sandbox.payfast.co.za/eng/process/';
38-
private $_pf_gf_module_ver = '1.7.0';
38+
private $_pf_gf_module_ver = '1.8.0';
3939

4040
public static function get_instance()
4141
{
@@ -122,7 +122,7 @@ public function feed_list_no_item_message()
122122
if (!rgar($settings, 'gf_payfast_configured')) {
123123
return sprintf(
124124
// translators: 1: opening anchor tag to Payfast settings, 2: closing anchor tag.
125-
__('To get started, configure your %1$sPayfast Settings%2$s!', 'gravityformspayfast'),
125+
__('To get started, configure your %1$sPayfast Aggregation Settings%2$s!', 'gravityformspayfast'),
126126
'<a href="' . admin_url('admin.php?page=gf_settings&subview=' . $this->_slug) . '">',
127127
'</a>'
128128
);
@@ -1039,23 +1039,23 @@ function (response) {
10391039
<h1><?php
10401040
printf(
10411041
// translators: %1$s and %s are the opening and closing <h1> tags for the Payfast link.
1042-
esc_html__('Payfast Add-On v%s', 'gravityformspayfast'),
1042+
esc_html__('Payfast Aggregation Add-On v%s', 'gravityformspayfast'),
10431043
esc_html($this->_pf_gf_module_ver)
10441044
) ?></h1>
10451045
<div class="about-text"><?php
10461046
esc_html_e(
1047-
'Thank you for updating! The new version of the Gravity Forms Payfast Add-On makes changes to how you manage your Payfast integration.',
1047+
'Thank you for updating! The new version of the Gravity Forms Payfast Aggregation Add-On makes changes to how you manage your Payfast integration.',
10481048
'gravityformspayfast'
10491049
) ?></div>
10501050
<div class="changelog">
10511051
<hr/>
10521052
<div class="feature-section col two-col">
10531053
<div class="col-1">
10541054
<h3><?php
1055-
esc_html_e('Manage Payfast Contextually', 'gravityformspayfast') ?></h3>
1055+
esc_html_e('Manage Payfast Aggregation Contextually', 'gravityformspayfast') ?></h3>
10561056
<p><?php
10571057
esc_html_e(
1058-
'Payfast Feeds are now accessed via the Payfast sub-menu within the Form Settings for the Form you would like to integrate Payfast with.',
1058+
'Payfast Aggregation Feeds are now accessed via the Payfast Aggregation sub-menu within the Form Settings for the Form you would like to integrate Payfast Aggregation with.',
10591059
'gravityformspayfast'
10601060
) ?></p>
10611061
</div>
@@ -1156,7 +1156,7 @@ public function admin_edit_payment_status_details($form_id, $lead)
11561156
?>
11571157
<div id="edit_payment_status_details" style="display:block">
11581158
<table>
1159-
<caption>Edit Payfast payment status details</caption>
1159+
<caption>Edit Payfast Aggregation payment status details</caption>
11601160
<tr>
11611161
<th scope="col">Payment Information</th>
11621162
</tr>
@@ -1648,12 +1648,13 @@ public function paymentStatus(
16481648
$amountGross,
16491649
$paymentId
16501650
),
1651+
16511652
];
16521653

16531654
$payfastRequest->pflog('- Log subscription payment');
16541655
$this->insertTransaction($paymentId, 'payment', $transactionId, $action['amount']);
16551656
$payfastRequest->pflog('- Log subscription payment');
1656-
GFFormsModel::add_note($paymentId, 0, 'Payfast', $action['note'], 'success');
1657+
GFFormsModel::add_note($paymentId, 0, 'Payfast Aggregation', $action['note'], 'success');
16571658
}
16581659
$this->sendNotifications(
16591660
$sendAdminMail,
@@ -1678,7 +1679,7 @@ public function paymentStatus(
16781679
$pfData['m_payment_id']
16791680
);
16801681
GFAPI::update_entry_property($pfData['m_payment_id'], 'payment_status', 'Cancelled');
1681-
GFFormsModel::add_note($pfData['m_payment_id'], 0, 'Payfast', $note, 'Cancelled');
1682+
GFFormsModel::add_note($pfData['m_payment_id'], 0, 'Payfast Aggregation', $note, 'Cancelled');
16821683

16831684
// Perform any custom actions
16841685
do_action('gform_payfast_payment_cancelled', $pfData);

gravityformspayfast/classes/PfGfForm.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,43 @@ public static function getFields(): array
1414
return array(
1515
array(
1616
'name' => 'payfastMerchantId',
17-
'label' => __('Payfast Merchant ID ', 'gravityformspayfast'),
17+
'label' => __('Merchant ID ', 'gravityformspayfast'),
1818
'type' => 'text',
1919
'class' => 'medium',
2020
'required' => false,
2121
'tooltip' => GFPayFast::H6_TAG . __(
22-
'Payfast Merchant ID',
22+
'Merchant ID',
2323
'gravityformspayfast'
2424
) . GFPayFast::H6_TAG_END . __(
25-
'Enter your Payfast Merchant ID.',
25+
'Enter your Merchant ID.',
2626
'gravityformspayfast'
2727
)
2828
),
2929
array(
3030
'name' => 'payfastMerchantKey',
31-
'label' => __('Payfast Merchant Key ', 'gravityformspayfast'),
31+
'label' => __('Merchant Key ', 'gravityformspayfast'),
3232
'type' => 'text',
3333
'class' => 'medium',
3434
'required' => false,
3535
'tooltip' => GFPayFast::H6_TAG . __(
36-
'Payfast Merchant Key',
36+
'Merchant Key',
3737
'gravityformspayfast'
3838
) . GFPayFast::H6_TAG_END . __(
39-
'Enter your Payfast Merchant Key.',
39+
'Enter your Merchant Key.',
4040
'gravityformspayfast'
4141
)
4242
),
4343
array(
4444
'name' => 'passphrase',
45-
'label' => __('Payfast Passphrase ', 'gravityformspayfast'),
45+
'label' => __('Passphrase ', 'gravityformspayfast'),
4646
'type' => 'text',
4747
'class' => 'medium',
4848
'required' => false,
4949
'tooltip' => GFPayFast::H6_TAG . __(
50-
'Payfast Passphrase',
50+
'Passphrase',
5151
'gravityformspayfast'
5252
) . GFPayFast::H6_TAG_END . __(
53-
'Only enter a passphrase if it is set on your Payfast account.',
53+
'Only enter a passphrase if it is set on your Payfast Aggregation account.',
5454
'gravityformspayfast'
5555
)
5656
),
@@ -73,7 +73,7 @@ public static function getFields(): array
7373
'horizontal' => true,
7474
'default_value' => 'production',
7575
'tooltip' => GFPayFast::H6_TAG . __('Mode', 'gravityformspayfast') . GFPayFast::H6_TAG_END . __(
76-
'Select Production to enable live transactions. Select Test for testing with the Payfast Sandbox.',
76+
'Select Production to enable live transactions. Select Test for testing with Sandbox.',
7777
'gravityformspayfast'
7878
)
7979
),
@@ -190,7 +190,7 @@ public function getPayfastConfigurationInstructions(): array
190190
sprintf(
191191
// translators: %1$s and %2$s are the opening and closing <a> tags for the Payfast link.
192192
__(
193-
'You will need a Payfast account in order to use the Payfast Add-On. Navigate to %1$sPayfast%2$s to register.',
193+
'You will need an account in order to use the Payfast Aggregation Add-On. Navigate to %1$sPayfast%2$s to register.',
194194
'gravityformspayfast'
195195
),
196196
'<a href="https://payfast.io" target="_blank">',
@@ -199,29 +199,29 @@ public function getPayfastConfigurationInstructions(): array
199199
'</p>
200200
<ul>
201201
<li>' . __(
202-
'The Payfast settings are configured per form. Navigate to \'Forms\' -> select \'Settings\' for the form, and select the \'Payfast\' tab.',
202+
'The Payfast Aggregation settings are configured per form. Navigate to \'Forms\' -> select \'Settings\' for the form, and select the \'Payfast Aggregation\' tab.',
203203
'gravityformspayfast'
204204
) . '</li>' .
205205
'<li>' . __(
206-
'From there, click \'Add New\' to configure Payfast feed settings for the currently selected form.',
206+
'From there, click \'Add New\' to configure Payfast Aggregation feed settings for the currently selected form.',
207207
'gravityformspayfast'
208208
) . '</li>' .
209209
'</ul>
210210
<p style="text-align: left;">' .
211211
__(
212-
'Enable \'Debug\' below to log the server-to-server communication between Payfast and your website, for each transaction. The log file for debugging can be found at /wp-content/plugins/gravityformspayfast/payfast.log. If activated, be sure to protect it by adding an .htaccess file in the same directory. If not, the file will be readable by anyone. ',
212+
'Enable \'Debug\' below to log the server-to-server communication between Payfast Aggregation and your website, for each transaction. The log file for debugging can be found at /wp-content/plugins/gravityformspayfast/payfast.log. If activated, be sure to protect it by adding an .htaccess file in the same directory. If not, the file will be readable by anyone. ',
213213
'gravityformspayfast'
214214
) .
215215
'</p>';
216216

217217
return array(
218218
array(
219-
'title' => esc_html__('How to configure Payfast', 'gravityformspayfast'),
219+
'title' => esc_html__('How to configure Payfast Aggregation', 'gravityformspayfast'),
220220
'description' => $description,
221221
'fields' => array(
222222
array(
223223
'name' => 'gf_payfast_debug',
224-
'label' => esc_html__('Payfast Debug', 'gravityformspayfast'),
224+
'label' => esc_html__('Debug', 'gravityformspayfast'),
225225
'type' => 'checkbox',
226226
'choices' => array(
227227
array(
@@ -251,7 +251,7 @@ public function getCancelUrl(): array
251251
'class' => 'medium',
252252
'required' => false,
253253
'tooltip' => GFPayFast::H6_TAG . __('Cancel URL', 'gravityformspayfast') . GFPayFast::H6_TAG_END . __(
254-
'Enter the URL the user should be sent to should they cancel before completing their payment. It currently defaults to the Payfast website.',
254+
'Enter the URL the user should be sent to should they cancel before completing their payment. It currently defaults to the Payfast Aggregation website.',
255255
'gravityformspayfast'
256256
)
257257
),

gravityformspayfast/classes/PfGfUtilities.php

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -201,34 +201,38 @@ public function includeVariablesIfSubscription($meta, array $varArray, $entry, $
201201
'custom_str4' => gmdate('Y-m-d'),
202202
'subscription_type' => 1,
203203
'billing_date' => gmdate('Y-m-d'),
204-
'frequency' => rgar($meta, 'frequency'),
205-
'cycles' => rgar($meta, 'cycles'),
206204
]);
207205

208-
$recurringAmountField = $meta['recurring_amount_field'] ?? null;
209206

210-
if ($recurringAmountField !== 'form_total') {
211-
if (!empty($entry[$recurringAmountField . '.2'])) {
212-
// Case: Specific recurring amount field with decimal value
213-
$varArray['recurring_amount'] = str_replace(
214-
",",
215-
"",
216-
substr($entry[$recurringAmountField . '.2'], 1)
217-
);
218-
} elseif (!empty($entry[$recurringAmountField])) {
219-
// Case: Specific recurring amount field without decimal value
220-
$varArray['recurring_amount'] = substr(
221-
$entry[$recurringAmountField],
222-
strpos($entry[$recurringAmountField], '|') + 1
223-
);
224-
} else {
225-
// Fallback to order total
226-
$varArray['recurring_amount'] = GFCommon::get_order_total($form, $entry);
227-
}
207+
$recurringAmountField = $meta['recurring_amount_field'] ?? null;
208+
209+
if ($recurringAmountField !== 'form_total') {
210+
if (!empty($entry[$recurringAmountField . '.2'])) {
211+
// Case: Specific recurring amount field with decimal value
212+
$varArray['recurring_amount'] = str_replace(
213+
",",
214+
"",
215+
substr($entry[$recurringAmountField . '.2'], 1)
216+
);
217+
} elseif (!empty($entry[$recurringAmountField])) {
218+
// Case: Specific recurring amount field without decimal value
219+
$varArray['recurring_amount'] = substr(
220+
$entry[$recurringAmountField],
221+
strpos($entry[$recurringAmountField], '|') + 1
222+
);
228223
} else {
229-
// Case: Recurring amount is based on form total
224+
// Fallback to order total
230225
$varArray['recurring_amount'] = GFCommon::get_order_total($form, $entry);
231226
}
227+
} else {
228+
// Case: Recurring amount is based on form total
229+
$varArray['recurring_amount'] = GFCommon::get_order_total($form, $entry);
230+
}
231+
232+
$varArray = array_merge($varArray, [
233+
'frequency' => rgar($meta, 'frequency'),
234+
'cycles' => rgar($meta, 'cycles'),
235+
]);
232236
}
233237

234238
return array($varArray, $entry);

0 commit comments

Comments
 (0)