update method

Future<NotchPayCustomer> update(
  1. String reference, {
  2. String? name,
  3. String? email,
  4. String? phone,
  5. String? description,
  6. NotchPayAddress? address,
  7. NotchPayAddress? shipping,
})

Updates an existing customer.

Implementation

Future<NotchPayCustomer> update(
  String reference, {
  String? name,
  String? email,
  String? phone,
  String? description,
  NotchPayAddress? address,
  NotchPayAddress? shipping,
}) async {
  final json = await _client.post(
    '/customers/$reference',
    body: {
      'name': name,
      'email': email,
      'phone': phone,
      'description': description,
      if (address != null) 'address': address.toJson(),
      if (shipping != null) 'shipping': shipping.toJson(),
    },
  );
  return NotchPayCustomer.fromJson(_unwrap(json));
}