Exemplo n.º 1
0
 void ICreditCard.AddParametersToRequest(RestRequest request)
 {
     request.AddParameter("card[number]", Number);
     request.AddParameter("card[exp_month]", ExpMonth);
     request.AddParameter("card[exp_year]", ExpYear);
     if (Cvc.HasValue())
     {
         request.AddParameter("card[cvc]", Cvc);
     }
     if (Name.HasValue())
     {
         request.AddParameter("card[name]", Name);
     }
     if (AddressLine1.HasValue())
     {
         request.AddParameter("card[address_line1]", AddressLine1);
     }
     if (AddressLine2.HasValue())
     {
         request.AddParameter("card[address_line2]", AddressLine2);
     }
     if (AddressZip.HasValue())
     {
         request.AddParameter("card[address_zip]", AddressZip);
     }
     if (AddressState.HasValue())
     {
         request.AddParameter("card[address_state]", AddressState);
     }
     if (AddressCountry.HasValue())
     {
         request.AddParameter("card[address_country]", AddressCountry);
     }
 }
Exemplo n.º 2
0
 void IObjectValidation.AddParametersToRequest(RestRequest request)
 {
     if (Token.HasValue())
     {
         request.AddParameter("source", Token);
     }
     else
     {
         request.AddParameter("source[object]", "card");
         request.AddParameter("source[number]", Number);
         request.AddParameter("source[exp_month]", ExpMonth);
         request.AddParameter("source[exp_year]", ExpYear);
         if (Cvc.HasValue())
         {
             request.AddParameter("source[cvc]", Cvc);
         }
         if (Name.HasValue())
         {
             request.AddParameter("source[name]", Name);
         }
         if (AddressLine1.HasValue())
         {
             request.AddParameter("source[address_line1]", AddressLine1);
         }
         if (AddressLine2.HasValue())
         {
             request.AddParameter("source[address_line2]", AddressLine2);
         }
         if (AddressCity.HasValue())
         {
             request.AddParameter("source[address_city]", AddressCity);
         }
         if (AddressState.HasValue())
         {
             request.AddParameter("source[address_state]", AddressState);
         }
         if (AddressZip.HasValue())
         {
             request.AddParameter("source[address_zip]", AddressZip);
         }
         if (AddressCountry.HasValue())
         {
             request.AddParameter("source[address_country]", AddressCountry);
         }
     }
 }
Exemplo n.º 3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (CardNumber.Length != 0)
            {
                hash ^= CardNumber.GetHashCode();
            }
            if (Cvc.Length != 0)
            {
                hash ^= Cvc.GetHashCode();
            }
            if (ExpiryMonth != 0)
            {
                hash ^= ExpiryMonth.GetHashCode();
            }
            if (FourDigitExpiryYear != 0)
            {
                hash ^= FourDigitExpiryYear.GetHashCode();
            }
            if (Zipcode.Length != 0)
            {
                hash ^= Zipcode.GetHashCode();
            }
            if (CardholderName.Length != 0)
            {
                hash ^= CardholderName.GetHashCode();
            }
            if (IsVirtualCard != false)
            {
                hash ^= IsVirtualCard.GetHashCode();
            }
            if (virtualCardLimit_ != null)
            {
                hash ^= VirtualCardLimit.GetHashCode();
            }
            if (virtualCardAvailableOn_ != null)
            {
                hash ^= VirtualCardAvailableOn.GetHashCode();
            }
            if (virtualCardExpiresOn_ != null)
            {
                hash ^= VirtualCardExpiresOn.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 4
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.CardPayment);
            PaymentButton        = FindViewById <ImageView>(Resource.Id.paynow);
            PaymentButton.Click += PaymentButton_Click;
            CardNumber           = FindViewById <EditText>(Resource.Id.edtCardNo);
            Cvc          = FindViewById <EditText>(Resource.Id.edtCvc);
            ExpDateYear  = FindViewById <EditText>(Resource.Id.edtExpiryDateYear);
            ExpDateMonth = FindViewById <EditText>(Resource.Id.edtExpiryDateMonth);
            CardNo       = FindViewById <TextView>(Resource.Id.txtCardNo);
            cvv          = FindViewById <TextView>(Resource.Id.txtCvc);
            expDate      = FindViewById <TextView>(Resource.Id.txtExpiryDate);
            Amount       = FindViewById <EditText>(Resource.Id.edtAmount);
            amount       = FindViewById <TextView>(Resource.Id.txtAmount);
            CardNumber.AddTextChangedListener(this);
            Cvc.AddTextChangedListener(this);
            ExpDateYear.AddTextChangedListener(this);
            ExpDateMonth.AddTextChangedListener(this);
        }
Exemplo n.º 5
0
        public override string ToString()
        {
            if (this.CardOwner.Length > 23)
            {
                this.CardOwner = this.CardOwner.Substring(0, 23);
            }

            if (string.IsNullOrEmpty(this.BackText))
            {
                this.BackText = CardNumber.Substring(CardNumber.Length - 4, 4) + " " + Cvc.ToString();
            }

            string DataBlock = @"#DCC#";

            if (string.IsNullOrEmpty(Track2) == false)
            {
                DataBlock += @"#CMP#;" + Track2 + @"?";
            }

            DataBlock += @"#GRD#0""
" + CardNumber + @"""
" + ExpDate + @"""
" + CardOwner + @"""
" + Cvc + @"""
" + BackText + @"""
#END#@@@@@";

            if (string.IsNullOrEmpty(Track2) == false)
            {
                DataBlock += "@";
            }
            return(DataBlock);
        }