コード例 #1
0
        public void TestUpdateCustomerDetails()
        {
            // Arrange
            this.requestMock.Expect(x => x.CreateRequest(this.baseUrl.ToString().TrimEnd('/') + this.orderUrl + this.path + "/" + this.captureId + "/customer-details")).Return(this.httpWebRequest);

            UpdateCustomerDetails updateCustomerDetails = new UpdateCustomerDetails()
            {
                BillingAddress = TestsHelper.GetAddress1()
            };

            WebHeaderCollection headers = new WebHeaderCollection();

            headers["Location"] = this.location;

            IResponse response = new Response(HttpStatusCode.NoContent, headers, string.Empty);

            this.requestMock.Expect(x => x.Send(this.httpWebRequest, updateCustomerDetails.ConvertToJson())).Return(response);

            // Act
            this.capture.UpdateCustomerDetails(updateCustomerDetails);

            // Assert
            this.requestMock.VerifyAllExpectations();
            Assert.AreEqual(this.httpWebRequest.ContentLength, updateCustomerDetails.ConvertToJson().Length);
            TestsHelper.AssertRequest(this.merchantId, this.secret, this.httpWebRequest, HttpMethod.Patch);
        }
コード例 #2
0
        public void Capture_UpdateCustomerDetails_Basic()
        {
            // Arrange
            UpdateCustomerDetails updateCustomerDetails = TestsHelper.GetUpdateCustomerDetails();

            TestsHelper.Mock(HttpMethod.Patch, this.capture.Location + "/customer-details", updateCustomerDetails.ConvertToJson(), HttpStatusCode.NoContent, this.connectorMock);

            this.capture.UpdateCustomerDetails(updateCustomerDetails);
        }
コード例 #3
0
        /// <summary>
        /// Get update customer details.
        /// </summary>
        /// <returns>a update customer details</returns>
        public static UpdateCustomerDetails GetUpdateCustomerDetails()
        {
            UpdateCustomerDetails updateCustomerDetails = new UpdateCustomerDetails()
            {
                ShippingAddress = GetAddress1(),

                BillingAddress = GetAddress2()
            };

            return(updateCustomerDetails);
        }
コード例 #4
0
ファイル: Order.cs プロジェクト: spouse71/kco_rest_dotnet
            /// <summary>
            /// Run the example code.
            /// </summary>
            public static void Main()
            {
                const string MerchantId   = "0";
                const string SharedSecret = "sharedSecret";
                string       orderId      = "12345";

                IConnector connector = ConnectorFactory.Create(MerchantId, SharedSecret, Client.EuTestBaseUrl);

                Client client = new Client(connector);
                IOrder order  = client.NewOrder(orderId);

                UpdateCustomerDetails updateCustomerDetails = new UpdateCustomerDetails()
                {
                    ShippingAddress = new Address()
                    {
                        Email = "*****@*****.**",
                        Phone = "57-3895734"
                    },

                    BillingAddress = new Address()
                    {
                        Email = "*****@*****.**",
                        Phone = "57-3895734"
                    }
                };

                try
                {
                    order.UpdateCustomerDetails(updateCustomerDetails);
                }
                catch (ApiException ex)
                {
                    Console.WriteLine(ex.ErrorMessage.ErrorCode);
                    Console.WriteLine(ex.ErrorMessage.ErrorMessages);
                    Console.WriteLine(ex.ErrorMessage.CorrelationId);
                }
                catch (WebException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
コード例 #5
0
 /// <summary>
 /// Updates the customer details.
 /// </summary>
 /// <param name="updateCustomerDetails">the order</param>
 public void UpdateCustomerDetails(UpdateCustomerDetails updateCustomerDetails)
 {
     this.Patch(this.Location + "/customer-details", updateCustomerDetails)
     .Status(HttpStatusCode.NoContent);
 }
コード例 #6
0
ファイル: KlarnaOrderService.cs プロジェクト: svenrog/Klarna
        public void UpdateCustomerInformation(string orderId, UpdateCustomerDetails updateCustomerDetails)
        {
            IOrder order = _client.NewOrder(orderId);

            order.UpdateCustomerDetails(updateCustomerDetails);
        }