Exemplo n.º 1
0
 public RegisterModel()
 {
     CreditCard = new CreditCardModel();
     BillingAddress = new BillingAddressModel();
 }
Exemplo n.º 2
0
        public PaymentInfoModel(BillingGateway dynabicBillingGateway, string customerReferenceId)
            : this()
        {
            CreditCard = new CreditCardModel();
            BillingAddress = new BillingAddressModel();
            
            //get the first credit card of our customer to edit
            CreditCardResponse creditCard;
            try
            {
                creditCard = dynabicBillingGateway.Customer.GetFirstCreditCardForCustomerByReferenceId(Config.MySiteSubdomain, customerReferenceId);
            }
            catch (NotFoundException)
            {
                creditCard = new CreditCardResponse();
            }

            CreditCard.Id = creditCard.Id;
            CreditCard.FirstNameOnCard = creditCard.FirstNameOnCard;
            CreditCard.LastNameOnCard = creditCard.LastNameOnCard;
            CreditCard.ExpirationDate = creditCard.ExpirationDate;
            CreditCard.Number = creditCard.Number;
            CreditCard.Cvv = creditCard.Cvv;

            //get the first Billing Address of our customer to edit
            AddressResponse billingAddress;
            try
            {
                billingAddress = dynabicBillingGateway.Customer.GetFirstBillingAddressForCustomerByReferenceId(Config.MySiteSubdomain, customerReferenceId);
            }
            catch (NotFoundException)
            {
                billingAddress = new AddressResponse();
            }

            BillingAddress.BillingAddressId = billingAddress.Id;
            BillingAddress.BillingAddress1 = billingAddress.Address1;
            BillingAddress.BillingCity = billingAddress.City;
            BillingAddress.BillingCountry = billingAddress.Country;
            BillingAddress.BillingFirstName = billingAddress.FirstName;
            BillingAddress.BillingLastName = billingAddress.LastName;
            BillingAddress.BillingProvince = billingAddress.StateProvince;
            BillingAddress.BillingZipPostalCode = billingAddress.ZipPostalCode;
        }