Author: jaz
Date: Wed May 16 16:41:40 2007 New Revision: 538772 URL: http://svn.apache.org/viewvc?view=rev&rev=538772 Log: implemented min balance setting Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java?view=diff&rev=538772&r1=538771&r2=538772 ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java Wed May 16 16:41:40 2007 @@ -26,7 +26,6 @@ import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.GenericEntityException; -import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.base.util.*; import org.ofbiz.order.order.OrderReadHelper; import org.ofbiz.order.finaccount.FinAccountHelper; @@ -34,7 +33,6 @@ import org.ofbiz.product.store.ProductStoreWorker; import java.util.Map; -import java.util.List; import java.math.BigDecimal; import java.sql.Timestamp; @@ -108,10 +106,16 @@ // fin the store requires a pin number; validate the PIN with the code GenericValue finAccountSettings = delegator.findByPrimaryKeyCache("ProductStoreFinActSetting", UtilMisc.toMap("productStoreId", productStoreId, "finAccountTypeId", finAccountTypeId)); + + BigDecimal minBalance = FinAccountHelper.ZERO; String allowAuthToNegative = "N"; if (finAccountSettings != null) { allowAuthToNegative = finAccountSettings.getString("allowAuthToNegative"); + minBalance = finAccountSettings.getBigDecimal("minBalance"); + if (minBalance == null) { + minBalance = FinAccountHelper.ZERO; + } // validate the PIN if the store requires it if ("Y".equals(finAccountSettings.getString("requirePinCode"))) { @@ -186,7 +190,7 @@ Debug.log("Allow auth to negative: " + allowAuthToNegative + " :: available: " + availableBalance + " comp: " + FinAccountHelper.ZERO + " = " + availableBalance.compareTo(FinAccountHelper.ZERO) + " :: req: " + amountBd, module); // check the available balance to see if we can auth this tx - if (("Y".equals(allowAuthToNegative) && availableBalance.compareTo(FinAccountHelper.ZERO) > -1) + if (("Y".equals(allowAuthToNegative) && availableBalance.compareTo(minBalance) > -1) || (availableBalance.compareTo(amountBd) > -1)) { Timestamp thruDate; Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?view=diff&rev=538772&r1=538771&r2=538772 ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Wed May 16 16:41:40 2007 @@ -1200,6 +1200,7 @@ if (ServiceUtil.isError(splitResp)) { Debug.logWarning("Problem processing the capture split payment: " + ServiceUtil.getErrorMessage(splitResp), module); } + Debug.logInfo("Captured: " + amountThisCapture + " Remaining (re-auth): " + splitAmount, module); } } else { Debug.logError("Payment not captured", module); |
Free forum by Nabble | Edit this page |