本文整理汇总了Java中com.paymentech.orbital.sdk.util.exceptions.InitializationException类的典型用法代码示例。如果您正苦于以下问题:Java InitializationException类的具体用法?Java InitializationException怎么用?Java InitializationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InitializationException类属于com.paymentech.orbital.sdk.util.exceptions包,在下文中一共展示了InitializationException类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ccAuth
import com.paymentech.orbital.sdk.util.exceptions.InitializationException; //导入依赖的package包/类
public static Map<String, Object> ccAuth(DispatchContext ctx, Map<String, Object> context) {
Delegator delegator = ctx.getDelegator();
Map<String, Object> results = ServiceUtil.returnSuccess();
Map<String, Object> props = buildOrbitalProperties(context, delegator);
props.put("transType", "AUTH_ONLY");
//Tell the request object which template to use (see RequestIF.java)
try {
request = new Request(RequestIF.NEW_ORDER_TRANSACTION);
} catch (InitializationException e) {
Debug.logError("Error in request initialization", module);
e.printStackTrace();
}
buildAuthOrAuthCaptureTransaction(context, delegator, props, request, results);
Map<String, Object> validateResults = validateRequest(context, props, request);
String respMsg = (String) validateResults.get(ModelService.RESPONSE_MESSAGE);
if (ModelService.RESPOND_ERROR.equals(respMsg)) {
results.put(ModelService.ERROR_MESSAGE, "Validation Failed - invalid values");
return results;
}
initializeTransactionProcessor();
Map<String, Object> processCardResponseContext = processCard(request);
// For Debugging Purpose
printTransResult((ResponseIF) processCardResponseContext.get("processCardResponse"));
processAuthTransResult(processCardResponseContext, results);
return results;
}
示例2: ccAuthCapture
import com.paymentech.orbital.sdk.util.exceptions.InitializationException; //导入依赖的package包/类
public static Map<String, Object> ccAuthCapture(DispatchContext ctx, Map<String, Object> context) {
Delegator delegator = ctx.getDelegator();
Map<String, Object> results = ServiceUtil.returnSuccess();
Map<String, Object> props = buildOrbitalProperties(context, delegator);
props.put("transType", "AUTH_CAPTURE");
//Tell the request object which template to use (see RequestIF.java)
try {
request = new Request(RequestIF.NEW_ORDER_TRANSACTION);
} catch (InitializationException e) {
Debug.logError("Error in request initialization", module);
e.printStackTrace();
}
buildAuthOrAuthCaptureTransaction(context, delegator, props, request, results);
Map<String, Object> validateResults = validateRequest(context, props, request);
String respMsg = (String) validateResults.get(ModelService.RESPONSE_MESSAGE);
if (ModelService.RESPOND_ERROR.equals(respMsg)) {
results.put(ModelService.ERROR_MESSAGE, "Validation Failed - invalid values");
return results;
}
initializeTransactionProcessor();
Map<String, Object> processCardResponseContext = processCard(request);
// For Debugging Purpose
printTransResult((ResponseIF) processCardResponseContext.get("processCardResponse"));
processAuthCaptureTransResult(processCardResponseContext, results);
return results;
}
示例3: buildReleaseTransaction
import com.paymentech.orbital.sdk.util.exceptions.InitializationException; //导入依赖的package包/类
private static void buildReleaseTransaction(Map<String, Object> params, Delegator delegator, Map<String, Object> props, RequestIF request, Map<String, Object> results) {
BigDecimal amount = (BigDecimal) params.get("releaseAmount");
GenericValue authTransaction = (GenericValue) params.get("authTransaction");
String orderId = UtilFormatOut.checkNull((String)params.get("orderId"));
try {
//If there were no errors preparing the template, we can now specify the data
//Basic Auth Fields
request.setFieldValue("MerchantID", UtilFormatOut.checkNull(props.get("merchantId").toString()));
request.setFieldValue("BIN", BIN_VALUE);
request.setFieldValue("TxRefNum", UtilFormatOut.checkNull(authTransaction.get("referenceNum").toString()));
request.setFieldValue("OrderID", UtilFormatOut.checkNull(orderId));
//Display the request
Debug.logInfo("\nRelease Request:\n ======== " + request.getXML());
results.put("releaseAmount", amount);
} catch (InitializationException ie) {
Debug.logInfo("Unable to initialize request object", module);
} catch (FieldNotFoundException fnfe) {
Debug.logError("Unable to find XML field in template" + fnfe.getMessage(), module);
} catch (Exception e) {
e.printStackTrace();
}
}
示例4: buildOrbitalProperties
import com.paymentech.orbital.sdk.util.exceptions.InitializationException; //导入依赖的package包/类
private static Map<String, Object> buildOrbitalProperties(Map<String, Object> context, Delegator delegator) {
//TODO: Will move this to property file and then will read it from there.
String configFile = "/applications/accounting/config/linehandler.properties";
String paymentGatewayConfigId = (String) context.get("paymentGatewayConfigId");
Map<String, Object> buildConfiguratorContext = FastMap.newInstance();
try {
buildConfiguratorContext.put("OrbitalConnectionUsername", getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "username"));
buildConfiguratorContext.put("OrbitalConnectionPassword", getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "connectionPassword"));
buildConfiguratorContext.put("merchantId", getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "merchantId"));
buildConfiguratorContext.put("engine.class", getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "engineClass"));
buildConfiguratorContext.put("engine.hostname", getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "hostName"));
buildConfiguratorContext.put("engine.port", getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "port"));
buildConfiguratorContext.put("engine.hostname.failover", getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "hostNameFailover"));
buildConfiguratorContext.put("engine.port.failover", getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "portFailover"));
buildConfiguratorContext.put("engine.connection_timeout_seconds", getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "connectionTimeoutSeconds"));
buildConfiguratorContext.put("engine.read_timeout_seconds", getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "readTimeoutSeconds"));
buildConfiguratorContext.put("engine.authorizationURI", getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "authorizationURI"));
buildConfiguratorContext.put("engine.sdk_version", getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "sdkVersion"));
buildConfiguratorContext.put("engine.ssl.socketfactory", getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "sslSocketFactory"));
buildConfiguratorContext.put("Response.response_type", getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "responseType"));
String configFileLocation = System.getProperty("ofbiz.home") + configFile;
Configurator config = Configurator.getInstance(configFileLocation);
buildConfiguratorContext.putAll(config.getConfigurations());
config.setConfigurations(buildConfiguratorContext);
} catch (InitializationException e) {
Debug.logError("Orbital Configurator Initialization Error: " + e.getMessage(), module);
e.printStackTrace();
}
return buildConfiguratorContext;
}
示例5: buildCaptureTransaction
import com.paymentech.orbital.sdk.util.exceptions.InitializationException; //导入依赖的package包/类
private static void buildCaptureTransaction(Map<String, Object> params, Delegator delegator, Map<String, Object> props, RequestIF request, Map<String, Object> results) {
GenericValue authTransaction = (GenericValue) params.get("authTransaction");
GenericValue creditCard = (GenericValue) params.get("creditCard");
BigDecimal amount = (BigDecimal) params.get("captureAmount");
String amountValue = amount.setScale(decimals, rounding).movePointRight(2).toPlainString();
String orderId = UtilFormatOut.checkNull((String)params.get("orderId"));
try {
//If there were no errors preparing the template, we can now specify the data
//Basic Auth Fields
request.setFieldValue("MerchantID", UtilFormatOut.checkNull(props.get("merchantId").toString()));
request.setFieldValue("BIN", BIN_VALUE);
request.setFieldValue("TxRefNum", UtilFormatOut.checkNull(authTransaction.get("referenceNum").toString()));
request.setFieldValue("OrderID", UtilFormatOut.checkNull(orderId));
request.setFieldValue("Amount", UtilFormatOut.checkNull(amountValue));
request.setFieldValue("PCDestName", UtilFormatOut.checkNull(creditCard.getString("firstNameOnCard") + creditCard.getString("lastNameOnCard")));
if (UtilValidate.isNotEmpty(creditCard.getString("contactMechId"))) {
GenericValue address = creditCard.getRelatedOne("PostalAddress", false);
if (address != null) {
request.setFieldValue("PCOrderNum", UtilFormatOut.checkNull(orderId));
request.setFieldValue("PCDestAddress1", UtilFormatOut.checkNull(address.getString("address1")));
request.setFieldValue("PCDestAddress2", UtilFormatOut.checkNull(address.getString("address2")));
request.setFieldValue("PCDestCity", UtilFormatOut.checkNull(address.getString("city")));
request.setFieldValue("PCDestState", UtilFormatOut.checkNull(address.getString("stateProvinceGeoId")));
request.setFieldValue("PCDestZip", UtilFormatOut.checkNull(address.getString("postalCode")));
}
}
//Display the request
Debug.logInfo("\nCapture Request:\n ======== " + request.getXML());
results.put("captureAmount", amount);
} catch (InitializationException ie) {
Debug.logInfo("Unable to initialize request object", module);
} catch (FieldNotFoundException fnfe) {
Debug.logError("Unable to find XML field in template" + fnfe.getMessage(), module);
} catch (Exception e) {
e.printStackTrace();
}
}
示例6: buildRefundTransaction
import com.paymentech.orbital.sdk.util.exceptions.InitializationException; //导入依赖的package包/类
private static void buildRefundTransaction(Map<String, Object> params, Map<String, Object> props, RequestIF request, Map<String, Object> results) {
GenericValue cc = (GenericValue) params.get("creditCard");
BigDecimal amount = (BigDecimal) params.get("refundAmount");
String amountValue = amount.setScale(decimals, rounding).movePointRight(2).toPlainString();
String number = UtilFormatOut.checkNull(cc.getString("cardNumber"));
String expDate = UtilFormatOut.checkNull(cc.getString("expireDate"));
expDate = formatExpDateForOrbital(expDate);
String orderId = UtilFormatOut.checkNull((String)params.get("orderId"));
try {
//If there were no errors preparing the template, we can now specify the data
//Basic Auth Fields
request.setFieldValue("IndustryType", "EC");
request.setFieldValue("MessageType", "R");
request.setFieldValue("MerchantID", UtilFormatOut.checkNull(props.get("merchantId").toString()));
request.setFieldValue("BIN", BIN_VALUE);
request.setFieldValue("OrderID", UtilFormatOut.checkNull(orderId));
request.setFieldValue("AccountNum", UtilFormatOut.checkNull(number));
request.setFieldValue("Amount", UtilFormatOut.checkNull(amountValue));
request.setFieldValue("Exp", UtilFormatOut.checkNull(expDate));
request.setFieldValue("Comments", "This is a credit card refund");
Debug.logInfo("\nRefund Request:\n ======== " + request.getXML());
results.put("refundAmount", amount);
} catch (InitializationException ie) {
Debug.logInfo("Unable to initialize request object", module);
} catch (FieldNotFoundException fnfe) {
Debug.logError("Unable to find XML field in template", module);
} catch (Exception e) {
e.printStackTrace();
}
}
示例7: initializeTransactionProcessor
import com.paymentech.orbital.sdk.util.exceptions.InitializationException; //导入依赖的package包/类
private static void initializeTransactionProcessor() {
//Create a Transaction Processor
//The Transaction Processor acquires and releases resources and executes transactions.
//It configures a pool of protocol engines, then uses the pool to execute transactions.
try {
tp = new TransactionProcessor();
} catch (InitializationException iex) {
Debug.logError("TransactionProcessor failed to initialize" + iex.getMessage(), module);
iex.printStackTrace();
}
}
示例8: buildAuthOrAuthCaptureTransaction
import com.paymentech.orbital.sdk.util.exceptions.InitializationException; //导入依赖的package包/类
private static void buildAuthOrAuthCaptureTransaction(Map<String, Object> params, Delegator delegator, Map<String, Object> props, RequestIF request, Map<String, Object> results) {
GenericValue cc = (GenericValue) params.get("creditCard");
BigDecimal amount = (BigDecimal) params.get("processAmount");
String amountValue = amount.setScale(decimals, rounding).movePointRight(2).toPlainString();
String number = UtilFormatOut.checkNull(cc.getString("cardNumber"));
String expDate = UtilFormatOut.checkNull(cc.getString("expireDate"));
expDate = formatExpDateForOrbital(expDate);
String cardSecurityCode = (String) params.get("cardSecurityCode");
String orderId = UtilFormatOut.checkNull((String)params.get("orderId"));
String transType = props.get("transType").toString();
String messageType = null;
if ("AUTH_ONLY".equals(transType)) {
messageType = "A";
} else if ("AUTH_CAPTURE".equals(transType)) {
messageType = "AC";
}
try {
request.setFieldValue("IndustryType", "EC");
request.setFieldValue("MessageType", UtilFormatOut.checkNull(messageType));
request.setFieldValue("MerchantID", UtilFormatOut.checkNull(props.get("merchantId").toString()));
request.setFieldValue("BIN", BIN_VALUE);
request.setFieldValue("OrderID", UtilFormatOut.checkNull(orderId));
request.setFieldValue("AccountNum", UtilFormatOut.checkNull(number));
request.setFieldValue("Amount", UtilFormatOut.checkNull(amountValue));
request.setFieldValue("Exp", UtilFormatOut.checkNull(expDate));
// AVS Information
GenericValue creditCard = null;
if (params.get("orderPaymentPreference") != null) {
GenericValue opp = (GenericValue) params.get("orderPaymentPreference");
if ("CREDIT_CARD".equals(opp.getString("paymentMethodTypeId"))) {
// sometimes the ccAuthCapture interface is used, in which case the creditCard is passed directly
creditCard = (GenericValue) params.get("creditCard");
if (creditCard == null || ! (opp.get("paymentMethodId").equals(creditCard.get("paymentMethodId")))) {
creditCard = opp.getRelatedOne("CreditCard", false);
}
}
request.setFieldValue("AVSname", "Demo Customer");
if (UtilValidate.isNotEmpty(creditCard.getString("contactMechId"))) {
GenericValue address = creditCard.getRelatedOne("PostalAddress", false);
if (address != null) {
request.setFieldValue("AVSaddress1", UtilFormatOut.checkNull(address.getString("address1")));
request.setFieldValue("AVScity", UtilFormatOut.checkNull(address.getString("city")));
request.setFieldValue("AVSstate", UtilFormatOut.checkNull(address.getString("stateProvinceGeoId")));
request.setFieldValue("AVSzip", UtilFormatOut.checkNull(address.getString("postalCode")));
}
}
} else {
// this would be the case for an authorization
GenericValue cp = (GenericValue)params.get("billToParty");
GenericValue ba = (GenericValue)params.get("billingAddress");
request.setFieldValue("AVSname", UtilFormatOut.checkNull(cp.getString("firstName")) + UtilFormatOut.checkNull(cp.getString("lastName")));
request.setFieldValue("AVSaddress1", UtilFormatOut.checkNull(ba.getString("address1")));
request.setFieldValue("AVScity", UtilFormatOut.checkNull(ba.getString("city")));
request.setFieldValue("AVSstate", UtilFormatOut.checkNull(ba.getString("stateProvinceGeoId")));
request.setFieldValue("AVSzip", UtilFormatOut.checkNull(ba.getString("postalCode")));
request.setFieldValue("AVSCountryCode", UtilFormatOut.checkNull(ba.getString("countryGeoId")));
}
// Additional Information
request.setFieldValue("Comments", "This is building of request object");
String shippingRef = getShippingRefForOrder(orderId, delegator);
request.setFieldValue("ShippingRef", shippingRef);
request.setFieldValue("CardSecVal", UtilFormatOut.checkNull(cardSecurityCode));
//Display the request
if ("AUTH_ONLY".equals(transType)) {
Debug.logInfo("\nAuth Request:\n ======== " + request.getXML());
} else if ("AUTH_CAPTURE".equals(transType)) {
Debug.logInfo("\nAuth Capture Request:\n ======== " + request.getXML());
}
results.put("processAmount", amount);
} catch (InitializationException ie) {
Debug.logInfo("Unable to initialize request object", module);
} catch (FieldNotFoundException fnfe) {
Debug.logError("Unable to find XML field in template", module);
} catch (Exception e) {
e.printStackTrace();
}
}