create_customer method
dynamic
create_customer({})
Implementation
create_customer({
String firstName = '',
String lastName = '',
String phoneNumber = '',
required String email,
required String username,
required String password,
String address1 = '',
String address2 = '',
String city = '',
String state = '',
String postcode = '',
String country = '',
}) async {
var customerData = {
'username': username,
'password': password,
'email': email,
'first_name': firstName,
'last_name': lastName,
'billing': {
'address_1': address1,
'address_2': address2,
'city': city,
'state': state,
'postcode': postcode,
'country': country,
},
'shipping': {
'address_1': address1,
'address_2': address2,
'city': city,
'state': state,
'postcode': postcode,
'country': country,
},
};
Response res;
var encodedData_customerData = json.encode(customerData);
res = await ApiServices().postRequest(
body: encodedData_customerData,
request: 'customers',
baseUrl: baseUrl,
consumerKey: consumerKey,
consumerSecret: consumerSecret);
var decoded_data = json.decode(res.body);
CustomerModel parsedData = CustomerModel.fromJson(decoded_data);
return parsedData;
}