private void SendButton_Click(object sender, RoutedEventArgs e)
        {
            var voidPayment = new Direct.VoidPayment();

            var voidPaymentRequest = new Direct.VoidPayment.VoidPaymentRequest() {
                Test = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings.Get("TestMode")),
                
                Vendor = VendorTextBox.Text,
                VendorTxCode = VendorTxCodeTextBox.Text,
                VPSTxId = VpsTxIdTextBox.Text,
                TxAuthNo = TxAuthNoTextBox.Text,
                SecurityKey = SecurityKeyTextBox.Text,
            };

            var voidPaymentOutput = voidPayment.Process(voidPaymentRequest);

            // convert to demo data
            var demoData = new DemoData()
            {
                TxType = "VOID",

                Vendor = voidPaymentRequest.Vendor,
                VendorTxCode = voidPaymentRequest.VendorTxCode,
                Status = voidPaymentOutput.Status,
                StatusDetail = voidPaymentOutput.StatusDetail,
            };
            // add data to list
            ((App)Application.Current).DemoDataList.Add(demoData);

            // refresh grid on main window
            ApplicationEvents.NotifyDataChanged();

            // close window
            this.Close();
        }
        public void Load(DemoData demoData)
        {
            AmountTextBox.Text = demoData.Amount.ToString();

            StatusTextBox.Text = demoData.Status;
            StatusDetailTextBox.Text = demoData.StatusDetail;

            VendorTextBox.Text = demoData.Vendor;
            VendorTxCodeTextBox.Text = demoData.VendorTxCode;

            VpsTxIdTextBox.Text = demoData.VpsTxId;
            SecurityKeyTextBox.Text = demoData.SecurityKey;
            TxAuthNoTextBox.Text = demoData.TxAuthNo;
        }
        private void SendButton_Click(object sender, RoutedEventArgs e)
        {
            var refundPayment = new Direct.RefundPayment();

            var refundPaymentRequest = new Direct.RefundPayment.RefundPaymentRequest() {
                Test = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings.Get("TestMode")),
                
                Vendor = VendorTextBox.Text,
                VendorTxCode = Transaction.GenerateVendorTxCode(),

                Amount = Convert.ToDecimal(AmountTextBox.Text),
                Currency = CurrencyTextBox.Text,
                Description = DescriptionTextBox.Text,

                RelatedVendorTxCode = VendorTxCodeTextBox.Text,
                RelatedVPSTxId = VpsTxIdTextBox.Text,
                RelatedTxAuthNo = TxAuthNoTextBox.Text,
                RelatedSecurityKey = SecurityKeyTextBox.Text,
            };

            var refundPaymentOutput = refundPayment.Process(refundPaymentRequest);

            // convert to demo data
            var demoData = new DemoData()
            {
                TxType = "REFUND",

                Vendor = refundPaymentRequest.Vendor,
                VendorTxCode = refundPaymentRequest.VendorTxCode,
                Amount = refundPaymentRequest.Amount,
                Currency = refundPaymentRequest.Currency,
                Description = refundPaymentRequest.Description,

                Status = refundPaymentOutput.Status,
                StatusDetail = refundPaymentOutput.StatusDetail,
                VpsTxId = refundPaymentOutput.VpsTxId,
                TxAuthNo = refundPaymentOutput.TxAuthNo,
            };
            // add data to list
            ((App)Application.Current).DemoDataList.Add(demoData);

            // refresh grid on main window
            ApplicationEvents.NotifyDataChanged();

            // close window
            this.Close();
        }
        public void Load(DemoData demoData)
        {
            AmountTextBox.Text = demoData.Amount.ToString();
            CurrencyTextBox.Text = demoData.Currency;
            DescriptionTextBox.Text = demoData.Description;

            StatusTextBox.Text = demoData.Status;
            StatusDetailTextBox.Text = demoData.StatusDetail;

            VendorTextBox.Text = demoData.Vendor;
            VendorTxCodeTextBox.Text = demoData.VendorTxCode;

            VpsTxIdTextBox.Text = demoData.VpsTxId;
            SecurityKeyTextBox.Text = demoData.SecurityKey;
            TxAuthNoTextBox.Text = demoData.TxAuthNo;

            AvsCv2TextBox.Text = demoData.AvsCv2;
            AddressResultTextBox.Text = demoData.AddressResult;
            PostCodeResultTextBox.Text = demoData.PostCodeResult;
            Cv2ResultTextBox.Text = demoData.Cv2Result;
            Status3dSecureTextBox.Text = demoData.Status3dSecure;
        }
        private void SendButton_Click(object sender, RoutedEventArgs e)
        {
            var newPayment = new Direct.NewPayment();

            var newPaymentRequest = new Direct.NewPayment.NewPaymentRequest() {

                Test = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings.Get("TestMode")),

                Vendor = System.Configuration.ConfigurationManager.AppSettings.Get("VendorName"),
                VendorTxCode = Transaction.GenerateVendorTxCode(),
                Amount = Convert.ToDecimal(AmountTextBox.Text),
                Currency = CurrencyTextBox.Text,
                Description = DescriptionTextBox.Text,
                CardHolder = CardholderTextBox.Text,
                CardNumber = CardNumberTextBox.Text,
                ExpiryDate = ExpiryDateTextBox.Text,
                CV2 = Cv2TextBox.Text,
                CardType = CardTypeTextBox.Text,
                CustomerName = CustomerNameTextBox.Text,

                BillingSurname = BillingSurnameTextBox.Text,
                BillingFirstnames = BillingFirstnamesTextBox.Text,
                BillingAddress1 = BillingAddress1TextBox.Text,
                BillingAddress2 = BillingAddress2TextBox.Text,
                BillingCity = BillingCityTextBox.Text,
                BillingPostCode = BillingPostCodeTextBox.Text,
                BillingCountry = BillingCountryTextBox.Text,
                BillingPhone = BillingPhoneTextBox.Text,

                DeliverySurname = DeliverySurnameTextBox.Text,
                DeliveryFirstnames = DeliveryFirstnamesTextBox.Text,
                DeliveryAddress1 = DeliveryAddress1TextBox.Text,
                DeliveryAddress2 = DeliveryAddress2TextBox.Text,
                DeliveryCity = DeliveryCityTextBox.Text,
                DeliveryPostCode = DeliveryPostCodeTextBox.Text,
                DeliveryCountry = DeliveryCountryTextBox.Text,
                DeliveryPhone = DeliveryPhoneTextBox.Text,

                //BillingAgreement = true,
                AccountType = "E",
                ApplyAVSCV2 = "0",
                Apply3DSecure = "2",
                //ClientIPAddress = "",
                //CreateToken = true,
                
                //CustomerEmail ="",
                //StoreToken = true,
                //Website = "",
            };

            var newPaymentOutput = newPayment.Process(newPaymentRequest);
            
            // convert to demo data
            var demoData = new DemoData() {
                TxType = "PAYMENT",

                Vendor = newPaymentRequest.Vendor,
                VendorTxCode = newPaymentRequest.VendorTxCode,
                Amount = newPaymentRequest.Amount,
                Currency = newPaymentRequest.Currency,
                Description = newPaymentRequest.Description,
                 
                Status = newPaymentOutput.Status,
                StatusDetail = newPaymentOutput.StatusDetail,
                VpsTxId = newPaymentOutput.VpsTxId,
                SecurityKey = newPaymentOutput.SecurityKey,
                TxAuthNo = newPaymentOutput.TxAuthNo,

                AvsCv2 = newPaymentOutput.AvsCv2,
                AddressResult = newPaymentOutput.AddressResult,
                PostCodeResult = newPaymentOutput.PostCodeResult,
                Cv2Result = newPaymentOutput.Cv2Result,
                Status3dSecure = newPaymentOutput.Status3dSecure,
            };
            // add data to list
            ((App)Application.Current).DemoDataList.Add(demoData);

            // refresh grid on main window
            ApplicationEvents.NotifyDataChanged();

            // close window
            this.Close();
        }