Ejemplo n.º 1
0
 public function init_class($name)
 {
     if (paymill_BENCHMARK) {
         paymill_doBenchmark(true, 'paymill_API_' . $name . '_initialized');
     }
     // benchmark
     // default parameters
     $default_param = array('request' => isset($GLOBALS['paymill_settings']->paymill_general_settings['api_key_private']) ? $GLOBALS['paymill_settings']->paymill_general_settings['api_key_private'] : false);
     // init class?
     if (isset($this->translation[$name][1]) && strlen($this->translation[$name][1]) > 0) {
         // parameter for init given?
         if (isset($default_param[$name])) {
             $this->{$name} = new $this->translation[$name][1]($default_param[$name]);
             if (paymill_BENCHMARK) {
                 paymill_doBenchmark(false, 'paymill_API_' . $name . '_initialized');
             }
             // benchmark
             return $this->{$name};
             // no parameter given for init
         } else {
             $this->{$name} = new $this->translation[$name][1]();
             if (paymill_BENCHMARK) {
                 paymill_doBenchmark(false, 'paymill_API_' . $name . '_initialized');
             }
             // benchmark
             return $this->{$name};
         }
     }
 }
Ejemplo n.º 2
0
 public function __construct($client_id, $amount, $currency)
 {
     if (paymill_BENCHMARK) {
         paymill_doBenchmark(true, 'paymill_payment');
     }
     // benchmark
     load_paymill();
     // this function-call can and should be used whenever working with Paymill API
     if ($this->paymentData === false) {
         try {
             $GLOBALS['paymill_loader']->request_payment->setToken($_POST['paymillToken']);
             $GLOBALS['paymill_loader']->request_payment->setClient($client_id);
             $this->paymentData = $GLOBALS['paymill_loader']->request->create($GLOBALS['paymill_loader']->request_payment);
             // Use this for further payment processing
             if (is_object($this->paymentData) && $this->paymentData->getType() == 'creditcard') {
                 $GLOBALS['paymill_loader']->request_preauth->setPayment($this->getPaymentID());
                 $GLOBALS['paymill_loader']->request_preauth->setAmount(round($amount));
                 $GLOBALS['paymill_loader']->request_preauth->setCurrency($currency);
                 $this->preauthData = $GLOBALS['paymill_loader']->request->create($GLOBALS['paymill_loader']->request_preauth);
                 // Use this for further payment processing, too
             }
         } catch (Exception $e) {
             $GLOBALS['paymill_loader']->paymill_errors->setError(__($e->getMessage(), 'paymill'));
         }
     }
     if (paymill_BENCHMARK) {
         paymill_doBenchmark(false, 'paymill_payment');
     }
     // benchmark
 }
Ejemplo n.º 3
0
function paymill_load_frontend_scripts()
{
    if (paymill_BENCHMARK) {
        paymill_doBenchmark(true, 'paymill_load_frontend_scripts');
    }
    // benchmark
    wp_deregister_script(array('paymill_bridge', 'paymill_bridge_custom'));
    wp_enqueue_script('jquery.formatCurrency-1.4.0.js', PAYMILL_PLUGIN_URL . 'lib/js/jquery.formatCurrency-1.4.0.js', array('jquery'), PAYMILL_VERSION);
    if (empty($GLOBALS['paymill_settings']->paymill_general_settings['pci_dss_3']) || $GLOBALS['paymill_settings']->paymill_general_settings['pci_dss_3'] != '1') {
        wp_enqueue_script('paymill_bridge', 'https://bridge.paymill.com/dss3', array('jquery'), PAYMILL_VERSION);
    } else {
        wp_enqueue_script('paymill_bridge', 'https://bridge.paymill.de/', array('jquery'), PAYMILL_VERSION);
    }
    wp_localize_script('paymill_bridge', 'paymill_lang', array('validateCardNumber' => esc_attr__('Invalid Credit Card Number', 'paymill'), 'validateExpiry' => esc_attr__('Invalid Expiration Date', 'paymill'), 'validateCvc' => esc_attr__('Invalid CVC', 'paymill'), 'validateAccountNumber' => esc_attr__('Invalid Account Number', 'paymill'), 'validateBankCode' => esc_attr__('Invalid Bank Code', 'paymill'), 'validateIBAN' => esc_attr__('Invalid IBAN', 'paymill'), 'validateBIC' => esc_attr__('Invalid BIC', 'paymill'), 'decimalSymbol' => esc_attr__($GLOBALS['paymill_settings']->paymill_pay_button_settings['number_decimal'], 'paymill'), 'digitGroupSymbol' => esc_attr__($GLOBALS['paymill_settings']->paymill_pay_button_settings['number_thousands'], 'paymill'), 'symbol' => esc_attr__($GLOBALS['paymill_settings']->paymill_pay_button_settings['currency'], 'paymill'), 'currency_format' => esc_attr__($GLOBALS['paymill_settings']->paymill_pay_button_settings['currency_format'], 'paymill'), 'internal_server_error' => esc_attr__('Communication with PSP failed', 'paymill'), 'invalid_public_key' => esc_attr__('Invalid Public Key', 'paymill'), 'invalid_payment_data' => esc_attr__('not permitted for this method of payment, credit card type, currency or country', 'paymill'), 'unknown_error' => esc_attr__('Unknown Error', 'paymill'), '3ds_cancelled' => esc_attr__('Password Entry of 3-D Secure password was cancelled by the user', 'paymill'), 'field_invalid_card_number' => esc_attr__('Missing or invalid creditcard number', 'paymill'), 'field_invalid_card_exp_year' => esc_attr__('Missing or invalid expiry year', 'paymill'), 'field_invalid_card_exp_month' => esc_attr__('Missing or invalid expiry month', 'paymill'), 'field_invalid_card_exp' => esc_attr__('Card is no longer valid or has expired', 'paymill'), 'field_invalid_card_cvc' => esc_attr__('Invalid checking number', 'paymill'), 'field_invalid_card_holder' => esc_attr__('Invalid cardholder', 'paymill'), 'field_invalid_amount' => esc_attr__('Invalid or missing amount', 'paymill'), 'field_invalid_amount_int' => esc_attr__('Invalid or missing amount for 3-D Secure', 'paymill'), 'field_invalid_currency' => esc_attr__('Invalid or missing currency code for 3-D Secure', 'paymill'), 'field_invalid_account_number' => esc_attr__('Missing or invalid bank account number', 'paymill'), 'field_invalid_account_holder' => esc_attr__('Missing or invalid bank account holder', 'paymill'), 'field_invalid_bank_code' => esc_attr__('Missing or invalid bank code', 'paymill'), 'field_invalid_iban' => esc_attr__('Missing or invalid IBAN', 'paymill'), 'field_invalid_bic' => esc_attr__('Missing or invalid BIC', 'paymill'), 'field_invalid_country' => esc_attr__('Missing or unsupported country (with IBAN)', 'paymill'), 'field_invalid_bank_data' => esc_attr__('Missing or invalid bank data combination', 'paymill')));
    wp_enqueue_script('paymill_bridge_custom', PAYMILL_PLUGIN_URL . 'lib/js/paymill.js', array('paymill_bridge'), PAYMILL_VERSION);
    wp_enqueue_script('livevalidation', PAYMILL_PLUGIN_URL . 'lib/js/livevalidation_standalone.compressed.js', array('paymill_bridge_custom'), PAYMILL_VERSION);
    wp_enqueue_script('livevalidation_custom', PAYMILL_PLUGIN_URL . 'lib/js/livevalidation_custom.js', array('livevalidation'), PAYMILL_VERSION);
    wp_localize_script('livevalidation_custom', 'paymill_livevl', array('wrongLength' => esc_attr__('Must be {is} characters long!', 'paymill'), 'tooShort' => esc_attr__('Must not be less than {minimum} characters long!', 'paymill'), 'tooLong' => esc_attr__('Must not be more than {maximum} characters long!', 'paymill'), 'notANumber' => esc_attr__('Must be a number!', 'paymill'), 'notAnInteger' => esc_attr__('Must be an integer!', 'paymill'), 'wrongNumber' => esc_attr__('Must be {is}!', 'paymill'), 'tooLow' => esc_attr__('Must not be less than {minimum}!', 'paymill'), 'tooHigh' => esc_attr__('Must not be more than {maximum}!', 'paymill'), 'notEmpty' => esc_attr__('Supply a value!', 'paymill')));
    if (empty($GLOBALS['paymill_settings']->paymill_general_settings['no_default_css']) || $GLOBALS['paymill_settings']->paymill_general_settings['no_default_css'] != '1') {
        wp_enqueue_style('paymill', PAYMILL_PLUGIN_URL . 'lib/css/paymill.css', false, PAYMILL_VERSION, false);
    }
    if (paymill_BENCHMARK) {
        paymill_doBenchmark(false, 'paymill_load_frontend_scripts');
    }
    // benchmark
}
Ejemplo n.º 4
0
function load_paymill()
{
    if (paymill_BENCHMARK) {
        paymill_doBenchmark(true, 'paymill_load_API');
    }
    // benchmark
    if (!isset($GLOBALS['paymill_loader']) || get_class($GLOBALS['paymill_loader']) != 'paymill_loader') {
        $GLOBALS['paymill_loader'] = new paymill_loader();
    }
    if (paymill_BENCHMARK) {
        paymill_doBenchmark(false, 'paymill_load_API');
    }
    // benchmark
}
Ejemplo n.º 5
0
 public function offerCreate($params)
 {
     if (paymill_BENCHMARK) {
         paymill_doBenchmark(true, 'paymill_subscription_offerCreate');
     }
     // benchmark
     load_paymill();
     // this function-call can and should be used whenever working with Paymill API
     try {
         $GLOBALS['paymill_loader']->request_offer->setAmount(round($params['amount']));
         $GLOBALS['paymill_loader']->request_offer->setCurrency($params['currency']);
         $GLOBALS['paymill_loader']->request_offer->setInterval($params['interval']);
         $GLOBALS['paymill_loader']->request_offer->setName($params['name']);
         $GLOBALS['paymill_loader']->request_offer->setTrialPeriodDays($params['trial_period_days']);
         $output = $GLOBALS['paymill_loader']->request->create($GLOBALS['paymill_loader']->request_offer);
         $offerID = $output->getId();
         $this->offerGetList(true);
         //$output			= $this->offerGetDetailByID($offerID);
         $output = $offerID;
     } catch (Exception $e) {
         $GLOBALS['paymill_loader']->paymill_errors->setError(__($e->getMessage(), 'paymill'));
         $output = false;
     }
     if (paymill_BENCHMARK) {
         paymill_doBenchmark(false, 'paymill_subscription_offerCreate');
     }
     // benchmark
     return $output;
 }
Ejemplo n.º 6
0
 private function plugin_options_tabs()
 {
     if (paymill_BENCHMARK) {
         paymill_doBenchmark(true, 'paymill_plugin_options_tabs');
     }
     // benchmark
     $current_tab = isset($_GET['tab']) ? $_GET['tab'] : $this->setting_keys['paymill_general_settings'];
     echo '<h2 class="nav-tab-wrapper">';
     foreach ($this->plugin_settings_tabs as $tab_key => $tab_caption) {
         $active = $current_tab == $tab_key ? 'nav-tab-active' : '';
         echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->plugin_options_key . '&amp;tab=' . $tab_key . '">' . $tab_caption . '</a>';
     }
     echo '</h2>';
     if (paymill_BENCHMARK) {
         paymill_doBenchmark(false, 'paymill_plugin_options_tabs');
     }
     // benchmark
 }
Ejemplo n.º 7
0
function paymill_shutdownBenchmark()
{
    return paymill_doBenchmark(false, 'shutdown', true);
}