public void doCCExtPayment(decimal amount, int cardID, enums.ccCardType ccCardType) { //var ccFeeFor using (var ctx = new AccContexts()) using (var ts = new TransactionScope()) { classes.ccPayment creditCardPayment = new ccPayment(); creditCardPayment.createNew(this.receiverEntityID, this.issuerEntityID, amount, this.currencyID, cardID); /*Record New Invoice Payment*/ var NewInvoicePayment = new AccountingLib.Models.invoicePayment() { invoiceID = invoiceID, paymentID = creditCardPayment.paymentID }; ctx.invoicePayment.AddObject(NewInvoicePayment); ctx.SaveChanges(); //get Fee bank cardType var card = new classes.card.CreditCard(); card.loadByCardID(cardID); ccFee ccfee = new ccFee(); ccfee.loadccFeeByBankCardTypeID((int)ccCardType, (card as Entity).getBankByCard(card.cardID).bankID); //Record related transctions [for invoice payment] List <int> transactions = new List <int>(); transactions.Add(Transaction.createNew(receiverEntityID, (int)AssetCategories.CCCASH, -1 * amount, this.currencyID)); transactions.Add(Transaction.createNew(receiverEntityID, (int)LibCategories.AP, +1 * amount, this.currencyID)); transactions.Add(Transaction.createNew(issuerEntityID, (int)AssetCategories.W, +1 * amount - (decimal)ccfee.amount, this.currencyID)); transactions.Add(Transaction.createNew(issuerEntityID, (int)AssetCategories.AR, -1 * amount, this.currencyID)); transactions.Add(Transaction.createNew(issuerEntityID, (int)OECategories.EXP, (decimal)ccfee.amount, this.currencyID)); /*Record Invoice Payment transactions*/ this.RecordInvoicePaymentTransactions(transactions, creditCardPayment.paymentID, enums.paymentStat.PaidApproved); /*Record Invoice Transaction*/ enums.invoiceStat?invoicestat = null; switch (ccCardType) { case enums.ccCardType.MASTERCARD: invoicestat = enums.invoiceStat.masterCardPaymant; break; case enums.ccCardType.VISACARD: invoicestat = enums.invoiceStat.visaCardPaymant; break; } this.RecordInvoiceTransaction(transactions, (enums.invoiceStat)invoicestat); ts.Complete(); } }
public void setFeeForCreditCardType(enums.ccCardType ccCardType, decimal amount, string description) { ccFee ccFee = new ccFee(); ccFee.createNew(this.bankID, amount, description, (int)ccCardType); }