本文整理汇总了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;
}
示例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();
}
示例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);
}
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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;
}
示例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);
}
示例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());
}
示例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());
}
示例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());
}