Skip to content

Commit 039d0f1

Browse files
committed
updated transaction inialization to include plugin name in custom fields
1 parent eac6d41 commit 039d0f1

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

class-gf-paystack-api.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55

66
class GFPaystackApi
77
{
8-
private $plugin_name;
9-
private $public_key;
10-
private $secret_key;
8+
public $plugin_name;
9+
10+
protected $public_key;
11+
12+
protected $secret_key;
1113

1214
public function __construct($config)
1315
{

class-gf-paystack.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,12 @@ public function redirect_url($feed, $submission_data, $form, $entry)
928928
// Get feed custom metadata
929929
$custom_data = $this->get_paystack_meta_data($feed, $entry, $form);
930930

931+
$custom_data[] = [
932+
'display_name' => 'Plugin Name',
933+
'variable_name' => 'plugin_name',
934+
'value' => $this->paystack_api->plugin_name
935+
];
936+
931937
// Generate transaction reference
932938
$reference = uniqid("gf-{$entry['id']}-");
933939

@@ -1471,15 +1477,15 @@ public function callback()
14711477
* @param array $entry
14721478
* @param array $action
14731479
*/
1474-
public function post_payment_action ($entry, $action)
1480+
public function post_payment_action($entry, $action)
14751481
{
14761482
parent::post_payment_action($entry, $action);
14771483

14781484
if (isset($action['add_subscription_payment']) && is_array($action['add_subscription_payment'])) {
14791485
$this->add_subscription_payment($entry, $action['add_subscription_payment']);
14801486
}
14811487
}
1482-
1488+
14831489
/**
14841490
* Retrieve the Paystack Event for the received webhook.
14851491
*
@@ -1706,7 +1712,6 @@ public function get_paystack_meta_data($feed, $entry, $form)
17061712
'variable_name' => sanitize_title($meta['custom_key']),
17071713
'value' => $field_value,
17081714
];
1709-
17101715
}
17111716
}
17121717

0 commit comments

Comments
 (0)