Пример #1
0
<?php

include '../bootstrap.php';
S2P_SDK\S2P_SDK_Module::st_debugging_mode(true);
S2P_SDK\S2P_SDK_Module::st_throw_errors(false);
$api_parameters = array();
// By default, API will check S2P_SDK_API_KEY, S2P_SDK_SITE_ID and S2P_SDK_ENVIRONMENT constats set in config.inc.php
// If you want to override these constants (per request) uncomment lines below and provide values to override
// $api_parameters['api_key'] = '{PROVIDED_APIKEY}';
// $api_parameters['site_id'] = '{PROVIDED_SITE_ID}';
// $api_parameters['environment'] = 'test'; // test or live
$api_parameters['method'] = 'methods';
$api_parameters['func'] = 'list_all';
$api_parameters['get_variables'] = array();
$api_parameters['method_params'] = array();
$call_params = array();
$finalize_params = array();
$finalize_params['redirect_now'] = false;
if (!($call_result = S2P_SDK\S2P_SDK_Module::quick_call($api_parameters, $call_params, $finalize_params))) {
    echo 'API call error: ';
    if ($error_arr = S2P_SDK\S2P_SDK_Module::st_get_error() and !empty($error_arr['display_error'])) {
        echo $error_arr['display_error'];
    } else {
        echo 'Unknown error.';
    }
} else {
    echo 'API call time: ' . $call_result['call_microseconds'] . 'ms<br/>' . "\n";
    if (!empty($call_result['finalize_result']['should_redirect']) and !empty($call_result['finalize_result']['redirect_to'])) {
        echo '<br/>' . "\n" . 'Go to <a href="' . $call_result['finalize_result']['redirect_to'] . '">' . $call_result['finalize_result']['redirect_to'] . '</a> to complete transaction<br/>' . "\n" . '<br/>' . "\n";
    }
    echo 'Call result:<br>' . "\n" . '<pre>';
Пример #2
0
// Detecting current directory path - in certain environment setups you might have to manually provide this path
if (!($_current_directory_path = __DIR__)) {
    $_current_directory_path = getcwd();
}
define('S2P_SDK_VERSION', '1.0.34');
define('S2P_SDK_DIR_PATH', $_current_directory_path . '/');
define('S2P_SDK_DIR_CLASSES', $_current_directory_path . '/classes/');
define('S2P_SDK_DIR_STRUCTURES', $_current_directory_path . '/structures/');
define('S2P_SDK_DIR_METHODS', $_current_directory_path . '/methods/');
define('S2P_SDK_DIR_LANGUAGES', $_current_directory_path . '/languages/');
include_once S2P_SDK_DIR_CLASSES . 's2p_sdk_error.inc.php';
include_once S2P_SDK_DIR_CLASSES . 's2p_sdk_language.inc.php';
include_once S2P_SDK_DIR_CLASSES . 's2p_sdk_module.inc.php';
include_once S2P_SDK_DIR_CLASSES . 's2p_sdk_database.inc.php';
include_once S2P_SDK_DIR_CLASSES . 's2p_sdk_wrapper.inc.php';
include_once S2P_SDK_DIR_STRUCTURES . 's2p_sdk_scope_variable.inc.php';
include_once S2P_SDK_DIR_STRUCTURES . 's2p_sdk_scope_structure.inc.php';
if (!S2P_SDK\S2P_SDK_Language::define_language(S2P_SDK\S2P_SDK_Language::LANG_EN, array('title' => 'English', 'files' => array(S2P_SDK_DIR_LANGUAGES . 'en.csv'))) or !S2P_SDK\S2P_SDK_Language::define_language(S2P_SDK\S2P_SDK_Language::LANG_RO, array('title' => 'Romana', 'files' => array(S2P_SDK_DIR_LANGUAGES . 'ro.csv')))) {
    // Do something if we cannot initialize English language
    S2P_SDK\S2P_SDK_Language::language_container()->throw_error();
} else {
    S2P_SDK\S2P_SDK_Language::language_container()->set_current_language(S2P_SDK\S2P_SDK_Language::LANG_EN);
}
S2P_SDK\S2P_SDK_Module::st_debugging_mode(false);
S2P_SDK\S2P_SDK_Module::st_detailed_errors(false);
S2P_SDK\S2P_SDK_Module::st_throw_errors(false);
if (!@file_exists(S2P_SDK_DIR_PATH . 'config.inc.php')) {
    die('SDK config file not found. Please configure bootstrap file.');
}
include_once S2P_SDK_DIR_PATH . 'config.inc.php';