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


Java Credentials类代码示例

本文整理汇总了Java中br.com.uol.pagseguro.domain.Credentials的典型用法代码示例。如果您正苦于以下问题:Java Credentials类的具体用法?Java Credentials怎么用?Java Credentials使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Credentials类属于br.com.uol.pagseguro.domain包,在下文中一共展示了Credentials类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registraNotificacao

import br.com.uol.pagseguro.domain.Credentials; //导入依赖的package包/类
/**
 * Pesquisa notificacao informada e registra alteracoes de status
 * @param notificationCode
 * @throws JazzAVPaymentException 
 * @throws ServletException
 * @throws IOException
 */
@Override
public AnuncioVO registraNotificacao(String notificationCode) throws TransacaoNaoEncontradaException, JazzAVPaymentException {
	//recupera credenciais para invocar servico pagseguro
	Credentials credentials = getCredentials();

	// solicta transacao para o pagseguro atraves da API especifica
	Transaction transaction = getTransaction(notificationCode, credentials);
	
	// recupera o registro do anuncio internamente
	AnuncioVO anuncio = getAnuncioVO(transaction);

	// registra historico de mudanca de status
	registraMudancaStatus(transaction, anuncio, "Atualizacao automatica de historico");
	
	return anuncio;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:24,代码来源:AnuncioBusinessImpl.java

示例2: buildURLByDateInterval

import br.com.uol.pagseguro.domain.Credentials; //导入依赖的package包/类
private static String buildURLByDateInterval(Credentials credentials, String serviceURL, Date initialDate,
        Date finalDate, Integer page, Integer maxPageResults) {

    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);

    StringBuffer url = new StringBuffer();
    url.append(serviceURL);
    url.append("?initialDate=" + (initialDate != null ? sdf.format(initialDate) : ""));
    url.append("&finalDate=" + (finalDate != null ? sdf.format(finalDate) : ""));
    if (page != null) {
        url.append("&page=" + page);
    }
    if (maxPageResults != null) {
        url.append("&maxPageResults=" + maxPageResults);
    }
    url.append("&" + UrlUtil.buildQueryString(credentials.getAttributes()));

    return url.toString();

}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:21,代码来源:TransactionSearchService.java

示例3: checkTransaction

import br.com.uol.pagseguro.domain.Credentials; //导入依赖的package包/类
/**
 * Returns a transaction from a notification code
 * 
 * @param credentials
 * @param notificationCode
 * @return a transaction from a notification code
 * @throws PagSeguroServiceException
 */
public static Transaction checkTransaction(Credentials credentials, String notificationCode)
        throws PagSeguroServiceException {

    log.info("NotificationService.CheckTransaction(notificationCode=" + notificationCode + ") - begin");

    // calling transaction notifications webservice
    HttpsURLConnection connection = HttpsURLConnectionUtil.getHttpsGetConnection(
            buildURL(credentials, notificationCode), CONTENT_TYPE);

    try {
        // Parsing the transaction
        Transaction transaction = TransactionParser.readTransaction(connection.getInputStream());
        log.info("NotificationService.CheckTransaction(notificationCode=" + notificationCode + ") - end - " + transaction);
        return transaction;
    } catch (Exception e) {
        log.error("NotificationService.CheckTransaction(notificationCode=" + notificationCode + ") - ", e);
        throw new RuntimeException(e);
    }
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:28,代码来源:NotificationService.java

示例4: doPayment

import br.com.uol.pagseguro.domain.Credentials; //导入依赖的package包/类
/**
 * Requests a payment
 * 
 * @param paymentRequest
 * @return The Uri to where the user needs to be redirected to in order to complete the payment process
 * @throws PagSeguroServiceException
 */
public static URL doPayment(Credentials credentials, PaymentRequest paymentRequest)
        throws PagSeguroServiceException {

	log.info("PaymentService.Register(" + paymentRequest + ") - begin");
    String xml = PaymentParser.writePaymentXml(paymentRequest);

    // calling payment web service
    HttpsURLConnection connection = HttpsURLConnectionUtil.getHttpsPostConnection(buildUrl(credentials, paymentRequest),
            URL_CONTENT_TYPE + "; charset=" + CHARSET, xml);

    try {
        // parsing web service response
        URL paymentURL = new URL(URL_REDIR + PaymentParser.readPaymentReturnXml(connection.getInputStream()));
        
        log.info("PaymentService.Register("+paymentRequest+") - end - " + paymentURL);
        return paymentURL;
        
    } catch (Exception e) {
        log.error("PaymentService.Register(" + paymentRequest + ") - error ", e);
        throw new RuntimeException(e);
    } finally {
        connection.disconnect();
    }
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:32,代码来源:PaymentService.java

示例5: getTransaction

import br.com.uol.pagseguro.domain.Credentials; //导入依赖的package包/类
/**
 * @param res 
 * @param notificationCode
 * @param credentials
 * @return
 * @throws JazzAVPaymentException 
 */
protected Transaction getTransaction(String notificationCode, Credentials credentials) throws JazzAVPaymentException  {
	Transaction transaction;
	try {
		transaction = tss.searchByCode(credentials, notificationCode);
	} catch (PagSeguroServiceException e) {
		
	
		log.error("Erro ao tentar recuperar a transacao referente a notificacao (notificationCode=" + notificationCode + ")", e);
		throw new JazzAVPaymentException("Erro ao tentar recuperar a transacao referente a notificacao (notificationCode=" + notificationCode + ")", e);
	}
	return transaction;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:20,代码来源:AnuncioBusinessImpl.java

示例6: searchByCode

import br.com.uol.pagseguro.domain.Credentials; //导入依赖的package包/类
/**
   * Finds a transaction with a matching transaction code
   * 
   * @param credentials
   * @param transactionCode
   * @return a transaction in PagSeguro
   * @see Transaction
   * @throws PagSeguroServiceException
   */
  public static Transaction searchByCode(Credentials credentials, String transactionCode)
          throws PagSeguroServiceException {

log.info("TransactionSearchService.SearchByCode(transactionCode=" + transactionCode + ") - begin");

      if (transactionCode == null || transactionCode.trim().equals("")) {
          throw new IllegalArgumentException("transaction code can not be null");
      }

      // calling transaction search web service
      HttpsURLConnection connection = HttpsURLConnectionUtil.getHttpsGetConnection(
              buildURLByCode(credentials, transactionCode), CONTENT_TYPE);

      try {
          // parsing transaction
          Transaction transaction = TransactionParser.readTransaction(connection.getInputStream());
	log.info("TransactionSearchService.SearchByCode(transactionCode="
			+ transactionCode + ") - end - " + transaction.toString());
          return transaction;
      } catch (Exception e) {
	log.error("TransactionSearchService.SearchByCode(transactionCode="
			+ transactionCode + ") - error", e);
          throw new RuntimeException(e);
      }finally{
      	connection.disconnect();
      }
  }
 
开发者ID:darciopacifico,项目名称:omr,代码行数:37,代码来源:TransactionSearchService.java

示例7: searchByDate

import br.com.uol.pagseguro.domain.Credentials; //导入依赖的package包/类
/**
   * Search transactions associated with this set of credentials within a date range
   *
   * @param credentials
   * @param initialDate
   * @param finalDate
   * @param page
   * @param maxPageResults
   * @return a object of <b>TransactionSearchResult</b>
   * @see TransactionSearchResult
   * @throws PagSeguroServiceException
   */
  public static TransactionSearchResult searchByDate(Credentials credentials, Date initialDate, Date finalDate,
          Integer page, Integer maxPageResults) throws PagSeguroServiceException {
      
  	SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
  	String initialDateString = initialDate != null ? sdf.format(initialDate) : null;
  	String finalDateString = finalDate!= null ? sdf.format(finalDate) :  null;
      
log.info("TransactionSearchService.SearchByDate(initialDate="
		+ initialDateString + ", finalDate=" + finalDateString + ") - begin");

      // call transaction search web service
      HttpsURLConnection connection = HttpsURLConnectionUtil.getHttpsGetConnection(
              buildURLByDate(credentials, initialDate, finalDate, page, maxPageResults), CONTENT_TYPE);

      TransactionSearchResult search = new TransactionSearchResult();
      try {
          // parsing PagSeguro response
          TransactionSearchResultXMLHandler.getHandler(connection.getInputStream(), search);
          
          log.info("TransactionSearchService.SearchByDate(initialDate="
  				+ initialDateString + ", finalDate=" + finalDateString + ") - end - "
  				+ search);
          
          return search;
          
      } catch (Exception e) {
      	log.error("TransactionSearchService.SearchByDate(initialDate="
  				+ initialDateString + ", finalDate=" + finalDateString + ") - error "
  				+ search, e);
          throw new RuntimeException(e);
      } finally {
      	connection.disconnect();
      }

  }
 
开发者ID:darciopacifico,项目名称:omr,代码行数:48,代码来源:TransactionSearchService.java

示例8: confirmarAnuncio

import br.com.uol.pagseguro.domain.Credentials; //导入依赖的package包/类
/**
 * Executa confirmacao do registro do anuncio, a partir do id de transacao informado
 * @throws JazzAVPaymentException 
 */
@Override
public AnuncioVO confirmarAnuncio(String id_pagseguro) throws TransacaoNaoEncontradaException, JazzAVPaymentException {

	//recupera credenciais para invocar servico pagseguro
	Credentials credentials = getCredentials();
	
	// solicta transacao para o pagseguro atraves da API especifica
	Transaction transaction = getTransaction(id_pagseguro, credentials);


	// recupera o registro do anuncio internamente
	AnuncioVO anuncio = getAnuncioVO(transaction);

	// registra historico de mudanca de status
	registraMudancaStatus(transaction, anuncio, "Confirmacao de registro de solicitacao de pagamento no pagseguro");
	
	return anuncio;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:23,代码来源:AnuncioBusinessImpl.java

示例9: findAnuncioVOByTransaction

import br.com.uol.pagseguro.domain.Credentials; //导入依赖的package包/类
/**
 * 
 * @return
 * @throws JazzAVPaymentException 
 */
@Override
public AnuncioVO findAnuncioVOByTransaction(String id_pagseguro) throws JazzAVPaymentException{
	

	//recupera credenciais para invocar servico pagseguro
	Credentials credentials = getCredentials();
	
	// solicta transacao para o pagseguro atraves da API especifica
	Transaction transaction = getTransaction(id_pagseguro, credentials);

	// recupera o registro do anuncio internamente
	AnuncioVO anuncio = getAnuncioVO(transaction);

	return anuncio;
	
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:22,代码来源:AnuncioBusinessImpl.java

示例10: buildURLByDate

import br.com.uol.pagseguro.domain.Credentials; //导入依赖的package包/类
private static String buildURLByDate(Credentials credentials, Date initialDate, Date finalDate, Integer page,
        Integer maxPageResults) {
    return buildURLByDateInterval(credentials, URL_SERVICE, initialDate, finalDate, page, maxPageResults);
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:5,代码来源:TransactionSearchService.java

示例11: buildURLByCode

import br.com.uol.pagseguro.domain.Credentials; //导入依赖的package包/类
private static String buildURLByCode(Credentials credentials, String transactionCode) {
    return URL_SERVICE + "/" + transactionCode + "?" + UrlUtil.buildQueryString(credentials.getAttributes());
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:4,代码来源:TransactionSearchService.java

示例12: buildURL

import br.com.uol.pagseguro.domain.Credentials; //导入依赖的package包/类
private static String buildURL(Credentials credentials, String notificationCode) {
    return URL_SERVICE + "/" + notificationCode + "/?" + UrlUtil.buildQueryString(credentials.getAttributes());
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:4,代码来源:NotificationService.java

示例13: buildUrl

import br.com.uol.pagseguro.domain.Credentials; //导入依赖的package包/类
private static String buildUrl(Credentials credentials, PaymentRequest payment) {
    return URL_SERVICE + "?" + UrlUtil.buildQueryString(credentials.getAttributes());
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:4,代码来源:PaymentService.java


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