use of org.compiere.model.MPayment in project adempiere by adempiere.
the class Collect method payDirectDebit.
// payCheck
/**
* Payment with direct debit
* @param amt
* @param routingNo
* @param accountCountry
* @param cVV
* @return true if payment processed correctly; otherwise false
*/
public boolean payDirectDebit(BigDecimal amt, String routingNo, String accountCountry, String cVV) {
MPayment payment = createPayment(MPayment.TENDERTYPE_DirectDebit);
payment.setC_CashBook_ID(entityPOS.getC_CashBook_ID());
payment.setAmount(order.getC_Currency_ID(), amt);
payment.setC_BankAccount_ID(entityPOS.getC_BankAccount_ID());
payment.setRoutingNo(routingNo);
payment.setA_Country(accountCountry);
payment.setCreditCardVV(cVV);
payment.setDateTrx(getDateTrx());
payment.setDateAcct(getDateTrx());
payment.saveEx();
payment.setDocAction(MPayment.DOCACTION_Complete);
payment.setDocStatus(MPayment.DOCSTATUS_Drafted);
if (payment.processIt(MPayment.DOCACTION_Complete)) {
payment.saveEx();
MBankStatement.addPayment(payment);
return true;
} else {
return false;
}
}
use of org.compiere.model.MPayment in project adempiere by adempiere.
the class Collect method createPayment.
// payCheck
/**
* Create Payment object
* Refer to invoice if there is an invoice.
* Otherwise refer to order (it is a prepayment)
*
* @return Payment object
*
*/
private MPayment createPayment(String tenderType) {
MPayment payment = new MPayment(Env.getCtx(), 0, trxName);
payment.setAD_Org_ID(entityPOS.getAD_Org_ID());
payment.setC_POS_ID(entityPOS.getC_POS_ID());
payment.setTenderType(tenderType);
payment.setIsReceipt(true);
payment.setC_Order_ID(order.getC_Order_ID());
payment.setIsPrepayment(true);
payment.setC_BPartner_ID(getC_BPartner_ID());
payment.setDateTrx(getDateTrx());
payment.setDateAcct(getDateTrx());
int invoiceId = order.getC_Invoice_ID();
if (invoiceId > 0) {
payment.setC_Invoice_ID(invoiceId);
MInvoice invoice = new MInvoice(Env.getCtx(), payment.getC_Invoice_ID(), trxName);
payment.setDescription(Msg.getMsg(Env.getCtx(), "Invoice No ") + invoice.getDocumentNo());
} else {
payment.setDescription(Msg.getMsg(Env.getCtx(), "Order No ") + order.getDocumentNo());
}
order.setC_POS_ID(entityPOS.getC_POS_ID());
order.saveEx(trxName);
return payment;
}
use of org.compiere.model.MPayment in project adempiere by adempiere.
the class Collect method payCheck.
// payCash
/**
* Payment with check
* @param amount
* @param accountNo
* @param routingNo
* @param checkNo
* @return true if payment processed correctly; otherwise false
*/
public boolean payCheck(BigDecimal amount, String accountNo, String routingNo, String checkNo) {
MPayment payment = createPayment(MPayment.TENDERTYPE_Check);
payment.setC_CashBook_ID(entityPOS.getC_CashBook_ID());
payment.setAmount(order.getC_Currency_ID(), amount);
payment.setC_BankAccount_ID(entityPOS.getC_BankAccount_ID());
payment.setAccountNo(accountNo);
payment.setRoutingNo(routingNo);
payment.setCheckNo(checkNo);
payment.setDescription(checkNo);
payment.setDateTrx(getDateTrx());
payment.setDateAcct(getDateTrx());
payment.saveEx();
payment.setDocAction(MPayment.DOCACTION_Complete);
payment.setDocStatus(MPayment.DOCSTATUS_Drafted);
if (payment.processIt(MPayment.DOCACTION_Complete)) {
payment.saveEx();
MBankStatement.addPayment(payment);
return true;
} else {
return false;
}
}
use of org.compiere.model.MPayment in project adempiere by adempiere.
the class Collect method payCash.
/**
* Process Payment
* @param amount
* @return true if payment processed correctly; otherwise false
*/
public boolean payCash(BigDecimal amount, BigDecimal overUnderAmt) {
MPayment payment = createPayment(MPayment.TENDERTYPE_Cash);
if (payment.isCashTrx() && !MSysConfig.getBooleanValue("CASH_AS_PAYMENT", true, payment.getAD_Client_ID()))
payment.setC_CashBook_ID(entityPOS.getC_CashBook_ID());
else
payment.setC_BankAccount_ID(entityPOS.getC_BankAccount_ID());
payment.setAmount(order.getC_Currency_ID(), amount);
payment.setC_BankAccount_ID(entityPOS.getC_BankAccount_ID());
payment.setDateTrx(getDateTrx());
payment.setDateAcct(getDateTrx());
payment.saveEx();
payment.setOverUnderAmt(overUnderAmt);
payment.saveEx();
payment.setDocAction(MPayment.DOCACTION_Complete);
payment.setDocStatus(MPayment.DOCSTATUS_Drafted);
if (payment.processIt(MPayment.DOCACTION_Complete)) {
payment.saveEx();
MBankStatement.addPayment(payment);
return true;
} else
return false;
}
use of org.compiere.model.MPayment in project adempiere by adempiere.
the class Collect method payCreditCard.
// payDirectDebit
/**
* Payment with credit card
*
* @return true if payment processed correctly; otherwise false
*
*/
public boolean payCreditCard(BigDecimal amount, String accountName, int month, int year, String cardNo, String cvc, String cardtype) {
MPayment payment = createPayment(MPayment.TENDERTYPE_CreditCard);
payment.setAmount(order.getC_Currency_ID(), amount);
payment.setC_BankAccount_ID(entityPOS.getC_BankAccount_ID());
payment.setDateTrx(getDateTrx());
payment.setDateAcct(getDateTrx());
payment.setCreditCard(MPayment.TRXTYPE_Sales, cardtype, cardNo, cvc, month, year);
payment.saveEx();
payment.setDocAction(MPayment.DOCACTION_Complete);
payment.setDocStatus(MPayment.DOCSTATUS_Drafted);
if (payment.processIt(MPayment.DOCACTION_Complete)) {
payment.saveEx();
MBankStatement.addPayment(payment);
return true;
} else {
return false;
}
}
Aggregations