From 5f50cd16b6ceacb118f483bc3465a0f10da99291 Mon Sep 17 00:00:00 2001 From: Elaine Tan Date: Thu, 8 Nov 2012 18:24:19 +0800 Subject: [PATCH] IDEMPIERE-462 Ticket #1001503: Credit Cards Online - make the payment processor fields configurable --- .../src/org/compiere/model/Callout.java | 2 +- .../src/org/compiere/model/CalloutEngine.java | 6 ++-- .../src/org/compiere/model/GridFieldVO.java | 21 +++++++++++++ .../src/org/compiere/model/GridTab.java | 2 +- .../src/org/compiere/model/IGridTab.java | 31 +++++++++++++++++++ .../org/compiere/model/PaymentProcessor.java | 2 +- 6 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 org.adempiere.base/src/org/compiere/model/IGridTab.java diff --git a/org.adempiere.base/src/org/compiere/model/Callout.java b/org.adempiere.base/src/org/compiere/model/Callout.java index 59501e7024..30dc16b2e9 100644 --- a/org.adempiere.base/src/org/compiere/model/Callout.java +++ b/org.adempiere.base/src/org/compiere/model/Callout.java @@ -45,7 +45,7 @@ public interface Callout * @return Error message or "" */ public String start (Properties ctx, String method, int WindowNo, - GridTab mTab, GridField mField, Object value, Object oldValue); + IGridTab mTab, GridField mField, Object value, Object oldValue); /** * Conversion Rules. diff --git a/org.adempiere.base/src/org/compiere/model/CalloutEngine.java b/org.adempiere.base/src/org/compiere/model/CalloutEngine.java index b901767056..3ae344e3b0 100644 --- a/org.adempiere.base/src/org/compiere/model/CalloutEngine.java +++ b/org.adempiere.base/src/org/compiere/model/CalloutEngine.java @@ -49,7 +49,7 @@ public class CalloutEngine implements Callout /** Logger */ protected CLogger log = CLogger.getCLogger(getClass()); - private GridTab m_mTab; + private IGridTab m_mTab; private GridField m_mField; /** @@ -70,7 +70,7 @@ public class CalloutEngine implements Callout * @return Error message or "" */ public String start (Properties ctx, String methodName, int WindowNo, - GridTab mTab, GridField mField, Object value, Object oldValue) + IGridTab mTab, GridField mField, Object value, Object oldValue) { if (methodName == null || methodName.length() == 0) throw new IllegalArgumentException ("No Method Name"); @@ -267,7 +267,7 @@ public class CalloutEngine implements Callout * * @return gridTab */ - public GridTab getGridTab() + public IGridTab getGridTab() { return m_mTab; } diff --git a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java index 2363a51ac8..a4fedd133f 100644 --- a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java +++ b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java @@ -355,6 +355,27 @@ public class GridFieldVO implements Serializable return voT; } // createParameter + public static GridFieldVO createParameter (Properties ctx, int WindowNo, + int AD_Column_ID, String ColumnName, String Name, int AD_Reference_ID, int AD_Reference_Value_ID, + boolean IsMandatory, boolean IsEncrypted) + { + GridFieldVO vo = new GridFieldVO (ctx, WindowNo, 0, 0, 0, false); + vo.isProcess = true; + vo.IsDisplayed = true; + vo.IsReadOnly = false; + vo.IsUpdateable = true; + vo.AD_Table_ID = 0; + vo.AD_Column_ID = AD_Column_ID; // ** + vo.ColumnName = ColumnName; + vo.Header = Name; + vo.displayType = AD_Reference_ID; + vo.AD_Reference_Value_ID = AD_Reference_Value_ID; + vo.IsMandatory = IsMandatory; + vo.IsEncryptedField= IsEncrypted; + // + vo.initFinish(); + return vo; + } /** * Make a standard field (Created/Updated/By) diff --git a/org.adempiere.base/src/org/compiere/model/GridTab.java b/org.adempiere.base/src/org/compiere/model/GridTab.java index 32c18ae1d5..0c49eb3732 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTab.java +++ b/org.adempiere.base/src/org/compiere/model/GridTab.java @@ -106,7 +106,7 @@ import org.compiere.util.ValueNamePair; * @author Paul Bowden, phib BF 2900767 Zoom to child tab - inefficient queries * @see https://sourceforge.net/tracker/?func=detail&aid=2900767&group_id=176962&atid=879332 */ -public class GridTab implements DataStatusListener, Evaluatee, Serializable +public class GridTab implements IGridTab, DataStatusListener, Evaluatee, Serializable { diff --git a/org.adempiere.base/src/org/compiere/model/IGridTab.java b/org.adempiere.base/src/org/compiere/model/IGridTab.java new file mode 100644 index 0000000000..d9a225866d --- /dev/null +++ b/org.adempiere.base/src/org/compiere/model/IGridTab.java @@ -0,0 +1,31 @@ +/****************************************************************************** + * Copyright (C) 2012 Elaine Tan * + * Copyright (C) 2012 Trek Global + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.compiere.model; + +/** + * + * @author Elaine + * + */ +public interface IGridTab { + public String setValue(String columnName, Object value); + public String setValue(GridField field, Object value); + public Object getValue(String columnName); + public Object getValue(GridField field); + + public String[] getActiveCallouts(); + public Callout[] getActiveCalloutInstance(); + + public String processCallout(GridField field); +} diff --git a/org.adempiere.base/src/org/compiere/model/PaymentProcessor.java b/org.adempiere.base/src/org/compiere/model/PaymentProcessor.java index f269a0031c..faad20051d 100644 --- a/org.adempiere.base/src/org/compiere/model/PaymentProcessor.java +++ b/org.adempiere.base/src/org/compiere/model/PaymentProcessor.java @@ -117,7 +117,7 @@ public abstract class PaymentProcessor */ public String validate() throws IllegalArgumentException { String msg = null; - if (p_mp.getCustomerPaymentProfileID() != null) + if (p_mp.getC_BP_BankAccount_ID() != 0 || p_mp.getCustomerPaymentProfileID() != null) return msg; if (MPayment.TENDERTYPE_CreditCard.equals(p_mp.getTenderType())) { msg = validateCreditCard();