コード例 #1
0
 function _paymentDataFormProcess($active_genre_identifier)
 {
     $payment_smarty = new Smarty();
     $payment_smarty->template_dir = DIR_FS_EXTERNAL . 'payone/templates/';
     $error = parent::get_error();
     if ($error != '') {
         $payment_smarty->assign('error', $error['error']);
     }
     $genre_config = $this->config[$active_genre_identifier];
     $payment_smarty->assign('genre_specific', $genre_config['genre_specific']);
     $standard_parameters = parent::_standard_parameters('creditcardcheck');
     $standard_parameters['responsetype'] = 'REDIRECT';
     $standard_parameters['storecarddata'] = 'yes';
     $standard_parameters['encoding'] = 'UTF-8';
     $standard_parameters['successurl'] = (ENABLE_SSL == true ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG . FILENAME_CHECKOUT_PROCESS . '?' . xtc_session_name() . '=' . xtc_session_id();
     $standard_parameters['errorurl'] = (ENABLE_SSL == true ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG . FILENAME_CHECKOUT_CONFIRMATION . '?' . xtc_session_name() . '=' . xtc_session_id() . '&conditions=true&payment_error=' . $this->code;
     $standard_parameters['hash'] = $this->payone->computeHash($standard_parameters, $this->global_config['key']);
     // not in hash but needed as hidden field
     $cctypes = $this->payone->getTypesForGenre($active_genre_identifier);
     for ($i = 0, $n = count($cctypes); $i < $n; $i++) {
         if ($cctypes[$i]['typekey'] == $_SESSION[$this->code]['cardtype']) {
             $standard_parameters['cardtype'] = $cctypes[$i]['shorttype'];
             break;
         }
     }
     $ccexpires_years = array();
     for ($y = 0, $base = date('y'); $y < 10; $y++) {
         $ccexpires_years[] = $base + $y;
     }
     $payment_smarty->assign('ccexpires_years', $ccexpires_years);
     $ccexpires_months = array();
     for ($m = 1; $m <= 12; $m++) {
         $ccexpires_months[] = sprintf('%02d', $m);
     }
     $payment_smarty->assign('ccexpires_months', $ccexpires_months);
     $hidden = array();
     foreach ($standard_parameters as $key => $value) {
         $hidden[] = xtc_draw_hidden_field($key, $value);
     }
     $payment_smarty->assign('hidden', implode("\n", $hidden) . "\n");
     $payment_smarty->assign('payonecss', DIR_WS_EXTERNAL . 'payone/css/payone.css');
     $payment_smarty->caching = 0;
     $module_form = $payment_smarty->fetch('checkout_payone_cc_form.html');
     return $module_form;
 }
コード例 #2
0
 function _paymentDataFormProcess($active_genre_identifier)
 {
     global $order;
     $payment_smarty = new Smarty();
     $payment_smarty->template_dir = DIR_FS_EXTERNAL . 'payone/templates/';
     $error = parent::get_error();
     if ($error != '') {
         $payment_smarty->assign('error', $error['error']);
     }
     $genre_config = $this->config[$active_genre_identifier];
     $global_config = $genre_config['global_override'] == 'true' ? $genre_config['global'] : $this->config['global'];
     foreach ($genre_config['types'] as $type_name => $type_config) {
         if ($type_config['active'] == 'true') {
             if ($type_name == 'klarna') {
                 if (in_array($order->billing['country']['iso_code_2'], $genre_config['genre_specific']['klarna']['countries'])) {
                     $required_fields = array('customers_dob' => $_SESSION[$this->code]['installment_customers_dob'], 'customers_telephone' => $_SESSION[$this->code]['installment_customers_telephone']);
                     $required_fields = array_merge($required_fields, $this->klarnalocale[$order->billing['country']['iso_code_2']]['required']);
                     $payment_smarty->assign('required_fields', $required_fields);
                     $payment_smarty->assign('invoice_js', '<script>
                                                  new Klarna.Terms.Invoice({  
                                                    el: \'invoice\',
                                                    eid: \'' . $genre_config['genre_specific']['klarna']['storeid'] . '\',
                                                    locale: \'' . $this->klarnalocale[$order->billing['country']['iso_code_2']]['locale'] . '\',
                                                    charge: 0
                                                  });
                                                </script>');
                     if ($this->klarnalocale[$order->billing['country']['iso_code_2']]['confirm'] == 'true') {
                         $payment_smarty->assign('confirm_text', sprintf(TEXT_KLARNA_CONFIRM, '<span id="conset"></span>'));
                         $payment_smarty->assign('confirm_js', '<script>
                                                    new Klarna.Terms.Consent({  
                                                      el: \'conset\',
                                                      eid: \'' . $genre_config['genre_specific']['klarna']['storeid'] . '\',
                                                      locale: \'' . $this->klarnalocale[$order->billing['country']['iso_code_2']]['locale'] . '\'
                                                    });
                                                  </script>');
                     }
                 }
             }
         }
     }
     $payment_smarty->assign('payonecss', DIR_WS_EXTERNAL . 'payone/css/payone.css');
     $payment_smarty->caching = 0;
     $module_form = $payment_smarty->fetch('checkout_payone_installment_form.html');
     return $module_form;
 }