getReference() public method

public getReference ( ) : Reference
return Reference
Example #1
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;
        }
Example #2
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);
        }
Example #3
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;
        }
Example #4
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);
        }