• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CustomerRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CustomerRequest的典型用法代码示例。如果您正苦于以下问题:C# CustomerRequest类的具体用法?C# CustomerRequest怎么用?C# CustomerRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CustomerRequest类属于命名空间,在下文中一共展示了CustomerRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AddCustomer

        /// <summary>
        /// Adds a new customer to the database.
        /// </summary>
        /// <param name="customer">Customer.</param>
        /// <returns>Number of records affected. If all worked well, then should be 1.</returns>
        public int AddCustomer(CustomerModel customer)
        {
            CustomerRequest request = new CustomerRequest();
            request.RequestId = NewRequestId;
            request.AccessToken = AccessToken;
            request.ClientTag = ClientTag;

            request.Action = "Create";
            request.Customer = Mapper.ToDataTransferObject(customer);

            CustomerResponse response = null;
            SafeProxy.DoAction<ActionServiceClient>(Service, client =>
                { response = client.SetCustomers(request); });

            if (request.RequestId != response.CorrelationId)
                throw new ApplicationException("AddCustomer: RequestId and CorrelationId do not match.");

            if (response.Acknowledge != AcknowledgeType.Success)
                throw new ApplicationException(response.Message);

            // Update version & new customerId
            customer.Version = response.Customer.Version;
            customer.CustomerId = response.Customer.CustomerId;

            return response.RowsAffected;
        }
开发者ID:ronymaychan,项目名称:demos,代码行数:31,代码来源:Provider.cs


示例2: Customer

        public void Customer()
        {
            CustomerRequest request = new CustomerRequest
            {
                PaymentMethodNonce = Nonce.Coinbase
            };
            Result<Customer> customerResult = gateway.Customer.Create(request);
            Assert.IsTrue(customerResult.IsSuccess());


            var customer = gateway.Customer.Find(customerResult.Target.Id);
            Assert.AreEqual(1, customer.CoinbaseAccounts.Length);

            CoinbaseAccount account = customer.CoinbaseAccounts[0];

            Assert.AreNotEqual("", account.UserEmail);
            Assert.IsNotNull(account.UserEmail);

            Assert.AreNotEqual("", account.UserName);
            Assert.IsNotNull(account.UserName);

            Assert.AreNotEqual("", account.UserId);
            Assert.IsNotNull(account.UserId);

            Assert.AreEqual(1, customer.PaymentMethods.Length);
            Assert.AreEqual(customer.PaymentMethods[0], customer.CoinbaseAccounts[0]);
        }
开发者ID:braintree,项目名称:braintree_dotnet,代码行数:27,代码来源:CoinbaseIntegrationTest.cs


示例3: ToXml_Includes_DeviceSessionId

        public void ToXml_Includes_DeviceSessionId()
        {
            var request = new CustomerRequest()
            {
                CreditCard = new CreditCardRequest()
                {
                    DeviceSessionId = "my_dsid",
                    FraudMerchantId = "my_fmid"
                }
            };

            Assert.IsTrue(request.ToXml().Contains("my_dsid"));
            Assert.IsTrue(request.ToXml().Contains("my_fmid"));
        }
开发者ID:braintree,项目名称:braintree_dotnet,代码行数:14,代码来源:CustomerRequestTest.cs


示例4: ToXml_Includes_DeviceData

        public void ToXml_Includes_DeviceData()
        {
            var request = new CustomerRequest()
            {
                CreditCard = new CreditCardRequest()
                {
                    DeviceData = "{\"device_session_id\":\"my_dsid\", \"fraud_merchant_id\":\"my_fmid\"}"
                }
            };

            Assert.IsTrue(request.ToXml().Contains("device_session_id"));
            Assert.IsTrue(request.ToXml().Contains("my_dsid"));
            Assert.IsTrue(request.ToXml().Contains("fraud_merchant_id"));
            Assert.IsTrue(request.ToXml().Contains("my_fmid"));
        }
开发者ID:braintree,项目名称:braintree_dotnet,代码行数:15,代码来源:CustomerRequestTest.cs


示例5: GetCustomer

        public Customer GetCustomer(int customerId)
        {
            CustomerRequest request = new CustomerRequest();
            request.RequestId = NewRequestId;
            request.AccessToken = AccessToken;
            request.ClientTag = ClientTag;

            request.LoadOptions = new string[] { "Customer" };
            request.Criteria = new CustomerCriteria { CustomerId = customerId };

            CustomerResponse response = ActionServiceClient.GetCustomers(request);

            if (request.RequestId != response.CorrelationId)
                throw new ApplicationException("GetCustomers: RequestId and CorrelationId do not match.");

            return response.Customer;
        }
开发者ID:ronymaychan,项目名称:demos,代码行数:17,代码来源:CustomerController.cs


示例6: AddCustomer

        public void AddCustomer(Customer customer)
        {
            CustomerRequest request = new CustomerRequest();
            request.RequestId = NewRequestId;
            request.AccessToken = AccessToken;
            request.ClientTag = ClientTag;

            request.Action = "Create";
            request.Customer = customer;

            CustomerResponse response = ActionServiceClient.SetCustomers(request);

            if (request.RequestId != response.CorrelationId)
                throw new ApplicationException("AddCustomer: RequestId and CorrelationId do not match.");

            // These messages are for public consumption. Includes validation errors.
            if (response.Acknowledge == AcknowledgeType.Failure)
                throw new ApplicationException(response.Message);
        }
开发者ID:ronymaychan,项目名称:demos,代码行数:19,代码来源:CustomerController.cs


示例7: DeleteCustomer

        public int DeleteCustomer(int customerId)
        {
            CustomerRequest request = new CustomerRequest();
            request.RequestId = NewRequestId;
            request.AccessToken = AccessToken;
            request.ClientTag = ClientTag;

            request.Action = "Delete";
            request.Criteria = new CustomerCriteria { CustomerId = customerId };

            CustomerResponse response = ActionServiceClient.SetCustomers(request);

            if (request.RequestId != response.CorrelationId)
                throw new ApplicationException("DeleteCustomer: RequestId and CorrelationId do not match.");

            if (response.Acknowledge == AcknowledgeType.Failure)
                throw new ApplicationException(response.Message);

            return response.RowsAffected;
        }
开发者ID:ronymaychan,项目名称:demos,代码行数:20,代码来源:CustomerController.cs


示例8: CreateCustomerFromTransparentRedirect

        public void CreateCustomerFromTransparentRedirect()
        {
            CustomerRequest trParams = new CustomerRequest
            {
                FirstName = "John"
            };

            CustomerRequest request = new CustomerRequest
            {
                LastName = "Doe"
            };

            string queryString = TestHelper.QueryStringForTR(trParams, request, gateway.TransparentRedirect.Url, service);
            Result<Customer> result = gateway.TransparentRedirect.ConfirmCustomer(queryString);
            Assert.IsTrue(result.IsSuccess());
            Customer customer = result.Target;

            Assert.AreEqual("John", customer.FirstName);
            Assert.AreEqual("Doe", customer.LastName);
        }
开发者ID:ronin1,项目名称:braintree_dotnet,代码行数:20,代码来源:TransparentRedirectTest.cs


示例9: Can_Create_A_Customer

        public void Can_Create_A_Customer()
        {
            //// Arrange
            var gateway = this.BraintreeProviderSettings.AsBraintreeGateway();

            var customerRequest = new CustomerRequest()
                                      {
                                          CustomerId = this.CustomerKey.ToString(),
                                          FirstName = "Rusty",
                                          LastName = "Swayne",
                                          Company = "Mindfly",
                                          Email = "[email protected]",
                                          Website = "http://www.mindfly.com"
                                      };

            //// Act
            var result = gateway.Customer.Create(customerRequest);

            //// Assert
            Assert.IsTrue(result.IsSuccess());
        }
开发者ID:Xamarui,项目名称:Merchello,代码行数:21,代码来源:BraintreeApiTests.cs


示例10: Find_RaisesNotFoundErrorForCreditCardToken

        public void Find_RaisesNotFoundErrorForCreditCardToken()
        {
            var createRequest = new CustomerRequest
            {
                CreditCard = new CreditCardRequest
                {
                    Number = "5555555555554444",
                    ExpirationDate = "05/12",
                    CVV = "123",
                }
            };

            var resp = gateway.Customer.Create(createRequest);
            Assert.IsNotNull(resp);
            Customer customer = resp.Target;
            Assert.IsNotNull(customer, resp.Message);
            try {
                gateway.PayPalAccount.Find(customer.CreditCards[0].Token);
                Assert.Fail("Should throw NotFoundException");
            } catch (NotFoundException) {}
        }
开发者ID:ronin1,项目名称:braintree_dotnet,代码行数:21,代码来源:PayPalAccountTest.cs


示例11: Setup

        public void Setup()
        {
            gateway = new BraintreeGateway
            {
                //Environment = Environment.DEVELOPMENT,
                //MerchantId = "integration_merchant_id",
                //PublicKey = "integration_public_key",
                //PrivateKey = "integration_private_key"
            };

            CustomerRequest request = new CustomerRequest
            {
                CreditCard = new CreditCardRequest
                {
                    CardholderName = "Fred Jones",
                    Number = "5555555555554444",
                    ExpirationDate = "05/12"
                }
            };

            customer = gateway.Customer.Create(request).Target;
            creditCard = customer.CreditCards[0];
        }
开发者ID:ronin1,项目名称:braintree_dotnet,代码行数:23,代码来源:SubscriptionTest.cs


示例12: Search_FindDuplicateCardsGivenPaymentMethodToken

        public void Search_FindDuplicateCardsGivenPaymentMethodToken()
        {
            CreditCardRequest creditCard = new CreditCardRequest
            {
                Number = "4111111111111111",
                ExpirationDate = "05/2012"
            };

            CustomerRequest jimRequest = new CustomerRequest
            {
                FirstName = "Jim",
                CreditCard = creditCard
            };

            CustomerRequest joeRequest = new CustomerRequest
            {
                FirstName = "Jim",
                CreditCard = creditCard
            };

            Customer jim = gateway.Customer.Create(jimRequest).Target;
            Customer joe = gateway.Customer.Create(joeRequest).Target;

            CustomerSearchRequest searchRequest = new CustomerSearchRequest().
                PaymentMethodTokenWithDuplicates.Is(jim.CreditCards[0].Token);

            ResourceCollection<Customer> collection = gateway.Customer.Search(searchRequest);

            List<string> customerIds = new List<string>();
            foreach (Customer customer in collection) {
                customerIds.Add(customer.Id);
            }

            Assert.IsTrue(customerIds.Contains(jim.Id));
            Assert.IsTrue(customerIds.Contains(joe.Id));
        }
开发者ID:ronin1,项目名称:braintree_dotnet,代码行数:36,代码来源:CustomerTest.cs


示例13: Update_AcceptsPaymentMethodNonce

        public void Update_AcceptsPaymentMethodNonce()
        {
            var create = new CustomerRequest
            {
                CreditCard = new CreditCardRequest
                {
                    Number = "4111111111111111",
                    ExpirationDate = "10/18",
                }
            };
            var customer = gateway.Customer.Create(create).Target;

            var update = new CustomerRequest
            {
                PaymentMethodNonce = Nonce.PayPalFuturePayment
            };
            var updatedCustomer = gateway.Customer.Update(customer.Id, update).Target;

            Assert.AreEqual(1, updatedCustomer.PayPalAccounts.Length);
            Assert.AreEqual(1, updatedCustomer.CreditCards.Length);
            Assert.AreEqual(2, updatedCustomer.PaymentMethods.Length);
        }
开发者ID:ronin1,项目名称:braintree_dotnet,代码行数:22,代码来源:CustomerTest.cs


示例14: Update_AcceptsNestedBillingAddressId

        public void Update_AcceptsNestedBillingAddressId()
        {
            Customer customer = gateway.Customer.Create(new CustomerRequest()).Target;

            AddressRequest addressRequest = new AddressRequest
            {
                FirstName = "John",
                LastName = "Doe"
            };

            Address address = gateway.Address.Create(customer.Id, addressRequest).Target;

            var updateRequest = new CustomerRequest
            {
                CreditCard = new CreditCardRequest
                {
                    Number = "4111111111111111",
                    ExpirationDate = "10/10",
                    BillingAddressId = address.Id
                }
            };

            Customer updatedCustomer = gateway.Customer.Update(customer.Id, updateRequest).Target;
            Address billingAddress = updatedCustomer.CreditCards[0].BillingAddress;
            Assert.AreEqual(address.Id, billingAddress.Id);
            Assert.AreEqual("John", billingAddress.FirstName);
            Assert.AreEqual("Doe", billingAddress.LastName);
        }
开发者ID:ronin1,项目名称:braintree_dotnet,代码行数:28,代码来源:CustomerTest.cs


示例15: Update_UpdatesCustomerAndNestedValues

        public void Update_UpdatesCustomerAndNestedValues()
        {
            var createRequest = new CustomerRequest()
            {
                FirstName = "Old First",
                LastName = "Old Last",
                CreditCard = new CreditCardRequest()
                {
                    Number = "4111111111111111",
                    ExpirationDate = "10/10",
                    BillingAddress = new CreditCardAddressRequest()
                    {
                        PostalCode = "11111"
                    }
                }
            };

            Customer customer = gateway.Customer.Create(createRequest).Target;
            CreditCard creditCard = customer.CreditCards[0];
            Address address = creditCard.BillingAddress;

            var updateRequest = new CustomerRequest()
            {
                FirstName = "New First",
                LastName = "New Last",
                CreditCard = new CreditCardRequest()
                {
                    ExpirationDate = "12/12",
                    Options = new CreditCardOptionsRequest()
                    {
                        UpdateExistingToken = creditCard.Token
                    },
                    BillingAddress = new CreditCardAddressRequest()
                    {
                        PostalCode = "44444",
                        CountryName = "Chad",
                        CountryCodeAlpha2 = "TD",
                        CountryCodeAlpha3 = "TCD",
                        CountryCodeNumeric = "148",
                        Options = new CreditCardAddressOptionsRequest()
                        {
                            UpdateExisting = true
                        }
                    }
                }
            };

            Customer updatedCustomer = gateway.Customer.Update(customer.Id, updateRequest).Target;
            CreditCard updatedCreditCard = gateway.CreditCard.Find(creditCard.Token);
            Address updatedAddress = gateway.Address.Find(customer.Id, address.Id);

            Assert.AreEqual("New First", updatedCustomer.FirstName);
            Assert.AreEqual("New Last", updatedCustomer.LastName);
            Assert.AreEqual("12/2012", updatedCreditCard.ExpirationDate);
            Assert.AreEqual("44444", updatedAddress.PostalCode);
            Assert.AreEqual("Chad", updatedAddress.CountryName);
            Assert.AreEqual("TD", updatedAddress.CountryCodeAlpha2);
            Assert.AreEqual("TCD", updatedAddress.CountryCodeAlpha3);
            Assert.AreEqual("148", updatedAddress.CountryCodeNumeric);
        }
开发者ID:ronin1,项目名称:braintree_dotnet,代码行数:60,代码来源:CustomerTest.cs


示例16: Update_UpdatesCustomerWithNewValues

        public void Update_UpdatesCustomerWithNewValues()
        {
            string oldId = Guid.NewGuid().ToString();
            string newId = Guid.NewGuid().ToString();
            var createRequest = new CustomerRequest()
            {
                Id = oldId,
                FirstName = "Old First",
                LastName = "Old Last",
                Company = "Old Company",
                Email = "[email protected]",
                Phone = "312.555.1111 xOld",
                Fax = "312.555.1112 xOld",
                Website = "old.example.com"
            };

            gateway.Customer.Create(createRequest);

            var updateRequest = new CustomerRequest()
            {
                Id = newId,
                FirstName = "Michael",
                LastName = "Angelo",
                Company = "Some Company",
                Email = "[email protected]",
                Phone = "312.555.1111",
                Fax = "312.555.1112",
                Website = "www.example.com"
            };

            Customer updatedCustomer = gateway.Customer.Update(oldId, updateRequest).Target;
            Assert.AreEqual(newId, updatedCustomer.Id);
            Assert.AreEqual("Michael", updatedCustomer.FirstName);
            Assert.AreEqual("Angelo", updatedCustomer.LastName);
            Assert.AreEqual("Some Company", updatedCustomer.Company);
            Assert.AreEqual("[email protected]", updatedCustomer.Email);
            Assert.AreEqual("312.555.1111", updatedCustomer.Phone);
            Assert.AreEqual("312.555.1112", updatedCustomer.Fax);
            Assert.AreEqual("www.example.com", updatedCustomer.Website);
            Assert.AreEqual(DateTime.Now.Year, updatedCustomer.CreatedAt.Value.Year);
            Assert.AreEqual(DateTime.Now.Year, updatedCustomer.UpdatedAt.Value.Year);
        }
开发者ID:ronin1,项目名称:braintree_dotnet,代码行数:42,代码来源:CustomerTest.cs


示例17: Create_withSecurityParams

        public void Create_withSecurityParams()
        {
            var createRequest = new CustomerRequest()
            {
                CreditCard = new CreditCardRequest()
                {
                    Number = "5555555555554444",
                    ExpirationDate = "05/22",
                    CVV = "123",
                    DeviceSessionId = "my_dsid"
                }
            };

            Result<Customer> result = gateway.Customer.Create(createRequest);

            Assert.IsTrue(result.IsSuccess());
        }
开发者ID:ronin1,项目名称:braintree_dotnet,代码行数:17,代码来源:CustomerTest.cs


示例18: Search_OnCreatedAt

        public void Search_OnCreatedAt()
        {
            CustomerRequest request = new CustomerRequest();

            Customer customer = gateway.Customer.Create(request).Target;

            DateTime createdAt = customer.CreatedAt.Value;
            DateTime threeHoursEarlier = createdAt.AddHours(-3);
            DateTime oneHourEarlier = createdAt.AddHours(-1);
            DateTime oneHourLater = createdAt.AddHours(1);

            CustomerSearchRequest searchRequest = new CustomerSearchRequest().
                Id.Is(customer.Id).
                CreatedAt.Between(oneHourEarlier, oneHourLater);

            Assert.AreEqual(1, gateway.Customer.Search(searchRequest).MaximumCount);

            searchRequest = new CustomerSearchRequest().
                Id.Is(customer.Id).
                CreatedAt.GreaterThanOrEqualTo(oneHourEarlier);

            Assert.AreEqual(1, gateway.Customer.Search(searchRequest).MaximumCount);

            searchRequest = new CustomerSearchRequest().
                Id.Is(customer.Id).
                CreatedAt.LessThanOrEqualTo(oneHourLater);

            Assert.AreEqual(1, gateway.Customer.Search(searchRequest).MaximumCount);

            searchRequest = new CustomerSearchRequest().
                Id.Is(customer.Id).
                CreatedAt.Between(threeHoursEarlier, oneHourEarlier);

            Assert.AreEqual(0, gateway.Customer.Search(searchRequest).MaximumCount);
        }
开发者ID:ronin1,项目名称:braintree_dotnet,代码行数:35,代码来源:CustomerTest.cs


示例19: ConfirmTransparentRedirect_CreatesNestedElementsAndCustomFields

        public void ConfirmTransparentRedirect_CreatesNestedElementsAndCustomFields()
        {
            CustomerRequest trParams = new CustomerRequest();

            CustomerRequest request = new CustomerRequest
            {
                FirstName = "John",
                LastName = "Doe",
                CreditCard = new CreditCardRequest
                {
                    Number = SandboxValues.CreditCardNumber.VISA,
                    CardholderName = "John Doe",
                    ExpirationDate = "05/10",
                    BillingAddress = new CreditCardAddressRequest
                    {
                        CountryName = "Mexico",
                        CountryCodeAlpha2 = "MX",
                        CountryCodeAlpha3 = "MEX",
                        CountryCodeNumeric = "484"
                    }
                },
                CustomFields = new Dictionary<string, string>
                {
                    { "store_me", "a custom value" }
                }
            };

            string queryString = TestHelper.QueryStringForTR(trParams, request, gateway.Customer.TransparentRedirectURLForCreate(), service);
            Result<Customer> result = gateway.Customer.ConfirmTransparentRedirect(queryString);
            Assert.IsTrue(result.IsSuccess());
            Customer customer = result.Target;
            Assert.AreEqual("John", customer.FirstName);
            Assert.AreEqual("Doe", customer.LastName);
            Assert.AreEqual("John Doe", customer.CreditCards[0].CardholderName);
            Assert.AreEqual("a custom value", customer.CustomFields["store_me"]);

            Address address = customer.CreditCards[0].BillingAddress;
            Assert.AreEqual("Mexico", address.CountryName);
            Assert.AreEqual("MX", address.CountryCodeAlpha2);
            Assert.AreEqual("MEX", address.CountryCodeAlpha3);
            Assert.AreEqual("484", address.CountryCodeNumeric);
        }
开发者ID:ronin1,项目名称:braintree_dotnet,代码行数:42,代码来源:CustomerTest.cs


示例20: Create_WithVenmoSdkSession

        public void Create_WithVenmoSdkSession()
        {
            var createRequest = new CustomerRequest()
            {
                CreditCard = new CreditCardRequest()
                {
                    Number = "5555555555554444",
                    ExpirationDate = "05/22",
                    Options = new CreditCardOptionsRequest() {
                        VenmoSdkSession = SandboxValues.VenmoSdk.SESSION
                    }
                }
            };

            Customer customer = gateway.Customer.Create(createRequest).Target;
            Assert.IsTrue(customer.CreditCards[0].IsVenmoSdk.Value);
        }
开发者ID:ronin1,项目名称:braintree_dotnet,代码行数:17,代码来源:CustomerTest.cs



注:本文中的CustomerRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CustomerType类代码示例发布时间:2022-05-24
下一篇:
C# CustomerRepository类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap