getAmountCashback() public method

public getAmountCashback ( ) : double
return double
Ejemplo n.º 1
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.º 2
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);
        }