logRefund static method

Future<void> logRefund({
  1. String? affiliation,
  2. String? coupon,
  3. String? currency,
  4. List<String> items = const [],
  5. double? shipping,
  6. double? tax,
  7. String? transactionId,
  8. double? value,
})

E-Commerce Refund event. This event signifies that a refund was issued

Implementation

static Future<void> logRefund({
  String? affiliation,
  String? coupon,
  String? currency,
  List<String> items = const [],
  double? shipping,
  double? tax,
  String? transactionId,
  double? value,
}) {
  currency ??= NumberFormat.simpleCurrency(
    locale: SupabaseAddons.systemLocale,
  ).currencyName;

  if (value != null || tax != null || shipping != null) {
    assert(
      currency != null,
      'If you supply the value parameter, you must also supply parameter so that revenue metrics can be computed accurately',
    );
  }

  return logEvent(name: 'refund', params: {
    'affiliation': affiliation,
    'coupon': coupon,
    'currency': currency,
    'items': items,
    'shipping': shipping,
    'tax': tax,
    'transactionId': transactionId,
    'value': value,
  });
}