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); }
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); }
/// <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); }
/// <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); } }
/// <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); }
public void UpdateCustomerInformation(string orderId, UpdateCustomerDetails updateCustomerDetails) { IOrder order = _client.NewOrder(orderId); order.UpdateCustomerDetails(updateCustomerDetails); }