📄 mpayment.java
字号:
public boolean setCreditCardExpYY (int newCreditCardExpYY)
{
int CreditCardExpYY = newCreditCardExpYY;
if (newCreditCardExpYY > 1999)
CreditCardExpYY = newCreditCardExpYY-2000;
setValue ("CreditCardExpYY", new Integer(CreditCardExpYY));
return true;
} // setCreditCardExpYY
/**
* Two digit CreditCard YY
* @return Two digit CreditCard YY
*/
public int getCreditCardExpYY()
{
Integer ii = (Integer)getValue("CreditCardExpYY");
if (ii == null)
return 0;
return ii.intValue();
} // getCreditCardExpYY
/**
* CreditCard Exp MMYY
* @param mmyy Exp in form of mmyy
* @return true if valid
*/
public boolean setCreditCardExp (String mmyy)
{
if (validateCreditCardExp(mmyy).length() != 0)
return false;
//
String exp = checkNumeric(mmyy);
String mmStr = exp.substring(0,2);
String yyStr = exp.substring(2,4);
setCreditCardExpMM (Integer.parseInt(mmStr));
setCreditCardExpYY (Integer.parseInt(yyStr));
return true;
} // setCreditCardExp
/**
* Is this a valid Credit Card Exp Date?
* @param mmyy Exp in form of mmyy
* @return "" or Error AD_Message
*/
public static String validateCreditCardExp (String mmyy)
{
String exp = checkNumeric(mmyy);
if (exp.length() != 4)
return "CreditCardExpFormat";
//
String mmStr = exp.substring(0,2);
String yyStr = exp.substring(2,4);
//
int mm = 0;
int yy = 0;
try
{
mm = Integer.parseInt(mmStr);
yy = Integer.parseInt(yyStr);
}
catch (Exception e)
{
return "CreditCardExpFormat";
}
return validateCreditCardExp(mm,yy);
} // validateCreditCardExp
/**
* Return Month of Exp
* @param mmyy Exp in form of mmyy
* @return month
*/
public static int getCreditCardExpMM (String mmyy)
{
String mmStr = mmyy.substring(0,2);
int mm = 0;
try
{
mm = Integer.parseInt(mmStr);
}
catch (Exception e)
{
}
return mm;
} // getCreditCardExpMM
/**
* Return Year of Exp
* @param mmyy Exp in form of mmyy
* @return year
*/
public static int getCreditCardExpYY (String mmyy)
{
String yyStr = mmyy.substring(2);
int yy = 0;
try
{
yy = Integer.parseInt(yyStr);
}
catch (Exception e)
{
}
return yy;
} // getCreditCardExpYY
/**
* Is this a valid Credit Card Exp Date?
* @param mm month
* @param yy year
* @return "" or Error AD_Message
*/
public static String validateCreditCardExp (int mm, int yy)
{
if (mm < 1 || mm > 12)
return "CreditCardExpMonth";
// if (yy < 0 || yy > EXP_YEAR)
// return "CreditCardExpYear";
// Today's date
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR) - 2000; // two digits
int month = cal.get(Calendar.MONTH) + 1; // zero based
//
if (yy < year)
return "CreditCardExpired";
else if (yy == year && mm < month)
return "CreditCardExpired";
return "";
} // validateCreditCardExp
/**
* CreditCard Exp MMYY
* @return Exp
*/
public String getCreditCardExp()
{
String mm = String.valueOf(getCreditCardExpMM());
String yy = String.valueOf(getCreditCardExpYY());
StringBuffer retValue = new StringBuffer();
if (mm.length() == 1)
retValue.append("0");
retValue.append(mm);
if (yy.length() == 1)
retValue.append("0");
retValue.append(yy);
//
return (retValue.toString());
} // getCreditCardExp
/**
* MICR
* @param MICR MICR
*/
public void setBankMICR (String MICR)
{
setValue ("MICR", checkNumeric(MICR));
} // setBankMICR
/**
* Get MICR
* @return MICR
*/
public String getBankMICR()
{
return (String)getValue("MICR");
} // getBankMICR
/**
* Routing No
* @param RoutingNo Routing No
*/
public void setBankRoutingNo(String RoutingNo)
{
setValue ("RoutingNo", checkNumeric(RoutingNo));
} // setBankRoutingNo
/**
* Get Routing No
* @return Routing No
*/
public String getBankRoutingNo()
{
return (String)getValue("RoutingNo");
} // getBankRoutingNo
/**
* Validate Routing Number
* @param routingNo Routing No
* @return "" or Error AD_Message
*/
public static String validateBankRoutingNo (String routingNo)
{
int length = checkNumeric(routingNo).length();
// US - length 9
// Germany - length 8
if (length == 8 || length == 9)
return "";
return "PaymentBankRoutingNotValid";
} // validateBankRoutingNo
/**
* Account No
* @param AccountNo AccountNo
*/
public void setBankAccountNo (String AccountNo)
{
setValue ("AccountNo", checkNumeric(AccountNo));
} // setBankAccountNo
/**
* Get Account No
* @return Account No
*/
public String getBankAccountNo()
{
return (String)getValue("AccountNo");
} // getBankAccountNo
/**
* Validate Account No
* @param AccountNo AccountNo
* @return "" or Error AD_Message
*/
public static String validateBankAccountNo (String AccountNo)
{
int length = checkNumeric(AccountNo).length();
if (length > 0)
return "";
return "PaymentBankAccountNotValid";
} // validateBankAccountNo
/**
* Check No
* @param CheckNo Check No
*/
public void setBankCheckNo(String CheckNo)
{
setValue("CheckNo", checkNumeric(CheckNo));
} // setBankCheckNo
/**
* Get Chack No
* @return CheckNo
*/
public String getBankCheckNo()
{
return (String)getValue ("CheckNo");
} // getBankCheckNo
/**
* Validate Check No
* @param CheckNo CheckNo
* @return "" or Error AD_Message
*/
public static String validateBankCheckNo (String CheckNo)
{
int length = checkNumeric(CheckNo).length();
if (length > 0)
return "";
return "PaymentBankCheckNotValid";
} // validateBankCheckNo
/**
* Account Name
* @param A_Name name
*/
public void setA_Name(String A_Name)
{
setValue ("A_Name", A_Name);
} // setA_Name
/**
* Get Account Name
* @return name
*/
public String getA_Name()
{
return (String)getValue("A_Name");
} // getA_Name
/**
* Set Account Street
* @param A_Street street
*/
public void setA_Street (String A_Street)
{
setValue ("A_Street", A_Street);
}
public String getA_Street()
{
return (String)getValue("A_Street");
}
/**
* Set Account City
* @param A_City city
*/
public void setA_City (String A_City)
{
setValue ("A_City", A_City);
}
public String getA_City()
{
return (String)getValue("A_City");
}
/**
* Set Account State
* @param A_State state
*/
public void setA_State(String A_State)
{
setValue ("A_State", A_State);
}
public String getA_State()
{
return (String)getValue("A_State");
}
/**
* Set Account Zip
* @param A_ZIP zip
*/
public void setA_Zip (String A_ZIP)
{
setValue ("A_Zip", A_ZIP);
}
public String getA_Zip()
{
return (String)getValue("A_Zip");
}
/**
* Set Account Country
* @param A_Country country
*/
public void setA_Country (String A_Country)
{
setValue ("A_Country", A_Country);
}
public String getA_Country()
{
return (String)getValue("A_Country");
}
/**
* Account Driver Licence
* @param A_Ident_DL Driver License
*/
public void setA_Ident_DL (String A_Ident_DL)
{
setValue ("A_Ident_DL", A_Ident_DL);
}
public String getA_Ident_DL()
{
return (String)getValue("A_Ident_DL");
}
/**
* Account SSN
* @param A_Ident_SSN SSN
*/
public void setA_Ident_SSN (String A_Ident_SSN)
{
setValue ("A_Ident_SSN", A_Ident_SSN);
}
public String getA_Ident_SSN()
{
return (String)getValue("A_Ident_SSN");
}
/**
* Account EMail
* @param A_EMail email
*/
public void setA_EMail (String A_EMail)
{
setValue ("A_EMail", A_EMail);
}
public String getA_EMail()
{
return (String)getValue("A_EMail");
}
/**
* Voice Auth Code
* @param VoiceAuthCode Voice Auth Code
*/
public void setVoiceAuthCode (String VoiceAuthCode)
{
setValue ("VoiceAuthCode", VoiceAuthCode);
}
public String getVoiceAuthCode()
{
return (String)getValue("VoiceAuthCode");
}
/**
* Original Trx ID
* @param Orig_TrxID Orig TrxID
*/
public void setOrig_TrxID (String Orig_TrxID)
{
setValue ("Orig_TrxID", Orig_TrxID);
}
public String getOrig_TrxID()
{
return (String)getValue("Orig_TrxID");
}
/**
* PO Number
* @param PONum PO Num
*/
public void setPONum(String PONum)
{
setValue ("PONum", PONum);
}
public String getPONum()
{
return (String)getValue("PONum");
}
/**
* Set DocumentNo to Payment info
*/
protected void setDocumentNo()
{
String DocumentNo = null;
if (TENDER_CREDITCARD.equals(getTenderType()))
DocumentNo = getCreditCardType() + " " + getCreditCardNumber() + " " + getCreditCardExpMM() + "/" + getCreditCardExpYY();
else
{
DocumentNo = getBankRoutingNo() + " " + getBankAccountNo();
if (TENDER_CHECK.equals(getTenderType()))
DocumentNo += " " + getBankCheckNo();
}
if (DocumentNo.length() == 0)
DocumentNo = ".";
if (DocumentNo.length() > 30)
DocumentNo = DocumentNo.substring(0,29);
//
setValue("DocumentNo", DocumentNo);
} // setDocumentNo
/**
* Get Document No
* @return documentNo
*/
public String getDocumentNo()
{
return (String)getValue("DocumentNo");
} // getDocumentNo
/**
* Date Trx
* @param DateTrx transaction date
*/
public void setDateTrx (Timestamp DateTrx)
{
setValue ("DateTrx", DateTrx);
} // setDateTrx
/**
* Get Trx Date
* @return DateTrx
*/
public Timestamp getDateTrx()
{
return (Timestamp)getValue("DateTrx");
} // getDateTrx
// ---------------
public String getR_PnRef()
{
return (String)getValue("R_PnRef");
}
void setR_PnRef (String R_PNRef)
{
setValueNoCheck ("R_PnRef", R_PNRef);
}
public String getR_Result()
{
return (String)getValue("R_Result");
}
void setR_Result (String R_Result)
{
setValueNoCheck ("R_Result", R_Result);
}
public String getR_Info()
{
return (String)getValue("R_Info");
}
void setR_Info (String R_Info)
{
if (R_Info != null && R_Info.length() > 2000)
setValueNoCheck ("R_Info", R_Info.substring(0,1999));
else
setValueNoCheck ("R_Info", R_Info);
}
public String getR_RespMsg()
{
return (String)getValue("R_RespMsg");
}
void setR_RespMsg (String R_RespMsg)
{
if (R_RespMsg != null && R_RespMsg.length() > 60)
setValueNoCheck ("R_RespMsg", R_RespMsg.substring(0,59));
else
setValueNoCheck ("R_RespMsg", R_RespMsg);
}
public String getR_AuthCode()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -