added options in paypal credential and payment
This commit is contained in:
@@ -35,7 +35,9 @@ function add_plugin_content_CIPF() {
|
||||
* options
|
||||
*
|
||||
*/
|
||||
//delete_option($option_paypal_object['_name']);
|
||||
$option_paypal = Plgntls::get_option_safe($option_paypal_object, true);
|
||||
//delete_option($option_payment_object['_name']);
|
||||
$option_payment = Plgntls::get_option_safe($option_payment_object, true);
|
||||
//delete_option($option_emails_object['_name']);
|
||||
$option_emails = Plgntls::get_option_safe($option_emails_object, true);
|
||||
@@ -96,50 +98,46 @@ function update_payment_messages_option_CIPF($request, $option_name, $option_dat
|
||||
function update_paypal_credentials_CIPF($request, $option_name, $option_data, $option_default) {
|
||||
Plgntls::debug_infos();
|
||||
|
||||
if (!isset(
|
||||
$request['sandbox_or_live'],
|
||||
$request['live_client_id'],
|
||||
$request['live_client_secret'],
|
||||
$request['sandbox_client_id'],
|
||||
$request['sandbox_client_secret'],
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* force price 1 cent ?
|
||||
*
|
||||
*/
|
||||
$force_1_cent = false;
|
||||
if (isset($request['force_1_cent'])) {
|
||||
$force_1_cent = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* is sandbox or live ?
|
||||
*
|
||||
*/
|
||||
$is_sandbox = false;
|
||||
if (!isset($request['sandbox_or_live'])) {
|
||||
return;
|
||||
}
|
||||
if ($request['sandbox_or_live'] === 'sandbox') {
|
||||
$is_sandbox = true;
|
||||
}
|
||||
else if ($request['sandbox_or_live'] === 'live') {
|
||||
$is_sandbox = false;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* client id
|
||||
* ids
|
||||
*
|
||||
*/
|
||||
$client_id = '';
|
||||
if (!isset($request['client_id'])) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$client_id = $request['client_id'];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* client secret
|
||||
*
|
||||
*/
|
||||
$client_secret = '';
|
||||
if (!isset($request['client_secret'])) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$client_secret = $request['client_secret'];
|
||||
}
|
||||
$live_client_id = $request['live_client_id'];
|
||||
$live_client_secret = $request['live_client_secret'];
|
||||
$sandbox_client_id = $request['sandbox_client_id'];
|
||||
$sandbox_client_secret = $request['sandbox_client_secret'];
|
||||
|
||||
|
||||
/*
|
||||
@@ -148,9 +146,12 @@ function update_paypal_credentials_CIPF($request, $option_name, $option_data, $o
|
||||
set_paypal_options_CIPF($is_sandbox, $client_id, $client_secret);
|
||||
*/
|
||||
$data = array(
|
||||
'force_1_cent' => $force_1_cent,
|
||||
'is_sandbox' => $is_sandbox,
|
||||
'client_id' => $client_id,
|
||||
'client_secret' => $client_secret,
|
||||
'live_client_id' => $live_client_id,
|
||||
'live_client_secret' => $live_client_secret,
|
||||
'sandbox_client_id' => $sandbox_client_id,
|
||||
'sandbox_client_secret' => $sandbox_client_secret,
|
||||
);
|
||||
Plgntls::update_option_safe($option_name, $data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user