Files
Testing/bwadmin/admin_paymentgw_googlecheckout.php

85 lines
2.2 KiB
PHP
Raw Permalink Normal View History

2026-11-17 16:15:01 -05:00
<?php
$page = "admin_paymentgw_googlecheckout";
include "admin_header.php";
// ALLOW ACCESS TO SUPERADMIN ONLY
if( $admin->admin_info['admin_id'] != 1) {
$page = "admin_payment_error";
include "admin_footer.php";
exit();
}
$task = semods::getpost('task', 'main');
// SET RESULT VARIABLE
$result = 0;
if($task == "testapi") {
echo "Not implemented";
//$paymentgw = semods_paymengtw_factory( 'googlecheckout' );
exit();
}
if($task == "main") {
// Load data
// Google Checkout
$paymentgw_typename = 'googlecheckout';
$paymentgw = semods::db_query_assoc( "SELECT * FROM se_semods_paymentgateways WHERE paymentgateway_typename = '$paymentgw_typename'" );
$googlech_enabled = $paymentgw['paymentgateway_enabled'];
$metadata = unserialize( $paymentgw['paymentgateway_metadata'] );
$googlech_merchant_id = $metadata['merchant_id'];
$googlech_merchant_key = $metadata['merchant_key'];
}
// SAVE CHANGES
if($task == "dosave") {
// Google Checkout
$paymentgw_typename = 'googlecheckout';
$googlech_enabled = semods::getpost('googlech_enabled',0);
$googlech_merchant_id = semods::getpost('googlech_merchant_id','');
$googlech_merchant_key = semods::getpost('googlech_merchant_key','');
$metadata = array();
$metadata['merchant_id'] = $googlech_merchant_id;
$metadata['merchant_key'] = $googlech_merchant_key;
$metadata = serialize( $metadata );
$database->database_query( "UPDATE se_semods_paymentgateways SET paymentgateway_enabled = $googlech_enabled, paymentgateway_metadata = '$metadata' WHERE paymentgateway_typename = '$paymentgw_typename'" );
header("Location: admin_paymentgw.php");
exit();
}
$notification_url = $url->url_base . "payment_googlecheckout.php?action=ipn";
// ASSIGN VARIABLES AND SHOW GENERAL SETTINGS PAGE
$smarty->assign('result', $result);
$smarty->assign('error', $error);
// Google Checkout
$smarty->assign('googlech_enabled', $googlech_enabled);
$smarty->assign('googlech_merchant_id', $googlech_merchant_id);
$smarty->assign('googlech_merchant_key', $googlech_merchant_key);
$smarty->assign('notification_url', $notification_url);
include "admin_footer.php";
?>