当前位置: 首页>>代码示例>>PHP>>正文


PHP PagSeguroConfig::setApplicationCharset方法代码示例

本文整理汇总了PHP中PagSeguroConfig::setApplicationCharset方法的典型用法代码示例。如果您正苦于以下问题:PHP PagSeguroConfig::setApplicationCharset方法的具体用法?PHP PagSeguroConfig::setApplicationCharset怎么用?PHP PagSeguroConfig::setApplicationCharset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PagSeguroConfig的用法示例。


在下文中一共展示了PagSeguroConfig::setApplicationCharset方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setPagSeguroConfig

 /**
  * Set Config's to PagSeguro API
  */
 private function setPagSeguroConfig()
 {
     $activeLog = $this->getConfigData('log');
     $charset = $this->getConfigData('charset');
     //Module version
     PagSeguroLibrary::setModuleVersion('magento' . ':' . Mage::helper('pagseguro')->getVersion());
     //CMS version
     PagSeguroLibrary::setCMSVersion('magento' . ':' . Mage::getVersion());
     //Setup Charset
     if ($charset != null and !empty($charset)) {
         PagSeguroConfig::setApplicationCharset($charset);
     }
     //Setup Log
     if ($activeLog == 1) {
         $logFile = $this->getConfigData('log_file');
         if (self::checkFile(Mage::getBaseDir() . '/' . $logFile)) {
             PagSeguroConfig::activeLog(Mage::getBaseDir() . '/' . $logFile);
         } else {
             PagSeguroConfig::activeLog();
             //Default Log
         }
     }
 }
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:26,代码来源:PaymentMethod.php

示例2: payment

 /**
  * Use PagSeguroLibrary
  * 
  * @param type $order_id
  * @return type
  */
 public function payment($order)
 {
     global $woocommerce;
     // Instantiate a new payment request
     $paymentRequest = new PagSeguroPaymentRequest();
     // Set cms version
     PagSeguroLibrary::setCMSVersion('woocommerce-v.' . $woocommerce->version);
     // Set plugin version
     PagSeguroLibrary::setModuleVersion('woocommerce-v.' . $this->plugin_version);
     // Set charset
     PagSeguroConfig::setApplicationCharset($this->charset);
     // Sets the currency
     $paymentRequest->setCurrency(PagSeguroCurrencies::getIsoCodeByName("REAL"));
     // Set a reference
     $paymentRequest->setReference($this->invoice_prefix . $order->id);
     //Sets shipping data
     $paymentRequest->setShippingAddress($order->billing_postcode, $order->billing_address_1, '', $order->billing_address_2, '', $order->billing_city, $order->billing_state, $order->billing_country);
     $paymentRequest->setShippingCost($order->order_shipping);
     $paymentRequest->setShippingType(PagSeguroShippingType::getCodeByType('NOT_SPECIFIED'));
     // Sets your customer information.
     $paymentRequest->setSender($order->billing_first_name . ' ' . $order->billing_last_name, $order->billing_email, substr($order->billing_phone, 0, 2), substr($order->billing_phone, 2));
     // Sets the url used by PagSeguro for redirect user after ends checkout process
     if (!empty($this->url_redirect)) {
         $paymentRequest->setRedirectUrl($this->url_redirect);
     } else {
         $paymentRequest->setRedirectUrl($this->get_return_url($order));
     }
     // Sets the url used by PagSeguro for redirect user after ends checkout process
     if (!empty($this->url_notification)) {
         $paymentRequest->setNotificationURL($this->url_notification);
     } else {
         $paymentRequest->setNotificationURL(home_url() . '/index.php?notificationurl=true');
     }
     //Sets Items
     if (sizeof($order->get_items()) > 0) {
         $paymentRequest->setItems($this->setItems($order));
     }
     // Sets the sum of discounts
     $paymentRequest->setExtraAmount(($order->order_discount + $order->cart_discount) * -1 + ($order->order_tax + $order->order_shipping_tax + $order->prices_include_tax));
     try {
         $credentials = new PagSeguroAccountCredentials($this->email, $this->token);
         return $paymentRequest->register($credentials);
     } catch (PagSeguroServiceException $e) {
         $woocommerce->add_error(__('Sorry, unfortunately there was an error during checkout. Please contact the store administrator if the problem persists.', 'wpwcpagseguro'));
         $woocommerce->show_messages();
         wp_die();
     }
 }
开发者ID:moterra,项目名称:woocommerce,代码行数:54,代码来源:wpwcpagseguro.php

示例3: createLog

 private function createLog()
 {
     /*** Retrieving configurated default charset */
     PagSeguroConfig::setApplicationCharset(Configuration::get('PAGSEGURO_CHARSET'));
     /*** Retrieving configurated default log info */
     if (Configuration::get('PAGSEGURO_LOG_ACTIVE')) {
         PagSeguroConfig::activeLog(_PS_ROOT_DIR_ . Configuration::get('PAGSEGURO_LOG_FILELOCATION'));
     }
     LogPagSeguro::info("PagSeguroAbandoned.Search( 'Pesquisa de transações abandonadas realizada em " . date("d/m/Y H:i") . ".')");
 }
开发者ID:franklindias,项目名称:prestashop,代码行数:10,代码来源:PagSeguroAbandonedOrder.php

示例4: _setPagSeguroConfiguration

 /**
  * Retrieve PagSeguro data configuration from database
  */
 private function _setPagSeguroConfiguration()
 {
     // retrieving configurated default charset
     PagSeguroConfig::setApplicationCharset('UTF-8');
     // retrieving configurated default log info
     $filename = JPATH_BASE . '/logs/log_pagseguro.log';
     $this->_verifyFile($filename);
     PagSeguroConfig::activeLog($filename);
 }
开发者ID:HikaShop,项目名称:hikashoppayment-pagseguro,代码行数:12,代码来源:pagseguro.php

示例5: _retrievePagSeguroConfiguration

 /**
  * Retrieve PagSeguro data configuration from database
  */
 private function _retrievePagSeguroConfiguration()
 {
     /* Retrieving configurated default charset */
     PagSeguroConfig::setApplicationCharset(Configuration::get('PAGSEGURO_CHARSET'));
     /* Retrieving configurated default log info */
     if (Configuration::get('PAGSEGURO_LOG_ACTIVE')) {
         PagSeguroConfig::activeLog(_PS_ROOT_DIR_ . Configuration::get('PAGSEGURO_LOG_FILELOCATION'));
     }
 }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:12,代码来源:validation.php

示例6: index

 protected function index()
 {
     $this->language->load('payment/pagseguro');
     $this->data['button_confirm'] = $this->language->get('button_confirm_pagseguro');
     $this->data['text_information'] = $this->language->get('text_information');
     $this->data['text_wait'] = $this->language->get('text_wait');
     require_once DIR_SYSTEM . 'library/PagSeguroLibrary/PagSeguroLibrary.php';
     // Altera a codificação padrão da API do PagSeguro (ISO-8859-1)
     PagSeguroConfig::setApplicationCharset('UTF-8');
     $mb_substr = function_exists("mb_substr") ? true : false;
     $this->load->model('checkout/order');
     $order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
     $paymentRequest = new PagSeguroPaymentRequest();
     /* 
      * Dados do cliente
      */
     // Ajuste no nome do comprador para o máximo de 50 caracteres exigido pela API
     $customer_name = trim($order_info['payment_firstname']) . ' ' . trim($order_info['payment_lastname']);
     if ($mb_substr) {
         $customer_name = mb_substr($customer_name, 0, 50, 'UTF-8');
     } else {
         $customer_name = utf8_encode(substr(utf8_decode($customer_name), 0, 50));
     }
     if ($order_info['currency_code'] != "BRL") {
         $this->log->write("PagSeguro :: Pedido " . $this->session->data['order_id'] . ". O PagSeguro só aceita moeda BRL (Real) e a loja está configurada para a moeda " . $order_info['currency_code']);
     }
     $paymentRequest->setCurrency($order_info['currency_code']);
     $paymentRequest->setSenderName(trim($customer_name));
     $paymentRequest->setSenderEmail(trim($order_info['email']));
     // há limitação de 60 caracteres de acordo com a API
     // OpenCart não separa o DDD do número do telefone. Assim, tentamos separá-los.
     $telefone = preg_replace("/[^0-9]/", '', $order_info['telephone']);
     $telefone = ltrim($telefone, '0');
     if (strlen($telefone) >= 9) {
         $paymentRequest->setSenderPhone(substr($telefone, 0, 2), substr($telefone, 2, strlen($telefone) - 1));
     }
     /* 
      * Frete
      */
     $tipo_frete = $this->config->get('pagseguro_tipo_frete');
     if ($tipo_frete) {
         $paymentRequest->setShippingType($tipo_frete);
     } else {
         $paymentRequest->setShippingType(3);
         // 3: Não especificado
     }
     $this->load->model('localisation/zone');
     if ($this->cart->hasShipping()) {
         $zone = $this->model_localisation_zone->getZone($order_info['shipping_zone_id']);
         // Endereço para entrega
         $paymentRequest->setShippingAddress(array('postalCode' => preg_replace("/[^0-9]/", '', $order_info['shipping_postcode']), 'street' => $order_info['shipping_address_1'], 'number' => '', 'complement' => '', 'district' => $order_info['shipping_address_2'], 'city' => $order_info['shipping_city'], 'state' => isset($zone['code']) ? $zone['code'] : '', 'country' => $order_info['shipping_iso_code_3']));
     } else {
         $zone = $this->model_localisation_zone->getZone($order_info['payment_zone_id']);
         // Endereço para entrega
         $paymentRequest->setShippingAddress(array('postalCode' => preg_replace("/[^0-9]/", '', $order_info['payment_postcode']), 'street' => $order_info['payment_address_1'], 'number' => '', 'complement' => '', 'district' => $order_info['payment_address_2'], 'city' => $order_info['payment_city'], 'state' => isset($zone['code']) ? $zone['code'] : '', 'country' => $order_info['payment_iso_code_3']));
     }
     /*
      * Produtos
      */
     foreach ($this->cart->getProducts() as $product) {
         $options_names = '';
         foreach ($product['option'] as $option) {
             $options_names .= '/' . $option['name'];
         }
         // limite de 100 caracteres para a descrição do produto
         if ($mb_substr) {
             $description = mb_substr($product['model'] . '-' . $product['name'] . $options_names, 0, 100, 'UTF-8');
         } else {
             $description = utf8_encode(substr(utf8_decode($product['model'] . '-' . $product['name'] . $options_names), 0, 100));
         }
         $item = array('id' => $product['product_id'], 'description' => trim($description), 'quantity' => $product['quantity'], 'amount' => $this->currency->format($product['price'], $order_info['currency_code'], false, false));
         // O frete será calculado pelo PagSeguro.
         if ($tipo_frete) {
             $peso = $this->getPesoEmGramas($product['weight_class_id'], $product['weight']) / $product['quantity'];
             $item['weight'] = round($peso);
         }
         $paymentRequest->addItem($item);
     }
     // Referência do pedido no PagSeguro
     if ($this->config->get('pagseguro_posfixo') != "") {
         $paymentRequest->setReference($this->session->data['order_id'] . "_" . $this->config->get('pagseguro_posfixo'));
     } else {
         $paymentRequest->setReference($this->session->data['order_id']);
     }
     // url para redirecionar o comprador ao finalizar o pagamento
     $paymentRequest->setRedirectUrl($this->url->link('checkout/success'));
     // url para receber notificações sobre o status das transações
     $paymentRequest->setNotificationURL($this->url->link('payment/pagseguro/callback'));
     // obtendo frete, descontos e taxas
     $total = $this->currency->format($order_info['total'] - $this->cart->getSubTotal(), $order_info['currency_code'], false, false);
     if ($total > 0) {
         $item = array('id' => '-', 'description' => $this->language->get('text_extra_amount'), 'quantity' => 1, 'amount' => $total);
         $paymentRequest->addItem($item);
     } else {
         if ($total < 0) {
             $paymentRequest->setExtraAmount($total);
         }
     }
     /* 
      * Fazendo a chamada para a API de Pagamentos do PagSeguro. 
//.........这里部分代码省略.........
开发者ID:huluwa,项目名称:mariazul,代码行数:101,代码来源:pagseguro.php

示例7: _setPagSeguroConfiguration

 /**
  * Retrieve PagSeguro data configuration from database
  */
 private function _setPagSeguroConfiguration(TablePaymentmethods $method)
 {
     // retrieving configurated default charset
     PagSeguroConfig::setApplicationCharset($method->pagseguro_charset);
     // retrieving configurated default log info
     if ($method->pagseguro_log) {
         $filename = JPATH_BASE . $method->pagseguro_log_file_name;
         $this->_verifyFile($filename);
         PagSeguroConfig::activeLog($filename);
     }
 }
开发者ID:saper,项目名称:organic-extensions,代码行数:14,代码来源:pagseguro.patch.php

示例8: createLog

 public function createLog($type, $dados)
 {
     /*** Retrieving configurated default charset */
     PagSeguroConfig::setApplicationCharset(Configuration::get('PAGSEGURO_CHARSET'));
     /*** Retrieving configurated default log info */
     if (Configuration::get('PAGSEGURO_LOG_ACTIVE')) {
         PagSeguroConfig::activeLog(_PS_ROOT_DIR_ . Configuration::get('PAGSEGURO_LOG_FILELOCATION'));
     }
     switch ($type) {
         case 'search':
             LogPagSeguro::info("PagSeguroConciliation.Search( 'Pesquisa de conciliação realizada em " . date("d/m/Y H:i") . " em um intervalo de " . $dados['days'] . " dias.')");
             break;
         default:
             LogPagSeguro::info("PagSeguroConciliation.Register( 'Alteração de Status da compra '" . $dados['idOrder'] . "' para o Status '" . $dados['newStatus'] . "(" . $dados['newIdStatus'] . ")' - '" . date("d/m/Y H:i") . "') - end");
             break;
     }
 }
开发者ID:kennedimalheiros,项目名称:prestashop,代码行数:17,代码来源:conciliation.php

示例9: createLog

 private function createLog($e)
 {
     /** Retrieving configurated default charset */
     PagSeguroConfig::setApplicationCharset(Configuration::get('PAGSEGURO_CHARSET'));
     /** Retrieving configurated default log info */
     if (Configuration::get('PAGSEGURO_LOG_ACTIVE')) {
         PagSeguroConfig::activeLog(_PS_ROOT_DIR_ . Configuration::get('PAGSEGURO_LOG_FILELOCATION'));
     }
     LogPagSeguro::info("PagSeguroService.Notification( 'Erro ao processar notificação. ErrorMessage: " . $e . " ') - end");
 }
开发者ID:kennedimalheiros,项目名称:prestashop,代码行数:10,代码来源:pagseguronotificationorderprestashop.php

示例10: _setPagSeguroConfiguration

 /**
  * Retrieve PagSeguro data configuration from database
  */
 private function _setPagSeguroConfiguration()
 {
     $charset = $this->request->post['pagseguro_charset'] == 1 ? $this->language->get('iso') : $this->language->get('utf');
     // setting configurated default charset
     PagSeguroConfig::setApplicationCharset($charset);
     $activeLog = $this->request->post['pagseguro_log'] == 1 ? TRUE : FALSE;
     // setting configurated default log info
     if ($activeLog) {
         $directory = $this->_getDirectoryLog();
         $this->_verifyLogFile($directory);
         PagSeguroConfig::activeLog($directory);
     }
 }
开发者ID:vidaecor,项目名称:opencart,代码行数:16,代码来源:pagseguro.php

示例11: setPagSeguroConfig

 /**
  * Set Config's to PagSeguro API
  *
  */
 private function setPagSeguroConfig()
 {
     $_activeLog = $this->getConfigData('log');
     $_charset = $this->getConfigData('charset');
     Mage::getSingleton('PagSeguro_PagSeguro_Helper_Data')->saveAllStatusPagSeguro();
     //Module version
     PagSeguroLibrary::setModuleVersion('magento' . ':' . $this->Module_Version);
     //CMS version
     PagSeguroLibrary::setCMSVersion('magento' . ':' . Mage::getVersion());
     //Setup Charset
     if ($_charset != null and !empty($_charset)) {
         PagSeguroConfig::setApplicationCharset($_charset);
     }
     //Setup Log
     if ($_activeLog == 1) {
         $_log_file = $this->getConfigData('log_file');
         if (self::checkFile(Mage::getBaseDir() . '/' . $_log_file)) {
             PagSeguroConfig::activeLog(Mage::getBaseDir() . '/' . $_log_file);
         } else {
             PagSeguroConfig::activeLog();
             //Default Log
         }
     }
 }
开发者ID:danielwalterrodrigues,项目名称:asus,代码行数:28,代码来源:PaymentMethod.php

示例12: activeLog

 private function activeLog()
 {
     if (Configuration::get('PAGSEGURO_LOG_ACTIVE')) {
         PagSeguroConfig::setApplicationCharset(Configuration::get('PAGSEGURO_CHARSET'));
         PagSeguroConfig::activeLog(_PS_ROOT_DIR_ . Configuration::get('PAGSEGURO_LOG_FILELOCATION'));
         $this->logActive = true;
     }
 }
开发者ID:franklindias,项目名称:prestashop,代码行数:8,代码来源:PagSeguroOrderConciliation.php


注:本文中的PagSeguroConfig::setApplicationCharset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。