コード例 #1
0
        public void updateShippingContact()
        {
            getApiKey();
            conekta.Api.version = "2.0.0";

            Customer customer = new conekta.Customer().create(@"{
                  ""name"": ""Emiliano Cabrera"",
                  ""phone"": ""5575553322"",
                  ""email"": ""*****@*****.**"",
                  ""corporate"": true
                  }");

            ShippingContact shipping_contact = customer.createShippingContact(@"{
                ""phone"": ""5575553322"",
                ""receiver"": ""Marvin Fuller"",
                ""between_streets"": ""Ackerman Crescent"",
                ""address"": {
                ""street1"": ""250 Alexis St"",
                ""street2"": ""fake street"",
                ""city"": ""Red Deer"",
                ""state"": ""Alberta"",
                ""country"": ""CA"",
                ""postal_code"": ""T4N 0B8"",
                ""residential"": true
                }
                }");

            shipping_contact = shipping_contact.update(@"{
                ""phone"": ""5575553324""
                }");

            Assert.AreEqual(shipping_contact.phone, "5575553324");
        }
コード例 #2
0
        public void createShippingContact()
        {
            getApiKey();
            conekta.Api.version = "2.0.0";

            Customer customer = new conekta.Customer().create(@"{
                  ""name"": ""Emiliano Cabrera"",
                  ""phone"": ""+5215544443333"",
                  ""email"": ""*****@*****.**"",
                  ""plan_id"": ""gold-plan"",
                  ""corporate"": true,
                  ""payment_sources"": [{
                  ""token_id"": ""tok_test_visa_4242"",
                  ""type"": ""card""
                  }],
                  ""shipping_contacts"": [{
                  ""email"": ""*****@*****.**"",
                  ""phone"": ""+5215555555555"",
                  ""receiver"": ""Marvin Fuller"",
                  ""between_streets"": ""Ackerman Crescent"",
                  ""address"": {
                  ""street1"": ""250 Alexis St"",
                  ""street2"": ""fake street"",
                  ""city"": ""Red Deer"",
                  ""state"": ""Alberta"",
                  ""country"": ""CA"",
                  ""postal_code"": ""T4N 0B8"",
                  ""residential"": true
                  }
                  }],
                  ""account_age"": 300,
                  ""paid_transactions"": 5
            }");

            ShippingContact shipping_contact = customer.createShippingContact(@"{
                ""phone"": ""+5215555555555"",
                ""receiver"": ""Marvin Fuller"",
                ""between_streets"": ""Ackerman Crescent"",
                ""address"": {
                ""street1"": ""250 Alexis St"",
                ""street2"": ""fake street"",
                ""city"": ""Red Deer"",
                ""state"": ""Alberta"",
                ""country"": ""CA"",
                ""postal_code"": ""T4N 0B8"",
                ""residential"": true
                }
                }");

            Assert.AreEqual(shipping_contact.phone, "+5215555555555");
        }
コード例 #3
0
 public string UpdateContacts(BillingContact contactBilling, ShippingContact contactShipping)
 {
     try
     {
         using (_context)
         {
             _context.SPUpdateContactInfo(Thread.CurrentPrincipal.Identity.Name, contactBilling.FirstName, contactBilling.LastName, contactBilling.Address, contactBilling.Apt, contactBilling.City, contactBilling.State, contactBilling.ZipCode, contactBilling.PhoneNumber, "", false);
             _context.SPUpdateContactInfo(Thread.CurrentPrincipal.Identity.Name, contactShipping.FirstName, contactShipping.LastName, contactShipping.Address, contactShipping.Apt, contactShipping.City, contactShipping.State, contactShipping.ZipCode, contactShipping.PhoneNumber, "", true);
             _context.SaveChanges();
             return("Saved");
         }
     }
     catch (Exception ex)
     {
         CustomLogging.LogMessage(TracingLevel.ERROR, new Exception("Error saving user contact information", ex));
         return("Failed");
     }
 }
コード例 #4
0
        public Contact GetUserContactInformation()
        {
            Contact contact = null;
            string  user    = Thread.CurrentPrincipal.Identity.Name;

            using (_context)
            {
                try
                {
                    _context.Database.Initialize(force: false);
                    using (var cmd = _context.Database.Connection.CreateCommand())
                    {
                        DbParameter parameter = cmd.CreateParameter();
                        parameter.ParameterName = "@username";
                        parameter.Value         = user;
                        cmd.Parameters.Add(parameter);
                        cmd.CommandType = System.Data.CommandType.StoredProcedure;
                        cmd.CommandText = "[dbo].[SPGetContactInformation]";
                        _context.Database.Connection.Open();
                        var reader = cmd.ExecuteReader();

                        BillingContact billing = ((IObjectContextAdapter)_context)
                                                 .ObjectContext
                                                 .Translate <BillingContact>(reader).SingleOrDefault();

                        reader.NextResult();
                        ShippingContact shipping = ((IObjectContextAdapter)_context)
                                                   .ObjectContext
                                                   .Translate <ShippingContact>(reader).SingleOrDefault();

                        contact = new Contact();
                        contact.BillingContact  = billing;
                        contact.ShippingContact = shipping;
                    }
                }
                catch (Exception ex)
                {
                    CustomLogging.LogMessage(TracingLevel.ERROR, new Exception("Error getting user contact information", ex));
                }
            }
            return(contact);
        }