public FoxyCustomer UpdateCustomer(FoxyCustomer customer) { var halClient = GetClient(); var customerResource = halClient .Root($"{_baseUrl}/customers/{customer.Id}") .Put("self", customer) .Item <FoxyCustomer>(); var updatedCustomer = customerResource.Data; if (customer.DefaultBillingAddress != null) { updatedCustomer.DefaultBillingAddress = halClient .Get(customerResource, "default_billing_address", FOXY_CART_CURIE) .Put("self", customer.DefaultBillingAddress) .Item <FoxyCustomerAddress>() .Data; } if (customer.DefaultShippingAddress != null) { updatedCustomer.DefaultShippingAddress = halClient .Get(customerResource, "default_shipping_address", FOXY_CART_CURIE) .Put("self", customer.DefaultShippingAddress) .Item <FoxyCustomerAddress>() .Data; } return(updatedCustomer); }
public FoxyCustomer CreateCustomer(FoxyCustomer customer) { var halClient = GetClient(); return(halClient .Root() .Get("store", FOXY_CART_CURIE) .Post("customers", customer, null, FOXY_CART_CURIE) .Get("self") .Item <FoxyCustomer>() .Data); }