本文整理汇总了Java中com.paypal.sdk.profiles.ProfileFactory类的典型用法代码示例。如果您正苦于以下问题:Java ProfileFactory类的具体用法?Java ProfileFactory怎么用?Java ProfileFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProfileFactory类属于com.paypal.sdk.profiles包,在下文中一共展示了ProfileFactory类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: sendNVPRequest
import com.paypal.sdk.profiles.ProfileFactory; //导入依赖的package包/类
private static NVPDecoder sendNVPRequest(GenericValue payPalConfig, NVPEncoder encoder) throws PayPalException {
NVPCallerServices caller = new NVPCallerServices();
try {
APIProfile profile = ProfileFactory.createSignatureAPIProfile();
profile.setAPIUsername(payPalConfig.getString("apiUserName"));
profile.setAPIPassword(payPalConfig.getString("apiPassword"));
profile.setSignature(payPalConfig.getString("apiSignature"));
profile.setEnvironment(payPalConfig.getString("apiEnvironment"));
caller.setAPIProfile(profile);
} catch (PayPalException e) {
Debug.logError(e.getMessage(), module);
}
String requestMessage = encoder.encode();
String responseMessage = caller.call(requestMessage);
NVPDecoder decoder = new NVPDecoder();
decoder.decode(responseMessage);
if (!"Success".equals(decoder.get("ACK"))) {
Debug.logError("A response other than success was received from PayPal: " + responseMessage, module);
}
return decoder;
}
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:25,代码来源:PayPalServices.java
示例2: initPayPalService
import com.paypal.sdk.profiles.ProfileFactory; //导入依赖的package包/类
private NVPCallerServices initPayPalService() throws PayPalException {
apiProfile = ProfileFactory.createSignatureAPIProfile();
apiProfile.setAPIUsername(apiUserName);
apiProfile.setAPIPassword(apiUserPassword);
apiProfile.setSignature(apiSignature);
apiProfile.setEnvironment(environment);
apiProfile.setSubject("");
payPalService = new NVPCallerServices();
payPalService.setAPIProfile(apiProfile);
return payPalService;
}
开发者ID:SECQME,项目名称:watchoverme-server,代码行数:14,代码来源:PaypalGW.java
示例3: PaypalApi
import com.paypal.sdk.profiles.ProfileFactory; //导入依赖的package包/类
public PaypalApi(String userId, String password, String signature,
String environment, String subject, int timeout)
throws PayPalException {
profile = ProfileFactory.createSignatureAPIProfile();
profile.setAPIUsername(userId);
profile.setAPIPassword(password);
profile.setSignature(signature);
profile.setEnvironment(environment);
profile.setSubject(subject);
profile.setTimeout(timeout);
}
开发者ID:maxdelo77,项目名称:replyit-master-3.2-final,代码行数:13,代码来源:PaypalApi.java
示例4: synchronizeAllTransactions
import com.paypal.sdk.profiles.ProfileFactory; //导入依赖的package包/类
/**
* Import all transactions that are not yet in the account.
* @see #myAccount
*/
public void synchronizeAllTransactions() {
//
try {
CallerServices caller = new CallerServices();
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
APIProfile profile = ProfileFactory.createSSLAPIProfile();
profile.setAPIUsername(getMyProperties().getProperty(PaypalImporter.SETTINGS_APIUSER));
profile.setAPIPassword(getMyProperties().getProperty(PaypalImporter.SETTINGS_APIPASSWD));
profile.setCertificateFile(getMyProperties().getProperty(PaypalImporter.SETTINGS_CERTFILE));
profile.setPrivateKeyPassword(getMyProperties().getProperty(PaypalImporter.SETTINGS_CERTPASSWD));
// profile.setEnvironment("beta-sandbox");
profile.setEnvironment("live");
caller.setAPIProfile(profile);
TransactionSearchRequestType request = new TransactionSearchRequestType();
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, 1);
// Paypal is limited to 100 transactions per result.
// thus we:
// * start with the current day,
// *then go back one day at a time
// * until we reached 10 consecutive days
// with no transaction that needed importing.
StringBuilder finalMessage = new StringBuilder();
int daysWithNoImportCountdown = MAXDAYSWITHNOIMPORT;
while (daysWithNoImportCountdown > 0) {
request.setEndDate((Calendar)calendar.clone());
calendar.add(Calendar.DAY_OF_MONTH, -1);
request.setStartDate(calendar);
TransactionSearchResponseType response =
(TransactionSearchResponseType) caller.call("TransactionSearch", request);
if (response.getAck().getValue() != AckCodeType._Success) {
LOG.log(Level.SEVERE, "Paypal-search with start-date " + calendar.getTime().toString() + " failed");
return;
}
PaymentTransactionSearchResultType[] ts = response.getPaymentTransactions();
if (ts == null) {
LOG.log(Level.INFO, "Paypal-search with start-date " + calendar.getTime().toString() + " had no result");
daysWithNoImportCountdown--;
continue;
}
LOG.log(Level.INFO, "Found " + ts.length + " records at all for day " + calendar.getTime().toString());
int importedCount = importDay(ts, finalMessage, calendar.getTime());
if (importedCount == 0) {
daysWithNoImportCountdown--;
}
else {
daysWithNoImportCountdown = MAXDAYSWITHNOIMPORT;
}
}
if (finalMessage.length() > 0) {
JOptionPane.showMessageDialog(null,
"Imorted Transactions:\n"
+ finalMessage.toString());
}
} catch (Exception e) {
LOG.log(Level.SEVERE, "Error synchronizing transactions from Paypal.", e);
}
}
开发者ID:nhrdl,项目名称:javacash,代码行数:76,代码来源:PaypalImporter.java
注:本文中的com.paypal.sdk.profiles.ProfileFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论