Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion wpjobster-paystack.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ protected function __construct()
add_action('plugins_loaded', array( $this, 'init_gateways' ), 0);
add_filter('plugin_action_links_' . plugin_basename(__FILE__), array( $this, 'plugin_action_links' ));

add_filter('wpj_payment_response_accepted_params', array( $this, 'add_gateway_param_accepted_uri_params' ));

add_filter('wpjobster_take_allowed_currency_paystack_gateway', array( $this,'get_gateway_currency' ));

add_action('wpjobster_taketo_paystack_gateway', array( $this, 'taketogateway_function' ), 10, 2);
Expand All @@ -103,6 +105,10 @@ function get_gateway_currency( $currency )
return $currency;
}

public function add_gateway_param_accepted_uri_params( $arr = array() ) {
$arr[] = 'trxref';
return $arr;
}

/**
* Initialize the gateway. Called very early - in the context of the plugins_loaded action
Expand Down Expand Up @@ -317,6 +323,11 @@ public function taketogateway_function($payment_type, $common_details)
$wpjobster_final_payable_amount = $common_details['wpjobster_final_payable_amount'];
$currency = $common_details['currency'];

$payment = wpj_get_payment( array(
'payment_type' => $payment_type,
'payment_type_id' => $common_details['order_id'],
) );

////
$all_data['amount'] = $wpjobster_final_payable_amount;
$all_data['currency'] = $currency;
Expand Down Expand Up @@ -356,7 +367,7 @@ public function taketogateway_function($payment_type, $common_details)
'amount' => $koboamount,
'reference' => $txn_code,
'metadata' => json_encode(array('custom_fields' => $meta )),
'callback_url' => get_bloginfo('url') . '?payment_response=paystack_response',
'callback_url' => get_bloginfo('url') . '?payment_response=paystack_response&payment_type=' . $payment_type . '&wpj_payment_id=' . $payment->id,

);
$args = array(
Expand Down