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);
            }
        }
        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);
            }
        }
 private void button1_Click(object sender, EventArgs e)
 {
     if ((this.textBox1.Text == null) && (this.textBox1.Text.Length == 0))
     {
         MessageBox.Show("Invalid TransactionId", "", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly, false);
     }
     else
     {
         EzeResult result = EzeAPI.create().getTransaction(this.textBox1.Text);
         if (result.getStatus() == Status.SUCCESS)
         {
             com.eze.api.TransactionDetails details = result.getResult().getTransactionDetails();
             TransactionDetails             td      = new TransactionDetails(parent, details.getTxnId(), "" + details.GetType(), "" + details.getAmount(), "2015-10-23", result.getResult().getMerchant().getMerchantName(), result.getResult().getCustomer().getMobileNumber());
             td.Show();
         }
         else
         {
             MessageBox.Show(result.getError().getMessage(), "", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly, false);
         }
     }
 }
Beispiel #4
0
        private EzeResult getResult(ApiOutput apiOutput)
        {
            EzeResult result = new EzeResult();
            Result paymentResult = new Result();
            paymentResult.setMessage("Ezeeeeeeeeeeeeeeeee");
            if (null == apiOutput) throw new EzeException("Invalid response from EPIC. ApiOutput is null");
            Console.WriteLine("1.."+apiOutput.EventType);

            Console.WriteLine("2. "+ MapEventName(apiOutput.EventType));
            result.setEventName(MapEventName(apiOutput.EventType));
            if (apiOutput.HasStatus) result.setStatus(MapStatus(apiOutput.Status));
            if (apiOutput.HasMsgText)
            {

                paymentResult.setMessage(apiOutput.MsgText);
                result.setResult(paymentResult);
            }
            Console.WriteLine("3.."+apiOutput.MsgText);
            Console.WriteLine("4.." + result);
            if (apiOutput.HasOutData)
            {
                 try
                 {
                     StatusInfo statusInfo = StatusInfo.ParseFrom(apiOutput.OutData);
                     if (apiOutput.HasStatus)
                     {

                         if (result.getStatus() == Status.FAILURE)
                         {
                             Console.WriteLine("Failure");
                             if (null != statusInfo)
                             {
                                 Error error = new Error();
                             error.setCode(statusInfo.Code);
                             error.setMessage(statusInfo.Message);
                             result.setError(error);
                             }
                         }

                     }

                 }
                 catch (InvalidProtocolBufferException e)
                 {
                     Console.WriteLine(e.Message);
                 }

                if ((apiOutput.Status == ApiOutput.Types.ResultStatus.SUCCESS) && (apiOutput.EventType.Equals(ApiOutput.Types.EventType.TXN_HISTORY_RESULT)))
                {
                    try
                    {
                        Console.WriteLine("history parsing begins... ");
                        TxnHistory txHistory = TxnHistory.ParseFrom(apiOutput.OutData);
                        Console.WriteLine("Null history "+txHistory);

                        if (null != txHistory)
                        {

                            Console.WriteLine(txHistory.TotalCount);
                          //  IList<Txn> list = txHistory.

                        }
                        else
                        {
                            Console.WriteLine("Null histpry");
                        }
                    }
                    catch (InvalidProtocolBufferException e)
                    {
                        Console.WriteLine(e.Message);
                    }
                }
                if ((apiOutput.Status == ApiOutput.Types.ResultStatus.SUCCESS) && (apiOutput.EventType.Equals(ApiOutput.Types.EventType.TXN_RESULT) || (apiOutput.EventType.Equals(ApiOutput.Types.EventType.TXN_DETAILS_RESULT))))
                {

                    TransactionDetails tDetails = new TransactionDetails();
                    Card card = new Card();
                    Merchant merchant = new Merchant();
                    Customer cust = new Customer();
                    Receipt receipt = new Receipt();
                    Cheque cheque = new Cheque();
                    Txn txnOutput;
                    try
                    {
                        txnOutput = Txn.ParseFrom(apiOutput.OutData);
                        tDetails.setPmtType(txnOutput.TxnType.ToString());
                        tDetails.setStatus(txnOutput.Status);
                        tDetails.setTxnId(txnOutput.TransactionId);
                        tDetails.setAmount(txnOutput.Amount);
                        tDetails.setSettlementStatus(txnOutput.SettlementStatus);
                        tDetails.setVoidable(txnOutput.Voidable);
                        tDetails.setAuthCode(txnOutput.AuthCode);
                        tDetails.setCardType(txnOutput.CardBrand);
                        tDetails.setOrderId(txnOutput.OrderId);
                        tDetails.setTid(txnOutput.Tid);
                        paymentResult.setTransactionDetails(tDetails);
                       merchant.setMerchantCode(txnOutput.Mid);
                        // merchant.setMerchantName(txnOutput.m);
                        paymentResult.setMerchant(merchant);
                        cust.setMobileNumber(txnOutput.CustomerMobileNumber);
                        // cust.setemailId(txnOutput.);
                        paymentResult.setCustomer(cust);
                        receipt.setReceiptUrl(txnOutput.ReceiptUrl);
                        receipt.setReceiptDate(txnOutput.Timestamp);
                        paymentResult.setReceipt(receipt);
                        cheque.setChequeNumber(txnOutput.ChequeNumber);
                        cheque.setChequeDate(txnOutput.ChequeDate);
                        cheque.setBankCode(txnOutput.BankCode);
                        // cheque.setBankName(txnOutput.b);
                        paymentResult.setCheque(cheque);
                        card.setCardBrand(txnOutput.CardBrand);
                        //  card.setMaskedCardNumber(txnOutput.LastFoundDigits);
                        paymentResult.setCard(card);
                    }
                    catch (InvalidProtocolBufferException e)
                    {
                        throw new EzeException("Error reading payment result. ex=" + e.Message);
                    }
                   // PaymentResult list = new List<PaymentResult>();
                    result.setResult(paymentResult);
                }
            }

            //Console.Write("ApiOutput: " + apiOutput.ToString());

            if ((result.getEventName() == EventName.NOTIFICATION) && (null != EzeEvent))
            {
                Result res = result.getResult();
                Console.WriteLine("5.."+res);
                if (res!=null)
                EzeEvent(result.getResult().getMessage(), new EventArgs());
            }

            return result;
        }
Beispiel #5
0
 public void setTransactionDetails(TransactionDetails transactionDetails)
 {
     this.tDetails = transactionDetails;
 }
Beispiel #6
0
 public void setTransactionDetails(TransactionDetails transactionDetails)
 {
     this.tDetails = transactionDetails;
 }
Beispiel #7
0
        private EzeResult getResult(ApiOutput apiOutput)
        {
            EzeResult result        = new EzeResult();
            Result    paymentResult = new Result();

            paymentResult.setMessage("Ezeeeeeeeeeeeeeeeee");
            if (null == apiOutput)
            {
                throw new EzeException("Invalid response from EPIC. ApiOutput is null");
            }
            Console.WriteLine("1.." + apiOutput.EventType);

            Console.WriteLine("2. " + MapEventName(apiOutput.EventType));
            result.setEventName(MapEventName(apiOutput.EventType));
            if (apiOutput.HasStatus)
            {
                result.setStatus(MapStatus(apiOutput.Status));
            }
            if (apiOutput.HasMsgText)
            {
                paymentResult.setMessage(apiOutput.MsgText);
                result.setResult(paymentResult);
            }
            Console.WriteLine("3.." + apiOutput.MsgText);
            Console.WriteLine("4.." + result);
            if (apiOutput.HasOutData)
            {
                try
                {
                    StatusInfo statusInfo = StatusInfo.ParseFrom(apiOutput.OutData);
                    if (apiOutput.HasStatus)
                    {
                        if (result.getStatus() == Status.FAILURE)
                        {
                            Console.WriteLine("Failure");
                            if (null != statusInfo)
                            {
                                Error error = new Error();
                                error.setCode(statusInfo.Code);
                                error.setMessage(statusInfo.Message);
                                result.setError(error);
                            }
                        }
                    }
                }
                catch (InvalidProtocolBufferException e)
                {
                    Console.WriteLine(e.Message);
                }

                if ((apiOutput.Status == ApiOutput.Types.ResultStatus.SUCCESS) && (apiOutput.EventType.Equals(ApiOutput.Types.EventType.TXN_HISTORY_RESULT)))
                {
                    try
                    {
                        Console.WriteLine("history parsing begins... ");
                        TxnHistory txHistory = TxnHistory.ParseFrom(apiOutput.OutData);
                        Console.WriteLine("Null history " + txHistory);

                        if (null != txHistory)
                        {
                            Console.WriteLine(txHistory.TotalCount);
                            //  IList<Txn> list = txHistory.
                        }
                        else
                        {
                            Console.WriteLine("Null histpry");
                        }
                    }
                    catch (InvalidProtocolBufferException e)
                    {
                        Console.WriteLine(e.Message);
                    }
                }
                if ((apiOutput.Status == ApiOutput.Types.ResultStatus.SUCCESS) && (apiOutput.EventType.Equals(ApiOutput.Types.EventType.TXN_RESULT) || (apiOutput.EventType.Equals(ApiOutput.Types.EventType.TXN_DETAILS_RESULT))))
                {
                    TransactionDetails tDetails = new TransactionDetails();
                    Card     card     = new Card();
                    Merchant merchant = new Merchant();
                    Customer cust     = new Customer();
                    Receipt  receipt  = new Receipt();
                    Cheque   cheque   = new Cheque();
                    Txn      txnOutput;
                    try
                    {
                        txnOutput = Txn.ParseFrom(apiOutput.OutData);
                        tDetails.setPmtType(txnOutput.TxnType.ToString());
                        tDetails.setStatus(txnOutput.Status);
                        tDetails.setTxnId(txnOutput.TransactionId);
                        tDetails.setAmount(txnOutput.Amount);
                        tDetails.setSettlementStatus(txnOutput.SettlementStatus);
                        tDetails.setVoidable(txnOutput.Voidable);
                        tDetails.setAuthCode(txnOutput.AuthCode);
                        tDetails.setCardType(txnOutput.CardBrand);
                        tDetails.setOrderId(txnOutput.OrderId);
                        tDetails.setTid(txnOutput.Tid);
                        paymentResult.setTransactionDetails(tDetails);
                        merchant.setMerchantCode(txnOutput.Mid);
                        // merchant.setMerchantName(txnOutput.m);
                        paymentResult.setMerchant(merchant);
                        cust.setMobileNumber(txnOutput.CustomerMobileNumber);
                        // cust.setemailId(txnOutput.);
                        paymentResult.setCustomer(cust);
                        receipt.setReceiptUrl(txnOutput.ReceiptUrl);
                        receipt.setReceiptDate(txnOutput.Timestamp);
                        paymentResult.setReceipt(receipt);
                        cheque.setChequeNumber(txnOutput.ChequeNumber);
                        cheque.setChequeDate(txnOutput.ChequeDate);
                        cheque.setBankCode(txnOutput.BankCode);
                        // cheque.setBankName(txnOutput.b);
                        paymentResult.setCheque(cheque);
                        card.setCardBrand(txnOutput.CardBrand);
                        //  card.setMaskedCardNumber(txnOutput.LastFoundDigits);
                        paymentResult.setCard(card);
                    }
                    catch (InvalidProtocolBufferException e)
                    {
                        throw new EzeException("Error reading payment result. ex=" + e.Message);
                    }
                    // PaymentResult list = new List<PaymentResult>();
                    result.setResult(paymentResult);
                }
            }

            //Console.Write("ApiOutput: " + apiOutput.ToString());

            if ((result.getEventName() == EventName.NOTIFICATION) && (null != EzeEvent))
            {
                Result res = result.getResult();
                Console.WriteLine("5.." + res);
                if (res != null)
                {
                    EzeEvent(result.getResult().getMessage(), new EventArgs());
                }
            }

            return(result);
        }