Ejemplo n.º 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            OptionalParams p = new OptionalParams();
            String mobileNumber = this.textBox4.Text;
            if (mobileNumber != null)
            {
                Customer cust = new Customer();
                cust.setMobileNumber(mobileNumber);
                p.setCustomer(cust);
            }
            EzeResult res = EzeAPI.create().cardTransaction(20.0,PaymentMode.SALE,p);
            Console.WriteLine("666666.... "+res.getStatus());
            if (res.getStatus() == Status.SUCCESS)
            {
                // f3 = new Form3(parent, "23");

                if (res.getResult() != null)
                {
                    com.eze.api.TransactionDetails td = res.getResult().getTransactionDetails();
                    Form3 f3 = new Form3(parent,td.getTxnId(),p.getCustomer(),parent);
                    f3.Show();
                }
            }
            else
            {
                MessageBox.Show(res.getError().getMessage(), "", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly, false);
            }
        }
Ejemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     String mobileNumber = this.textBox5.Text;
     String emailId = this.textBox6.Text;
     Customer customer = new Customer();
     customer.setEmailId(emailId);
     customer.setMobileNumber(mobileNumber);
     String referenceId = this.textBox4.Text;
     //
     String chequeBankName = this.textBox2.Text;
     String chequeBankCode = this.textBox3.Text;
     String chequeDate = this.textBox4.Text;
     Cheque che = new Cheque();
     che.setBankName(chequeBankName);
     che.setBankCode(chequeBankCode);
     che.setChequeDate(chequeDate);
     che.setChequeNumber("100");
     Reference refe = new Reference();
     refe.setReference1(referenceId);
     OptionalParams op = new OptionalParams();
     op.setCustomer(customer);
     op.setReference(refe);
     double amount = double.Parse(this.textBox1.Text);
     EzeResult result = EzeAPI.create().chequeTransaction(amount,che,op);
     if (result.getStatus() == Status.SUCCESS)
     {
         if (result.getResult() != null)
         {
             com.eze.api.TransactionDetails td = result.getResult().getTransactionDetails();
             Form3 f3 = new Form3(parent, td.getTxnId(), op.getCustomer(), parent);
             f3.Show();
         }
     }
     else
     {
         MessageBox.Show(result.getError().getMessage(), "", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly, false);
     }
 }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            double amount = double.Parse(this.textBox1.Text);
            String refernceId = this.textBox2.Text;
            String mobileNumber = this.textBox3.Text;
            Customer cust = new Customer();
            cust.setMobileNumber(mobileNumber);
            OptionalParams op = new OptionalParams();
            op.setCustomer(cust);

               // ref.se
              //  op.setReference(ref);
            EzeResult result = EzeAPI.create().cashTransaction(amount,op);
            if (result.getStatus() == Status.SUCCESS)
            {
                Form3 f = new Form3(this,result.getResult().getTransactionDetails().getTxnId(),cust,parent);
                f.Show();

            }
            else
            {
                MessageBox.Show(result.getError().getMessage(), "", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly, false);
            }
        }
Ejemplo n.º 4
0
        public EzeResult chequeTransaction(double amount,Cheque cDetails, OptionalParams options)
        {
            EzeResult result = null;
            Console.WriteLine("...Take Payment By Cash <" + ",amount=" + amount + "," + ">");
            TxnInput.Types.TxnType txnType = TxnInput.Types.TxnType.CHEQUE;

            if (amount <= 0) throw new EzeException("Amount is 0 or negative");

            TxnInput tInput = TxnInput.CreateBuilder()
                    .SetTxnType(txnType)
                    .SetAmount(amount)
                    .Build();

            if ((null == cDetails) ||
                (null == cDetails.getChequeNumber()) || (cDetails.getChequeNumber().Length == 0) ||
                (null == cDetails.getChequeDate()) || (cDetails.getChequeDate().Length == 0) ||
                (null == cDetails.getBankName()))
            {
                throw new EzeException("Cheque details not passed for a Cheque transaction");
            }

            if (null != cDetails.getChequeNumber()) tInput = TxnInput.CreateBuilder(tInput).SetChequeNumber(cDetails.getChequeNumber()).Build();
            if (null != cDetails.getChequeDate()) tInput = TxnInput.CreateBuilder(tInput).SetChequeDate(cDetails.getChequeDate()).Build();
            if (null != cDetails.getBankCode()) tInput = TxnInput.CreateBuilder(tInput).SetBankCode(cDetails.getBankCode()).Build();
              //  if (null != cDetails.getBankName()) tInput = TxnInput.CreateBuilder(tInput).SetBankName(cDetails.getBankName()).Build();
              //  if (null != options.getChequeDate()) tInput = TxnInput.CreateBuilder(tInput).SetChequeDate(options.getChequeDate().ToString()).Build();

            if (null != options)
            {
                if (null != options.getReference())
                {
                    if (null != options.getReference().getReference1()) tInput = TxnInput.CreateBuilder(tInput).SetOrderId(options.getReference().getReference1()).Build();
                    if (null != options.getReference().getReference2()) tInput = TxnInput.CreateBuilder(tInput).SetExternalReference2(options.getReference().getReference2()).Build();
                    if (null != options.getReference().getReference3()) tInput = TxnInput.CreateBuilder(tInput).SetExternalReference3(options.getReference().getReference3()).Build();
                }

                if (null != options.getCustomer())
                {
                    String mobileNumber = options.getCustomer().getMobileNumber();
                    String emailId = options.getCustomer().getEmailId();
                    if (null != mobileNumber) tInput = TxnInput.CreateBuilder(tInput).SetCustomerMobile(mobileNumber).Build();
                    if (null != emailId) tInput = TxnInput.CreateBuilder(tInput).SetCustomerEmail(emailId).Build();

                }
            }

            ApiInput apiInput = ApiInput.CreateBuilder()
                    .SetMsgType(ApiInput.Types.MessageType.TXN)
                    .SetMsgData(tInput.ToByteString()).Build();

            this.send(apiInput);

            while (true)
            {
                result = this.getResult(this.receive());

                if (result.getEventName() == EventName.TAKE_PAYMENT)
                {
                    if (result.getStatus() == Status.SUCCESS) EzeEvent("Payment Successful", new EventArgs());
                    else EzeEvent("Payment Failed", new EventArgs());
                    break;
                }
            }

            return result;
        }
Ejemplo n.º 5
0
        public EzeResult cardTransaction( double amount, PaymentMode mode, OptionalParams options)
        {
            EzeResult result = null;
            Console.WriteLine("...Take Payment <" + mode + ",amount=" + amount + "," + ">");
            TxnInput.Types.TxnType txnType = TxnInput.Types.TxnType.CARD_AUTH;

            if (amount <= 0) throw new EzeException("Amount is 0 or negative");

            TxnInput tInput = TxnInput.CreateBuilder()
                    .SetTxnType(txnType)
                    .SetAmount(amount)
                    .Build();

            if (null != options)
            {
                if (null != options.getReference())
                {
                    if (null != options.getReference().getReference1()) tInput = TxnInput.CreateBuilder(tInput).SetOrderId(options.getReference().getReference1()).Build();
                    if (null != options.getReference().getReference2()) tInput = TxnInput.CreateBuilder(tInput).SetExternalReference2(options.getReference().getReference2()).Build();
                    if (null != options.getReference().getReference3()) tInput = TxnInput.CreateBuilder(tInput).SetExternalReference3(options.getReference().getReference3()).Build();
                }
                if (0 != options.getAmountCashback()) tInput = TxnInput.CreateBuilder(tInput).SetAmountOther(options.getAmountCashback()).Build();
                //  if (0 != options.getAamountTip()) tInput = TxnInput.CreateBuilder(tInput).Set(options.getBankCode()).Build();
                if (null != options.getCustomer())
                {
                    String mobileNumber = options.getCustomer().getMobileNumber();
                    String emailId = options.getCustomer().getEmailId();
                    if (null != mobileNumber) tInput = TxnInput.CreateBuilder(tInput).SetCustomerMobile(mobileNumber).Build();
                    if (null != emailId) tInput = TxnInput.CreateBuilder(tInput).SetCustomerEmail(emailId).Build();

                }
            }

            ApiInput apiInput = ApiInput.CreateBuilder()
                    .SetMsgType(ApiInput.Types.MessageType.TXN)
                    .SetMsgData(tInput.ToByteString()).Build();

            this.send(apiInput);

            while (true)
            {
                result = this.getResult(this.receive());

                if (result.getEventName() == EventName.TAKE_PAYMENT)
                {
                    if (result.getStatus() == Status.SUCCESS) EzeEvent("Payment Successful", new EventArgs());
                    else EzeEvent("Payment Failed", new EventArgs());
                    break;
                }
            }

            return result;
        }
Ejemplo n.º 6
0
        public EzeResult chequeTransaction(double amount, Cheque cDetails, OptionalParams options)
        {
            EzeResult result = null;

            Console.WriteLine("...Take Payment By Cash <" + ",amount=" + amount + "," + ">");
            TxnInput.Types.TxnType txnType = TxnInput.Types.TxnType.CHEQUE;

            if (amount <= 0)
            {
                throw new EzeException("Amount is 0 or negative");
            }

            TxnInput tInput = TxnInput.CreateBuilder()
                              .SetTxnType(txnType)
                              .SetAmount(amount)
                              .Build();

            if ((null == cDetails) ||
                (null == cDetails.getChequeNumber()) || (cDetails.getChequeNumber().Length == 0) ||
                (null == cDetails.getChequeDate()) || (cDetails.getChequeDate().Length == 0) ||
                (null == cDetails.getBankName()))
            {
                throw new EzeException("Cheque details not passed for a Cheque transaction");
            }

            if (null != cDetails.getChequeNumber())
            {
                tInput = TxnInput.CreateBuilder(tInput).SetChequeNumber(cDetails.getChequeNumber()).Build();
            }
            if (null != cDetails.getChequeDate())
            {
                tInput = TxnInput.CreateBuilder(tInput).SetChequeDate(cDetails.getChequeDate()).Build();
            }
            if (null != cDetails.getBankCode())
            {
                tInput = TxnInput.CreateBuilder(tInput).SetBankCode(cDetails.getBankCode()).Build();
            }
            //  if (null != cDetails.getBankName()) tInput = TxnInput.CreateBuilder(tInput).SetBankName(cDetails.getBankName()).Build();
            //  if (null != options.getChequeDate()) tInput = TxnInput.CreateBuilder(tInput).SetChequeDate(options.getChequeDate().ToString()).Build();


            if (null != options)
            {
                if (null != options.getReference())
                {
                    if (null != options.getReference().getReference1())
                    {
                        tInput = TxnInput.CreateBuilder(tInput).SetOrderId(options.getReference().getReference1()).Build();
                    }
                    if (null != options.getReference().getReference2())
                    {
                        tInput = TxnInput.CreateBuilder(tInput).SetExternalReference2(options.getReference().getReference2()).Build();
                    }
                    if (null != options.getReference().getReference3())
                    {
                        tInput = TxnInput.CreateBuilder(tInput).SetExternalReference3(options.getReference().getReference3()).Build();
                    }
                }

                if (null != options.getCustomer())
                {
                    String mobileNumber = options.getCustomer().getMobileNumber();
                    String emailId      = options.getCustomer().getEmailId();
                    if (null != mobileNumber)
                    {
                        tInput = TxnInput.CreateBuilder(tInput).SetCustomerMobile(mobileNumber).Build();
                    }
                    if (null != emailId)
                    {
                        tInput = TxnInput.CreateBuilder(tInput).SetCustomerEmail(emailId).Build();
                    }
                }
            }

            ApiInput apiInput = ApiInput.CreateBuilder()
                                .SetMsgType(ApiInput.Types.MessageType.TXN)
                                .SetMsgData(tInput.ToByteString()).Build();

            this.send(apiInput);

            while (true)
            {
                result = this.getResult(this.receive());

                if (result.getEventName() == EventName.TAKE_PAYMENT)
                {
                    if (result.getStatus() == Status.SUCCESS)
                    {
                        EzeEvent("Payment Successful", new EventArgs());
                    }
                    else
                    {
                        EzeEvent("Payment Failed", new EventArgs());
                    }
                    break;
                }
            }

            return(result);
        }
Ejemplo n.º 7
0
        public EzeResult cardTransaction(double amount, PaymentMode mode, OptionalParams options)
        {
            EzeResult result = null;

            Console.WriteLine("...Take Payment <" + mode + ",amount=" + amount + "," + ">");
            TxnInput.Types.TxnType txnType = TxnInput.Types.TxnType.CARD_AUTH;

            if (amount <= 0)
            {
                throw new EzeException("Amount is 0 or negative");
            }

            TxnInput tInput = TxnInput.CreateBuilder()
                              .SetTxnType(txnType)
                              .SetAmount(amount)
                              .Build();

            if (null != options)
            {
                if (null != options.getReference())
                {
                    if (null != options.getReference().getReference1())
                    {
                        tInput = TxnInput.CreateBuilder(tInput).SetOrderId(options.getReference().getReference1()).Build();
                    }
                    if (null != options.getReference().getReference2())
                    {
                        tInput = TxnInput.CreateBuilder(tInput).SetExternalReference2(options.getReference().getReference2()).Build();
                    }
                    if (null != options.getReference().getReference3())
                    {
                        tInput = TxnInput.CreateBuilder(tInput).SetExternalReference3(options.getReference().getReference3()).Build();
                    }
                }
                if (0 != options.getAmountCashback())
                {
                    tInput = TxnInput.CreateBuilder(tInput).SetAmountOther(options.getAmountCashback()).Build();
                }
                //  if (0 != options.getAamountTip()) tInput = TxnInput.CreateBuilder(tInput).Set(options.getBankCode()).Build();
                if (null != options.getCustomer())
                {
                    String mobileNumber = options.getCustomer().getMobileNumber();
                    String emailId      = options.getCustomer().getEmailId();
                    if (null != mobileNumber)
                    {
                        tInput = TxnInput.CreateBuilder(tInput).SetCustomerMobile(mobileNumber).Build();
                    }
                    if (null != emailId)
                    {
                        tInput = TxnInput.CreateBuilder(tInput).SetCustomerEmail(emailId).Build();
                    }
                }
            }

            ApiInput apiInput = ApiInput.CreateBuilder()
                                .SetMsgType(ApiInput.Types.MessageType.TXN)
                                .SetMsgData(tInput.ToByteString()).Build();

            this.send(apiInput);

            while (true)
            {
                result = this.getResult(this.receive());

                if (result.getEventName() == EventName.TAKE_PAYMENT)
                {
                    if (result.getStatus() == Status.SUCCESS)
                    {
                        EzeEvent("Payment Successful", new EventArgs());
                    }
                    else
                    {
                        EzeEvent("Payment Failed", new EventArgs());
                    }
                    break;
                }
            }

            return(result);
        }