applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
PaymentGatewayServices
has 65 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public class PaymentGatewayServices {
private static final Debug.OfbizLogger module = Debug.getOfbizLogger(java.lang.invoke.MethodHandles.lookup().lookupClass());
public static final String AUTH_SERVICE_TYPE = "PRDS_PAY_AUTH";
public static final String REAUTH_SERVICE_TYPE = "PRDS_PAY_REAUTH";
Method capturePayment
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private static Map<String, Object> capturePayment(DispatchContext dctx, GenericValue userLogin, OrderReadHelper orh,
GenericValue paymentPref, BigDecimal amount, GenericValue authTrans, Locale locale) {
Method authPayment
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private static Map<String, Object> authPayment(LocalDispatcher dispatcher, GenericValue userLogin, OrderReadHelper orh, GenericValue paymentPreference, BigDecimal totalRemaining, boolean reauth, BigDecimal overrideAmount) throws GeneralException {
Method processCaptureResult
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private static void processCaptureResult(DispatchContext dctx, Map<String, Object> result, GenericValue userLogin,
GenericValue paymentPreference, String authServiceType, Locale locale) throws GeneralException {
Method saveError
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private static void saveError(LocalDispatcher dispatcher, GenericValue userLogin, GenericValue paymentPref, Map<String, Object> result, String serviceType, String transactionCode) {
Method processReAuthFromCaptureFailure
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private static void processReAuthFromCaptureFailure(DispatchContext dctx, Map<String, Object> result, BigDecimal amount,
GenericValue userLogin, GenericValue paymentPreference, Locale locale) throws GeneralException {
Avoid deeply nested control flow statements. Open
Open
for (GenericValue otherPaymentMethodAndCreditCard : otherPaymentMethodAndCreditCardList) {
// change OrderPaymentPreference in memory only and call auth service
orderPaymentPreference.set("paymentMethodId", otherPaymentMethodAndCreditCard.getString("paymentMethodId"));
Map<String, Object> authRetryResult = authPayment(dispatcher, userLogin, orh, orderPaymentPreference, totalRemaining, reAuth, transAmount);
try {
Avoid deeply nested control flow statements. Open
Open
if (Debug.infoOn()) {
Debug.logInfo("Amount captured for order [" + orderId + "] from unapplied payments associated to billing account [" + billingAccountId + "] is: " + amountCaptured, module);
}
Avoid deeply nested control flow statements. Open
Open
if (context.get("captureRefNum") == null) {
captureResult.put("captureRefNum", ""); // FIXME: this is an hack to avoid a service validation error for processCaptureResult (captureRefNum is mandatory, but it is not used for billing accounts)
}
Method capturePayment
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private static Map<String, Object> capturePayment(DispatchContext dctx, GenericValue userLogin, OrderReadHelper orh,
GenericValue paymentPref, BigDecimal amount, Locale locale) {
Avoid deeply nested control flow statements. Open
Open
if (authAmount.compareTo(amountCaptured) > 0) {
BigDecimal splitAmount = authAmount.subtract(amountCaptured);
try {
Map<String, Object> splitCtx = UtilMisc.<String, Object>toMap("userLogin", userLogin, "orderPaymentPreference", paymentPref, "splitAmount", splitAmount);
dispatcher.addCommitService("processCaptureSplitPayment", splitCtx, true);
Avoid deeply nested control flow statements. Open
Open
if (failedTries < autoOrderCcTryLaterMax) {
needsNsfRetry = true;
}
Avoid deeply nested control flow statements. Open
Open
if (amountCaptured.compareTo(BigDecimal.ZERO) == 0) {
continue;
}
Avoid deeply nested control flow statements. Open
Open
if (Debug.infoOn()) {
Debug.logInfo("Captured: " + amountThisCapture + " Remaining (re-auth): " + splitAmount, module);
}
Method processCaptureResult
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private static void processCaptureResult(DispatchContext dctx, Map<String, Object> result, GenericValue userLogin,
GenericValue paymentPreference, Locale locale) throws GeneralException {
Method processResult
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private static boolean processResult(DispatchContext dctx, Map<String, Object> result, GenericValue userLogin,
GenericValue paymentPreference, Locale locale) throws GeneralException {
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder,
"AccountingTroubleCallingReleaseOrderPaymentPreferenceService", locale) + " " +
paymentPref.getString("paymentMethodTypeId"));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder,
"AccountingPaymentCannotBeCaptured", locale) + " " + captureResult);
Avoid too many return
statements within this method. Open
Open
return results;
Avoid too many return
statements within this method. Open
Open
return results;
Avoid too many return
statements within this method. Open
Open
return result;
Avoid too many return
statements within this method. Open
Open
return results;
Avoid too many return
statements within this method. Open
Open
return result;
Avoid too many return
statements within this method. Open
Open
return processorResult;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingInvoiceApplicationCreationError", locale));
Avoid too many return
statements within this method. Open
Open
return results;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder,
"AccountingTroubleCallingReleaseOrderPaymentPreferenceService", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder,
"AccountingPaymentCannotBeCaptured", locale) + " " + captureResult);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingPaymentServiceMissingAmount",
UtilMisc.toMap("serviceName", serviceName, "inParams", inParams), locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(payRes));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(releaseResRes));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder,
"AccountingPaymentCannotBeCaptured", locale));
Avoid too many return
statements within this method. Open
Open
return results;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
"AccountingPaymentCannotBeAuthorized",
UtilMisc.toMap("errroString", e.toString()), locale));
Avoid too many return
statements within this method. Open
Open
return result;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(releaseResult));
Avoid too many return
statements within this method. Open
Open
return result;
Avoid too many return
statements within this method. Open
Open
return results;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(captureResult));
Avoid too many return
statements within this method. Open
Open
return null;
Avoid too many return
statements within this method. Open
Open
return results;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
Avoid too many return
statements within this method. Open
Open
return null;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder,
"AccountingTroubleCallingReleaseOrderPaymentPreferenceService", locale) + " " +
e.getMessage());
Avoid too many return
statements within this method. Open
Open
return results;
Avoid too many return
statements within this method. Open
Open
return result;
Avoid too many return
statements within this method. Open
Open
return result;
Avoid too many return
statements within this method. Open
Open
return result;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder,
"AccountingTroubleCallingReleaseOrderPaymentPreferenceService", locale) + " " +
paymentPref.getString("paymentMethodTypeId"));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingPaymentCannotBeCaptured", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ex.getMessage());
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingPaymentServiceCannotGetModel",
UtilMisc.toMap("serviceName", serviceName), locale));
Avoid too many return
statements within this method. Open
Open
return captureResult;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingPaymentTransactionNotYetSupported", locale) + " " + paymentMethodTypeId);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingPaymentServiceError",
UtilMisc.toMap("paymentService", paymentService, "authContext", authContext),
locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(response));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingPaymentCreditCardMissingMandatoryFields", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnSuccess();
Avoid too many return
statements within this method. Open
Open
return refundResRes;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingPaymentServiceError",
UtilMisc.toMap("paymentService", paymentService, "authContext", requestContext),
locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.makeErrorMessage(response, null, null, null, null));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(paRes));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder,
"OrderOrderNotFound", UtilMisc.toMap("orderId", orderId), locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingPaymentSettingNotFound",
UtilMisc.toMap("productStoreId", productStoreId, "transactionType", transactionType), locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingPaymentCreditCardEmailAddressCannotBeEmpty", locale));
Avoid too many return
statements within this method. Open
Open
return result;
Avoid too many return
statements within this method. Open
Open
return returnResults;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingPaymentTransactionNotYetSupported", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingPaymentCreditCardBillingAddressMssingMandatoryFields", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(responseRes));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(refundResponse));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingPaymentRefundError", locale) + " " + e.getMessage());
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingPaymentSettingNotFound",
UtilMisc.toMap("productStoreId", productStoreId, "transactionType", ""), locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingPaymentAuthorizationFailed", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingPaymentSettingNotValid", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(response));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(response));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingPaymentRefundError", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(refundResRes));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingPaymentCreditCardNotFound",
UtilMisc.toMap("paymentMethodId", paymentMethodId), locale));
Avoid too many return
statements within this method. Open
Open
return result;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnSuccess();
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingPaymentCreditError",
UtilMisc.toMap("errorString", e.getMessage()), locale));