<< Click to Display Table of Contents >> Navigation: Developers' Guide > Using Data Interface > FAQs > Sample > Handling Payment in Current Transaction |
Navigation: Developers' Guide > Using Data Interface > FAQs > Sample >
Handling Payment in Current Transaction
This sample add-on demonstrates the usage of payment object.
For example, modifying payment details for current transaction on the basis of change in discount/amount of a tender type etc.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using CXS.Retail.Extensibility; using CXS.Retail.UIComponents; using CXS.Retail.ManagementUIComponents; using CXS.Platform.UIComponents; using CXS.Retail.Extensibility.Modules.Transaction; using System.Windows.Forms; using CXSRetailPOS;
namespace POSEventsSampleAddon { class Payment : TransactionPaymentModuleBase { public override void OnAddPaymentViewIntialized(object sender, ViewInitializedEventArgs args) { //PaymentDetailEntryView MessageBox.Show("On Add Payment View Intialized : TransactionPayment"); PaymentDetailEntryView pv = sender as PaymentDetailEntryView; } public override void OnAfterCancel(object sender, EventArgs<CXS.SubSystem.Transaction.Transaction> args) { MessageBox.Show("On After Cancel : TransactionPayment"); } public override void OnAfterDelete(object sender, EventArgs<CXS.SubSystem.Transaction.Transaction, CXS.SubSystem.Transaction.TransactionPayment> args) { MessageBox.Show("On After Delete : TransactionPayment"); } public override void OnAfterSave(object sender, EventArgs<CXS.SubSystem.Transaction.Transaction> args) { MessageBox.Show("On After Save : TransactionPayment");
} public override void OnAfterCancelPayment(object sender, EventArgs<CXS.SubSystem.Transaction.Transaction> args) { MessageBox.Show("On After Cancel Payment : TransactionPayment"); } public override void OnBeforeCancel(object sender, EventArgs<CXS.SubSystem.Transaction.Transaction> args) { MessageBox.Show("On Before Cancel : TransactionPayment"); } public override void OnBeforeCancelPayment(object sender, EventArgs<CXS.SubSystem.Transaction.Transaction, CXS.SubSystem.Transaction.TransactionPayment> args) { MessageBox.Show("On Before Cancel Payment : TransactionPayment"); } public override void OnBeforeDelete(object sender, EventArgs<CXS.SubSystem.Transaction.Transaction, CXS.SubSystem.Transaction.TransactionPayment> args) { MessageBox.Show("On Before Delete : TransactionPayment"); } public override void OnBeforePrintPreview(object sender, EventArgs<CXS.SubSystem.Transaction.Transaction> args) { MessageBox.Show("On Before Print Preview : TransactionPayment"); } public override void OnBeforepaymentTypeSelection(object sender, EventArgs<CXS.SubSystem.Transaction.Transaction, CXS.SubSystem.Payment.PaymentType> args) { CXS.SubSystem.Payment.TenderType tender = args.ChildItem.Type; MessageBox.Show(tender.ToString()); MessageBox.Show("Payment Type to be Selected : TransactionPayment"); } public override void OnAfterpaymentTypeSelection(object sender, EventArgs<CXS.SubSystem.Transaction.Transaction, CXS.SubSystem.Transaction.TransactionPayment> args) { //args.ChildItem.Amount = Convert.ToDecimal(1000); MessageBox.Show("On after payment type selection : TransactionPayment"); CXS.SubSystem.Transaction.TransactionPayment pay = args.ChildItem; pay.PaidAmount = Convert.ToDecimal(4); pay.NetPayableAmount = Convert.ToDecimal(3); }
public override void OnBeforeAddPayment(object sender, EventArgs<CXS.SubSystem.Transaction.Transaction, CXS.SubSystem.Transaction.TransactionPayment> args) { CXS.SubSystem.Transaction.TransactionPayment pay = args.ChildItem; pay.PaidAmount = 4; pay.NetPayableAmount = 3; pay.CashBackAmount = 4; args.ChildItem.CashBackAmount = 5;
//args.ChildItem.PaidAmount = Convert.ToDecimal(5); //args.ChildItem.NetPayableAmount = Convert.ToDecimal(10); MessageBox.Show("Payment will be added now : TransactionPayment"); } public override void OnAfterAddPayment(object sender, EventArgs<CXS.SubSystem.Transaction.Transaction> args) { MessageBox.Show("Payment added : TransactionPayment"); args.Item.DiscountPercent = 10;
} public override void OnBeforeSave(object sender, EventArgs<CXS.SubSystem.Transaction.Transaction> args) { MessageBox.Show("On Before Save : TransactionPayment"); } } } |
Download and open the "POSEventsSampleAddon" project file. Refer to the Payment class file.