示例#1
0
        private void AcceptButton_Click(object sender, EventArgs e)
        {
            POSCard storedCard = new POSCard();

            //storedCard.First6 = First6TextBox.Text;
            //storedCard.Name = CustomerName.Text;
            this.Dispose();
            SignatureVerifyRequest.Accept();
        }
        private void okButton_Click(object sender, EventArgs e)
        {
            // need to save this information
            Card        = new POSCard();
            Card.Name   = CustomerNameTextBox.Text;
            Card.First6 = First6TextBox.Text;
            Card.Last4  = Last4TextBox.Text;
            Card.Month  = MonthComboBox.SelectedItem.ToString();
            Card.Year   = YearComboBox.SelectedItem.ToString();
            Card.Token  = Payment.cardTransaction.token;

            Store.Cards.Add(Card);

            this.Close();
        }
        private void Auth(POSCard card)
        {
            StoreItems.BringToFront();
            StoreDiscounts.BringToFront();

            SaleButton.Enabled = false;
            StoreItems.Enabled = false;
            newOrderBtn.Enabled = false;

            AuthRequest request = new AuthRequest();
            request.Amount = Store.CurrentOrder.Total;
            request.ExternalId = ExternalIDUtil.GenerateRandomString(13);

            // Card Entry methods
            long CardEntry = 0;
            CardEntry |= ManualEntryCheckbox.Checked ? CloverConnector.CARD_ENTRY_METHOD_MANUAL : 0;
            CardEntry |= MagStripeCheckbox.Checked ? CloverConnector.CARD_ENTRY_METHOD_MAG_STRIPE : 0;
            CardEntry |= ChipCheckbox.Checked ? CloverConnector.CARD_ENTRY_METHOD_ICC_CONTACT : 0;
            CardEntry |= ContactlessCheckbox.Checked ? CloverConnector.CARD_ENTRY_METHOD_NFC_CONTACTLESS : 0;

            request.CardEntryMethods = CardEntry;
            request.CardNotPresent = CardNotPresentCheckbox.Checked;
            if (!offlineDefault.Checked)
            {
                request.AllowOfflinePayment = offlineYes.Checked;
            }
            if (!approveOfflineDefault.Checked)
            {
                request.ApproveOfflinePaymentWithoutPrompt = approveOfflineYes.Checked;
            }
            if (card != null)
            {
                request.VaultedCard = new com.clover.sdk.v3.payments.VaultedCard();
                request.VaultedCard.cardholderName = card.Name;
                request.VaultedCard.first6 = card.First6;
                request.VaultedCard.last4 = card.Last4;
                request.VaultedCard.expirationDate = card.Month + "" + card.Year;
                request.VaultedCard.token = card.Token;
            }
            cloverConnector.Auth(request);
        }
        private void addCardToUI(POSCard card)
        {
            if (card != null)
            {
                ListViewItem lvi = new ListViewItem();
                lvi.Tag = card;
                lvi.SubItems.Add(new ListViewItem.ListViewSubItem());
                lvi.SubItems.Add(new ListViewItem.ListViewSubItem());
                lvi.SubItems.Add(new ListViewItem.ListViewSubItem());
                lvi.SubItems.Add(new ListViewItem.ListViewSubItem());
                lvi.SubItems.Add(new ListViewItem.ListViewSubItem());
                lvi.SubItems.Add(new ListViewItem.ListViewSubItem());

                lvi.SubItems[0].Text = card.Name;
                lvi.SubItems[1].Text = card.First6;
                lvi.SubItems[2].Text = card.Last4;
                lvi.SubItems[3].Text = card.Month;
                lvi.SubItems[4].Text = card.Year;
                lvi.SubItems[5].Text = card.Token;

                cardsListView.Items.Add(lvi);
                autoResizeColumns(cardsListView);
                uiThread.Send(delegate (object state)
                {
                    if (SaleButton.ContextMenu.MenuItems[0].Enabled == false)
                    {
                        SaleButton.ContextMenu.MenuItems[0].Enabled = true;
                        AuthButton.ContextMenu.MenuItems[0].Enabled = true;
                    }
                }, null);
            }
        }
        public void OnVaultCardResponse(VaultCardResponse vcResponse)
        {
            String screenResponseMsg = "";
            if (vcResponse.Success && vcResponse.Card.token != null)
            {
                POSCard posCard = new POSCard();
                posCard.Name = vcResponse.Card.cardholderName;
                posCard.First6 = vcResponse.Card.first6;
                posCard.Last4 = vcResponse.Card.last4;
                posCard.Token = vcResponse.Card.token;
                posCard.Month = vcResponse.Card.expirationDate.Substring(0, 2);
                posCard.Year = vcResponse.Card.expirationDate.Substring(2, 2);
                Store.Cards.Add(posCard);

                uiThread.Send(delegate (object state)
                {
                    addCardToUI(posCard);
                    screenResponseMsg = "Card" + vcResponse.Card.first6 + "xxxxxx" + vcResponse.Card.last4 + " was added";
                    AlertForm.Show(this, "Card Vaulted", screenResponseMsg);
                }, null);
            }
            else
            {
                uiThread.Send(delegate (object state)
                {
                    if (vcResponse.Success)
                    {
                        screenResponseMsg = "Card token was not populated by the payment gateway.  This card cannot be saved.";
                    }
                    else {
                        screenResponseMsg = "Card was not successfully saved";
                    }
                    AlertForm.Show(this, screenResponseMsg, vcResponse.Reason);
                }, null);
            }
        }
 private void Cancel_Button_Click(object sender, EventArgs e)
 {
     Card = null;
     this.Close();
     this.Dispose();
 }
 private void OK_Button_Click(object sender, EventArgs e)
 {
     Card = (POSCard)this.VaultedCardsListView.SelectedItems[0].Tag;
     this.Close();
     this.Dispose();
 }
        private void okButton_Click(object sender, EventArgs e)
        {
            // need to save this information
            Card = new POSCard();
            Card.Name = CustomerNameTextBox.Text;
            Card.First6 = First6TextBox.Text;
            Card.Last4 = Last4TextBox.Text;
            Card.Month = MonthComboBox.SelectedItem.ToString();
            Card.Year = YearComboBox.SelectedItem.ToString();
            Card.Token = Payment.cardTransaction.token;

            Store.Cards.Add(Card);

            this.Close();
        }
 private void OK_Button_Click(object sender, EventArgs e)
 {
     Card = (POSCard)this.VaultedCardsListView.SelectedItems[0].Tag;
     this.Close();
     this.Dispose();
 }
 private void Cancel_Button_Click(object sender, EventArgs e)
 {
     Card = null;
     this.Close();
     this.Dispose();
 }